Posts

Post not yet marked as solved
1 Replies
192 Views
Am new to objective c I need to set a characteristic data which I get from a Bluetooth using CB read to Byte array then return a byte buffer. the same is written in java how can I do the same in objective c dataArray = characteristic.getValue(); tsLong = System.currentTimeMillis() - tsStart; float timeSeconds = (float) ((float) tsLong / 1000.0); String timerstring = String.format("%.2f", timeSeconds); message = convertByteToChannelData(ByteBuffer.wrap(dataArray), timerstring, 0); this is the convertByteToChannelData method public String convertByteToChannelData(ByteBuffer wrap,String timerString, int stimulus){ wrap.order(ByteOrder.LITTLE_ENDIAN); // Set 1 Channels // Channels 1, 5, 6, 11, 16, 17 ch1R = (float) ((wrap.getShort(0) / 4095.) * 3.3); ch1Rs = (float) ((wrap.getShort(4) / 4095.) * 3.3); ch5R = (float) ((wrap.getShort(12) / 4095.) * 3.3); ch5Rs = (float) ((wrap.getShort(4) / 4095.) * 3.3); ch6R = (float) ((wrap.getShort(6) / 4095.) * 3.3); }
Posted Last updated
.