ouvrir btsnoop_hci.log avec wireshark mettre comme filtre d'affichage : btatt.uuid128 == 45:4d:22:88:a1:22:05:8d:9b:42:9d:0f:37:72:af:82 || btatt.uuid128 == 45:4d:11:88:a1:22:05:8d:9b:42:9d:0f:37:72:af:82 bluetooth.dst == f6:1a:86:24:ab:fd || bluetooth.src == f6:1a:86:24:ab:fd filtrage pour les requêtes getFile/checkGetLogFileContinue : (bluetooth.dst == f6:1a:86:24:ab:fd || bluetooth.src == f6:1a:86:24:ab:fd) && btatt.value[0] == 0c getFileList : (bluetooth.dst == f6:1a:86:24:ab:fd || bluetooth.src == f6:1a:86:24:ab:fd) && btatt.value[0] == 0b btatt.service_uuid128 == 45:4d:77:66:a1:22:05:8d:9b:42:9d:0f:37:72:af:82 btatt.service_uuid128 == 45:4d:77:88:a1:22:05:8d:9b:42:9d:0f:37:72:af:82 btatt.uuid128 == 45:4d:33:88:a1:22:05:8d:9b:42:9d:0f:37:72:af:82 btatt.uuid128 == 45:4d:11:88:a1:22:05:8d:9b:42:9d:0f:37:72:af:82 les fonctions qui construisent des tableaux de données à destination du rider sont : requestDataCmd (généralement 2 bytes) et generateActionData (au moins 3 bytes) Types de commandes : ==================== 6 : readDeviceInfo 11 : getFileList 12 : getFile Déroulé des échanges sur la characteristic COMMAND : ==================================================== ==> 06 04(b000 001 00) ............................... readDeviceInfo() appelle requestDataCmd(cmdid==6, seqno==1) (seqno correspond aux bits 2,3,4 du deuxième octet) <== 06 24(b001 001 00) 02 ==> 06 44(010 001 00) 03 ............................ onCharacteristicChangedCommandChannel appelle generateActionData(cmdid==6, seqno==1, actioncode==3) ### RÉCÉPTIONS SUR LA CHARACTÉRISTIQUE DATA ### ...... infos du bryton? ==> 0b(11) 08(b000 010 00) ........................... getFileList() appelle requestDataCmd(cmdid==11, seqno==2) <== 0b(11) 28(b001 010 00) 02 ==> 0b(11) 48(b010 010 00) 03 ........................ onCharacteristicChangedCommandChannel appelle generateActionData(cmdid==11, seqno==2, actioncode==3) ### RÉCÉPTIONS SUR LA CHARACTÉRISTIQUE DATA ### ...... liste des fichiers? ==> 0c(12) 0c(b000 011 00) 64 bd a8 ec 01(fileType) .. sûrement un appel de requestDataCmd(cmdid==12, seqno==3, fileType==1, fileid==?, "") initié par getFile() les octets 2,3,4,5 sont retournés par ParserUtil.fitFileNameToByteArray(fileid) <== 0c 2c(b001 011 00) 02 ==> 0c 4c(b010 011 00) 05 00 0a ...................... sûrement un appel de generateActionData(cmdid==12, seqno==3, actioncode==5). "00 0a" représente this.flowCtrl sur 2 octets ### RÉCÉPTIONS SUR LA CHARACTÉRISTIQUE DATA ### ...... contenu du fichier? ==> 0c 4c(b010 011 00) 06 ### RÉCÉPTIONS SUR LA CHARACTÉRISTIQUE DATA ### ...... contenu du fichier? ==> 0c 4c(b010 011 00) 06 ### RÉCÉPTIONS SUR LA CHARACTÉRISTIQUE DATA ### ...... contenu du fichier? ... suite à la la frame 1808 ==> 0c(12) 10(b000 100 00) 64 bd 66 ae 01 idem plus haut getFile() public static Map statusCodeMsg = new Hashtable() { // from class: com.brytonsport.active.bleplugin.SampleGattAttributes.2 { put(0, "Unknown error"); put(1, "Busy"); put(2, "OK"); put(3, "Factory status"); put(4, "Address error"); put(5, "Need sync time"); put(6, "No need sync"); } }; /**********************************************************************/ ##### readDeviceInfo? /**********************************************************************/ Frame 554: 14 bytes on wire (112 bits), 14 bytes captured (112 bits) Bluetooth [Source: SamsungE_30:29:75 (0c:02:bd:30:29:75)] [Destination: f6:1a:86:24:ab:fd (f6:1a:86:24:ab:fd)] Bluetooth HCI H4 [Direction: Sent (0x00)] HCI Packet Type: ACL Data (0x02) Bluetooth HCI ACL Packet Bluetooth L2CAP Protocol Length: 5 CID: Attribute Protocol (0x0004) Bluetooth Attribute Protocol Opcode: Write Request (0x12) Handle: 0x000e (Unknown: Unknown) [Service UUID: 454d7788a122058d9b429d0f3772af82] [UUID: 454d2288a122058d9b429d0f3772af82] Value: 0604 /**********************************************************************/ ##### réponse au readDeviceInfo /**********************************************************************/ Frame 557: 15 bytes on wire (120 bits), 15 bytes captured (120 bits) Bluetooth [Source: f6:1a:86:24:ab:fd (f6:1a:86:24:ab:fd)] [Destination: SamsungE_30:29:75 (0c:02:bd:30:29:75)] Bluetooth HCI H4 [Direction: Rcvd (0x01)] HCI Packet Type: ACL Data (0x02) Bluetooth HCI ACL Packet .... 0000 0000 0010 = Connection Handle: 0x002 ..10 .... .... .... = PB Flag: First Automatically Flushable Packet (2) 00.. .... .... .... = BC Flag: Point-To-Point (0) Data Total Length: 10 Data [Connect in frame: 461] [Disconnect in frame: 2189] [Source BD_ADDR: f6:1a:86:24:ab:fd (f6:1a:86:24:ab:fd)] [Source Device Name: Rider_310 ] [Source Role: Unknown (0)] [Destination BD_ADDR: SamsungE_30:29:75 (0c:02:bd:30:29:75)] [Destination Device Name: Galaxy A12] [Destination Role: Unknown (0)] [Current Mode: Unknown (-1)] Bluetooth L2CAP Protocol Length: 6 CID: Attribute Protocol (0x0004) Bluetooth Attribute Protocol Opcode: Handle Value Notification (0x1b) Handle: 0x000e (Unknown: Unknown) [Service UUID: 454d7788a122058d9b429d0f3772af82] [UUID: 454d2288a122058d9b429d0f3772af82] Value: 062402 06 --> 6 24 --> 001 001 00 02 --> 2 (status code OK) ==> /**********************************************************************/ /**********************************************************************/ ##### readDeviceInfo? (pas mal de notifications sur la characteristique DATA ensuite) /**********************************************************************/ Frame 558: 15 bytes on wire (120 bits), 15 bytes captured (120 bits) Bluetooth [Source: SamsungE_30:29:75 (0c:02:bd:30:29:75)] [Destination: f6:1a:86:24:ab:fd (f6:1a:86:24:ab:fd)] Bluetooth HCI H4 [Direction: Sent (0x00)] HCI Packet Type: ACL Data (0x02) Bluetooth HCI ACL Packet Bluetooth L2CAP Protocol Length: 6 CID: Attribute Protocol (0x0004) Bluetooth Attribute Protocol Opcode: Write Request (0x12) Handle: 0x000e (Unknown: Unknown) [Service UUID: 454d7788a122058d9b429d0f3772af82] [UUID: 454d2288a122058d9b429d0f3772af82] Value: 064403 /**********************************************************************/ /**********************************************************************/ ##### getFile /**********************************************************************/ Frame 1808: 19 bytes on wire (152 bits), 19 bytes captured (152 bits) Bluetooth [Source: SamsungE_30:29:75 (0c:02:bd:30:29:75)] [Destination: f6:1a:86:24:ab:fd (f6:1a:86:24:ab:fd)] Bluetooth HCI H4 [Direction: Sent (0x00)] HCI Packet Type: ACL Data (0x02) Bluetooth HCI ACL Packet Bluetooth L2CAP Protocol Length: 10 CID: Attribute Protocol (0x0004) Bluetooth Attribute Protocol Opcode: Write Request (0x12) Handle: 0x000e (Unknown: Unknown) [Service UUID: 454d7788a122058d9b429d0f3772af82] [UUID: 454d2288a122058d9b429d0f3772af82] Value: 0c1064bd66ae01 /**********************************************************************/ /**********************************************************************/ ##### checkGetLogFileContinue /**********************************************************************/ Frame 1428: 15 bytes on wire (120 bits), 15 bytes captured (120 bits) Bluetooth [Source: SamsungE_30:29:75 (0c:02:bd:30:29:75)] [Destination: f6:1a:86:24:ab:fd (f6:1a:86:24:ab:fd)] Bluetooth HCI H4 [Direction: Sent (0x00)] HCI Packet Type: ACL Data (0x02) Bluetooth HCI ACL Packet Bluetooth L2CAP Protocol Length: 6 CID: Attribute Protocol (0x0004) Bluetooth Attribute Protocol Opcode: Write Request (0x12) Handle: 0x000e (Unknown: Unknown) [Service UUID: 454d7788a122058d9b429d0f3772af82] [UUID: 454d2288a122058d9b429d0f3772af82] Value: 0c4c06 /**********************************************************************/