সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
ব্যাটারি বিজ্ঞপ্তি
যখন একটি প্রদানকারী একাধিক উপাদান অন্তর্ভুক্ত করে, তখন প্রতিটি উপাদানের জন্য ব্যাটারি স্তরের সন্ধানকারীকে অবহিত করা কার্যকর হতে পারে। এর একটি উদাহরণ হল যখন একটি ইয়ারবাড কেস খোলা হয় এবং সিকারকে প্রতিটি পৃথক কুঁড়ি এবং কেসটির জন্য ব্যাটারি জানতে হবে।
এটি সম্পন্ন করার জন্য, একজন প্রদানকারী বিজ্ঞাপনে অতিরিক্ত তথ্য অন্তর্ভুক্ত করতে পারেন, বিজ্ঞাপনে বর্ণিত ফাস্ট পেয়ার অ্যাকাউন্ট ডেটার উপরে নির্মিত: যখন আবিষ্কার করা যায় না ।
অ্যাকাউন্ট ডেটা ছাড়াও, প্রদানকারীর ব্যাটারি মান নির্দিষ্ট করে একটি অতিরিক্ত ক্ষেত্র অন্তর্ভুক্ত করা উচিত। প্যাকেটে নিম্নলিখিতগুলি থাকতে হবে:
অক্টেট | ডেটা টাইপ | বর্ণনা | মান | বাধ্যতামূলক? |
---|
0 | uint8 | পতাকা | 0x00 (সমস্ত বিট ভবিষ্যতে ব্যবহারের জন্য সংরক্ষিত) | বাধ্যতামূলক |
1 - সে | | অ্যাকাউন্ট কী ডেটা | বাধ্যতামূলক | |
s + 1 | uint8 | ব্যাটারি স্তরের দৈর্ঘ্য এবং প্রকার 0bLLLLTTTT- L = ব্যাটারির মানের সংখ্যা
- T = প্রকার
| 0bLLLLTTTT
- দৈর্ঘ্য = 0b0011 = 3 ব্যাটারির মান
- প্রকার = 0b0011 (UI ইঙ্গিত দেখান) বা 0b0100 (UI ইঙ্গিত লুকান)
| ঐচ্ছিক |
s + 2 , s + 3 , s + 4 | uint8 | ব্যাটারির মান 0bSVVVVVVV- S = অবস্থা (চার্জ হচ্ছে বা না হচ্ছে)
- V = মান
- ব্যাটারির মান বাম কুঁড়ি ( s + 2 ), ডান কুঁড়ি ( s + 3 ) এবং কেস ( s + 4 ) হিসাবে অর্ডার করা উচিত।
| 0bSVVVVVVV
- অবস্থা = 0b1 (চার্জিং) বা 0b0 (চার্জ হচ্ছে না)
- মান = ব্যাটারি স্তর 0 থেকে 100 শতাংশ পর্যন্ত, অজানা জন্য 0bS1111111।
| ঐচ্ছিক |
টেম্পারিং প্রতিরোধ করার জন্য, ব্যাটারির তথ্য অন্তর্ভুক্ত করার জন্য উপরের অ্যাকাউন্ট কী ডেটা সামান্য পরিবর্তন করা হবে যখন ব্যাটারি মান বিজ্ঞাপনে অন্তর্ভুক্ত করা হবে। সাধারণত, অ্যাকাউন্ট কী ফিল্টার তৈরি করার সময়, একটি লবণের সাথে অ্যাকাউন্ট কী একত্রিত করে একটি মান V তৈরি করা হয়। পরিবর্তে, যখন ব্যাটারি তথ্যেরও বিজ্ঞাপন দেওয়া হচ্ছে, V মানটি নিম্নরূপ তৈরি করা উচিত:
- একটি মান V তৈরি করুন, যেখানে:
- প্রথম 16 বাইট হল K।
- পরবর্তী বাইট হল লবণ ।
- অবশিষ্ট বাইটগুলি হল ব্যাটারির তথ্য ( s + 1 থেকে s + 4 পর্যন্ত দৈর্ঘ্য এবং উপরের টেবিলের টাইপ বাইট সহ)।
উপরে ব্যাটারির দৈর্ঘ্য এবং টাইপ ফিল্ডে যেমন উল্লেখ করা হয়েছে, ধরনটি 0b0011
বা 0b0100
হতে পারে।
- 0b0011 - যখন প্রদানকারী ব্যাটারি মানগুলির UI-তে একটি ইঙ্গিত দেখাতে চায় তখন ব্যবহার করুন;
- 0b0100 - ব্যবহার করুন যখন প্রদানকারী ইঙ্গিতটি লুকিয়ে রাখতে চায় যদি এটি ইতিমধ্যেই দেখায়।
এর জন্য একটি সাধারণ ব্যবহারের ক্ষেত্রে হল 0b0011
ব্যবহার করা যখন কেসটি খোলা হয় এবং 0b0100
যখন কেস থেকে কুঁড়ি সরানো হয় বা এটি আবার বন্ধ করা হয়।
//The sample code demonstrates that the headset only reports the battery level. #define FASTPAIR_ACCOUNT_KEY_SIZE 16 // In the sample code, the size of salt is 2 bytes. #define SALT_SIZE 2 // 1st byte - Battery level length and type // 2nd~4th bytes - Battery values #define BAT_LEVEL_SIZE 3 uint8_t V[FASTPAIR_ACCOUNT_KEY_SIZE + SALT_SIZE + BAT_LEVEL_SIZE + 1] = {0}; int v_index = 0; // The first 16 bytes are K. uint8_t K[FASTPAIR_ACCOUNT_KEY_SIZE] = {0}; fastpair_get_account_key_by_index(keyIndex, K); memcpy(V, K, FASTPAIR_ACCOUNT_KEY_SIZE); v_index = v_index + FASTPAIR_ACCOUNT_KEY_SIZE; // The next byte is the Salt. uint8_t randomSalt = (uint8_t)rand(); V[v_index] = randomSalt; v_index = v_index + SALT_SIZE; // The remaining bytes are the battery information (from s + 1 to s + 4 including the length and type bytes). uint8_t battery_level_len = 0; uint8_t battery_level[BAT_LEVEL_SIZE] = {0}; fastpair_get_bat_level(&battery_level_len, battery_level); // type = 0b0011 (show UI indication) or 0b0100 (hide UI indication) V[v_index] = (battery_level_len << 4 | (is_show_ui ? 0x3 : 0x4)); v_index = v_index + 1; for (int idx = 0; idx < battery_level_len; idx++) { V[v_index++] = battery_level[idx]; }
ট্র্যাকিং প্রতিরোধ করার জন্য, প্রদানকারীর সব সময় বিজ্ঞাপনে কাঁচা ব্যাটারি ডেটা অন্তর্ভুক্ত করা উচিত নয়। এর পরিবর্তে এটি RFCOMM-এর মাধ্যমে পাঠানো যেতে পারে যখন একজন অনুসন্ধানকারীর সাথে সংযুক্ত থাকে, দেখুন বার্তা প্রবাহ: ডিভাইস তথ্য ।
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-13 UTC-তে শেষবার আপডেট করা হয়েছে।
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-08-13 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eProviders can include battery information for multiple components (e.g., earbuds and case) in the advertisement data using a specific format.\u003c/p\u003e\n"],["\u003cp\u003eThe advertisement data includes battery levels for each component and flags to control UI indication on the Seeker device.\u003c/p\u003e\n"],["\u003cp\u003eTo prevent tampering, the Account Key Data is modified to include battery information, requiring a specific construction process.\u003c/p\u003e\n"],["\u003cp\u003eProviders can choose to show or hide battery information in the Seeker's UI based on user interaction (e.g., case opening/closing).\u003c/p\u003e\n"],["\u003cp\u003eTo prevent tracking, raw battery data should not be constantly advertised but can be sent securely via RFCOMM after connection.\u003c/p\u003e\n"]]],[],null,["Battery Notification **Note:** Google recommends implementing the [Cryptographic Test Cases](/nearby/fast-pair/specifications/appendix/cryptotestcases \"Link to the Cryptographic Test Cases.\") to ease verification of these requirements.\n\nWhen a Provider includes multiple components, it can be useful to notify the\nSeeker of the battery level for each component. One example of this would be\nwhen a earbuds case is opened and the Seeker needs to know the battery for\neach individual bud and the case itself.\n\nTo accomplish this, a Provider can include additional information in the\nadvertisement, built on top of the Fast Pair Account Data described in\n[Advertising: When not discoverable](/nearby/fast-pair/specifications/service/provider#AdvertisingWhenNotDiscoverable \"Advertizing when not Discoverable\").\n\nIn addition to the Account Data, the Provider should include an additional field\nspecifying the battery values. The packet shall contain the following:\n\n| Octet | Data type | Description | Value | Mandatory? |\n|-----------------------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|------------|\n| 0 | `uint8` | Flags | 0x00 (all bits reserved for future use) | Mandatory |\n| 1 - *s* | | Account Key Data | Mandatory | |\n| *s + 1* | `uint8` | Battery level length and type 0bLLLLTTTT - L = Number of battery values - T = type | 0bLLLLTTTT - length = 0b0011 = 3 battery values - type = 0b0011 (show UI indication) or 0b0100 (hide UI indication) | Optional |\n| *s + 2* , *s + 3* , *s + 4* | `uint8` | Battery values 0bSVVVVVVV - S = status (charging or not charging) - V = value - The battery values should be ordered as left bud (*s + 2* ), right bud (*s + 3* ) and case (*s + 4*). | 0bSVVVVVVV - status = 0b1 (charging) or 0b0 (not charging) - value = battery level ranging from 0 to 100 percent, 0bS1111111 for unknown. | Optional |\n\nTo prevent tampering, the Account Key Data above shall be slightly\nmodified to include battery information when the battery values are included\nin the advertisement. Normally, when building the [account key\nfilter](/nearby/fast-pair/specifications/service/provider#AccountKeyFilter \"Account Key Filter\"), a value *V* is produced by combining the account\nkey with a salt. Instead, when battery information is also being advertised, the\nvalue *V* should be constructed as follows:\n\n1. Produce a value *V* , where:\n 1. The first 16 bytes are *K*.\n 2. The next bytes are the [Salt](/nearby/fast-pair/specifications/service/provider#SaltField \"Salt Field\").\n 3. The remaining bytes are the battery information (from *s + 1* to *s + 4* including the length and type byte from the table above).\n\nAs noted in the battery length and type field above, the type can be either\n`0b0011` or `0b0100`.\n\n- 0b0011 - Use when the Provider wants the Seeker to show an indication in the UI of the battery values;\n- 0b0100 - Use when the Provider wants the Seeker to hide the indication if it is already showing.\n\nOne common use case for this is to use `0b0011` when the case has opened and\n`0b0100` when buds have been removed from the case or it has been closed again. \n\n //The sample code demonstrates that the headset only reports the battery level.\n\n #define FASTPAIR_ACCOUNT_KEY_SIZE 16\n\n // In the sample code, the size of salt is 2 bytes.\n #define SALT_SIZE 2\n\n // 1st byte - Battery level length and type\n // 2nd~4th bytes - Battery values\n #define BAT_LEVEL_SIZE 3\n\n uint8_t V[FASTPAIR_ACCOUNT_KEY_SIZE + SALT_SIZE + BAT_LEVEL_SIZE + 1] = {0};\n int v_index = 0;\n\n // The first 16 bytes are K.\n uint8_t K[FASTPAIR_ACCOUNT_KEY_SIZE] = {0};\n fastpair_get_account_key_by_index(keyIndex, K);\n memcpy(V, K, FASTPAIR_ACCOUNT_KEY_SIZE);\n v_index = v_index + FASTPAIR_ACCOUNT_KEY_SIZE;\n\n // The next byte is the Salt.\n uint8_t randomSalt = (uint8_t)rand();\n V[v_index] = randomSalt;\n v_index = v_index + SALT_SIZE;\n\n // The remaining bytes are the battery information (from s + 1 to s + 4 including the length and type bytes).\n\n uint8_t battery_level_len = 0;\n uint8_t battery_level[BAT_LEVEL_SIZE] = {0};\n\n fastpair_get_bat_level(&battery_level_len, battery_level);\n\n // type = 0b0011 (show UI indication) or 0b0100 (hide UI indication)\n V[v_index] = (battery_level_len \u003c\u003c 4 | (is_show_ui ? 0x3 : 0x4));\n v_index = v_index + 1;\n\n for (int idx = 0; idx \u003c battery_level_len; idx++) {\n V[v_index++] = battery_level[idx];\n }\n\nTo prevent tracking, the Provider should not include raw battery data in the\nadvertisement all the time. It can instead be sent via RFCOMM when connected to\na Seeker, see [Message Stream: Device Information](/nearby/fast-pair/specifications/extensions/deviceinformation \"Message Stream: Device Information\")."]]