e-sites / bluetonium Goto Github PK
View Code? Open in Web Editor NEWBluetooth mapping in Swift
License: MIT License
Bluetooth mapping in Swift
License: MIT License
Is this easily compatible with macOS? if not, any desire to add that?
How to get battery level from device
I’m having this issue I am able to list devices, then to connect to the chosen one but when I trie to write value, nothing happens I’m ina hurry and didn’t mind to pay for the service of helping me out solving this as is due on Thursday contact please at [email protected]
I implemented a serial service model, that will write and read.
A problem when trying to write...in the writeValue() method of ServiceModel the transformer(forUUID: UUID) return nill as no characteristic for this was found.
What is happening?
This is my SerialServiceMode:
import Foundation
import Bluetonium
import CoreBluetooth
struct SerialServiceModelConstants {
static let serviceUUID = "6E400001-B5A3-F393-E0A9-E50E24DCCA9E"
static let serialWriteUUID = "6E400002-B5A3-F393-E0A9-E50E24DCCA9E"
static let serialReadUUID = "6E400003-B5A3-F393-E0A9-E50E24DCCA9E"
}
class SerialServiceModel : ServiceModel{
weak var delegate : SerialServiceModelDelegate?
var recentMessage : NSData = NSData()
var sendMessage : NSData = NSData()
override func serviceUUID() -> String {
return SerialServiceModelConstants.serviceUUID
}
override func mapping(map: Map) {
recentMessage <- map[SerialServiceModelConstants.serialReadUUID]
sendMessage <- map[SerialServiceModelConstants.serialWriteUUID]
}
override func registerNotifyForCharacteristic(withUUID UUID: String) -> Bool {
print("Serial Register Notify Become Available \(UUID)")
return true
}
override func characteristicBecameAvailable(withUUID UUID: String) {
readValue(withUUID: UUID)
print("Serial Service Characteristic Become Available \(UUID)")
}
override func characteristicDidUpdateValue(withUUID UUID: String) {
if UUID == SerialServiceModelConstants.serialReadUUID{
dispatch_async(dispatch_get_main_queue()) { () -> Void in
self.delegate?.receiveFromSerial(String(data: self.recentMessage, encoding: NSUTF8StringEncoding)!)
}
}
}
func writeToSerial(withInfo text : String){
self.sendMessage = text.dataUsingEncoding(NSUTF8StringEncoding)!
self.writeValue(withUUID: SerialServiceModelConstants.serialWriteUUID)
self.sendMessage = NSData()
}
}
protocol SerialServiceModelDelegate: class {
func receiveFromSerial(serialPrint : String)
}
Does it have?
Hey, I'd love to see this lib available in Swift 3 so I can implement it in my project.
Thanks 😄
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.