How to set up node-red on rasbian to get information from a ble-energy-harvesting button? - bluetooth-lowenergy

at first: I'm not a BLE expert so I try to describe my problem as good as I can and I apologize in advance if I don't use the right terms or definitions.
I've bought a BLE-Energy-Harvesting button of type PTM 215B (1).
I've installed node-red on Raspberry-Pi 2b (2)
Locally on node-red the package node-red-contrib-generic-ble was install with npm (3)
when node-red is started I can see the elements of generic-ble-package and so I tried to configure the "Generic Ble In"-Item.
When I scan for devices, I have to push and release the button several times till it is shown in the list - that's no wonder because without these actions the button has no energy.
But then it gets complicated. When I click on "Apply", the item tries to get the GATT(ributes) from the button.The problem is - as far as I understood - the button doesn't have any.
From the CLI I've used bluetoothctl to scan for devices and I've seen that the button is always recognized by the system (on-button-pressed and on-button-released).
I've also tried with different other node-red packaged but they had even more problems ( e.g. noble (4) could not be installed properly and it looks like abandoned )
I assume the problem is sitting in front of the screen but this is the second Saturday I'm trying to "install a button" and I really don't know how to proceed.
I've read (somewhere) that one of the strength of BLE is the possible usage of energy-harvesting -sensors. But does the "general-ble"-package do the job?
-If yes, how?
-If no, which package should I use?
I'd really like to use a node-red-package because I want to expand an already existing flow.
I appreciate any help and/or link.
Thank you in advance.
Regards,
Mr P
Additional info:
Raspbian: VERSION="10 (buster)"
npm --version: 6.14.8
node-red: 1.2.6: Maintenance Release
Ref.
(1) https://www.enocean.com/en/products/enocean_modules_24ghz_ble/ptm-215b/
(2) https://nodered.org/docs/getting-started/raspberrypi
(3) https://flows.nodered.org/node/node-red-contrib-generic-ble
(4) https://flows.nodered.org/node/node-red-contrib-noble

I found the way to do the job:
I installed the ble-beacon-scanner (1) and that works fine for my purpose.
As I understood: Beacons use ble-notifications, which don't share attributes and don't need a continuous connectivity.
The generic library unfortunately doesn't offer this part of the ble-protocol.
Thank you all.
Regards,
Mr P
(1) https://flows.nodered.org/node/node-red-contrib-blebeacon-scanner

Related

SYCL DPC++ auto detect device

This question might be trivial, unfortunately I haven't found the answer I was looking for.
I used dpct migration tool to port some cuda code to Intel DPC++ and then I further optimized everything I needed and eventually got rid of everything related to dpct expect the super handy
dpct::get_current_device();
which basically solves all the previous pain I had to put compile options to select the appropriate device and control them with Makefiles and so on.
Is there any way to do this without using dpct ?
I had a look at how dpct does this (here) but it looks pretty non-straightforward and it relies on other internal functions.
Is there any way to avoid this ?
I'm not totally clear from your question whether you want to 1) grab a handle to your device or 2) select a device on which to run stuff, so I'll try to answer both. Note that dpct::get_current_device() isn't actually selecting a device, it's just returning the device which you have already selected earlier in your program.
Typically when using SYCL we start with a sycl::queue, which we use to submit kernels, memory copy operations etc. From a sycl::queue you can access your device with:
sycl::device d = q.get_device();
But it seems like you may instead be asking for the simplest way to select a device. In this case, the simplest approach is to construct your queue with one of SYCL's provided device selectors:
sycl::queue q{sycl::gpu_selector()};
sycl::queue q{sycl::cpu_selector()};
sycl::queue q{sycl::default_selector()};
Note that the last option (sycl::default_selector()) is probably what dpct is currently doing for you.

KDE Taskbar Progress

