Home > Mobile >  Oc byte function transformation
Oc byte function transformation

Time:10-16

Need according to Java byte function to convert into the oc, I according to the Internet to turn, the result is wrong, this is to be sent instructions to a bluetooth device, please help

Byte [] value=https://bbs.csdn.net/topics/new byte [5].
The value of [0]=1;
If (recordId<10) {
Int a=Integer. The valueOf (recordId. ToString ());
The value [1]=(byte) ((byte) a + '0');
The value [2]=0;
The value [3]=0;
The value [4]=0;
}
MPresenter. WriteCharacteristicValue (BLEConfig. SVR_UUID, BLEConfig CONTROL_UUID, value);
This is the inside of the Java code to the

NSData * data;
If (number & lt; 10) {
Nsstrings * strData=https://bbs.csdn.net/topics/[nsstrings stringWithFormat: @ 0% "01 d," number].
NSLog (@ "% @", strData);
NSArrayUInt8 bytes [dataArr. Count];
For (NSInteger I=0; IObj=dataArr nsstrings *;
UInt8 byte=(UInt8) strtoul ([obj UTF8String], 0 16th);
Bytes=byte;
}
NSLog (@ "% s", bytes);
Data=https://bbs.csdn.net/topics/[NSData dataWithBytes: bytes length: dataArr. Count];
}

[self. Peripheral writeValue: data? ForCharacteristic: self. WritedongtaiCharacteristic type: CBCharacteristicWriteWithResponse];
This is my turn of oc
  •  Tags:  
  • iOS
  • Related