Does WiPy Pysense Device will connect with Other Bluetooth Sensor Devices.? - bluetooth

Does the Pysense(WiPy) device will connect and get service from any other Bluetooth Sensor Devices available in the market.?

Yes we can connect any Bluetooth sensor with mac address using
bluetooth = Bluetooth()
bluetooth.start_scan(5)
while bluetooth.isscanning():
adv = bluetooth.get_adv()
if adv:
if(str(binascii.hexlify(adv.mac).decode()) == '78a50454b267'):
conn = bluetooth.connect(adv.mac)
print(type(conn))

Related

How to detect 4G dongle(s) connected to my computer using NodeJs

How can I detect 4G dongle(s) connected to my computer using NodeJS?
I tried the following code:
var os = require('os');
var allNetworkInterfaces = os.networkInterfaces();
console.log(allNetworkInterfaces);
It works, but I got all network interfaces... I would like to get a list with my 4G dongles only. Knowing that I could have either 1 dongle, or several dongles connected to the same computer, as well as other USB hardwares connected.
After installing the usb package by running npm install usb I was able to get a list of usb devices using the following code:
const usb = require('usb');
const devices = usb.getDeviceList();
console.log( devices );
You will have to go through that list and decide which is your "4G dongle".

BLED112 set Encryption?

I'm using BLED112 and "pygatt BGAPI backend" Python library to communicate to a custom 3rd party BLE device.
Using the "Bluegiga BLE GUI" I can read/write to the device characteristic but only after clicking the "Encrypt" button next to the device.
What is the python library equivalent to setting / enabling the encryption?
I can't seem to find encryption parameter in either adapter initialization or in the device connection functions
Simplified code:
import pygatt
adapter = pygatt.BGAPIBackend()
adapter.start()
device = adapter.connect("01:23:45:67:89", address_type=pygatt.BLEAddressType.random, timeout=10)
raw_read = device.char_read_handle(32)
The library has a function "bond" which performs the same command as the "Encrypt" button.
import pygatt
adapter = pygatt.BGAPIBackend()
adapter.start()
device = adapter.connect("01:23:45:67:89", address_type=pygatt.BLEAddressType.random, timeout=10)
device.bond()
raw_read = device.char_read_handle(32)

How to write to a Characteristic as of Bluez 5.48

I am using Bluez 5.50; 5.48 was the version acquire-write became officially (non-experimentally) supported. Am I using the acquire-write / write feature properly?
On my Raspberry Pi Zero W:
pi#raspberrypi:~ $ bluetoothctl
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# scan on
Discovery started
[bluetooth]# connect B8:27:E8:72:33:7A
Attempting to connect to B8:27:E8:72:33:7A
Connection successful
[DSD TECH]# menu gatt
[DSD TECH]# select-attribute 0000ffe1-0000-1000-8000-00805f9b34fb
[DSD TECH:/service0010/char0011]# acquire-write
[CHG] Attribute /org/bluez/hci0/dev_B8_27_E8_72_33_7A/service0010/char0011 WriteAcquired: yes
AcquireWrite success: fd 7 MTU 23
[DSD TECH:/service0010/char0011]# write("h")
[DSD TECH:/service0010/char0011]# write('h')
[DSD TECH:/service0010/char0011]# write(h)
[DSD TECH:/service0010/char0011]# write(0x68)
On my Arduino Nano connected to HM-10:
void setup()
{
Serial.begin(9600);
}
void loop() {
delay(10);
if (Serial.available())
{
char c = Serial.read();
Serial.println("Read value");
}
}
I use the iOS app named "Serial" which connects to my HM-10. I send the letter h over and read "Read value" on the arduino serial monitor. I do this directly before and after using the raspberry pi, on the same arduino serial monitor. The raspberry pi notifications never come thru. Yes, I am certain it is the same HM-10. It is the only HM-10 I have powered on in BLE range, and I cannot connect to the UUID while my phone is connected. (Actually, I submit connect B8:27:E8:72:33:7A to the raspberry pi, and keeps trying, and then disconnect from phone, and rpi automatically connects).
Thanks in advance!
When using gatt services with bluetoothctl, leave off the parentheses and just use:
write 0x68
acquire-write returns a file descriptor that can be used for writing to the GATT characteristic, usage of write will be locked. so either use acquire-write (which requires a write-without-response flag) or use write.
void WriteValue(array{byte} value, dict options)
Issues a request to write the value of the
characteristic.
Possible options: "offset": Start offset
"device": Device path (Server only)
"link": Link type (Server only)
"prepare-authorize": boolean Is prepare
authorization
request
Possible Errors: org.bluez.Error.Failed
org.bluez.Error.InProgress
org.bluez.Error.NotPermitted
org.bluez.Error.InvalidValueLength
org.bluez.Error.NotAuthorized
org.bluez.Error.NotSupported
fd, uint16 AcquireWrite(dict options) [optional]
Acquire file descriptor and MTU for writing. Usage of
WriteValue will be locked causing it to return
NotPermitted error.
For server the MTU returned shall be equal or smaller
than the negotiated MTU.
For client it only works with characteristic that has
WriteAcquired property which relies on
write-without-response Flag.
To release the lock the client shall close the file
descriptor, a HUP is generated in case the device
is disconnected.
Note: the MTU can only be negotiated once and is
symmetric therefore this method may be delayed in
order to have the exchange MTU completed, because of
that the file descriptor is closed during
reconnections as the MTU has to be renegotiated.
Possible options: "device": Object Device (Server only)
"MTU": Exchanged MTU (Server only)
"link": Link type (Server only)
Possible Errors: org.bluez.Error.Failed
org.bluez.Error.NotSupported

