interCommunication method
Map<String, dynamic>
interCommunication(
- bool isStart,
- bool isSingleChannel
)
override
Implementation
@override
Map<String, dynamic> interCommunication(bool isStart, bool isSingleChannel) {
// if (isRequestPending) {
// return {
// "isError": true,
// "message": "PENDING_PREVIOUS_REQUEST",
// "details": "Called interCommunication()"
// };
// }
if (initializedCamera.isEmpty) {
return {"isError": true, "message": "Invalid camera operation!"};
}
if (isSingleChannel) {
if (isDualInterComStarted) {
methodChannel.invokeMethod(
'DUAL_INTERCOM_STOP', {"cameraId": initializedCamera});
}
if (isStart) {
isSingleInterComStarted = true;
methodChannel.invokeMethod(
'SINGLE_INTERCOM_START', {"cameraId": initializedCamera});
} else {
isSingleInterComStarted = false;
methodChannel.invokeMethod(
'SINGLE_INTERCOM_STOP', {"cameraId": initializedCamera});
}
} else {
if (isDualInterComStarted) {
methodChannel.invokeMethod(
'SINGLE_INTERCOM_STOP', {"cameraId": initializedCamera});
}
if (isStart) {
isDualInterComStarted = true;
methodChannel.invokeMethod(
'DUAL_INTERCOM_START', {"cameraId": initializedCamera});
} else {
isDualInterComStarted = false;
methodChannel.invokeMethod(
'DUAL_INTERCOM_STOP', {"cameraId": initializedCamera});
}
}
return {
"isError": false,
"message": isStart
? "Enabled InterCommunication!"
: "Disabled InterCommunication!"
};
}