Skip to content

Commit

Permalink
Add BLE write type
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc GRIFFIE committed May 6, 2019
1 parent e76b783 commit 829bc9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
7 changes: 1 addition & 6 deletions Gormsson/Source/Gormsson.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,7 @@ public final class Gormsson: NSObject {
return
}

// TODO: Remove this workaround to support set timestamp done by ob'do.
// This has to be rollback to little endian usage conformance
print("Data to be written:", value.toData().map({ String(format: "%02hhx", $0).uppercased() }))
print("Data to be written:", value.toData().toOctets.reversed().map({ String(format: "%02hhx", $0).uppercased() }))

current.writeValue(Data(value.toData().toOctets.reversed()),
current.writeValue(value.toData(),
for: cbCharacteristic,
type: type)

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ manager.notify(.heartRateMeasurement, success: { value in

### Write characteristic

If you want to write value to a characteristic, it's pretty straight forward. You provide the characteristic to be used and the given value to write.
If you want to write value to a characteristic, it's pretty straight forward. You provide the characteristic to be used and the given value to write and optionaly provide BLE write type. Default is `.withResponse`

```swift
manager.write(.setState, value: UInt8(1), success: {
manager.write(.setState, value: UInt8(1), type: .withoutResponse, success: {
print("set state success")
}, error: { error in
print("set state failure:", error ?? "nil")
Expand Down Expand Up @@ -229,4 +229,4 @@ We provide a full range of solutions to get better and faster results. We're alw
Folding cell is released under the MIT license.
See [LICENSE](https://raw.githubusercontent.com/MoveUpwards/Gormsson/master/LICENSE) for details.

If you use the open-source library in your project, please make sure to credit and backlink to www.moveupwards.dev
If you use the open-source library in your project, please make sure to credit and backlink to www.moveupwards.dev

0 comments on commit 829bc9e

Please sign in to comment.