SIM808 bluetooth issue

I've connected my sim808 module to a HC05 bluetooth module with SPP profile.
Hc05 UART config is 9600 , no parity,1 stop.
i'm connecting with these at commands:
AT+BTPOWER=1
AT+BTCONNECT=1,4 // I have already paired two devices
when i send message printf("0adch=0&temp=27&hu=14") via HC05 to SIM808 , it breaks message to multiple parts like below (I've connected SIM808 to PC via a usb-ttl convertor,so i can see messages on sim RX port) :
+BTSPPDATA: 1,1,0
+BTSPPDATA: 1,10,adch=0&tem
+BTSPPDATA: 1,10,p=27&hu=14

Bluez DBus API to set duplicate filter to disable

How to set scan parameters and disable the filter duplicates, so that I can receive all advertisement from the controller ?
StartDiscovery API only notifies, whenever new device is identified but I want to set filter duplicate to disabled, so that I can receive each and every advertisement from the controller?.
But I didn't find any DBus API to set the scan parameters nor set scan enable API.
My Goal is simple I need get notify each advertisement received on controller to my client app, How can I do that with Bluez?
Note : I might missing some basic points because new to bluetooth and bluez.
In the below output you can see that the Device "Parthiban" is already present under /org/bluez/hci0/dev_44_D8_84_02_A3_17. I have started the scan which in turn triggers "StartDiscovery()" method and the same device is updated with RSSI value.
root#mx6q:~# bluetoothctl
[NEW] Controller 5C:F3:70:6E:26:02 Adapter [default]
**[NEW] Device 44:D8:84:02:A3:17 Parthiban**
[NEW] Device 2C:F0:A2:26:D7:F5 iPhone tteam
[NEW] Device 78:F8:82:10:E7:0C Nexus 5X
[bluetooth]# scan on
Discovery started
[CHG] Controller 5C:F3:70:6E:26:02 Discovering: yes
**[CHG] Device 44:D8:84:02:A3:17 RSSI: -52**
So you can use "g_dbus_connection_signal_subscribe" on the interface "org.freedesktop.DBus.Properties" for "PropertiesChanged" signal.
while(g_variant_iter_loop(&iter, "{sv}", &property, &value)) {
if(strcasecmp(property, "RSSI") == 0) {
/*
* - Extract the device address from object path
* /org/bluez/hci0/dev_44_D8_84_02_A3_17
* - Play with the device
*/
}

Resources