BlueZ 5.4 DBus API ConnectProfile GATT service UUID - dbus

How can I connect to a GATT service using the DBus API with BlueZ?
I have used the BlueZ DBUS API to discover a device, connect, and discover the GATT service UUID's.
However when I try to ConnectProfile for one of the GATT service UUID's I get a error.

Got an answer from the BlueZ mailing list:
"So far, there is no GATT D-Bus API in BlueZ 5.x. The only way to
access GATT profiles in BlueZ 5.x is using existing profile specific
D-Bus APIs (thermometer, heart rate, proximity, cycling speed, HID
over GATT) or using C API (like gatttool does)."
(http://marc.info/?l=linux-bluetooth&m=136656873604635&w=2")
This is not supported into BlueZ 5.4

Related

Open CTI adaptor for voice channal

I am new to CTI and I am trying to implement CTI in my org.
currently I have CTI Server's API I can hit those API with the APEX classes.
now my concern is that how can we pass the media packets with the CTI Adaptor like if my head phones are attached with my system than I would be able to hear voice and talk as well currently I am using desktop based softphone for this, if this softphone is not registered with the CTI server then also can't manage to make a call with the given API. Now I am having two questions.
can I remove that desktop based softphone and can make Open CTI adaptor as softphone?
If I will be able to make adaptor as a softphone then how would I be able to send my Voice packet over the voice channel?
thanks advance.

MQTT broker inside C application

Currently, I am using Raspberry Pi on which I am hosting mosquitto MQTT broker and a separate C application that connects and subscribes to localhost. It is a wrapper of what I actually needed.
I actually need an MQTT broker running inside a C application from where I can control what client IDs can connect. Is there any way to achieve it?
Mosquitto provides a plugin interface that allows you to control which clients can connect and which topics they can publish/subscribe to.
Normally you would not control access by client id as this can be easily spoofed, instead you should probably be using username/password (or client certificates) to identify the clients.
There are example plugins that store this information in a database so it can be updated dynamically

How to susbcribe to a telemetry events using MQTT and using C code?

How to susbcribe to a telemetry events using MQTT and using C code? (this is a microcontroller code)
I can send data to a specified topic but when I trying to subscribe to this topic I got error message
This is the message from the log
"mqttTopic": "/devices/my-device/events/my_telem_topic1",
This is the error message from the log
"message": "SUBSCRIBE: Failed to subscribe to topic: '/devices/my-device/events/my_telem_topic1'."
To add to what Kamal posted:
Part of the confusion here is that both MQTT and Pub/Sub (where IoT Core puts your device's telemetry events) are called "topics".
There are 4 MQTT topics for devices to work with (this is all on device side, not Cloud side):
/devices/<device-id>/commands
/devices/<device-id>/config
/devices/<device-id>/state
/devices/<device-id>/events
The first two are there for devices to subscribe to in order to get updates from the IoT Core Admin SDK, the latter two are topics for device to publish data to the Cloud.
In order for a device to subscribe to another device's telemetry, it would need to be able to subscribe to the Pub/Sub topic that's receiving telemetry from the other device. This won't be done as part of the MQTT implementation, but rather, you'd need to implement the Pub/Sub API on your device. This is going to require a separate authentication path as well, likely a service account key that you add to your GCP project, then download to your device. The links in Kamal's answer should get you started if you want to go down that route.
Depending on what you're doing however, as they say, you can probably process the incoming telemetry from one device in a Cloud Function or similar, then set a config for the device that wants to be responsive to that telemetry. That way, if the device is online, it'll get it right away, or if it's not online, it'll get it upon reconnecting to IoT Core.
Telemetry events sent to Cloud IoT are sent to a Cloud Pub/Sub topic that is configured when the device registry is created and are not intended to be retrieved via MQTT on devices. One could use any of the mechanisms available in Google Cloud to subscribe to these messages (Cloud Functions, Cloud Dataflow, or a custom-written subscriber). Commands can be received by devices via MQTT. The topic for a device's commands is /devices/{device-id}/commands/#. APIs are available to send commands to devices.
One would generally send telemetry events from devices, analyze them with one of the aforementioned Cloud products, and then possibly generate commands to devices based on the results of that analysis.

How to change MQTT hostname for Google Iot Core

I am working on an iot device using google-cloud-iot-core, but i would like to have allow for 3rd party support, so i want to change the host name of the mqtt, how can it be done?
Thanks in advance
If you change that endpoint, then you're no longer talking to IoT Core. It's not configurable, as that's the endpoint to talk to the service.
You can setup your own MQTT server somewhere else (could do it in GCE or GKE with a custom container) and make the hostname whatever you want, and then setup your own broker to take the MQTT payloads and create Pub/Sub messages, or even to act as a forwarding proxy to IoT Core itself I suppose (although security and auth might get a bit odd).
Or you could even just go directly to Pub/Sub. It all just depends on your need.
As I mentioned, changing the hostname for IoT Core (the mqtt.googleapis.com) it means that you aren't using IoT Core any longer. There's no other way to access the communication broker piece of IoT Core to do the Pub/Sub message creation, etc. If you don't use the IoT Core endpoint (hostname) then you'd be on your own for creating the Pub/Sub messages from the IoT device data.

Ionic framework - detect internet connection

I am developing simple application using Ionic framework (and AngularJs) that fetches json data from my webpage. How can I detect is there "internet connection" and display message to user: "Connect to internet" if not.
EDIT
Can I use cordova API for that ?
Cordova provides org.apache.cordova.network-information plugin.
See documentation HERE
This plugin provides an implementation of an old version of the Network Information API. It provides information about the device's cellular and wifi connection, and whether the device has an internet connection.
If I am not mistaken, this plugin only detects whether the Wi-Fi or Cellular networking is enabled on the device. This does not always mean that the application can actually reach your remote server, if you are connected to the WiFi network without internet connection.
Therefore, the only solution I have found to ensure that the application can reach your remote server is to continuously ping the server.

Resources