Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
fr.bmartel:notti-service
Advanced tools
Notti library is an embedded Android service for controlling Notti Bluetooth devices
Notti is a small bluetooth led light with built in battery made by Witti
This project is composed of two modules :
Android service that manage your Notti bluetooth device(s) through BLE GATT interfaces :
Characteristics on Notti cant be read on current device firmware. Previous state should be memorized to maintain statefull processing
Grab from Bintray maven repository :
compile 'fr.bmartel:notti-service:0.21'
Bind your activity/service to NottiBtService
:
Intent intent = new Intent(context, NottiBtService.class);
startService(intent);
bound = bindService(intent, mServiceConnection, BIND_AUTO_CREATE);
if (bound){
// you are bound to Notti service
}
else {
// binding failure
}
And for your service connection :
private ServiceConnection mServiceConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.i(TAG, "Connected to service");
NottiBtService nottiService = ((NottiBtService.LocalBinder) service).getService();
}
@Override
public void onServiceDisconnected(ComponentName name) {
Log.i(TAG, "Disconnected from service");
}
};
Notti service exposes a set of API, an application can uses in its own process
Start a scan which will go on until a stopScan()
is called :
boolean status = service.startScan();
if (status){
// scan start request success
}
else {
//scan start failure
}
service.stopScan();
This is a map of devices scanned until now. Only Notti
devices will appear :
BluetoothDevice
objectMap<String, BluetoothDevice> scanList = service.getScanningList();
boolean scanStatus = service.isScanning();
if (scanStatus){
// currently scanning
}
else {
// not scanning
}
Empty the scanning list :
service.clearScanningList();
Connect a device with its device address :
service.connect("5C:31:3E:7F:81:1B");
You can get device address from scanning list key item
List of devices that have already been connected at least once since service start :
IBluetoothDeviceConn
object featuring a Bluetooth connection objectHashMap<String, IBluetoothDeviceConn> connectionList = service.getConnectionList();
IBluetoothDeviceConn
can be cast into INottiDevice
to be able to control your Notti device :
if (service.getConnectionList().get("5C:31:3E:7F:81:1B").getDevice() instanceof INottiDevice) {
INottiDevice device = (INottiDevice) service.getConnectionList().get("5C:31:3E:7F:81:1B").getDevice();
}
boolean status = service.disconnect("5C:31:3E:7F:81:1B");
if (status){
// disconnection request complete
}
else {
// disconnection failure
}
service.disconnectall();
You can receive events related to following actions :
To receive those one of these events or all of them, you have to register a BroadcastReceiver
object with following filters :
Intent | descriptions |
---|---|
BluetoothEvents.BT_EVENT_SCAN_START | scan has started |
BluetoothEvents.BT_EVENT_SCAN_END | scan has ended |
BluetoothEvents.BT_EVENT_DEVICE_DISCOVERED | a new device has been discovered and added to scanning list |
BluetoothEvents.BT_EVENT_DEVICE_CONNECTED | a device has connected |
BluetoothEvents.BT_EVENT_DEVICE_DISCONNECTED | a device has disconnected |
For receiving all events :
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(BluetoothEvents.BT_EVENT_SCAN_START);
intentFilter.addAction(BluetoothEvents.BT_EVENT_SCAN_END);
intentFilter.addAction(BluetoothEvents.BT_EVENT_DEVICE_DISCOVERED);
intentFilter.addAction(BluetoothEvents.BT_EVENT_DEVICE_CONNECTED);
intentFilter.addAction(BluetoothEvents.BT_EVENT_DEVICE_DISCONNECTED);
Register your BroadCastReceiver
:
registerReceiver(mGattUpdateReceiver, intentFilter);
And your mGattUpdateReceiver
looks like :
private final BroadcastReceiver mGattUpdateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (BluetoothEvents.BT_EVENT_SCAN_START.equals(action)) {
Log.i("notti-app", "Scan has started");
} else if (BluetoothEvents.BT_EVENT_SCAN_END.equals(action)) {
Log.i("notti-app", "Scan has ended");
} else if (BluetoothEvents.BT_EVENT_DEVICE_DISCOVERED.equals(action)) {
BluetoothObject btDevice = BluetoothObject.parseArrayList(intent);
if (btDevice != null) {
Log.i("notti-app", "New device has been discovered : " +
btDevice.getDeviceName() + " - " + btDevice.getDeviceAddress());
}
} else if (BluetoothEvents.BT_EVENT_DEVICE_CONNECTED.equals(action)) {
BluetoothObject btDevice = BluetoothObject.parseArrayList(intent);
if (btDevice != null) {
Log.i("notti-app", "Device connected : " +
btDevice.getDeviceName() + " - " + btDevice.getDeviceAddress());
}
} else if (BluetoothEvents.BT_EVENT_DEVICE_DISCONNECTED.equals(action)) {
BluetoothObject btDevice = BluetoothObject.parseArrayList(intent);
if (btDevice != null) {
Log.i("notti-app", "Device disconnected : " +
btDevice.getDeviceName() + " - " + btDevice.getDeviceAddress());
}
}
}
};
You can parse device name and device address with BluetoothObject
class as featured above.
This Android application bounds to Notti service to control your device(s)
You can do the following :
This project require Android SDK lvl17+
FAQs
Android app interacting with Notti bluetooth device
We found that fr.bmartel:notti-service demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.