ionic cordovarduino java.lang.ArrayIndexOutOfBoundsException - ionic-framework

Im trying to connect usb camera to android mobile phone in ionic framework. im able to connect to device but serial.open is not working.
Error:
java.lang.ArrayIndexOutOfBoundsException: length=0; index=1 at
android.hardware.usb.UsbInterface.getEndpoint(UsbInterface.java:135)
at
com.hoho.android.usbserial.driver.CdcAcmSerialDriver$CdcAcmSerialPort.open(CdcAcmSerialDriver.java:129)
at fr.drangies.cordova.serial.Serial$3.run(Serial.java:242) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:760)
My Code:
this.serial.requestPermission({
vid: '1908',
pid: '2311',
driver: 'CdcAcmSerialDriver'
})
.then(
res => {
alert(JSON.stringify(res));
this.openSerial();
},
error => {
alert(JSON.stringify(error));
}
);
this.serial.open({
baudRate: 19200,
dataBits: 8,
stopBits: 1,
parity: 0,
dtr: true,
rts: true,
sleepOnPause: false
})

Related

Ionic 6 Capacitor Custom Notification Sound Not working on Android

I am using Ionic react 6 with capacitor 4 to build an app that requires notifications with custom sound, but its always coming with default sound,
I created a push notification channel using this code:
PushNotifications.createChannel({
description: 'General Notifications',
id: 'fcm_default_channel',
importance: 5,
lights: true,
name: 'My notification channel',
sound: 'jingle.wav',
vibration: true,
visibility: 1,
lightColor: '#FF0000'
}).then(()=>{
console.log('push channel created: ');
}).catch(error =>{
console.error('push channel error: ', error);
});
and its getting created successfully, and this the payload I am sending to FCM from sever using php
$fields = [
"to" => $fcmToken,
"notification" => [
"title" => "New Message",
"body" => $message,
"sound" => "jingle.wav",
"channelId" => 'fcm_default_channel',
"notificationCount" => 1,
"defaultSound"=> false,
],
"data" => [
"type" => "message",
"scope" => "user"
]
];
and here is my sound file in /res/raw
enter image description here
and still can get the sound file to run, its always coming with device default notification sound, I tried real device, emulator, all same problem
thanks

react native ios TypeError: undefined is not an object (evaluating 'ProcessingUI.Constants')

