Skip to content

Conversation

@rohitsangwan01
Copy link
Contributor

@rohitsangwan01 rohitsangwan01 commented Jun 19, 2022

Added onWriteValue Handler , which will pass DeviceId , Characteristic and String? Error
if Error Null , means Success Write Call

also Added error in OnConnectionStatusChang , to get Correct reason of Disconnection , on Flutter Side

Currently implemented in
Mac / Ios/ Android

Copy link
Collaborator

@Sunbreak Sunbreak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too many changes in only one PR. If you want other errors, then commit with different PRs please

"deviceId" to gatt.device.address,
"ConnectionState" to "disconnected"
"ConnectionState" to "disconnected",
"error" to "Disconnection Reason : Status $status"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to connection error's PR

sendMessage(messageConnector, mapOf(
"deviceId" to deviceID,
"characteristic" to characteristic.uuid.toString(),
"error" to "Write Command Status : $status"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Write Command Status : $status" is a error message, not a program recongized code

An ErrorCode with optional ErrorMessage is a better choice

])
}

public func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral,error: Error?) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to connection error's PR

messageConnector.sendMessage([
"deviceId": peripheral.uuid.uuidString,
"ConnectionState": "disconnected",
"error": String(describing: error)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to connection error's PR

}
self.messageConnector.sendMessage([
"deviceId": peripheral.uuid.uuidString,
"error": String(describing: error),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to discover error's PR

@override
Future<void> setNotifiable(String deviceId, String service, String characteristic, BleInputProperty bleInputProperty) async {
_method.invokeMethod('setNotifiable', {
await _method.invokeMethod('setNotifiable', {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to notify error's PR

@override
Future<void> readValue(String deviceId, String service, String characteristic) async {
_method.invokeMethod('readValue', {
await _method.invokeMethod('readValue', {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to read error's PR

@override
Future<int> requestMtu(String deviceId, int expectedMtu) async {
_method.invokeMethod('requestMtu', {
await _method.invokeMethod('requestMtu', {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to mtu error's PR

void connect(String deviceId) {
_findDeviceById(deviceId).connect().then((_) {
onConnectionChanged?.call(deviceId, BlueConnectionState.connected);
onConnectionChanged?.call(deviceId, BlueConnectionState.connected,null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to connection error's PR


OnValueChanged? onValueChanged;

OnWrite? onWrite;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OnWriteValue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants