I would like to access GATT profile from C program using Bluez
I think that it is possible to read / write to the gatt profile using the "hci_send_req" function or the "hci_send_cmd" function.
However, we can not find the parameters that set the data.
Is it connected to the terminal of BLE and read / write to Gatt profile is not prepared?
Added..2018/11/22 17:06 (JST)
First of all, I investigate whether it can be realized from the command line.
The environment is RaspberryPi3.
pi@raspberrypi:~ $ sudo dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX --type=method_call org.bluez.Device1.Connect
Error org.bluez.Error.Failed: Software caused connection abort
Sorry, please hide the MAC address.
With the gatttool command, connect, primary, char-read-hnd, and char-write-req (cmd) are possible terminals.
Add... 2018/11/22 20:43
Thank you for the information.
I tried, but org.bluez.Adapter1 actually exists, but an error occurs.
pi@raspberrypi:~ $ sudo ./glibtest XX:XX:XX:XX:XX:XX
Adapter is Powered "on"
Unable to get result: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Method "ConnectDevice" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
The existence of org.bluez.Adapter1 is checked with the following command.
sudo dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0 --type=method_call org.freedesktop.DBus.Introspectable.Introspect
</method></interface><interface name="org.bluez.Adapter1"><method name="StartDiscovery"></method><method name="SetDiscoveryFilter"><arg name="properties" type="a{sv}" direction="in"/>
The version of bluez has been updated from 5.43 to 5.44.
c linux bluez gatt hci
add a comment |
I think that it is possible to read / write to the gatt profile using the "hci_send_req" function or the "hci_send_cmd" function.
However, we can not find the parameters that set the data.
Is it connected to the terminal of BLE and read / write to Gatt profile is not prepared?
Added..2018/11/22 17:06 (JST)
First of all, I investigate whether it can be realized from the command line.
The environment is RaspberryPi3.
pi@raspberrypi:~ $ sudo dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX --type=method_call org.bluez.Device1.Connect
Error org.bluez.Error.Failed: Software caused connection abort
Sorry, please hide the MAC address.
With the gatttool command, connect, primary, char-read-hnd, and char-write-req (cmd) are possible terminals.
Add... 2018/11/22 20:43
Thank you for the information.
I tried, but org.bluez.Adapter1 actually exists, but an error occurs.
pi@raspberrypi:~ $ sudo ./glibtest XX:XX:XX:XX:XX:XX
Adapter is Powered "on"
Unable to get result: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Method "ConnectDevice" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
The existence of org.bluez.Adapter1 is checked with the following command.
sudo dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0 --type=method_call org.freedesktop.DBus.Introspectable.Introspect
</method></interface><interface name="org.bluez.Adapter1"><method name="StartDiscovery"></method><method name="SetDiscoveryFilter"><arg name="properties" type="a{sv}" direction="in"/>
The version of bluez has been updated from 5.43 to 5.44.
c linux bluez gatt hci
2
You might want to use the DBus API for this.
– r3mus n0x
Nov 22 '18 at 5:50
Thank you for your answer. I will try while examining!!
– GorillaEngineer
Nov 22 '18 at 6:07
Sorry. "Error org.bluez.Error.Failed: Software caused connection abort" Can not be resolved with Connect.
– GorillaEngineer
Nov 22 '18 at 7:02
Share the code to get better answer!
– Parthiban
Nov 22 '18 at 7:26
You can useConnectDevice
method if you already know the MAC address of the device. Else you need toStartDiscovery
,Trust
,Pair
andConnect
in sequence. You can find theConnectDevice
method example here: gist.github.com/parthitce/eb6b751df3235f7247babc4c9aba41d8. You can also find more examples in gist.github.com/parthitce and explanation in linumiz.com/author/parthiban
– Parthiban
Nov 22 '18 at 10:46
add a comment |
I think that it is possible to read / write to the gatt profile using the "hci_send_req" function or the "hci_send_cmd" function.
However, we can not find the parameters that set the data.
Is it connected to the terminal of BLE and read / write to Gatt profile is not prepared?
Added..2018/11/22 17:06 (JST)
First of all, I investigate whether it can be realized from the command line.
The environment is RaspberryPi3.
pi@raspberrypi:~ $ sudo dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX --type=method_call org.bluez.Device1.Connect
Error org.bluez.Error.Failed: Software caused connection abort
Sorry, please hide the MAC address.
With the gatttool command, connect, primary, char-read-hnd, and char-write-req (cmd) are possible terminals.
Add... 2018/11/22 20:43
Thank you for the information.
I tried, but org.bluez.Adapter1 actually exists, but an error occurs.
pi@raspberrypi:~ $ sudo ./glibtest XX:XX:XX:XX:XX:XX
Adapter is Powered "on"
Unable to get result: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Method "ConnectDevice" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
The existence of org.bluez.Adapter1 is checked with the following command.
sudo dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0 --type=method_call org.freedesktop.DBus.Introspectable.Introspect
</method></interface><interface name="org.bluez.Adapter1"><method name="StartDiscovery"></method><method name="SetDiscoveryFilter"><arg name="properties" type="a{sv}" direction="in"/>
The version of bluez has been updated from 5.43 to 5.44.
c linux bluez gatt hci
I think that it is possible to read / write to the gatt profile using the "hci_send_req" function or the "hci_send_cmd" function.
However, we can not find the parameters that set the data.
Is it connected to the terminal of BLE and read / write to Gatt profile is not prepared?
Added..2018/11/22 17:06 (JST)
First of all, I investigate whether it can be realized from the command line.
The environment is RaspberryPi3.
pi@raspberrypi:~ $ sudo dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_XX_XX_XX_XX_XX_XX --type=method_call org.bluez.Device1.Connect
Error org.bluez.Error.Failed: Software caused connection abort
Sorry, please hide the MAC address.
With the gatttool command, connect, primary, char-read-hnd, and char-write-req (cmd) are possible terminals.
Add... 2018/11/22 20:43
Thank you for the information.
I tried, but org.bluez.Adapter1 actually exists, but an error occurs.
pi@raspberrypi:~ $ sudo ./glibtest XX:XX:XX:XX:XX:XX
Adapter is Powered "on"
Unable to get result: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: Method "ConnectDevice" with signature "a{sv}" on interface "org.bluez.Adapter1" doesn't exist
The existence of org.bluez.Adapter1 is checked with the following command.
sudo dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0 --type=method_call org.freedesktop.DBus.Introspectable.Introspect
</method></interface><interface name="org.bluez.Adapter1"><method name="StartDiscovery"></method><method name="SetDiscoveryFilter"><arg name="properties" type="a{sv}" direction="in"/>
The version of bluez has been updated from 5.43 to 5.44.
c linux bluez gatt hci
c linux bluez gatt hci
edited Nov 22 '18 at 11:47
GorillaEngineer
asked Nov 22 '18 at 5:17
GorillaEngineerGorillaEngineer
11
11
2
You might want to use the DBus API for this.
– r3mus n0x
Nov 22 '18 at 5:50
Thank you for your answer. I will try while examining!!
– GorillaEngineer
Nov 22 '18 at 6:07
Sorry. "Error org.bluez.Error.Failed: Software caused connection abort" Can not be resolved with Connect.
– GorillaEngineer
Nov 22 '18 at 7:02
Share the code to get better answer!
– Parthiban
Nov 22 '18 at 7:26
You can useConnectDevice
method if you already know the MAC address of the device. Else you need toStartDiscovery
,Trust
,Pair
andConnect
in sequence. You can find theConnectDevice
method example here: gist.github.com/parthitce/eb6b751df3235f7247babc4c9aba41d8. You can also find more examples in gist.github.com/parthitce and explanation in linumiz.com/author/parthiban
– Parthiban
Nov 22 '18 at 10:46
add a comment |
2
You might want to use the DBus API for this.
– r3mus n0x
Nov 22 '18 at 5:50
Thank you for your answer. I will try while examining!!
– GorillaEngineer
Nov 22 '18 at 6:07
Sorry. "Error org.bluez.Error.Failed: Software caused connection abort" Can not be resolved with Connect.
– GorillaEngineer
Nov 22 '18 at 7:02
Share the code to get better answer!
– Parthiban
Nov 22 '18 at 7:26
You can useConnectDevice
method if you already know the MAC address of the device. Else you need toStartDiscovery
,Trust
,Pair
andConnect
in sequence. You can find theConnectDevice
method example here: gist.github.com/parthitce/eb6b751df3235f7247babc4c9aba41d8. You can also find more examples in gist.github.com/parthitce and explanation in linumiz.com/author/parthiban
– Parthiban
Nov 22 '18 at 10:46
2
2
You might want to use the DBus API for this.
– r3mus n0x
Nov 22 '18 at 5:50
You might want to use the DBus API for this.
– r3mus n0x
Nov 22 '18 at 5:50
Thank you for your answer. I will try while examining!!
– GorillaEngineer
Nov 22 '18 at 6:07
Thank you for your answer. I will try while examining!!
– GorillaEngineer
Nov 22 '18 at 6:07
Sorry. "Error org.bluez.Error.Failed: Software caused connection abort" Can not be resolved with Connect.
– GorillaEngineer
Nov 22 '18 at 7:02
Sorry. "Error org.bluez.Error.Failed: Software caused connection abort" Can not be resolved with Connect.
– GorillaEngineer
Nov 22 '18 at 7:02
Share the code to get better answer!
– Parthiban
Nov 22 '18 at 7:26
Share the code to get better answer!
– Parthiban
Nov 22 '18 at 7:26
You can use
ConnectDevice
method if you already know the MAC address of the device. Else you need to StartDiscovery
, Trust
, Pair
and Connect
in sequence. You can find the ConnectDevice
method example here: gist.github.com/parthitce/eb6b751df3235f7247babc4c9aba41d8. You can also find more examples in gist.github.com/parthitce and explanation in linumiz.com/author/parthiban– Parthiban
Nov 22 '18 at 10:46
You can use
ConnectDevice
method if you already know the MAC address of the device. Else you need to StartDiscovery
, Trust
, Pair
and Connect
in sequence. You can find the ConnectDevice
method example here: gist.github.com/parthitce/eb6b751df3235f7247babc4c9aba41d8. You can also find more examples in gist.github.com/parthitce and explanation in linumiz.com/author/parthiban– Parthiban
Nov 22 '18 at 10:46
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424289%2fi-would-like-to-access-gatt-profile-from-c-program-using-bluez%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424289%2fi-would-like-to-access-gatt-profile-from-c-program-using-bluez%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
You might want to use the DBus API for this.
– r3mus n0x
Nov 22 '18 at 5:50
Thank you for your answer. I will try while examining!!
– GorillaEngineer
Nov 22 '18 at 6:07
Sorry. "Error org.bluez.Error.Failed: Software caused connection abort" Can not be resolved with Connect.
– GorillaEngineer
Nov 22 '18 at 7:02
Share the code to get better answer!
– Parthiban
Nov 22 '18 at 7:26
You can use
ConnectDevice
method if you already know the MAC address of the device. Else you need toStartDiscovery
,Trust
,Pair
andConnect
in sequence. You can find theConnectDevice
method example here: gist.github.com/parthitce/eb6b751df3235f7247babc4c9aba41d8. You can also find more examples in gist.github.com/parthitce and explanation in linumiz.com/author/parthiban– Parthiban
Nov 22 '18 at 10:46