@@ -538,15 +538,15 @@ void SPP::serviceNotSupported(uint8_t transactionIDHigh, uint8_t transactionIDLo
538
538
l2capoutbuf[0 ] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
539
539
l2capoutbuf[1 ] = transactionIDHigh;
540
540
l2capoutbuf[2 ] = transactionIDLow;
541
- l2capoutbuf[3 ] = 0x00 ; // Parameter Length
542
- l2capoutbuf[4 ] = 0x05 ; // Parameter Length
543
- l2capoutbuf[5 ] = 0x00 ; // AttributeListsByteCount
544
- l2capoutbuf[6 ] = 0x02 ; // AttributeListsByteCount
541
+ l2capoutbuf[3 ] = 0x00 ; // MSB Parameter Length
542
+ l2capoutbuf[4 ] = 0x05 ; // LSB Parameter Length = 5
543
+ l2capoutbuf[5 ] = 0x00 ; // MSB AttributeListsByteCount
544
+ l2capoutbuf[6 ] = 0x02 ; // LSB AttributeListsByteCount = 2
545
545
546
546
/* Attribute ID/Value Sequence: */
547
- l2capoutbuf[7 ] = 0x35 ;
548
- l2capoutbuf[8 ] = 0x00 ;
549
- l2capoutbuf[9 ] = 0x00 ;
547
+ l2capoutbuf[7 ] = 0x35 ; // Data element sequence - length in next byte
548
+ l2capoutbuf[8 ] = 0x00 ; // Length = 0
549
+ l2capoutbuf[9 ] = 0x00 ; // No continuation state
550
550
551
551
SDP_Command (l2capoutbuf, 10 );
552
552
}
@@ -555,56 +555,60 @@ void SPP::serialPortResponse1(uint8_t transactionIDHigh, uint8_t transactionIDLo
555
555
l2capoutbuf[0 ] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
556
556
l2capoutbuf[1 ] = transactionIDHigh;
557
557
l2capoutbuf[2 ] = transactionIDLow;
558
- l2capoutbuf[3 ] = 0x00 ; // Parameter Length
559
- l2capoutbuf[4 ] = 0x2B ; // Parameter Length
560
- l2capoutbuf[5 ] = 0x00 ; // AttributeListsByteCount
561
- l2capoutbuf[6 ] = 0x26 ; // AttributeListsByteCount
558
+ l2capoutbuf[3 ] = 0x00 ; // MSB Parameter Length
559
+ l2capoutbuf[4 ] = 0x2B ; // LSB Parameter Length = 43
560
+ l2capoutbuf[5 ] = 0x00 ; // MSB AttributeListsByteCount
561
+ l2capoutbuf[6 ] = 0x26 ; // LSB AttributeListsByteCount = 38
562
562
563
563
/* Attribute ID/Value Sequence: */
564
- l2capoutbuf[7 ] = 0x36 ;
565
- l2capoutbuf[8 ] = 0x00 ;
566
- l2capoutbuf[9 ] = 0x3C ;
567
- l2capoutbuf[10 ] = 0x36 ;
568
- l2capoutbuf[11 ] = 0x00 ;
569
-
570
- l2capoutbuf[12 ] = 0x39 ;
571
- l2capoutbuf[13 ] = 0x09 ;
572
- l2capoutbuf[14 ] = 0x00 ;
573
- l2capoutbuf[15 ] = 0x00 ;
574
- l2capoutbuf[16 ] = 0x0A ;
575
- l2capoutbuf[17 ] = 0x00 ;
564
+ l2capoutbuf[7 ] = 0x36 ; // Data element sequence - length in next two bytes
565
+ l2capoutbuf[8 ] = 0x00 ; // MSB Length
566
+ l2capoutbuf[9 ] = 0x3C ; // LSB Length = 60
567
+
568
+ l2capoutbuf[10 ] = 0x36 ; // Data element sequence - length in next two bytes
569
+ l2capoutbuf[11 ] = 0x00 ; // MSB Length
570
+ l2capoutbuf[12 ] = 0x39 ; // LSB Length = 57
571
+
572
+ l2capoutbuf[13 ] = 0x09 ; // Unsigned Integer - length 2 bytes
573
+ l2capoutbuf[14 ] = 0x00 ; // MSB ServiceRecordHandle
574
+ l2capoutbuf[15 ] = 0x00 ; // LSB ServiceRecordHandle
575
+ l2capoutbuf[16 ] = 0x0A ; // Unsigned int - length 4 bytes
576
+ l2capoutbuf[17 ] = 0x00 ; // ServiceRecordHandle value - TODO: Is this related to HCI_Handle?
576
577
l2capoutbuf[18 ] = 0x01 ;
577
578
l2capoutbuf[19 ] = 0x00 ;
578
579
l2capoutbuf[20 ] = 0x06 ;
579
- l2capoutbuf[21 ] = 0x09 ;
580
- l2capoutbuf[22 ] = 0x00 ;
581
- l2capoutbuf[23 ] = 0x01 ;
582
- l2capoutbuf[24 ] = 0x35 ;
583
- l2capoutbuf[25 ] = 0x03 ;
584
- l2capoutbuf[26 ] = 0x19 ;
585
- l2capoutbuf[27 ] = 0x11 ;
586
-
587
- l2capoutbuf[28 ] = 0x01 ;
588
- l2capoutbuf[29 ] = 0x09 ;
589
- l2capoutbuf[30 ] = 0x00 ;
590
- l2capoutbuf[31 ] = 0x04 ;
591
- l2capoutbuf[32 ] = 0x35 ;
592
- l2capoutbuf[33 ] = 0x0C ;
593
- l2capoutbuf[34 ] = 0x35 ;
594
- l2capoutbuf[35 ] = 0x03 ;
595
- l2capoutbuf[36 ] = 0x19 ;
596
- l2capoutbuf[37 ] = 0x01 ;
597
- l2capoutbuf[38 ] = 0x00 ;
598
- l2capoutbuf[39 ] = 0x35 ;
599
- l2capoutbuf[40 ] = 0x05 ;
600
- l2capoutbuf[41 ] = 0x19 ;
601
- l2capoutbuf[42 ] = 0x00 ;
602
- l2capoutbuf[43 ] = 0x03 ;
603
-
604
- l2capoutbuf[44 ] = 0x08 ;
605
- l2capoutbuf[45 ] = 0x02 ; // Two extra bytes
606
- l2capoutbuf[46 ] = 0x00 ; // 25 (0x19) more bytes to come
607
- l2capoutbuf[47 ] = 0x19 ;
580
+
581
+ l2capoutbuf[21 ] = 0x09 ; // Unsigned Integer - length 2 bytes
582
+ l2capoutbuf[22 ] = 0x00 ; // MSB ServiceClassIDList
583
+ l2capoutbuf[23 ] = 0x01 ; // LSB ServiceClassIDList
584
+ l2capoutbuf[24 ] = 0x35 ; // Data element sequence - length in next byte
585
+ l2capoutbuf[25 ] = 0x03 ; // Length = 3
586
+ l2capoutbuf[26 ] = 0x19 ; // UUID (universally unique identifier) - length = 2 bytes
587
+ l2capoutbuf[27 ] = 0x11 ; // MSB SerialPort
588
+ l2capoutbuf[28 ] = 0x01 ; // LSB SerialPort
589
+
590
+ l2capoutbuf[29 ] = 0x09 ; // Unsigned Integer - length 2 bytes
591
+ l2capoutbuf[30 ] = 0x00 ; // MSB ProtocolDescriptorList
592
+ l2capoutbuf[31 ] = 0x04 ; // LSB ProtocolDescriptorList
593
+ l2capoutbuf[32 ] = 0x35 ; // Data element sequence - length in next byte
594
+ l2capoutbuf[33 ] = 0x0C ; // Length = 12
595
+
596
+ l2capoutbuf[34 ] = 0x35 ; // Data element sequence - length in next byte
597
+ l2capoutbuf[35 ] = 0x03 ; // Length = 3
598
+ l2capoutbuf[36 ] = 0x19 ; // UUID (universally unique identifier) - length = 2 bytes
599
+ l2capoutbuf[37 ] = 0x01 ; // MSB L2CAP
600
+ l2capoutbuf[38 ] = 0x00 ; // LSB L2CAP
601
+
602
+ l2capoutbuf[39 ] = 0x35 ; // Data element sequence - length in next byte
603
+ l2capoutbuf[40 ] = 0x05 ; // Length = 5
604
+ l2capoutbuf[41 ] = 0x19 ; // UUID (universally unique identifier) - length = 2 bytes
605
+ l2capoutbuf[42 ] = 0x00 ; // MSB RFCOMM
606
+ l2capoutbuf[43 ] = 0x03 ; // LSB RFCOMM
607
+ l2capoutbuf[44 ] = 0x08 ; // Unsigned Integer - length 1 byte
608
+
609
+ l2capoutbuf[45 ] = 0x02 ; // ContinuationState - Two more bytes
610
+ l2capoutbuf[46 ] = 0x00 ; // MSB length
611
+ l2capoutbuf[47 ] = 0x19 ; // LSB length = 25 more bytes to come
608
612
609
613
SDP_Command (l2capoutbuf, 48 );
610
614
}
@@ -613,40 +617,49 @@ void SPP::serialPortResponse2(uint8_t transactionIDHigh, uint8_t transactionIDLo
613
617
l2capoutbuf[0 ] = SDP_SERVICE_SEARCH_ATTRIBUTE_RESPONSE_PDU;
614
618
l2capoutbuf[1 ] = transactionIDHigh;
615
619
l2capoutbuf[2 ] = transactionIDLow;
616
- l2capoutbuf[3 ] = 0x00 ; // Parameter Length
617
- l2capoutbuf[4 ] = 0x1C ; // Parameter Length
618
- l2capoutbuf[5 ] = 0x00 ; // AttributeListsByteCount
619
- l2capoutbuf[6 ] = 0x19 ; // AttributeListsByteCount
620
+ l2capoutbuf[3 ] = 0x00 ; // MSB Parameter Length
621
+ l2capoutbuf[4 ] = 0x1C ; // LSB Parameter Length = 28
622
+ l2capoutbuf[5 ] = 0x00 ; // MSB AttributeListsByteCount
623
+ l2capoutbuf[6 ] = 0x19 ; // LSB AttributeListsByteCount = 25
620
624
621
625
/* Attribute ID/Value Sequence: */
622
- l2capoutbuf[7 ] = 0x01 ;
623
- l2capoutbuf[8 ] = 0x09 ;
624
- l2capoutbuf[9 ] = 0x00 ;
625
- l2capoutbuf[10 ] = 0x06 ;
626
- l2capoutbuf[11 ] = 0x35 ;
627
-
628
- l2capoutbuf[12 ] = 0x09 ;
629
- l2capoutbuf[13 ] = 0x09 ;
630
- l2capoutbuf[14 ] = 0x65 ;
631
- l2capoutbuf[15 ] = 0x6E ;
632
- l2capoutbuf[16 ] = 0x09 ;
633
- l2capoutbuf[17 ] = 0x00 ;
634
- l2capoutbuf[18 ] = 0x6A ;
635
- l2capoutbuf[19 ] = 0x09 ;
626
+ l2capoutbuf[7 ] = 0x01 ; // Channel 1 - TODO: Try different values, so multiple servers can be used at once
627
+
628
+ l2capoutbuf[8 ] = 0x09 ; // Unsigned Integer - length 2 bytes
629
+ l2capoutbuf[9 ] = 0x00 ; // MSB LanguageBaseAttributeIDList
630
+ l2capoutbuf[10 ] = 0x06 ; // LSB LanguageBaseAttributeIDList
631
+ l2capoutbuf[11 ] = 0x35 ; // Data element sequence - length in next byte
632
+ l2capoutbuf[12 ] = 0x09 ; // Length = 9
633
+
634
+ // Identifier representing the natural language = en = English - see: "ISO 639:1988"
635
+ l2capoutbuf[13 ] = 0x09 ; // Unsigned Integer - length 2 bytes
636
+ l2capoutbuf[14 ] = 0x65 ; // 'e'
637
+ l2capoutbuf[15 ] = 0x6E ; // 'n'
638
+
639
+ // "The second element of each triplet contains an identifier that specifies a character encoding used for the language"
640
+ // Encoding is set to 106 (UTF-8) - see: http://www.iana.org/assignments/character-sets/character-sets.xhtml
641
+ l2capoutbuf[16 ] = 0x09 ; // Unsigned Integer - length 2 bytes
642
+ l2capoutbuf[17 ] = 0x00 ; // MSB of character encoding
643
+ l2capoutbuf[18 ] = 0x6A ; // LSB of character encoding (106)
644
+
645
+ // Attribute ID that serves as the base attribute ID for the natural language in the service record
646
+ // "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"
647
+ l2capoutbuf[19 ] = 0x09 ; // Unsigned Integer - length 2 bytes
636
648
l2capoutbuf[20 ] = 0x01 ;
637
649
l2capoutbuf[21 ] = 0x00 ;
638
- l2capoutbuf[22 ] = 0x09 ;
639
- l2capoutbuf[23 ] = 0x01 ;
640
- l2capoutbuf[24 ] = 0x00 ;
641
- l2capoutbuf[25 ] = 0x25 ;
642
650
651
+ l2capoutbuf[22 ] = 0x09 ; // Unsigned Integer - length 2 bytes
652
+ l2capoutbuf[23 ] = 0x01 ; // MSB ServiceDescription
653
+ l2capoutbuf[24 ] = 0x00 ; // LSB ServiceDescription
654
+
655
+ l2capoutbuf[25 ] = 0x25 ; // Text string - length in next byte
643
656
l2capoutbuf[26 ] = 0x05 ; // Name length
644
657
l2capoutbuf[27 ] = ' T' ;
645
658
l2capoutbuf[28 ] = ' K' ;
646
659
l2capoutbuf[29 ] = ' J' ;
647
660
l2capoutbuf[30 ] = ' S' ;
648
661
l2capoutbuf[31 ] = ' P' ;
649
- l2capoutbuf[32 ] = 0x00 ; // No more data
662
+ l2capoutbuf[32 ] = 0x00 ; // No continuation state
650
663
651
664
SDP_Command (l2capoutbuf, 33 );
652
665
}
0 commit comments