mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Added comments for "SDP_ServiceSearchAttributeResponse"
This commit is contained in:
parent
aae52f82c3
commit
b8aecacd6d
1 changed files with 84 additions and 71 deletions
155
SPPServer.cpp
155
SPPServer.cpp
|
@ -504,15 +504,15 @@ void SPPServer::serviceNotSupported(uint8_t transactionIDHigh, uint8_t transacti
|
|||
l2capoutbuf[0] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
|
||||
l2capoutbuf[1] = transactionIDHigh;
|
||||
l2capoutbuf[2] = transactionIDLow;
|
||||
l2capoutbuf[3] = 0x00; // Parameter Length
|
||||
l2capoutbuf[4] = 0x05; // Parameter Length
|
||||
l2capoutbuf[5] = 0x00; // AttributeListsByteCount
|
||||
l2capoutbuf[6] = 0x02; // AttributeListsByteCount
|
||||
l2capoutbuf[3] = 0x00; // MSB Parameter Length
|
||||
l2capoutbuf[4] = 0x05; // LSB Parameter Length = 5
|
||||
l2capoutbuf[5] = 0x00; // MSB AttributeListsByteCount
|
||||
l2capoutbuf[6] = 0x02; // LSB AttributeListsByteCount = 2
|
||||
|
||||
/* Attribute ID/Value Sequence: */
|
||||
l2capoutbuf[7] = 0x35;
|
||||
l2capoutbuf[8] = 0x00;
|
||||
l2capoutbuf[9] = 0x00;
|
||||
l2capoutbuf[7] = 0x35; // Data element sequence - length in next byte
|
||||
l2capoutbuf[8] = 0x00; // Length = 0
|
||||
l2capoutbuf[9] = 0x00; // No continuation state
|
||||
|
||||
SDP_Command(l2capoutbuf, 10);
|
||||
}
|
||||
|
@ -521,56 +521,60 @@ void SPPServer::serialPortResponse1(uint8_t transactionIDHigh, uint8_t transacti
|
|||
l2capoutbuf[0] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
|
||||
l2capoutbuf[1] = transactionIDHigh;
|
||||
l2capoutbuf[2] = transactionIDLow;
|
||||
l2capoutbuf[3] = 0x00; // Parameter Length
|
||||
l2capoutbuf[4] = 0x2B; // Parameter Length
|
||||
l2capoutbuf[5] = 0x00; // AttributeListsByteCount
|
||||
l2capoutbuf[6] = 0x26; // AttributeListsByteCount
|
||||
l2capoutbuf[3] = 0x00; // MSB Parameter Length
|
||||
l2capoutbuf[4] = 0x2B; // LSB Parameter Length = 43
|
||||
l2capoutbuf[5] = 0x00; // MSB AttributeListsByteCount
|
||||
l2capoutbuf[6] = 0x26; // LSB AttributeListsByteCount = 38
|
||||
|
||||
/* Attribute ID/Value Sequence: */
|
||||
l2capoutbuf[7] = 0x36;
|
||||
l2capoutbuf[8] = 0x00;
|
||||
l2capoutbuf[9] = 0x3C;
|
||||
l2capoutbuf[10] = 0x36;
|
||||
l2capoutbuf[11] = 0x00;
|
||||
l2capoutbuf[7] = 0x36; // Data element sequence - length in next two bytes
|
||||
l2capoutbuf[8] = 0x00; // MSB Length
|
||||
l2capoutbuf[9] = 0x3C; // LSB Length = 60
|
||||
|
||||
l2capoutbuf[12] = 0x39;
|
||||
l2capoutbuf[13] = 0x09;
|
||||
l2capoutbuf[14] = 0x00;
|
||||
l2capoutbuf[15] = 0x00;
|
||||
l2capoutbuf[16] = 0x0A;
|
||||
l2capoutbuf[17] = 0x00;
|
||||
l2capoutbuf[10] = 0x36; // Data element sequence - length in next two bytes
|
||||
l2capoutbuf[11] = 0x00; // MSB Length
|
||||
l2capoutbuf[12] = 0x39; // LSB Length = 57
|
||||
|
||||
l2capoutbuf[13] = 0x09; // Unsigned Integer - length 2 bytes
|
||||
l2capoutbuf[14] = 0x00; // MSB ServiceRecordHandle
|
||||
l2capoutbuf[15] = 0x00; // LSB ServiceRecordHandle
|
||||
l2capoutbuf[16] = 0x0A; // Unsigned int - length 4 bytes
|
||||
l2capoutbuf[17] = 0x00; // ServiceRecordHandle value - TODO: Is this related to HCI_Handle?
|
||||
l2capoutbuf[18] = 0x01;
|
||||
l2capoutbuf[19] = 0x00;
|
||||
l2capoutbuf[20] = 0x06;
|
||||
l2capoutbuf[21] = 0x09;
|
||||
l2capoutbuf[22] = 0x00;
|
||||
l2capoutbuf[23] = 0x01;
|
||||
l2capoutbuf[24] = 0x35;
|
||||
l2capoutbuf[25] = 0x03;
|
||||
l2capoutbuf[26] = 0x19;
|
||||
l2capoutbuf[27] = 0x11;
|
||||
|
||||
l2capoutbuf[28] = 0x01;
|
||||
l2capoutbuf[29] = 0x09;
|
||||
l2capoutbuf[30] = 0x00;
|
||||
l2capoutbuf[31] = 0x04;
|
||||
l2capoutbuf[32] = 0x35;
|
||||
l2capoutbuf[33] = 0x0C;
|
||||
l2capoutbuf[34] = 0x35;
|
||||
l2capoutbuf[35] = 0x03;
|
||||
l2capoutbuf[36] = 0x19;
|
||||
l2capoutbuf[37] = 0x01;
|
||||
l2capoutbuf[38] = 0x00;
|
||||
l2capoutbuf[39] = 0x35;
|
||||
l2capoutbuf[40] = 0x05;
|
||||
l2capoutbuf[41] = 0x19;
|
||||
l2capoutbuf[42] = 0x00;
|
||||
l2capoutbuf[43] = 0x03;
|
||||
l2capoutbuf[21] = 0x09; // Unsigned Integer - length 2 bytes
|
||||
l2capoutbuf[22] = 0x00; // MSB ServiceClassIDList
|
||||
l2capoutbuf[23] = 0x01; // LSB ServiceClassIDList
|
||||
l2capoutbuf[24] = 0x35; // Data element sequence - length in next byte
|
||||
l2capoutbuf[25] = 0x03; // Length = 3
|
||||
l2capoutbuf[26] = 0x19; // UUID (universally unique identifier) - length = 2 bytes
|
||||
l2capoutbuf[27] = 0x11; // MSB SerialPort
|
||||
l2capoutbuf[28] = 0x01; // LSB SerialPort
|
||||
|
||||
l2capoutbuf[44] = 0x08;
|
||||
l2capoutbuf[45] = 0x02; // Two extra bytes
|
||||
l2capoutbuf[46] = 0x00; // 25 (0x19) more bytes to come
|
||||
l2capoutbuf[47] = 0x19;
|
||||
l2capoutbuf[29] = 0x09; // Unsigned Integer - length 2 bytes
|
||||
l2capoutbuf[30] = 0x00; // MSB ProtocolDescriptorList
|
||||
l2capoutbuf[31] = 0x04; // LSB ProtocolDescriptorList
|
||||
l2capoutbuf[32] = 0x35; // Data element sequence - length in next byte
|
||||
l2capoutbuf[33] = 0x0C; // Length = 12
|
||||
|
||||
l2capoutbuf[34] = 0x35; // Data element sequence - length in next byte
|
||||
l2capoutbuf[35] = 0x03; // Length = 3
|
||||
l2capoutbuf[36] = 0x19; // UUID (universally unique identifier) - length = 2 bytes
|
||||
l2capoutbuf[37] = 0x01; // MSB L2CAP
|
||||
l2capoutbuf[38] = 0x00; // LSB L2CAP
|
||||
|
||||
l2capoutbuf[39] = 0x35; // Data element sequence - length in next byte
|
||||
l2capoutbuf[40] = 0x05; // Length = 5
|
||||
l2capoutbuf[41] = 0x19; // UUID (universally unique identifier) - length = 2 bytes
|
||||
l2capoutbuf[42] = 0x00; // MSB RFCOMM
|
||||
l2capoutbuf[43] = 0x03; // LSB RFCOMM
|
||||
l2capoutbuf[44] = 0x08; // Unsigned Integer - length 1 byte
|
||||
|
||||
l2capoutbuf[45] = 0x02; // ContinuationState - Two more bytes
|
||||
l2capoutbuf[46] = 0x00; // MSB length
|
||||
l2capoutbuf[47] = 0x19; // LSB length = 25 more bytes to come
|
||||
|
||||
SDP_Command(l2capoutbuf, 48);
|
||||
}
|
||||
|
@ -579,40 +583,49 @@ void SPPServer::serialPortResponse2(uint8_t transactionIDHigh, uint8_t transacti
|
|||
l2capoutbuf[0] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
|
||||
l2capoutbuf[1] = transactionIDHigh;
|
||||
l2capoutbuf[2] = transactionIDLow;
|
||||
l2capoutbuf[3] = 0x00; // Parameter Length
|
||||
l2capoutbuf[4] = 0x1C; // Parameter Length
|
||||
l2capoutbuf[5] = 0x00; // AttributeListsByteCount
|
||||
l2capoutbuf[6] = 0x19; // AttributeListsByteCount
|
||||
l2capoutbuf[3] = 0x00; // MSB Parameter Length
|
||||
l2capoutbuf[4] = 0x1C; // LSB Parameter Length = 28
|
||||
l2capoutbuf[5] = 0x00; // MSB AttributeListsByteCount
|
||||
l2capoutbuf[6] = 0x19; // LSB AttributeListsByteCount = 25
|
||||
|
||||
/* Attribute ID/Value Sequence: */
|
||||
l2capoutbuf[7] = 0x01;
|
||||
l2capoutbuf[8] = 0x09;
|
||||
l2capoutbuf[9] = 0x00;
|
||||
l2capoutbuf[10] = 0x06;
|
||||
l2capoutbuf[11] = 0x35;
|
||||
l2capoutbuf[7] = 0x01; // Channel 1 - TODO: Try different values, so multiple servers can be used at once
|
||||
|
||||
l2capoutbuf[12] = 0x09;
|
||||
l2capoutbuf[13] = 0x09;
|
||||
l2capoutbuf[14] = 0x65;
|
||||
l2capoutbuf[15] = 0x6E;
|
||||
l2capoutbuf[16] = 0x09;
|
||||
l2capoutbuf[17] = 0x00;
|
||||
l2capoutbuf[18] = 0x6A;
|
||||
l2capoutbuf[19] = 0x09;
|
||||
l2capoutbuf[8] = 0x09; // Unsigned Integer - length 2 bytes
|
||||
l2capoutbuf[9] = 0x00; // MSB LanguageBaseAttributeIDList
|
||||
l2capoutbuf[10] = 0x06; // LSB LanguageBaseAttributeIDList
|
||||
l2capoutbuf[11] = 0x35; // Data element sequence - length in next byte
|
||||
l2capoutbuf[12] = 0x09; // Length = 9
|
||||
|
||||
// Identifier representing the natural language = en = English - see: "ISO 639:1988"
|
||||
l2capoutbuf[13] = 0x09; // Unsigned Integer - length 2 bytes
|
||||
l2capoutbuf[14] = 0x65; // 'e'
|
||||
l2capoutbuf[15] = 0x6E; // 'n'
|
||||
|
||||
// "The second element of each triplet contains an identifier that specifies a character encoding used for the language"
|
||||
// Encoding is set to 106 (UTF-8) - see: http://www.iana.org/assignments/character-sets/character-sets.xhtml
|
||||
l2capoutbuf[16] = 0x09; // Unsigned Integer - length 2 bytes
|
||||
l2capoutbuf[17] = 0x00; // MSB of character encoding
|
||||
l2capoutbuf[18] = 0x6A; // LSB of character encoding (106)
|
||||
|
||||
// Attribute ID that serves as the base attribute ID for the natural language in the service record
|
||||
// "To facilitate the retrieval of human-readable universal attributes in a principal language, the base attribute ID value for the primary language supported by a service record shall be 0x0100"
|
||||
l2capoutbuf[19] = 0x09; // Unsigned Integer - length 2 bytes
|
||||
l2capoutbuf[20] = 0x01;
|
||||
l2capoutbuf[21] = 0x00;
|
||||
l2capoutbuf[22] = 0x09;
|
||||
l2capoutbuf[23] = 0x01;
|
||||
l2capoutbuf[24] = 0x00;
|
||||
l2capoutbuf[25] = 0x25;
|
||||
|
||||
l2capoutbuf[22] = 0x09; // Unsigned Integer - length 2 bytes
|
||||
l2capoutbuf[23] = 0x01; // MSB ServiceDescription
|
||||
l2capoutbuf[24] = 0x00; // LSB ServiceDescription
|
||||
|
||||
l2capoutbuf[25] = 0x25; // Text string - length in next byte
|
||||
l2capoutbuf[26] = 0x05; // Name length
|
||||
l2capoutbuf[27] = 'T';
|
||||
l2capoutbuf[28] = 'K';
|
||||
l2capoutbuf[29] = 'J';
|
||||
l2capoutbuf[30] = 'S';
|
||||
l2capoutbuf[31] = 'P';
|
||||
l2capoutbuf[32] = 0x00; // No more data
|
||||
l2capoutbuf[32] = 0x00; // No continuation state
|
||||
|
||||
SDP_Command(l2capoutbuf, 33);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue