Hi, I'm currently scanning for ble devices at two different locations and sending the data to firebase. I would like to then get the value of Test1 and Test2 and see if any of the ble Mac addresses match.
I just cant seem to figure it out..
Here is my data I uploaded to Firebase.
I'm assuming this will not work as the data set contains more then just Mac addresses as I'm sending the DeviceList?
However when I change value to store to it does not record all the addresses..
Q1. Is there a trick to only just recording Mac addresses? (even though later on I would still like to record all the other details, mainly the device name if it has one)
Q2. Is it possible to retrieve the Firebase data and look for devices that are the same and display the match?
The problem is I am unable to list my Mac's in that format.
They are currently
but what I need is them to be listed like this
I just cant work out how to separate the list and add each item as a tag........? its driving me nuts..
Thank you.... It's getting there.... but the device list contains more then 2 devices (MacAdd RSSI Name)
So this works for the first one and then the second Mac contains the rest.
@TIMAI2@ABG Thanks for your help so far. I have manage to Achieve the first part of listing the Mac's as Tags and the rest of the information as the value. I'll post my blocks in the event that it might help someone else. It was of trial and lots of errors.
I fear I'll get more headaches trying to work out now the original question of trying to work out how I can check if there are any MAC matches in Location1 vs Location2....
This hand crafted example is the data structure I imagined ...
macIDs is the bucket, and its tags are the mac IDs.
Each mac ID has under it subtags (is that a Firebase thing?) for each of the locations that see it in their device list.
Each tag = mac ID / location has the value true.
This enforces uniqueness, so when a location sees a mac ID it only needs to set value true for tag macID/location under bucket "macIDs".
I'm guessing if you request the value for tag 0A:7B:CF:AF:06:F9 you will receive the dictionary {"loc2":true,"loc3":true} or the JSON equivalent.
I have not tested this, since I don't have that many Bluetooth devices.
Further details ...
This assumes you trim the fat off the mac ID before you add it, and you don't care about the fat. If you care about the fat (stuff that appears after the macID in each item if the device list), that changes the tree structure. (example to follow)
This also assumes the extra stuff with the mac ID belongs only to the mac ID, and not to the connection between location and mac ID. That would require moving the auxData subtags to under each macID/location branch.
If you are thinking of doing mesh networking, and you want a way to see which devices connect to which other devices, you will also need to know what the MACID of a device is, in itself.
You might need an extension to look into this. (I have not looked into this.)
Alternatively, you would have to rig your app to send and receive messages like "What is your name?" and respond to such messages.
Thanks mate. No mesh networking required.
I find navigating the firebase buckets the most dificult.
I have it working ok ish with trimming all the fat off.
But still recording it the fat in a list and might work out a way where at the end I can back fill the fat. Havent really decided yet. I appreciate all the help.