1
votes

I currently have a DEX BLE-1 adaptor from Honeywell used to retrieve dex data from vending machines. I have a swift 3 iOS app that uses CoreBluetooth to make scans and pair to the peripheral. The adaptor has has three services: serial port, battery, and dex service. The dex service has three characteristics: firmware version, session, and settings. I suppose the session characteristic is used to retrieve the dex; however, I am not sure how to do so.

I use the didUpdateValueFor peripheral method to get the value relating to the uuid of the characteristic of session but the value is nil.

func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {

        if characterstic.uuid.uuidString == uuidSession {
            if(characteristic.value != nil) {
                print(characterstic.value)
            }
        }
}

Is the DEX supposed to be retrieved from the session characteristic value? It seems to be a few bytes, maybe I have to concatenate the bytes? But the value is nil anyways. I am new at this but should this be done through the serial port? I read somewhere you could establish a connection through it, or is this totally off?

2
Did you answer for above? Do we need to use any SDK?abbas.aniefa

2 Answers

0
votes

The DEX communication with a vending machine is a serial port connection.

The new Blu-DEX is BLE 4.0 and works with both Android and Apple.

0
votes

You're just looking for characterstic or for the value ?

func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {

    let readValue = characteristic.value
    if let str = String(data: readValue!, encoding: String.Encoding.utf8) {
        print("Line \(index): \(str)")
        index += 1
    } else {
        print("Received an invalid string!")
    }

}