It depends on what the purpose of the message buffer will be.
Since you get decimal values ββfrom String, you can use the Integer.parseInt method with a radius of 10, and then apply to byte :
byte message[] = new byte[] { (byte)java.lang.Integer.parseInt("0", 10), (byte)java.lang.Integer.parseInt("166", 10), (byte)java.lang.Integer.parseInt("2", 10), (byte)java.lang.Integer.parseInt("252", 10), (byte)java.lang.Integer.parseInt("255", 10) };
If you just want to send data on the main channel, you should send it as follows:
bulkTransfer(outEndpoint, message, message.length, 1000);
Audit requests typically target some features on the USB device itself and are determined by the vendor. If you need to send a buffer as a management request, you must send it as follows:
controlTransfer(USB_DIR_OUT, VENDOR_DEFINED_REQUEST, VENDOR_DEFINED_VALUE, USB_INTERFACE_INDEX, message, message.length, 1000);
source share