Add on write handler and errors#36
Open
rohitsangwan01 wants to merge 4 commits intowoodemi:masterfrom
Open
Conversation
Sunbreak
reviewed
Jun 19, 2022
Collaborator
Sunbreak
left a comment
There was a problem hiding this comment.
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" |
Collaborator
There was a problem hiding this comment.
Move to connection error's PR
| sendMessage(messageConnector, mapOf( | ||
| "deviceId" to deviceID, | ||
| "characteristic" to characteristic.uuid.toString(), | ||
| "error" to "Write Command Status : $status" |
Collaborator
There was a problem hiding this comment.
"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?) { |
Collaborator
There was a problem hiding this comment.
Move to connection error's PR
| messageConnector.sendMessage([ | ||
| "deviceId": peripheral.uuid.uuidString, | ||
| "ConnectionState": "disconnected", | ||
| "error": String(describing: error) |
Collaborator
There was a problem hiding this comment.
Move to connection error's PR
| } | ||
| self.messageConnector.sendMessage([ | ||
| "deviceId": peripheral.uuid.uuidString, | ||
| "error": String(describing: error), |
Collaborator
There was a problem hiding this comment.
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', { |
Collaborator
There was a problem hiding this comment.
Move to notify error's PR
| @override | ||
| Future<void> readValue(String deviceId, String service, String characteristic) async { | ||
| _method.invokeMethod('readValue', { | ||
| await _method.invokeMethod('readValue', { |
| @override | ||
| Future<int> requestMtu(String deviceId, int expectedMtu) async { | ||
| _method.invokeMethod('requestMtu', { | ||
| await _method.invokeMethod('requestMtu', { |
| void connect(String deviceId) { | ||
| _findDeviceById(deviceId).connect().then((_) { | ||
| onConnectionChanged?.call(deviceId, BlueConnectionState.connected); | ||
| onConnectionChanged?.call(deviceId, BlueConnectionState.connected,null); |
Collaborator
There was a problem hiding this comment.
Move to connection error's PR
|
|
||
| OnValueChanged? onValueChanged; | ||
|
|
||
| OnWrite? onWrite; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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