{"id":19156868,"url":"https://github.com/bertrandmartel/notti-library","last_synced_at":"2025-06-24T06:33:36.805Z","repository":{"id":94808608,"uuid":"43715729","full_name":"bertrandmartel/notti-library","owner":"bertrandmartel","description":"Android app interacting with Notti bluetooth device","archived":false,"fork":false,"pushed_at":"2017-01-12T14:56:08.000Z","size":1484,"stargazers_count":7,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-19T20:17:32.278Z","etag":null,"topics":["android-library","android-service","bluetooth-le","iot","notti-device"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bertrandmartel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-05T21:49:23.000Z","updated_at":"2021-09-29T10:24:26.000Z","dependencies_parsed_at":"2023-03-13T16:56:47.202Z","dependency_job_id":null,"html_url":"https://github.com/bertrandmartel/notti-library","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fnotti-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fnotti-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fnotti-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bertrandmartel%2Fnotti-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bertrandmartel","download_url":"https://codeload.github.com/bertrandmartel/notti-library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252838763,"owners_count":21812082,"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":["android-library","android-service","bluetooth-le","iot","notti-device"],"created_at":"2024-11-09T08:36:11.171Z","updated_at":"2025-05-07T07:46:44.159Z","avatar_url":"https://github.com/bertrandmartel.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Notti Android library #\n\n[![Build Status](https://travis-ci.org/bertrandmartel/notti-library.svg)](https://travis-ci.org/bertrandmartel/notti-library)\n[![Download](https://api.bintray.com/packages/bertrandmartel/maven/notti-service/images/download.svg) ](https://bintray.com/bertrandmartel/maven/notti-service/_latestVersion)\n[![Maven Central](https://maven-badges.herokuapp.com/maven-central/fr.bmartel/notti-service/badge.svg)](https://maven-badges.herokuapp.com/maven-central/fr.bmartel/notti-service)\n[![Javadoc](http://javadoc-badge.appspot.com/fr.bmartel/notti-service.svg?label=javadoc)](http://javadoc-badge.appspot.com/fr.bmartel/notti-service)\n[![License](http://img.shields.io/:license-mit-blue.svg)](LICENSE.md)\n\nNotti library is an embedded Android service for controlling Notti Bluetooth devices\n\n\u003chr/\u003e\n\nNotti is a small bluetooth led light with built in battery made by Witti\n\n![screenshot](img/device.png)\n\nThis project is composed of two modules :\n\n* Android Service, exposing APIs to scan,connect and control a Notti device\n* Android Application which control Notti through service APIs\n\n## Notti Service\n\nAndroid service that manage your Notti bluetooth device(s) through BLE GATT interfaces :\n\n* set ON/OFF\n* set RGB color\n* set color intensity\n\n\u003ci\u003eCharacteristics on Notti cant be read on current device firmware. Previous state should be memorized to maintain statefull processing\u003c/i\u003e\n\n## Include into your project\n\nGrab from Bintray maven repository :\n\n```\ncompile 'fr.bmartel:notti-service:0.21'\n```\n\n## Bind and/or Start Notti service\n\nBind your activity/service to `NottiBtService` : \n\n```\nIntent intent = new Intent(context, NottiBtService.class);\n\nstartService(intent);\n\nbound = bindService(intent, mServiceConnection, BIND_AUTO_CREATE);\n\nif (bound){\n\t// you are bound to Notti service\n}\nelse {\n\t// binding failure\n}\n```\n\nAnd for your service connection : \n\n```\nprivate ServiceConnection mServiceConnection = new ServiceConnection() {\n\n\t@Override\n\tpublic void onServiceConnected(ComponentName name, IBinder service) {\n\n\t\tLog.i(TAG, \"Connected to service\");\n\n\t\tNottiBtService nottiService = ((NottiBtService.LocalBinder) service).getService();\n\t}\n\n\t@Override\n\tpublic void onServiceDisconnected(ComponentName name) {\n\n\t\tLog.i(TAG, \"Disconnected from service\");\n\t}\n\n};\n```\n\n## API Description\n\nNotti service exposes a set of API, an application can uses in its own process\n\n### Start a scan\n\nStart a scan which will go on until a `stopScan()` is called :\n\n```\nboolean status = service.startScan();\n\nif (status){\n\t// scan start request success\n}\nelse {\n\t//scan start failure\n}\n```\n\n### Stop a scan\n\n```\nservice.stopScan();\n```\n\n### Get scanning list\n\nThis is a map of devices scanned until now. Only `Notti` devices will appear :\n\n* key : Bluetooth address\n* value : `BluetoothDevice` object\n\n```\nMap\u003cString, BluetoothDevice\u003e scanList = service.getScanningList();\n```\n\n### Get scaning status\n\n```\nboolean scanStatus = service.isScanning();\n\nif (scanStatus){\n\t// currently scanning\n}\nelse {\n\t// not scanning\n}\n```\n\n### Clear scannning list\n\nEmpty the scanning list :\n\n```\nservice.clearScanningList();\n```\n\n### Connect to device\n\nConnect a device with its device address : \n\n```\nservice.connect(\"5C:31:3E:7F:81:1B\");\n```\n\n\u003ci\u003eYou can get device address from scanning list key item\u003c/i\u003e\n\n### Get list of devices\n\nList of devices that have already been connected at least once since service start :\n\n* key : Bluetooth address\n* value : `IBluetoothDeviceConn` object featuring a Bluetooth connection object\n```\nHashMap\u003cString, IBluetoothDeviceConn\u003e connectionList = service.getConnectionList();\n```\n\n`IBluetoothDeviceConn` can be cast into `INottiDevice` to be able to control your Notti device : \n\n```\nif (service.getConnectionList().get(\"5C:31:3E:7F:81:1B\").getDevice() instanceof INottiDevice) {\n\n\tINottiDevice device = (INottiDevice) service.getConnectionList().get(\"5C:31:3E:7F:81:1B\").getDevice();\n\n}\n```\n\n### Disconnect from device\n\n```\nboolean status = service.disconnect(\"5C:31:3E:7F:81:1B\");\n\nif (status){\n\t// disconnection request complete\n}\nelse {\n\t// disconnection failure\n}\n```\n\n### Disconnect all devices\n\n```\nservice.disconnectall();\n```\n\n## Events\n\nYou can receive events related to following actions :\n\n* scan has started\n* scan has ended\n* a new device has been discovered\n* a device has connected\n* a device has disconnected\n\nTo receive those one of these events or all of them, you have to register a `BroadcastReceiver` object with following filters :\n\n| Intent              | descriptions |\n|--------------------|-------------------|\n| BluetoothEvents.BT_EVENT_SCAN_START        | scan has started      |\n| BluetoothEvents.BT_EVENT_SCAN_END         | scan has ended     |\n| BluetoothEvents.BT_EVENT_DEVICE_DISCOVERED | a new device has been discovered and added to scanning list      |\n| BluetoothEvents.BT_EVENT_DEVICE_CONNECTED     | a device has connected     |\n| BluetoothEvents.BT_EVENT_DEVICE_DISCONNECTED            | a device has disconnected      |\n\nFor receiving all events :\n```\nIntentFilter intentFilter = new IntentFilter();\nintentFilter.addAction(BluetoothEvents.BT_EVENT_SCAN_START);\nintentFilter.addAction(BluetoothEvents.BT_EVENT_SCAN_END);\nintentFilter.addAction(BluetoothEvents.BT_EVENT_DEVICE_DISCOVERED);\nintentFilter.addAction(BluetoothEvents.BT_EVENT_DEVICE_CONNECTED);\nintentFilter.addAction(BluetoothEvents.BT_EVENT_DEVICE_DISCONNECTED);\n``` \n\nRegister your `BroadCastReceiver` :\n\n```\nregisterReceiver(mGattUpdateReceiver, intentFilter);\n```\n\nAnd your `mGattUpdateReceiver` looks like :\n\n```\nprivate final BroadcastReceiver mGattUpdateReceiver = new BroadcastReceiver() {\n\n\t@Override\n\tpublic void onReceive(Context context, Intent intent) {\n\n\t\tString action = intent.getAction();\n\n\t\tif (BluetoothEvents.BT_EVENT_SCAN_START.equals(action)) {\n\n\t\t\tLog.i(\"notti-app\", \"Scan has started\");\n\n\t\t} else if (BluetoothEvents.BT_EVENT_SCAN_END.equals(action)) {\n\n\t\t\tLog.i(\"notti-app\", \"Scan has ended\");\n\n\t\t} else if (BluetoothEvents.BT_EVENT_DEVICE_DISCOVERED.equals(action)) {\n\n\t\t\tBluetoothObject btDevice = BluetoothObject.parseArrayList(intent);\n\n\t\t\tif (btDevice != null) {\n\t\t\t\tLog.i(\"notti-app\", \"New device has been discovered : \" + \n\t\t\t\t\tbtDevice.getDeviceName() + \" - \" + btDevice.getDeviceAddress());\n\t\t\t}\n\n\t\t} else if (BluetoothEvents.BT_EVENT_DEVICE_CONNECTED.equals(action)) {\n\n\t\t\tBluetoothObject btDevice = BluetoothObject.parseArrayList(intent);\n\n\t\t\tif (btDevice != null) {\n\t\t\t\tLog.i(\"notti-app\", \"Device connected : \" + \n\t\t\t\t\tbtDevice.getDeviceName() + \" - \" + btDevice.getDeviceAddress());\n\t\t\t}\n\n\t\t} else if (BluetoothEvents.BT_EVENT_DEVICE_DISCONNECTED.equals(action)) {\n\n\t\t\tBluetoothObject btDevice = BluetoothObject.parseArrayList(intent);\n\n\t\t\tif (btDevice != null) {\n\t\t\t\tLog.i(\"notti-app\", \"Device disconnected : \" + \n\t\t\t\t\tbtDevice.getDeviceName() + \" - \" + btDevice.getDeviceAddress());\n\t\t\t}\n\n\t\t} \n\t}\n};\n\n````\n\nYou can parse device name and device address with `BluetoothObject` class as featured above.\n\n## Notti application\n\nThis Android application bounds to Notti service to control your device(s)\n\nYou can do the following :\n\n* scan network looking for your Notti devices\n* connect to your devices,\n* control all Notti device functions\n\n## Requirements\n\nThis project require Android SDK lvl17+\n\n## External Lib\n\n* Color picker by Lars Werkman : https://github.com/LarsWerkman/HoloColorPicker\n\n## Screenshots\n\n![screenshot](img/screenshot.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertrandmartel%2Fnotti-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbertrandmartel%2Fnotti-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbertrandmartel%2Fnotti-library/lists"}