android - OBDKey Bluetooth -


I want to connect my Motorola Dried with Bluetooth to OBDKey I use BluetoothChat as an example to connect to Bluetooth, as the KWP protocol

then I byte [] command [/ p>

 < Code> command [0] writes = rawToByte (0x02); Order [1] = rawToByte (0x85); Order [2] = rawToByte (0x05); Order [3] = rawToByte (0xc7); Order [4] = rawToByte (0x33); Order [5] = rawToByte (0xf1); Command [6] = rawToByte (0x00); Order [7] = rawToByte (0x00); Order [8] = rawToByte (0x00); Command [9] = rawToByte (0x00); Order [10] = rawToByte (0x00); Order [11] = rawToByte (0x00); Order [12] = rawToByte (0x00); Order [13] = rawToByte (0x00); Order [14] = rawToByte (0x76);  

Where the function is "rawtoobyte":

  public static byte rawtoobayte (int b) {return (byte) (0xff & amp; b); }  

This value is the first command sent to the OBDKey device byte 0x02 in the result, so this value copies. what I have done?

OBDK is an ELM327 based Bluetooth OBD adapter. This deal is similar to the Xxtreme and ScanTool.NET Bluetooth Adapters, as far as the features and method of use are. I am quite familiar with the latter two.

How to send a string to the device, assuming that you have already opened the socket and stream, and the output socket has been named MBT-overputstream

  / * * * Send the exact string provided * We do not add a CRL or anything like that - we just send the exact string as a tool - is * to send the ultimate * - the exact string to send the tool * @ Return - There is no problem until It is right then, in which case we return false; * / Public Boolean Transmission (String Senda) {// Yes, we can not send data if we are not connected! If (insert (!)! = True) return false; Byte Bessend [] = sendThis.getBytes (); Try {mBTOutputStream.write (bsendThis);} hold (exception e) {ioErrorOccurredDuringOutput (); return false; } IoResetOutputErrorCount (); Back true; }  

Also remember to read from the device, otherwise the input buffer will be completed and I / O will start blocking.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -