اعتبارًا من 27 آذار (مارس) 2025، ننصحك باستخدام android-latest-release
بدلاً من aosp-main
لإنشاء AOSP والمساهمة فيه. لمزيد من المعلومات، يُرجى الاطّلاع على التغييرات في AOSP.
البلوتوث
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يوفّر نظام التشغيل Android حزمة بروتوكولات بلوتوث تلقائية تتوافق مع كل من البلوتوث الكلاسيكي والبلوتوث المنخفض الطاقة (BLE). باستخدام البلوتوث، يمكن لأجهزة Android إنشاء شبكات منطقة شخصية لإرسال البيانات وتلقّيها مع أجهزة بلوتوث قريبة.
في الإصدار 4.3 من نظام التشغيل Android والإصدارات الأحدث، تتيح حزمة بروتوكولات Bluetooth في Android إمكانية تنفيذ تقنية البلوتوث المنخفض الطاقة (BLE). لاستخدام واجهات برمجة تطبيقات BLE بشكل كامل، اتّبِع متطلبات واجهة HCI الخاصة بالبلوتوث على Android. يمكن لأجهزة Android التي تتضمّن مجموعة شرائح مؤهَّلة استخدام تقنية البلوتوث الكلاسيكية أو كلتا التقنيتَين. لا تتوافق تقنية البلوتوث المنخفض الطاقة (BLE) مع شرائح تعريف البلوتوث القديمة.
في نظام التشغيل Android 8.0، تكون حزمة بروتوكول البلوتوث مؤهَّلة بالكامل لاستخدام البلوتوث 5. لاستخدام ميزات البلوتوث 5 المتاحة، يجب أن يحتوي الجهاز على مجموعة شرائح مؤهَّلة للبلوتوث 5.
هندسة Android
يتواصل تطبيق البلوتوث مع عملية البلوتوث من خلال Binder. تستخدم عملية البلوتوث واجهة Java الأصلية (JNI) للتواصل مع حزمة بروتوكولات البلوتوث، وتتيح للمطوّرين الوصول إلى ملفات تعريف البلوتوث المختلفة. يوضّح هذا الرسم التخطيطي البنية العامة لحزمة بروتوكول البلوتوث:

الشكل 1. بنية البلوتوث في Android
- إطار عمل التطبيق
-
على مستوى إطار عمل التطبيق، توجد رموز التطبيق التي تستخدم واجهات برمجة التطبيقات
android.bluetooth
للتفاعل مع أجهزة Bluetooth. داخليًا، يستدعي هذا الرمز عملية Bluetooth
من خلال آلية Binder IPC.
- تطبيق البلوتوث
-
يتم تجميع تطبيق البلوتوث، المتوفّر في
packages/modules/Bluetooth/android/app
،
كتطبيق Android، ويتم تنفيذ ملفات تعريف البلوتوث في طبقة إطار عمل Android. يتصل هذا التطبيق بمجموعة برامج البلوتوث من خلال JNI.
- JNI
-
يقع رمز JNI المرتبط بـ
android.bluetooth
في
packages/modules/Bluetooth/android/app/jni
. يتم استدعاء رمز JNI إلى حزمة بروتوكول البلوتوث عند حدوث عمليات بلوتوث معيّنة، مثل عند اكتشاف الأجهزة.
- حزمة بروتوكولات البلوتوث
-
يتم توفير حزمة بروتوكولات البلوتوث التلقائية في مشروع Android مفتوح المصدر (AOSP) وتقع في
packages/modules/Bluetooth/system
. تنفِّذ الحزمة طبقة تجريد الأجهزة (HAL) العامة للبلوتوث وتخصّصها باستخدام الإضافات وتغييرات الإعدادات.
- تنفيذ المورّد
-
تتفاعل أجهزة المورّد مع حزمة برامج البلوتوث باستخدام لغة تعريف واجهة HAL (HIDL).
HIDL
تحدِّد HIDL الواجهة بين حزمة Bluetooth وتنفيذ المورِّد. لإنشاء ملفات Bluetooth HIDL، مرِّر ملفات واجهة Bluetooth إلى أداة إنشاء HIDL. توجد ملفات الواجهة في
hardware/interfaces/bluetooth
.
تطوير حزمة البلوتوث
حزمة بروتوكولات البلوتوث في Android هي حزمة بروتوكولات بلوتوث مؤهَّلة بالكامل. تتوفّر قائمة المؤهلات على موقع Bluetooth SIG الإلكتروني (يجب تسجيل الدخول) ضمن QDID 169365.
تتوفّر حزمة البلوتوث الأساسية في
packages/modules/Bluetooth
. يتم التطوير في AOSP، ونرحّب بالمساهمات.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-08-22 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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-22 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Bluetooth\n\nAndroid provides a default Bluetooth stack that supports both Classic Bluetooth and Bluetooth\nLow Energy (BLE). Using Bluetooth, Android devices can create personal area networks to send\nand receive data with nearby Bluetooth devices.\n\n\nIn Android 4.3 and higher, the Android Bluetooth stack provides the ability to implement\nBLE. To fully use the BLE APIs, follow the\n[Android Bluetooth HCI Requirements](/docs/core/connect/bluetooth/hci_requirements). Android devices with a qualified chipset can implement either Classic Bluetooth or both\nClassic Bluetooth and BLE. BLE isn't backward compatible with older Bluetooth chipsets.\n\n\nIn Android 8.0, the Bluetooth stack is fully qualified for Bluetooth 5. To use\navailable Bluetooth 5 features, the device needs to have a Bluetooth 5 qualified chipset.\n\nAndroid architecture\n--------------------\n\n\nA Bluetooth app communicates with the Bluetooth process through Binder. The Bluetooth\nprocess uses Java Native Interface (JNI) to communicate with the Bluetooth stack and provides\ndevelopers with access to various Bluetooth profiles. This diagram shows the general\nstructure of the Bluetooth stack:\n\n**Figure 1.** Android Bluetooth architecture.\n\napp framework\n:\n At the app framework level is app code, which uses the\n [`android.bluetooth`](http://developer.android.com/reference/android/bluetooth/package-summary.html)\n APIs to interact with the Bluetooth hardware. Internally, this code calls the Bluetooth\n process through the Binder IPC mechanism.\n\nBluetooth app\n:\n The Bluetooth app, located in `packages/modules/Bluetooth/android/app`,\n is packaged as an Android app and implements the Bluetooth profiles at the Android framework\n layer. This app calls into the Bluetooth stack through JNI.\n\nJNI\n:\n The JNI code associated with `android.bluetooth` is located in\n `packages/modules/Bluetooth/android/app/jni`. The JNI code calls into the\n Bluetooth stack when certain Bluetooth operations occur, such as when devices are\n discovered.\n\nBluetooth stack\n:\n The default Bluetooth stack is provided in AOSP and is located in\n `packages/modules/Bluetooth/system`. The stack implements the generic Bluetooth\n HAL and customizes it with extensions and configuration changes.\n\nvendor implementation\n:\n Vendor devices interact with the Bluetooth stack using the HAL interface definition\n language (HIDL).\n\n### HIDL\n\n\n[HIDL](/docs/core/architecture/hidl) defines the interface between the\nBluetooth stack and the vendor implementation. To generate the Bluetooth HIDL files, pass the\nBluetooth interface files into the HIDL generation tool. The interface files are located in\n[`hardware/interfaces/bluetooth`](https://android.googlesource.com/platform/hardware/interfaces/+/android16-release/bluetooth/).\n\n### Bluetooth stack development\n\n\nThe Android Bluetooth stack is a fully qualified Bluetooth stack. The qualification listing is\non the Bluetooth SIG website (requires sign-in) under\n[QDID 169365](https://launchstudio.bluetooth.com/ListingDetails/130825).\n\n\nThe core Bluetooth stack resides in\n[packages/modules/Bluetooth](https://cs.android.com/android/platform/superproject/+/android-latest-release:packages/modules/Bluetooth/). Development happens in AOSP, and contributions are welcome."]]