I am working on an iOS test application to work with a Bluetooth 4.0 LE module I have developed. The module acts as a wireless UART connection to other electronic devices. I need to send an array of binary bytes through the peripheral. My setup already uses NSdata and transmits that via Bluetooth to the module.
Say for example I have an NSString @"ABCDE" then the string is converted into NSdata and transmitted, it arrives in my module as "ABCDE" works great, no problems.
However for one of my main applications I need to convert the charecters of the string into a proprietary byte array using a look up table. Then this byte array needs to become the NSdata and be transmitted.
Here is an example:
Let say I have the string @"A"
a look up function determines each "A" becomes 5 binary bytes: "0111111 1001000 100100 0111111 0000000"
(All letters consist of 5 bytes of binary data.
Now I need to store that in the NSData object so that it is sent through Bluetooth. The problem I am running into is that if I use the string representation of that data I will end up with a data object that is incorrect. I have tried many things but nothing seems to be working. Any help would be greatly appreciated!