The project is made using expo and then later ejected, it is working fine on android, on iOS the build is succeeded but I get this run time error: TypeError: undefined is not an object (evaluating 'ProcessingUI.Constants'). So, I searched a bit and maybe this error is related to react-native-video-processing but as I said, it is working fine on android, i.e. the app is running. Below are some details about the project and error log:
package.json:
{
"dependencies": {
"expo": ">=44.0.0-0 <45.0.0",
"react": "17.0.1",
"react-devtools": "^4.24.3",
"react-devtools-core": "^4.24.3",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-video-processing": "^2.0.0",
}
}
Error log:
TypeError: undefined is not an object (evaluating 'ProcessingUI.Constants')
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:172:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
at node_modules/expo-dev-launcher/build/DevLauncherErrorManager.js:44:19 in errorHandler
at node_modules/expo-dev-launcher/build/DevLauncherErrorManager.js:49:24 in <anonymous>
at node_modules/#react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules/metro-runtime/src/polyfills/require.js:204:6 in guardedLoadModule
at http://192.168.29.37:8081/.vscode/exponentIndex.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:547079:3 in global code
ADDITIONAL INFO:
The error call stack points to: VideoPlayer.js and when I tap on it, opens a file in node_modules/react-native-video-processing/lib/VideoPlayer/VideoPlayer.ios.js:
import { ViewPropTypes, requireNativeComponent, NativeModules, UIManager } from 'react-native';
import { getActualSource } from '../utils';
const PLAYER_COMPONENT_NAME = 'RNVideoProcessing';
const { RNVideoTrimmer } = NativeModules;
const ProcessingUI = UIManager.getViewManagerConfig('RNVideoProcessing');
export class VideoPlayer extends Component {
static propTypes = {
source: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
play: PropTypes.bool,
replay: PropTypes.bool,
rotate: PropTypes.bool,
currentTime: PropTypes.number,
volume: PropTypes.number,
startTime: PropTypes.number,
background_Color: PropTypes.string,
endTime: PropTypes.number,
playerWidth: PropTypes.number,
playerHeight: PropTypes.number,
onChange: PropTypes.func,
resizeMode: PropTypes.string,
...ViewPropTypes
};
static defaultProps = { // ---> error here - line 29.
play: false,
replay: false,
rotate: false,
resizeMode: ProcessingUI.Constants.ScaleNone,
volume: 0.0,
currentTime: 0,
startTime: 0,
};
...
When I comment all the lines of code which is using ProcessingUI in this file, the app starts working fine in iOS!
I am not able to resolve this issue, can someone guide me?
Thank you!

How to connect to web socket with APP_ID, APP_KEY and APP_SECRET with Flutter Application

How to connect to web socket with APP_ID, APP_KEY, and APP_SECRET with Flutter Application.
I used flutter_pusher_client and laravel_echo but I got `java.security.cert.CertPathValidatorException: Trust anchor for certification path not found error.
My Code
PusherOptions pusherOptions = PusherOptions(
encrypted: true,
host: 'socket.abcd.com',
cluster: 'mt1',
port: 6001,
);
FlutterPusher flutterPusher = FlutterPusher(
'PUSHER_APP_KEY',
pusherOptions,
enableLogging: true,
);
Echo echo = Echo({
'broadcaster': 'pusher',
'client': flutterPusher,
'wssHost': 'socket.abcd.com',
'wssPort': 6001,
'disableStats': true,
'forceTLS': true,
'autoConnect': true,
'enabledTransports': ['ws', 'wss'],
});
flutterPusher.connect(
onConnectionStateChange:
(FPC.ConnectionStateChange connectionStateChange) {
print(
'PUSHER CONNECTION STATE CHANGE C: ${connectionStateChange.previousState} -> ${connectionStateChange.currentState}',
);
},
onError: (FPC.ConnectionError connectionError) {
print(
'PUSHER CONNECTION ERROR C: ${connectionError.code} ${connectionError.exception} ${connectionError.message}');
},
);
echo.join('chat')
..here((user) => print('ECHO USER: user'))
..listen('NewMessage', (event) {
print('ECHO MESSAGE: $event');
});

cordova-plugin-iosrtc not work with sip.js 0.11 on movile ionic js webrtc app

I am developing a webrtc call/videocall app bases on Ionic/AngularJS technologies. The app works with sip.js for call actions over PBX server. For IOS integration with WebRtc, app works with cordova-plugin-iosrtc. When I try connect with PBX to call or received call, app throws errors on two possible use mode of cordova-plugin-iosrtc with sip.js
A) When I try to use cordova-plugin-iosrtc working on peer connection iOS plugin mode ....
telephoneService.js (Angular JS)
var pc = new cordova.plugins.iosrtc.RTCPeerConnection({
iceServers: []
});
cordova.plugins.iosrtc.getUserMedia(
// constraints
{ audio: true, video: true },
// success callback
function (stream) {
console.log('got local MediaStream: ', stream);
pc.addStream(stream);
},
// failure callback
function (error) {
console.error('getUserMedia failed: ', error);
}
);
var sessionDescriptionHandlerOptions = {
constraints: {
audio: audioId,
video: videoId
},
media: {
local: {
audio: document.getElementById('localAudio')
},
remote: {
audio: document.getElementById('remoteAudio')
}
},
extraHeaders: extraHeaders
}
}
userAgent.invite('sipusertocall', sessionDescriptionHandlerOptions);
receive the next error:
undefined is not a object evaluating 'environment.navigator.mediaDevices.getUserMedia' (sip.js lib)
B)
cordova.plugins.iosrtc.registerGlobals(); use iosrtc plugin with webrtc native api (navigator.mediaDevice.getUserMedia(), ....)
navigator.mediaDevices.getUserMedia(
function (stream) {
console.log('got local MediaStream: ', stream);
window.stream = stream;
},
// failure callback
function (error) {
console.error('getUserMedia failed: ', error);
}
)
var sessionDescriptionHandlerOptions = {
constraints: {
audio: audioId,
video: videoId
},
media: {
local: {
audio: document.getElementById('localAudio')
},
remote: {
audio: document.getElementById('remoteAudio')
}
},
extraHeaders: extraHeaders
}
userAgent.invite('sipusertocall', sessionDescriptionHandlerOptions);
App receive from sip.js next error from PBX: Failed:WebRTC Error
Client show next error at same time:
setLocalDescription() must be called with a RTCSessionDescription instance as first argument
So the newer SIP.js is actually passing in an instance of RTCSessionDescriptionInit which although has a similar structure: { sdp: ..., type: ... } to an RTCSessionDescription init is not accepted by the cordova iosrtc implementation.
I have created a fix for this in the form of a custom SDH for SIP.js (as I encountered the exact same issue). My custom SDH converts the object to a new RTCSessionDescription(...) just before it gets passed in to getLocationDescription and setRemoteDescription.
Link to SDH plugin:
https://github.com/iotum/cordova-ios-session-description-handler
Hope this helps!
Wes

Protractor browserstack-local config stopped working and throws generic error

I was able to run my Protractor tests using browserstack-local earlier tonight but was unable to by the end of the evening and I can't figure out what's going on.
node v7.4.0
protractor v5.0.0
browserstack-local v1.2.0
Here's my conf.ts file:
'use strict';
import { Config, browser } from 'protractor';
import testSuites = require('./testSuites.js');
import browserstack = require('browserstack-local');
const commonCapabilities = {
'browserstack.user': '*****',
'browserstack.key': '*****',
'browserstack.local': true
};
export let config: Config = {
baseUrl: 'https://localhost:8443',
seleniumAddress: 'http://hub-cloud.browserstack.com/wd/hub',
multiCapabilities: [{
browserName: 'chrome',
browser_version: '54.0',
os: 'Windows',
os_version: '10',
resolution: '1280x800'
}],
specs: ['src/**/*spec.js'],
suites: testSuites.suites,
framework: 'mocha',
mochaOpts: {
reporter: 'spec',
slow: 0,
timeout: 60000
},
allScriptsTimeout: 3600000,
onPrepare: () => {
browser.manage().window().setSize(1280, 800);
},
params: {
user: 'seleniumtesting'
},
beforeLaunch() {
console.log('Starting BrowserStack Local...');
return new Promise((resolve, reject) => {
exports.bs_local = new browserstack.Local();
exports.bs_local.start({ key: commonCapabilities['browserstack.key']}, error => {
if (error) {
return reject(error);
}
console.log('BrowserStack Started.');
resolve();
});
});
},
afterLaunch() {
return new Promise(resolve => {
if (!exports.bs_local) {
console.log('Skipping shutdown of BrowserStack Local...');
resolve();
return;
}
console.log('Stopping BrowserStack Local...');
exports.bs_local.stop(resolve);
});
}
};
// Code to support common capabilities
exports.config.multiCapabilities.forEach((caps) => {
Object.keys(commonCapabilities).forEach(i => {
caps[i] = caps[i] || commonCapabilities[i];
});
});
When I run my Protractor tests I'm getting:
Starting BrowserStack Local...
(node:3755) DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
/usr/local/lib/node_modules/protractor/node_modules/q/q.js:155
throw e;
^
Error
at /protractor/node_modules/browserstack-local/lib/Local.js:57:20
at ChildProcess.exithandler (child_process.js:202:7)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:885:16)
at Socket.<anonymous> (internal/child_process.js:334:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:501:12)
It's strange because I didn't change anything in my environment since it was last working earlier in the evening, and now I can't get it to run anymore without seeing this error. I've been trying to debug this without any luck, could someone please help me spot if I'm missing anything?
Thanks in advance!
"os.tmpDir" deprecated onwards Node v7.0.0. Try downgrading your Node and execute.
More details are available in https://github.com/hapijs/hapi/issues/3369