I am trying to show a progress in the taskbar of the plasma desktop using the KDE Frameworks. In short, it want to do the same thing as dolphin, when it copies files:
I'm kinda stuck, because I don't even know where to get started. The only thing I found that could be useful is KStatusBarJobTracker, but I don't know how to use it. I could not find any tutorials or examples how to do this.
So, after digging around, and thanks to the help of #leinir, I was able to find out the following:
Since Plasma 5.6 KDE supports the Unitiy DBus Launcher-API, which can be used, for example, to show progress
I found a post on AskUbuntu that explains how to use the API with Qt
The real problem is: This only works, if you have a valid desktop file in one of the standard locations! You need to pass the file as parameter of the DBus message to make it work.
Based on this information, I figured out how to use it and created a GitHub repository, that supports cross platform taskbar progress, and uses this API for the linux implementation.
However, here is how to do it anyways. It should work for KDE Plasma and the Unity desktop, maybe more (haven't tried any others):
Create a .desktop file for your application. For test purpose, this can be a "dummy" file, that could look like this:
[Desktop Entry]
Type=Application
Version=1.1
Name=MyApp
Exec=<path_to>/MyApp
Copy that file to ~/.local/share/applications/ (or wherever user specific desktop files go on your system)
In your code, all you need to do is execute the following code, to update the taskbar state:
auto message = QDBusMessage::createSignal(QStringLiteral("/com/example/MyApp"),
QStringLiteral("com.canonical.Unity.LauncherEntry"),
QStringLiteral("Update"));
//you don't always have to specify all parameters, just the ones you want to update
QVariantMap properties;
properties.insert(QStringLiteral("progress-visible"), true);// enable the progress
properties.insert(QStringLiteral("progress"), 0.5);// set the progress value (from 0.0 to 1.0)
properties.insert(QStringLiteral("count-visible"), true);// display the "counter badge"
properties.insert(QStringLiteral("count"), 42);// set the counter value
message << QStringLiteral("application://myapp.desktop") //assuming you named the desktop file "myapp.desktop"
<< properties;
QDBusConnection::sessionBus().send(message);
Compile and run your application. You don't have to start it via the desktop file, at least I did not need to. If you want to be sure your application is "connected" to that desktop file, just set a custom icon for the file. Your application should show that icon in the taskbar.
And thats basically it. Note: The system remembers the last state when restarting the application. Thus, you should reset all those parameters once when starting the application.
Right, so as it turns out you are right, there is not currently a tutorial for this. This reviewboard request, however, shows how it was implemented in KDevelop, and it should be possible for you to work it out through that :) https://git.reviewboard.kde.org/r/127050/
ps: that there is no tutorial now might be a nice way for you to hop in and help out, by writing a small, self contained tutorial for it... something i'm sure would be very much welcomed :)

Is there a way to play sound on mobile when task finished

Maybe I didn't search to good, but I wonder is there a way to play a sound on my Apple mobile device when the task is finished, for example call to apply?
Best Regards
(This is one of many possible answers, and happens to work very well for me.)
I use Pushbullet and RPushbullet. After the initial setup (free account and free use), from any R instance (that has connectivity with the internet) I can run pbNote('note', 'title', 'body of note'), and it "instantly" comes up on my computer and mobile.
Because it is an R package/function, it can be easily scripted to meet whatever static/dynamic needs may arise. It can also send images (I'm told), files, addresses (think google maps), and lists.
I'm using the twitteR package and tweet something when a long-lasting task is done. You can then setup a second twitter account to follow the account you tweet to from R and set an alarm for new tweets.
To be able to tweet from R, you have to go through all the authentication steps for Twitter, though.
I use my own github package to send a text. This is wrapping python code I didn't write and don't understand so I maintain it for myself but have not been able to address other people's problems:
https://github.com/trinker/gmailR
So the use may look something like:
gmail(to=cell2email(5555555555, "sprint"), password = "password")
Including this at the end of the script sends me a text when the long task is complete. This really is taking advantage that cell numbers can be turned into email addresses if the cell carrier is known.

How to make another app open in Game Maker?

I'm using Game Maker for Mac by YoYo Games, and I was wondering if it's possible to open another app in a Game Maker game by pressing a button. Sorry if this doesn't seem very clear, tell me if it isn't.
Thanks!
I do not know about the mac-version, but in the windows-version it can be done using the following functions:
execute_program(prog,arg,wait)
execute_shell(prog,arg)
execute_program, execute_shell and execute_file are obsolete. Don't use them, they will be removed.
Why?
These functions cannot be used any more due to changes in the underlying runner that GameMaker:Studio uses to generate the device specific packages making it impossible to generate objects, images or code "on the fly" as was done before.
How to fix this? I'd make a DLL for Windows and some other DLL-like program (I guess .vst or .so? ) for the Mac version, that can run external codes

Android kernel LED control

Im new to this forum so be nice ;) i have followed rules :)
I am helping the dev for my kernel that I use. Since the mod I want is mainly only for me i figured its my duty to get it working myself.
The problem:
I have edited my *.kl files to disable the five front facing hardware buttons from waking the device and only allow the volume up / down buttons to wake the device as the front facing buttons get pressed when its in my pocket.
However, even though the front facing buttons no longer turn on the device , when they get pressed they light up adding an extra 6mA drain .
What I've tried:
I wrote an apk to change the permissions of the /sys/class/leds/button-backlight/brightness file to keep them off. Despite the program working , permissions allow the file be edited, causing them to light up.
What i need help on:
I downloaded my dev's kernel using git and I want to edit the kernel myself to keep the button lights off during sleep . However kernel code is not my comfort zone .. so i need help .
Thanks everyone for helping and simply just reading !
1) Messing with code is a bad idea (especially if you lack skill and don't know C and UNIX).
2) what you are probably looking for is script that will run on startup (initrc) and there you need to set it and change permissions using chmod command.
Thus you need to Setup what you want (with echo command presumably) -> change permissions so file can not be rewritten (chmod) -> put two commands in initrc.
Kernel can be like any other configured using make menuconfig and then compiling it, in that case you just disable stuff that you don't like.
[OT] I may be off though, your (original) question (there was no question mark) did not make too much sense here and there. Read this howto: How To Ask Questions The Smart Way from Eric Steven Raymond. Thanks.

Resources