GithubHelp home page GithubHelp logo

e-sites / bluetonium Goto Github PK

View Code? Open in Web Editor NEW
165.0 16.0 15.0 89 KB

Bluetooth mapping in Swift

License: MIT License

Ruby 1.17% Swift 90.19% Objective-C 8.64%
ios swift bluetooth-low-energy bluetooth cocoapods carthage peripherals

bluetonium's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bluetonium's Issues

-

Does it have?

didFindDevice not call

My code as below but when i click button Scan function didFindDevice never responds. Did I declare something wrong?
screen shot 2017-12-14 at 17 26 53

Connect but no write

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]

Swift 3 compatibility

Hey, I'd love to see this lib available in Swift 3 so I can implement it in my project.

Thanks 😄

Problem when writing to a Serial Service

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)
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.