Closed fishymander closed 6 years ago
ORSSerialPort natively deals in plain old binary data, not strings. You give it an instance of NSData
(or Data
in Swift) to send, and that's what it give you when it receives data as well.
To create an NSData using a series of hex bytes:
Objective-C
NSData *data = [NSData dataWithBytes:(void *)(&(char){0x7E, 0x03, 0x00, 0x00, 0xE7}) length:5];
Swift:
let data = Data(bytes: [0x7E, 0x03, 0x00, 0x00, 0xE7])
Hope this helps.
Is there an ability to send and receive hex data using this instead of strings? I am trying to interface with the following device. https://www.enttec.com/us/products/controls/dmx-usb/dmx-usb-pro/
Example data send: 7E 03 00 00 E7 should get a response from the device about what parameters it supports.