I made an app that advertises an iBeacon. The UUID changes every 30 seconds. Within the UUID is the androidID of the phone and a timestamp. Both are encrypted. My smarthome system decrypts the UUID and gets the timestamp and the androidID.If both are valid the front door opens.
The app creates an UUID and starts advertising, stops after 30 seconds an creates a new one and restarts the advertising. This goes on for ever until the app (running in backround) doesn't get closed.
I wonder if it is possible to change the advertising data (UUID) without stopping and restarting the advertising??
Thanks!
Is starting with AdvertisingSet a solution??
The way to do this is via the setAdvertisingData() method. Calling this in the middle of advertising shouldn't be an issue (as long as you are on API 26 or later). From the Android developer website:-
Set/update data being Advertised. Make sure that data doesn't exceed
the size limit for specified AdvertisingSetParameters. This method
returns immediately, the operation status is delivered through
callback.onAdvertisingDataSet().
Advertising data must be empty if non-legacy scannable advertising is
used. For apps targeting Build.VERSION_CODES#R or lower, this requires
the Manifest.permission#BLUETOOTH_ADMIN permission which can be gained
with a simple manifest tag. For apps targeting
Build.VERSION_CODES#S or or higher, this requires the
Manifest.permission#BLUETOOTH_ADVERTISE permission which can be gained
with Activity.requestPermissions(String[], int). Requires
Manifest.permission.BLUETOOTH_ADVERTISE
Have a look at the links below for more information:-
How do you update the Android BLE advertising data at runtime
Dynamically changing BLE data in Android
BLE advertisements changing in Android
Related
I'm using BTool, together with a TI Launchpad and the nRF Connect mobile app on my Samsung S21. I am curious, what type of services nRF Connect can be used, that send notifications to my TI Launchpad whenever their value is changed. Not periodically. Only after their value is changed.
I tried using a Battery Level service, but I'm not sure on how to "subscribe" to that service (how to enable notifications) from BTool.
Any advice?
According to this BTool User Guide I found the process of enabling notifications is as follows:
In order to enable notifications, the client device must write a value of 0x0001 to the client characteristic configuration descriptor (CCCD) for the particular characteristic. The handle for the CCCD immediately follows the characteristic value’s handle. Therefore, a value of 0x0001 must be written to the “handle + 1”.
The Battery Service you created has the UUID 0x180F and you have to get the handle for this characteristic. One way is described in the part about reading a characteristic by UUID.
To do this, you will first need to click the “Read/Write” tab in BTool. Select the option “Read Using Characteristic UUID” under the”sub-procedure” option in the “Characteristic Read” section at the top of the screen. Enter the UUID (note that the LSB is entered first, and the MSB is entered last) in the “Characteristic UUID” box, and click the “Read” button.
You can now access the CCCD using "handle + 1" as described earlier. To enable the notifications just write 0x0001 to that handle.
I'm developing a system to control a range of IoT devices. Each set of devices is grouped into a "system" that monitors/controls a real-world process. For example system A may be managing process A and have:
3 cameras
1 accelerometer
1 magnetometer
5 thermocouples
The webserver maintains socket connections to each device. Users can connect (via a UI - again with WebSockets) to the webserver and receive updates about systems to which they are subscribed.
When a user wants to begin process A, they should press a 'start' button on the interface. This will start up the cameras, accelerometer, magnetometer, and thermocouples. These will begin sending data to the server. It also triggers the server to set the recording mode to true for each device, which means the server will write output to a database. My question:
Should I send a single 'start' request from javascript code in my UI to the server, and allow the server to start each device individually (how do I then handle an error, for example, if a single sensor isn't working - what about if two sensors don't work?). Or do I send individual requests from the UI to the server for each device, i.e. start camera 1, start camera 2, start accelerometer, start recording camera1, etc. and handle each success/error state individually?
My preference throughout the system so far has been the latter approach - one request, one response; with an HTTP error code. However, programming becomes more complex when there are many devices to control, for example - System B has 12 thermocouples.
Some components of the system are not vital - e.g. if 1 camera fails we can continue, however, if the accelerometer fails the whole system cannot run and so human monitoring is required. If the server started the devices individually from a single 'start' message, should I return an array of errors, or should the server know which components are vital and return a single error if a vital component fails? And in a failure state, should the server then handle stopping each sensor and returning to the original state - and what if that then fails? I foresee this code becoming quite complex with this approach.
I've been going back and forth over the best way to approach this for months, but I can't find much advice online around building complex, production-ready IoT systems for the real world. If anybody has any advice or could point me towards any papers/books/etc. I would really appreciate it.
Thanks in advance,
Tom
What i have:
I am running a freeradius server fully configured of how i need it to be. Everything works just fine right now.
What i need:
I need the radius to put the devices in a seperate vlan before authentication and to run a vulnerability scan (nessus / openvas etc) on the devices in this vlan to check for software status ( antivirus etc. )
if the device passes the test the authentication should be done normaly.
if it fails it should be put into a third ( fourth if you count the unauth-vid ) vlan.
can someone tell me if this is doable in freeradius ?
thanks in advance for your answers
Yes. But this is a very broad question and is dependent on the networking equipment being used. I'll give you an overview of how I'd design such a system.
In general, you'll have an easier time if you can use the same DHCP server/IP range for your NAC and full access VLAN. That means you don't have to signal the higher networking layers in the client that there's been a state change, you can swap out VLANs behind the scenes to change what they can access.
You'd set up a database with an entry for each client. This doesn't have to be pre-populated, it could be populated during the first auth attempt. Part of each client entry would be a status field detailing when they last completed NAC.
You'd also need an accounting database, to store information about where each client is connected to the network.
If the client had never completed NAC checks before, you'd assign the client to the NAC VLAN, and signal your NAC processes to start interrogating it.
FreeRADIUS can act as both a RADIUS and DHCPv4 server, so you'd probably do signal the NAC process from the DHCPv4 side because then you'd know what IP the client received.
Binding the RADIUS and DHCPv4 sides can be done in a couple of ways. The most obvious is MAC, another common way is NAS/Port ID using the accounting table.
Once the NAC checks had completed, you'd have the NAC process write out a receipt in detail file format, and have that read back in by a detail file listener (there are examples of this in sites-available/ in the 'decoupled-accounting' virtual server files). When reading those entries back in, you'd change the state in the database, and send a CoA packet to the switch using information from the accounting database to identify the client. This would flip the VLAN and allow them to the standard set of networking resources.
I know this is very high level, documenting it properly would probably exceed StackOverflow's character limit. If you need more help with this, I suggest you research what I've described above and then start asking the RADIUS related questions on the FreeRADIUS user's mailing list https://freeradius.org/support/.
I am hitting 100 devices limit on PubNub's free plan, but most of those devices are not active. So can I somehow remove them ?
PubNub Daily Active Devices
They are not removable because it is a running count of unique devices per day. The next day, the count starts over. It is likely this is either a mobile app with frequently changing IPs (on the road, like ride share, taxi dispatch, etc) or you are using a host like Heroku or Google App Engine where each execution of PubNub operation (probably a publish), the server host is creating a new dynamic IP address.
If you are using GAE or Heroku or other host/platform/cloud that uses dynamic IPs when it creates a process, then you will continue to see higher than actual IPs (daily active devices). You will want to implement UUID reuse. The new pricing is based on UUIDs now anyways but PubNub will generate a new UUID with every PubNub init so you need to persist a UUID and reuse it (set the UUID on the PubNub instance) so it doesn't over count UUIDs.
I want to develop an iPhone application whose main function is to hang up an outgoing phone call after X amount of seconds/minutes have passed since the call was placed, not from when the call was connected. After hanging up, the application will automatically redial to continue the phone call without any user intervention. The application will only redial in the case the same application has hanged up the call. If any of the parties hang up the call, the application will not redial.
Expected features to be developed are:
Add and update a list of phone numbers to monitor
The user must be able to type in directly a phone number or select it from the address book. The list will show the name and phone number monitored like “Roberto Ibarra: 33 5555 5555”. This list will serve as the database of phone numbers the application will identify as outgoing calls that must be hanged up and redialed automatically after X amount of minutes have passed. The application must not affect incoming calls or outgoing calls to numbers other than the ones on this list.
If possible, the application must fully integrate with the OS dialing system so that calls placed from any part of the phone will be monitored. For example, if a call is dialed with voice commands it should be monitored by this application.
Alert and hang up
The application must send a BEEP 5 seconds before hanging up, so as to both parties in the call can hear it and be aware the call will be about to end. This will not be configurable by the user, it will always happen 5 seconds before ending the monitored call. If the call is an outgoing call and the number is part of the list of numbers to monitor, the application will then hangup the call once the X amount of minutes/seconds have been reached. This beep can be a DTMF tone.
Automatically redial a monitored call that was ended by the application
The application will automatically redial the number that was being called to continue the call ONLY if the call was automatically ended by the application because the time limit was reached. If the call was ended by the user, then the call must NOT be redialed.
Copy protection mechanism
The application must have a copy protection mechanism based on the phone's IMEI. The application must ask the first time for a code and show the phone's IMEI. The code will be generated by a third party website by entering the IMEI and if correctly entered in the phone, then the application will work.
The algorithm will be based on a hash from the IMEI and some seed to be determined. The crypt function should be something like MD5 or some other function available in the OS in the majority of the phones using the OS.
You cannot do this. You have no access to calls made from the device and certainly can't hangup any in process calls. The closest you can come is asking the phone application to dial a number.