{"id":3627,"url":"https://github.com/movisens/SmartGattLib","last_synced_at":"2025-08-03T20:32:58.457Z","repository":{"id":9251689,"uuid":"11074870","full_name":"movisens/SmartGattLib","owner":"movisens","description":"SmartGattLib is a Java library that simplifies the work with Bluetooth SMART devices","archived":false,"fork":false,"pushed_at":"2023-11-23T08:31:38.000Z","size":282,"stargazers_count":280,"open_issues_count":1,"forks_count":66,"subscribers_count":36,"default_branch":"master","last_synced_at":"2024-08-16T15:38:49.058Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/movisens.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2013-06-30T17:57:58.000Z","updated_at":"2024-07-18T05:39:56.000Z","dependencies_parsed_at":"2024-01-02T21:21:21.563Z","dependency_job_id":"fd687ee3-edfb-4ce4-a155-6c24dbf71de4","html_url":"https://github.com/movisens/SmartGattLib","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movisens%2FSmartGattLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movisens%2FSmartGattLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movisens%2FSmartGattLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/movisens%2FSmartGattLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/movisens","download_url":"https://codeload.github.com/movisens/SmartGattLib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228567009,"owners_count":17937983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:16:46.842Z","updated_at":"2024-12-07T05:30:47.345Z","avatar_url":"https://github.com/movisens.png","language":"Java","funding_links":[],"categories":["Bluetooth","Libraries","库","Android"],"sub_categories":["Wireless","[](https://github.com/JStumpp/awesome-android/blob/master/readme.md#wireless)无线"],"readme":"SmartGattLib\n============\n\u003ca href=\"https://jitpack.io/#movisens/SmartGattLib/\"\u003e\u003cimg src=\"https://img.shields.io/github/tag/movisens/SmartGattLib.svg?label=Maven%20on%20JitPack\" /\u003e\u003c/a\u003e\n\nSmartGattLib is a Java library that simplifies the work with **Bluetooth SMART** devices (a.k.a. **Bluetooth Low Energy** in Bluetooth 4.0). It provides all UUIDs of the adopted [GATT specification](http://developer.bluetooth.org/gatt/Pages/default.aspx) and an convenient way to interpret the characteristics (e.g. Heart Rate, BatteryLevel).\n\n### Implemented and tested characteristics ###\n\n * BatteryLevel\n * BodySensorLocation\n * HeartRateMeasurement\n * ManufacturerNameString\n * More to come. Please commit pull request to add more characteristics.\n\n### Compatibility ###\nThe library has **no dependencies** and can be use with **every Bluetooth SMART stack** e.g.:\n\n * [Android API Level 18](http://developer.android.com/guide/topics/connectivity/bluetooth-le.html)\n * [RxAndroidBle](https://github.com/Polidea/RxAndroidBle)\n\n### Integration ###\nWorking with Bluetooth SMART devices is usually done in the following way:\n\n1. Scan for devices\n2. Connect to a GATT device\n3. Discover services\n4. Get characteristics for the services of interest **(SmartGattLib helps identifying the services)**\n5. Read characteristics or register for updates **(SmartGattLib helps identifying the characteristics)**\n6. Interpret the updates from the characteristics **(SmartGattLib helps interpreting the data)**\n\nExample Android project with SmartGattLib available [here](https://github.com/movisens/android-SmartGattLib-Example). This is a fork of the Android BluetoothLeGatt Example project. Main modifications can be found in this  [commit](https://github.com/movisens/android-SmartGattLib-Example/commit/7635d950f8af37ddae4a3bf563ddfb658fa88d0f).\n\n### Set up ###\n\n1. Add the JitPack repository and the dependency to your build file:\n\n  ```gradle\n\trepositories {\n\t    maven { url \"https://jitpack.io\" }\n\t}\n\tdependencies {\n\t    compile 'com.github.movisens:SmartGattLib:3.6'\n\t}\n  ```\n  or download the latest .jar file from the [releases](https://github.com/movisens/SmartGattLib/releases) page and place it in your Android app’s libs/ folder. \n2. Use the example below to identifiy services and characteristics and interpret their data\n\n### Example Usage ###\n```java\nimport com.movisens.smartgattlib.*;\nimport com.movisens.smartgattlib.attributes.*;\nimport com.movisens.smartgattlib.helper.*;\n\n// onConnected\n// TODO: iterate over available services\nUUID serviceUuid = null;// service.getUuid();\nif (Services.HEART_RATE.getUuid().equals(serviceUuid)) {\n\n    // TODO: iterate over characteristics\n    UUID characteristicUuid = null;// characteristic.getUuid();\n    if (Characteristics.HEART_RATE_MEASUREMENT.getUuid().equals(characteristicUuid)) {\n        // TODO: Enable notification e.g. for Android API 18:\n        // BluetoothGattDescriptor descriptor = characteristic.getDescriptor(Descriptor.CLIENT_CHARACTERISTIC_CONFIGURATION);\n        // descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);\n        // mBluetoothGatt.writeDescriptor(descriptor);\n    }\n} else {\n    System.out.println(\"Found unused Service: \" + Services.lookup(serviceUuid));\n}\n\n// onCharacteristicChanged\nUUID uuid = null;// characteristic.getUuid();\nbyte[] data = null;// characteristic.getValue();\n\nAbstractAttribute a = Characteristics.lookup(uuid).createAttribute(data);\nif (a instanceof HeartRateMeasurement) {\n    HeartRateMeasurement heartRateMeasurement = ((HeartRateMeasurement) a);\n    heartRateMeasurement.getHr();\n    heartRateMeasurement.getEe();\n} else if (a instanceof DefaultAttribute) {\n    System.err.println(\"characteristic for \" + uuid + \" is unknown\");\n} else {\n    System.out.println(\"unused characteristic \" + a.getCharacteristic().getName());\n}\n\n// write Attribute\nAbstractAttribute aa = new Weight(12.3);\n// TODO: Write aa.getBytes() to aa.getCharacteristic().getUuid();\n```\n### License ###\nCopyright 2017 movisens GmbH\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmovisens%2FSmartGattLib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmovisens%2FSmartGattLib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmovisens%2FSmartGattLib/lists"}