จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การควบคุมอุปกรณ์ช่วยฟัง
การควบคุมอุปกรณ์ช่วยฟังในฟีเจอร์จับคู่ด่วนมีจุดมุ่งหมายเพื่อมอบการควบคุมการเข้าถึงที่ดีขึ้นสำหรับฟีเจอร์สำคัญของอุปกรณ์ช่วยฟังใน Android เราได้เพิ่มกลุ่มข้อความใหม่ Hearable
controls ภายในสตรีมข้อความเพื่อให้บรรลุเป้าหมายนี้
ชื่อกลุ่มข้อความ |
ค่า |
การควบคุมอุปกรณ์ช่วยฟัง |
0x08 |
การควบคุมเสียงรบกวนแบบแอ็กทีฟ
การควบคุมเสียงรบกวนแบบแอ็กทีฟกำลังกลายเป็นฟีเจอร์ที่โดดเด่นสำหรับหูฟังพรีเมียม ในฝั่งอุปกรณ์ที่ค้นหา การจับคู่ด่วนจะมี UI และตรรกะในการตั้งค่า รับ และบันทึกสถานะ
และระบบจะจัดเก็บสถานะไว้ในฝั่งผู้ให้บริการ
ผู้ให้บริการต้องส่ง Session Nonce เมื่อเชื่อมต่อสตรีมเหตุการณ์
เราจึงกำหนดรหัสข้อความต่อไปนี้เพื่อให้บรรลุเป้าหมายนี้
ชื่อรหัสของข้อความ |
ค่า |
ผู้ส่ง |
ผู้ตอบ |
MAC |
ACK |
รับสถานะ ANC |
0x11 |
Seeker |
ผู้ให้บริการ |
N |
N |
ตั้งค่าสถานะ ANC |
0x12 |
Seeker |
ผู้ให้บริการ |
Y |
Y |
แจ้งสถานะ ANC |
0x13 |
ผู้ให้บริการ |
Seeker |
N |
N |
เมื่อ Seeker เชื่อมต่อกับ Provider หรือเมื่อ Provider ได้รับข้อความ "Get ANC
state" Provider
จะแจ้งสถานะ ANC เพื่อให้ Seeker ทราบความสามารถของ ANC และสถานะที่จัดเก็บไว้
ข้อความมีดังนี้
ไบต์ |
ประเภทข้อมูล |
คำอธิบาย |
ค่า |
0 |
uint8 |
การควบคุมอุปกรณ์ช่วยฟัง |
0x08 |
1 |
uint8 |
แจ้งสถานะ ANC |
0x13 |
2 - 3 |
uint16 |
ความยาวข้อมูลเพิ่มเติม |
0x04 |
4 - 7 |
|
ข้อมูลควบคุม ANC |
แตกต่างกันไป |
ข้อมูลควบคุม ANC
ไบต์ |
ประเภทข้อมูล |
คำอธิบาย |
ค่า |
0 |
uint8 |
รหัสรุ่น |
แตกต่างกัน, 0x02 สำหรับเวอร์ชันนี้ |
1 |
ธง |
สวิตช์ UI แต่ละโหมดจะเปิดใช้ (1) หรือปิดใช้ (0) ตามค่าของบิตแฟล็ก ดังนี้ บิต 0 (MSB): โปร่งใส บิต 1: ปรับเปลี่ยนได้ (หรือ 0 หากไม่รองรับ) บิต 2: ปิด บิต 3: สงวนไว้ (ตั้งค่าบิตเป็น 0) บิต 4: ANC |
แตกต่างกันไป |
2 |
ธง |
ปุ่มเปิด/ปิดที่ตั้งค่าได้ คุณยังตั้งค่าบิตสลับ UI ด้านบนทั้งหมดหรือบางส่วนได้ที่นี่เพื่อระบุว่าบิตใดที่เปิดใช้อยู่ในปัจจุบัน |
แตกต่างกันไป |
3 |
ธง |
สถานะปัจจุบัน ตั้งค่าได้เพียง 1 บิตและค่าของไบต์นี้ต้องไม่ใช่ 0 |
แตกต่างกันไป |
แถบเลื่อนจะแสดง UI สลับตามข้อมูลการควบคุม ANC
ตัวอย่างที่ 1: ผู้ให้บริการรองรับ ANC 3 ทาง: โปร่งใส - ปิด - ANC และหูฟัง
อยู่บนศีรษะ ตอนนี้ตั้งค่าโหมดทั้งหมดได้แล้ว และสถานะปัจจุบันคือปิด
ไบต์ |
ประเภทข้อมูล |
คำอธิบาย |
ค่า |
0 |
uint8 |
รหัสรุ่น |
0x01 |
1 |
ธง |
สวิตช์ UI |
0b10101000 |
2 |
ธง |
สวิตช์ที่ตั้งค่าได้ |
0b10101000 |
3 |
ธง |
สถานะปัจจุบัน |
0b00100000 |
ตัวอย่างที่ 2: ผู้ให้บริการรองรับ ANC 3 ทาง: โปร่งใส - ปิด - ANC มีหูฟัง
ข้างเดียวที่อยู่บนศีรษะหรือไม่มีหูฟังอยู่บนศีรษะ จึงตั้งค่าโหมดไม่ได้ และ
สถานะปัจจุบันคือปิด
ไบต์ |
ประเภทข้อมูล |
คำอธิบาย |
ค่า |
0 |
uint8 |
รหัสรุ่น |
0x01 |
1 |
ธง |
การเปิด/ปิด UI |
0b10101000 |
2 |
ธง |
ปุ่มเปิด/ปิดที่ตั้งค่าได้ |
0b00000000 |
3 |
ธง |
สถานะปัจจุบัน |
0b00100000 |
หากผู้ใช้สลับปุ่มเปิด/ปิด Seeker จะตั้งค่าสถานะปัจจุบันเป็น
Provider ดังนี้
ไบต์ |
ประเภทข้อมูล |
คำอธิบาย |
ค่า |
0 |
uint8 |
การควบคุมอุปกรณ์ช่วยฟัง |
0x08 |
1 |
uint8 |
ตั้งค่าสถานะ ANC |
0x12 |
2 - 3 |
uint16 |
ความยาวข้อมูลเพิ่มเติม |
แตกต่างกัน, 0x04 หรือ 0x14 |
4 |
uint8 |
รหัสเวอร์ชัน Seeker |
แตกต่างกัน, 0x01 หรือ 0x02 |
5 |
ธง |
โหมดที่ตั้งค่า ANC ได้ (สลับ UI) |
แตกต่างกันไป |
6 |
ธง |
โหมดที่เปิดใช้ ANC (สลับได้) |
แตกต่างกันไป |
7 |
ธง |
ดัชนีโหมด ANC ใหม่ (สถานะใหม่) |
แตกต่างกันไป |
8 - 23 |
|
จองแล้ว |
แตกต่างกันไป |
ไบต์ที่ 4-7 คือข้อมูลควบคุม ANC ที่ส่งจาก
ฝั่ง Seeker หากตั้งค่าความยาวเพิ่มเติมเป็น 0x14 ไบต์ที่สงวนไว้ 8-23
จะปรากฏขึ้น และเมื่อได้รับไบต์เหล่านี้ ผู้ให้บริการควรละเว้นไบต์ดังกล่าว
หากตั้งค่าความยาวเพิ่มเติมเป็น 0x04 จะไม่มีไบต์ที่สงวนไว้
เมื่อผู้ให้บริการได้รับข้อความ "ตั้งค่าสถานะ ANC" ผู้ให้บริการควรรับทราบ
และแจ้งสถานะ ANC ให้แก่ผู้ขอทั้งหมดที่เชื่อมต่ออยู่
หากผู้ใช้เปลี่ยนการตั้งค่าผ่านท่าทางของชุดหูฟังหรือแอปพลิเคชันคู่
ผู้ให้บริการควรส่งการแจ้งเตือนไปยังผู้ค้นหาที่เชื่อมต่อทั้งหมดด้วย
ตัวอย่างที่ 3: ผู้ให้บริการรองรับ ANC 4 ทาง ได้แก่ โปร่งใส - ปรับอัตโนมัติ - ปิด - ANC
หูฟังเอียร์บัดอยู่บนศีรษะ ตอนนี้ตั้งค่าโหมดทั้งหมดได้แล้ว และสถานะปัจจุบันคือปรับอัตโนมัติ
ไบต์ |
ประเภทข้อมูล |
คำอธิบาย |
ค่า |
0 |
uint8 |
รหัสรุ่น |
0x01 |
1 |
ธง |
การเปิด/ปิด UI |
0b11101000 |
2 |
ธง |
ปุ่มเปิด/ปิดที่ตั้งค่าได้ |
0b11101000 |
3 |
ธง |
สถานะปัจจุบัน |
0b01000000 |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-28 UTC
[null,null,["อัปเดตล่าสุด 2025-08-28 UTC"],[[["\u003cp\u003eHearable Controls utilize Message Stream to enhance access to headphone features on Android.\u003c/p\u003e\n"],["\u003cp\u003eActive Noise Control (ANC) functionality allows for setting, retrieving, and saving noise cancellation preferences.\u003c/p\u003e\n"],["\u003cp\u003eANC state is communicated between devices, allowing the user interface to reflect available and current noise control modes.\u003c/p\u003e\n"],["\u003cp\u003eANC state can be controlled by the user via device UI and is synchronized across connected devices through notifications.\u003c/p\u003e\n"]]],["Hearable controls are added within the Message Stream for better access to hearable features. Active Noise Control (ANC) functionality is implemented, allowing the Seeker to get, set, and save the ANC state, which is stored by the Provider. The Provider can notify the Seeker of ANC capabilities and stored state. UI toggles for ANC are managed via flags, including transparent, off, and ANC modes. The Seeker sends a \"Set ANC state\" message to update the current ANC mode. The Provider must acknowledge these messages and notify connected Seekers.\n"],null,["Hearable Controls\n\nHearable controls on Fast Pair aim to provide better access controls for\nimportant Hearable features on Android. A new message group Hearable\ncontrols inside [Message Stream](/nearby/fast-pair/specifications/extensions/messagestream#MessageStream \"Message Stream\") has been added to achieve this.\n\n| Message Group Name | Value |\n|--------------------|-------|\n| Hearable control | 0x08 |\n\nActive noise control\n\nActive noise control is becoming a prominent feature for premium headphones. On\nthe Seeker side, Fast Pair will have the UI and logic to set, get and save the\nstate, and the state will be stored on the Provider side.\nIt is mandatory for provider to send [Session Nonce](/nearby/fast-pair/specifications/extensions/mac#SessionAndMessageNonce \"Session Nonce\") when event\nstream is connected.\nTo achieve this, below message codes are defined:\n\n| Message Code Name | Value | Sender | Responder | MAC | ACK |\n|-------------------|-------|----------|-----------|-----|-----|\n| Get ANC state | 0x11 | Seeker | Provider | N | N |\n| Set ANC state | 0x12 | Seeker | Provider | Y | Y |\n| Notify ANC state | 0x13 | Provider | Seeker | N | N |\n\nWhen a Seeker connects to a Provider, or when a Provider receives a \"Get ANC\nstate\" message, the Provider\ncan Notify the ANC state to let the Seeker know its ANC capability and its\nstored state. The message is as follow:\n\n| Byte | Data Type | Description | Value |\n|-------|-----------|-------------------------------------|----------|\n| 0 | uint8 | Hearable control | 0x08 |\n| 1 | uint8 | Notify ANC state | 0x13 |\n| 2 - 3 | uint16 | Additional data length | 0x04 |\n| 4 - 7 | | [ANC control data](#ANCControlData) | *varies* |\n\nANC control data\n\n| Byte | Data Type | Description | Value |\n|------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------|\n| 0 | uint8 | Version code | *varies*, 0x02 for this version |\n| 1 | Flags | UI toggles Each mode is enabled (1) or disabled (0) according to the value of its flag bit, as follows: Bit 0 (MSB): transparent Bit 1: adaptive (or 0 if it is not supported) Bit 2: off Bit 3: Reserved (Set bit to 0) Bit 4: ANC | *varies* |\n| 2 | Flags | Settable toggles Any or all of the UI toggle bits above may also be set here, to indicate which are currently enabled. | *varies* |\n| 3 | Flags | Current state Only one bit can be set and value of this byte shall be non zero. | *varies* |\n\nThe Seeker will show the toggle UI according to the ANC control data.\n\nExample 1: The Provider supports 3-way ANC: transparent - off - ANC \\& buds are\non-head, all modes are settable now, and current state is off:\n\n| Byte | Data Type | Description | Value |\n|------|-----------|------------------|------------|\n| 0 | uint8 | Version code | 0x01 |\n| 1 | Flags | UI toggles | 0b10101000 |\n| 2 | Flags | Settable toggles | 0b10101000 |\n| 3 | Flags | Current state | 0b00100000 |\n\nExample 2: The Provider supports 3-way ANC: transparent - off - ANC, only one\nbud is on-head now or no buds is on-head, so no modes are settable, and the\ncurrent state is off:\n\n| Byte | Data Type | Description | Value |\n|------|-----------|-----------------|------------|\n| 0 | uint8 | Version code | 0x01 |\n| 1 | Flags | UI toggle | 0b10101000 |\n| 2 | Flags | Settable toggle | 0b00000000 |\n| 3 | Flags | Current state | 0b00100000 |\n\nIf the user switches the toggle, the Seeker will set the current state to the\nProvider as follow:\n\n| Byte | Data Type | Description | Value |\n|--------|-----------|-------------------------------------|------------------------|\n| 0 | uint8 | Hearable control | 0x08 |\n| 1 | uint8 | Set ANC state | 0x12 |\n| 2 - 3 | uint16 | Additional data length | *varies*, 0x04 or 0x14 |\n| 4 | uint8 | Seeker Version code | *varies*, 0x01 or 0x02 |\n| 5 | Flags | ANC Settable modes (UI toggle) | *varies* |\n| 6 | Flags | ANC Enabled modes (Settable toggle) | *varies* |\n| 7 | Flags | New ANC mode index (New state) | *varies* |\n| 8 - 23 | | Reserved | *varies* |\n\nThe byte 4 - 7 is actually [ANC control data](#ANCControlData) sent from\nSeeker side. If additional length value is set as 0x14, the reserved bytes 8-23\nwould be present and on receipt of these bytes, the provider should ignore them.\nIf additional length value is set as 0x04, there are no reserved bytes present.\n\nWhen a Provider receives a \"Set ANC state\" message, it should [Acknowledge](/nearby/fast-pair/specifications/extensions/acknowledgement#MessageStreamAcknowledgements \"Message Stream Acknowledgements\"),\nand Notify ANC state to all connected Seekers.\nIf the user changes the setting via headset gesture or companion application,\nthe Provider should also send notification to all connected Seekers.\n\nExample 3: The Provider supports 4-way ANC: transparent - adaptive - off - ANC,\nbuds are on-head, all modes are settable now, and current state is adaptive:\n\n| Byte | Data Type | Description | Value |\n|------|-----------|-----------------|------------|\n| 0 | uint8 | Version code | 0x01 |\n| 1 | Flags | UI toggle | 0b11101000 |\n| 2 | Flags | Settable toggle | 0b11101000 |\n| 3 | Flags | Current state | 0b01000000 |"]]