ব্লুটুথ কম শক্তি
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
অ্যান্ড্রয়েড কেন্দ্রীয় ভূমিকায় ব্লুটুথ লো এনার্জি (BLE) এর জন্য অন্তর্নির্মিত প্ল্যাটফর্ম সমর্থন প্রদান করে এবং এমন API সরবরাহ করে যা অ্যাপগুলি ডিভাইসগুলি আবিষ্কার করতে, পরিষেবাগুলির জন্য অনুসন্ধান করতে এবং তথ্য প্রেরণ করতে ব্যবহার করতে পারে৷
সাধারণ ব্যবহারের ক্ষেত্রে নিম্নলিখিত অন্তর্ভুক্ত:
- কাছাকাছি ডিভাইসগুলির মধ্যে অল্প পরিমাণে ডেটা স্থানান্তর করা হচ্ছে।
- ব্যবহারকারীদের তাদের বর্তমান অবস্থানের উপর ভিত্তি করে একটি কাস্টমাইজড অভিজ্ঞতা দিতে প্রক্সিমিটি সেন্সরগুলির সাথে ইন্টারঅ্যাক্ট করা।
ক্লাসিক ব্লুটুথের বিপরীতে, BLE উল্লেখযোগ্যভাবে কম পাওয়ার খরচের জন্য ডিজাইন করা হয়েছে। এটি অ্যাপ্লিকেশানগুলিকে BLE ডিভাইসগুলির সাথে যোগাযোগ করতে দেয় যেগুলির শক্তির প্রয়োজনীয়তা কঠোর হয়, যেমন প্রক্সিমিটি সেন্সর, হার্ট রেট মনিটর এবং ফিটনেস ডিভাইস৷
সতর্কতা: যখন একজন ব্যবহারকারী তাদের ডিভাইসটি BLE ব্যবহার করে অন্য ডিভাইসের সাথে জোড়া দেয়, তখন দুটি ডিভাইসের মধ্যে যোগাযোগ করা ডেটা ব্যবহারকারীর ডিভাইসের সমস্ত অ্যাপে অ্যাক্সেসযোগ্য।
এই কারণে, যদি আপনার অ্যাপটি সংবেদনশীল ডেটা ক্যাপচার করে, তাহলে সেই ডেটার গোপনীয়তা রক্ষা করার জন্য আপনাকে অ্যাপ-লেয়ার নিরাপত্তা প্রয়োগ করা উচিত।
বুনিয়াদি
BLE-সক্ষম ডিভাইসগুলি একে অপরের মধ্যে ডেটা প্রেরণের জন্য, তাদের প্রথমে যোগাযোগের একটি চ্যানেল তৈরি করতে হবে। ব্লুটুথ LE API ব্যবহার করার জন্য আপনাকে আপনার ম্যানিফেস্ট ফাইলে একাধিক অনুমতি ঘোষণা করতে হবে৷ একবার আপনার অ্যাপকে ব্লুটুথ ব্যবহার করার অনুমতি দেওয়া হলে, আপনার অ্যাপটিকে BluetoothAdapter
অ্যাক্সেস করতে হবে এবং ডিভাইসে ব্লুটুথ উপলব্ধ কিনা তা নির্ধারণ করতে হবে যদি ব্লুটুথ উপলব্ধ থাকে, তাহলে ডিভাইসটি কাছাকাছি BLE ডিভাইসগুলির জন্য স্ক্যান করবে৷ একবার একটি ডিভাইস পাওয়া গেলে, BLE ডিভাইসের GATT সার্ভারের সাথে সংযোগ করার মাধ্যমে BLE ডিভাইসের ক্ষমতা আবিষ্কৃত হয়। একবার সংযোগ তৈরি হয়ে গেলে, উপলব্ধ পরিষেবা এবং বৈশিষ্ট্যগুলির উপর ভিত্তি করে সংযুক্ত ডিভাইসের সাথে ডেটা স্থানান্তর করা যেতে পারে ।
মূল শর্তাবলী এবং ধারণা
নিম্নলিখিত মূল BLE শর্তাবলী এবং ধারণাগুলির একটি সারাংশ:
- জেনেরিক অ্যাট্রিবিউট প্রোফাইল (GATT)
- GATT প্রোফাইল হল একটি সাধারণ স্পেসিফিকেশন যা একটি BLE লিঙ্কের মাধ্যমে "অ্যাট্রিবিউট" নামে পরিচিত ডেটার ছোট টুকরো পাঠানো এবং গ্রহণ করার জন্য। সমস্ত বর্তমান BLE অ্যাপ্লিকেশন প্রোফাইল GATT এর উপর ভিত্তি করে। আরও জানতে GitHub-এ Android BluetoothLeGatt নমুনা পর্যালোচনা করুন।
- প্রোফাইল
- ব্লুটুথ SIG BLE ডিভাইসের জন্য অনেক প্রোফাইল সংজ্ঞায়িত করে। একটি প্রোফাইল একটি নির্দিষ্ট অ্যাপ্লিকেশনে একটি ডিভাইস কিভাবে কাজ করে তার একটি স্পেসিফিকেশন। মনে রাখবেন যে একটি ডিভাইস একাধিক প্রোফাইল বাস্তবায়ন করতে পারে। উদাহরণস্বরূপ, একটি ডিভাইসে হার্ট রেট মনিটর এবং একটি ব্যাটারি স্তর সনাক্তকারী থাকতে পারে।
- অ্যাট্রিবিউট প্রোটোকল (ATT)
- GATT অ্যাট্রিবিউট প্রোটোকল (ATT) এর উপরে নির্মিত। এটিকে GATT/ATT নামেও উল্লেখ করা হয়। ATT BLE ডিভাইসে চালানোর জন্য অপ্টিমাইজ করা হয়েছে। এই লক্ষ্যে, এটি যতটা সম্ভব কম বাইট ব্যবহার করে। প্রতিটি অ্যাট্রিবিউটকে ইউনিভার্সলি ইউনিক আইডেন্টিফায়ার (UUID) দ্বারা স্বতন্ত্রভাবে চিহ্নিত করা হয়, যা একটি স্ট্রিং আইডির জন্য একটি প্রমিত 128-বিট ফর্ম্যাট যা তথ্যকে স্বতন্ত্রভাবে সনাক্ত করতে ব্যবহৃত হয়। ATT দ্বারা পরিবাহিত বৈশিষ্ট্যগুলি বৈশিষ্ট্য এবং পরিষেবা হিসাবে ফর্ম্যাট করা হয়৷
- চারিত্রিক
- একটি বৈশিষ্ট্যে একটি একক মান এবং 0-n বর্ণনাকারী থাকে যা বৈশিষ্ট্যের মান বর্ণনা করে। একটি বৈশিষ্ট্য একটি টাইপ হিসাবে চিন্তা করা যেতে পারে, একটি শ্রেণীর অনুরূপ।
- বর্ণনাকারী
- বর্ণনাকারীরা এমন বৈশিষ্ট্যগুলিকে সংজ্ঞায়িত করে যা একটি চরিত্রগত মান বর্ণনা করে। উদাহরণস্বরূপ, একজন বর্ণনাকারী একটি মানব-পঠনযোগ্য বর্ণনা, একটি বৈশিষ্ট্যের মানের জন্য একটি গ্রহণযোগ্য পরিসর, বা একটি বৈশিষ্ট্যের মানের সাথে নির্দিষ্ট পরিমাপের একটি ইউনিট নির্দিষ্ট করতে পারে।
- সেবা
- একটি পরিষেবা হল বৈশিষ্ট্যের একটি সংগ্রহ। উদাহরণস্বরূপ, আপনার "হার্ট রেট মনিটর" নামে একটি পরিষেবা থাকতে পারে যাতে "হার্ট রেট পরিমাপ" এর মতো বৈশিষ্ট্য অন্তর্ভুক্ত থাকে। আপনি bluetooth.org- এ বিদ্যমান GATT-ভিত্তিক প্রোফাইল এবং পরিষেবাগুলির একটি তালিকা খুঁজে পেতে পারেন।
ভূমিকা এবং দায়িত্ব
যখন একটি ডিভাইস একটি BLE ডিভাইসের সাথে যোগাযোগ করে, তখন ভূমিকা এবং দায়িত্ব দুটি ভিন্ন উপায়ে বিভক্ত হয়:
কেন্দ্রীয় বনাম পেরিফেরাল। এটি BLE সংযোগের ক্ষেত্রেই প্রযোজ্য—কেন্দ্রীয় ভূমিকায় থাকা ডিভাইসটি স্ক্যান করে, বিজ্ঞাপনের সন্ধান করে এবং পেরিফেরাল ভূমিকাতে থাকা ডিভাইসটি বিজ্ঞাপন দেয়। দুটি ডিভাইস যা শুধুমাত্র পেরিফেরাল ভূমিকা সমর্থন করে একে অপরের সাথে কথা বলতে পারে না, এবং দুটি ডিভাইস যা শুধুমাত্র কেন্দ্রীয় ভূমিকা সমর্থন করতে পারে না।
GATT সার্ভার বনাম GATT ক্লায়েন্ট। এটি নির্ধারণ করে কিভাবে দুটি ডিভাইস সংযোগ স্থাপন করার পর একে অপরের সাথে কথা বলে। ক্লায়েন্টের ভূমিকায় থাকা ডিভাইসটি ডেটার জন্য অনুরোধ পাঠায় এবং সার্ভারের ভূমিকায় থাকা ডিভাইসটি সেগুলি পূরণ করে।
কেন্দ্রীয়-পেরিফেরাল এবং সার্ভার-ক্লায়েন্ট ভূমিকা বিভাগের মধ্যে পার্থক্য বোঝার জন্য, একটি উদাহরণ বিবেচনা করুন যেখানে আপনার কাছে একটি অ্যান্ড্রয়েড ফোন এবং একটি BLE-সক্ষম অ্যাক্টিভিটি ট্র্যাকার রয়েছে যা ফোনে সেন্সর ডেটা রিপোর্ট করে।
ফোন - কেন্দ্রীয় ডিভাইস - সক্রিয়ভাবে BLE ডিভাইসগুলির জন্য স্ক্যান করে৷ কার্যকলাপ ট্র্যাকার - পেরিফেরাল ডিভাইস - বিজ্ঞাপন দেয় এবং সংযোগের জন্য একটি অনুরোধ পাওয়ার জন্য অপেক্ষা করে৷
ফোন এবং কার্যকলাপ ট্র্যাকার একটি সংযোগ স্থাপন করার পরে, তারা একে অপরের কাছে GATT মেটাডেটা স্থানান্তর করা শুরু করে। এই ক্ষেত্রে, ফোনে চলমান অ্যাপটি ডেটার জন্য অনুরোধ পাঠায়, তাই এটি GATT ক্লায়েন্ট হিসাবে কাজ করে। কার্যকলাপ ট্র্যাকার সেই অনুরোধগুলি পূরণ করে, তাই এটি GATT সার্ভার হিসাবে কাজ করে।
অ্যাপের একটি বিকল্প ডিজাইনের পরিবর্তে ফোনটি GATT সার্ভারের ভূমিকা পালন করতে পারে। আরও তথ্যের জন্য BluetoothGattServer
দেখুন।
এই পৃষ্ঠার কন্টেন্ট ও কোডের নমুনাগুলি Content License-এ বর্ণিত লাইসেন্সের অধীনস্থ। Java এবং OpenJDK হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-29 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-07-29 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# Bluetooth Low Energy\n\nAndroid provides built-in platform support for Bluetooth Low Energy (BLE) in the\ncentral role and provides APIs that apps can use to discover devices, query for\nservices, and transmit information.\n\nCommon use cases include the following:\n\n- Transferring small amounts of data between nearby devices.\n- Interacting with proximity sensors to give users a customized experience based on their current location.\n\nIn contrast to [classic Bluetooth](/develop/connectivity/bluetooth),\nBLE is designed for significantly lower power consumption. This allows apps to\ncommunicate with BLE devices that have stricter power requirements, such as\nproximity sensors, heart rate monitors, and fitness devices. \n\n**Caution:** When a user pairs their device with another device\nusing BLE, the data that's communicated between the two devices is\naccessible to **all** apps on the user's device.\n\n\nFor this reason, if your app captures sensitive data, you should implement\napp-layer security to protect the privacy of that data.\n\nThe basics\n----------\n\nFor BLE-enabled devices to transmit data between each other, they must first\nform a channel of communication. Use of the Bluetooth LE APIs requires you to\n[declare several permissions](/develop/connectivity/bluetooth/bt-permissions)\nin your manifest file. Once your app has permission to use Bluetooth, your app\nneeds to access the `BluetoothAdapter` and\n[determine if Bluetooth is available on the device](/develop/connectivity/bluetooth/setup)\nIf Bluetooth is available, the device will\n[scan for nearby BLE devices](/develop/connectivity/bluetooth/ble/find-ble-devices).\nOnce a device is found, the capabilities of the BLE device are discovered by\n[connecting to the GATT server on the BLE device](/develop/connectivity/bluetooth/ble/connect-gatt-server).\nOnce a connection is made,\n[data can be transferred with the connected device](/develop/connectivity/bluetooth/ble/transfer-ble-data)\nbased on the available services and characteristics.\n\nKey terms and concepts\n----------------------\n\nThe following is a summary of key BLE terms and concepts:\n\n-\n\n **Generic Attribute Profile (GATT)**\n : The GATT profile is a general specification for sending and receiving short\n pieces of data known as \"attributes\" over a BLE link. All current BLE\n application profiles are based on GATT. Review the [Android BluetoothLeGatt\n sample](https://github.com/android/platform-samples/tree/main/samples/connectivity/bluetooth/ble/src/main/java/com/example/platform/connectivity/bluetooth/ble)\n on GitHub to learn more.\n-\n\n **Profiles**\n : The **Bluetooth SIG** defines many\n [profiles](https://www.bluetooth.org/en-us/specification/adopted-specifications)\n for BLE devices. A profile is a specification for how a device works in a\n particular application. Note that a device can implement more than one\n profile. For example, a device could contain a heart rate monitor and a\n battery level detector.\n-\n\n **Attribute Protocol (ATT)**\n : GATT is built on top of the Attribute Protocol (ATT). This is also referred to\n as GATT/ATT. ATT is optimized to run on BLE devices. To this end, it uses as\n few bytes as possible. Each attribute is uniquely identified by a Universally\n Unique Identifier (UUID), which is a standardized 128-bit format for a string\n ID used to uniquely identify information. The *attributes* transported by ATT\n are formatted as *characteristics* and *services*.\n-\n\n **Characteristic**\n : A characteristic contains a single value and 0-n descriptors that describe the\n characteristic's value. A characteristic can be thought of as a type,\n analogous to a class.\n-\n\n **Descriptor**\n : Descriptors are defined attributes that describe a characteristic value. For\n example, a descriptor might specify a human-readable description, an\n acceptable range for a characteristic's value, or a unit of measure that is\n specific to a characteristic's value.\n-\n\n **Service**\n : A service is a collection of characteristics. For example, you could have a\n service called \"Heart Rate Monitor\" that includes characteristics such as\n \"heart rate measurement.\" You can find a list of existing GATT-based profiles\n and services on [bluetooth.org](https://www.bluetooth.org/en-us/specification/adopted-specifications).\n\n### Roles and responsibilities\n\nWhen a device interacts with a BLE device, roles and responsibilities are\ndivided in two different ways:\n\n- **Central versus peripheral.** This applies to the BLE connection itself---the\n device in the central role scans, looking for advertisement, and the device in\n the peripheral role advertises. Two devices that only support the peripheral\n role can't talk to each other, and neither can two devices that only support\n the central role.\n\n- **GATT server versus GATT client.** This determines how the two devices talk\n to each other after they've established the connection. The device in the\n client role sends requests for data, and the device in the server role\n fulfills them.\n\nTo understand the distinction between the central-peripheral and server-client\nrole divisions, consider an example where you have an Android phone and a\nBLE-enabled activity tracker that reports sensor data back to the phone.\n\n- The phone---the *central* device---actively scans for BLE devices. The activity\n tracker---the *peripheral* device---advertises and waits to receive a request for\n connection.\n\n- After the phone and the activity tracker have established a connection, they\n start transferring GATT metadata to each other. In this case, the app running\n on the phone sends requests for data, so it acts as the *GATT client* . The\n activity tracker fulfills those requests, so it acts as the *GATT server*.\n\nAn alternative design of the app might involve the phone playing the GATT server\nrole instead. See\n[`BluetoothGattServer`](/reference/android/bluetooth/BluetoothGattServer) for\nmore information."]]