On Azure IOT Hub, Is it possible to create a device which acts an alias for an already deployed device? - azure-iot-hub

For Azure IOT Hub - I am working on a project where I would like to create some scripts based around the device name of an IOT device in the field. The device name already has details related to the location and device number of the location (which is what the script will pull).
Example H4C1F5Device3, where H4C1F5 is the postal code, and device 3 refers to the 3rd device in this location.
However due to a mixup in deployment, some devices don't match this naming convention and make scripting a little broken.
So my question is there a way to create an "alias"/dummy device in IOT hub with the correct name which can point to the previously deployed device with the "incorrect" name?
So far I have only looked at solutions in the Portal (no CLI, Node.js, etc.). I have tried making changes in the "Device Twins" page, but it does not accept changes when attempting to save.
Would appreciate any help on this. The Azure documentation is quite good, but I'm having trouble finding the solution to this exact query.

There is no such feature in Azure IoT Hub. You could create the new device IDs and reprovision your device with the new credentials.
It's also good practice not to store this kind of information in the device ID. You could use tags on the device twin (or desired properties if the device needs to know), unlike the device ID they are mutable.

Related

How to connect to Cumulocity services in order to add multiple devices data

I'm currently building a dotnet core project that receives data from multiple devices and has to send them over to Cumulocity.
So the flow of the app would be something similar to:
dotnet core app receives new data
connects to cumulocity account
creates device with name according to data received
sends data
repeat for multiple devices
I've been doing this for the past week using this code.
It works fine but then i noticed that calling the client.CreateDevice(...) was not creating new ones when presented with different data, it always hit the same one.
This tells me that i'm probably doing this wrong, that this library is to be used only within devices and not this way.
So my question is, to handle/send multiple devices data to the platform which library should i be using (if any)?
Thank you.
I figured it out, when connecting to Cumulocity the ClientId value will identify the device, to create new ones i just map that property to my devices ID.
Problem solved.

Android, Getting inconsistency in User Current Location.?

I am new in android and wanna get user current location using GPS_PROVIDER, but every time getting different-different location how can I use Google Play Services. and what is the best way to get accurate location in android.
Thanks you.
In general there are two different types of locations available through the Android API.
One is the GPS-Location which only works outdoors and which has an accuaracy between 5m and 50m.
The other kind of location is the so called Network-Location which is a loaction measure based on Wifi Networks in you surrounding and GSM-Base-Stations which have a accuracy between 100m and 1500m. This localization technique also works indoors, because it only requires you smartphone to have network access. The accuaracy gets better in urban areas where a lot of Wifi and GSM-Base-Stations are located. The more GSM-Base-Station / Wifi hotspos are available the better is the accurarcy of the loation measurement. It can also get down to 5m.
When requesting such an location Google does internally some magic to compute the position. This request requires a internet connection (you don't need to explicitly give the permission). Interanally Android sends a request to a Google server which contains fingerprints of the surrounding GSM-Base-Stations and afterwards computes your location (if you are curious you can find the code here).
With GPS-bases location the location accurarcy is the same all over the world without any internet connection, but works only outdoors.
With my applications I implemented a logic which detects if GPS is present or not and if not I switched to network localization, this works fine.

How to list the available Wifi access point in worklight

I have to list the available wifi access point in my app by using worklight . How to do that using worklight.
For some sample code showing how to continually acquire all the access points for a set of SSIDs see:
Differentiating between indoor areas in the Knowledge Center.
You can use a wildcard (*) for the SSID and MAC in the access point filters.
If you just want a one-time acquisition use the WL.Device.Wifi.acquireVisibleAccessPoints API.
Note that on non-Android platforms, you are limited to information about the connected access point. See here for more on platform restrictions.

CoreBluetooth - get all devices connected to Bluetooth peripheral

Is there a way how to get list of all devices connected to the Bluetooth peripheral?
I want to connect to iBeacon and check if another iPhone is connected to it.
No, two reasons why not:
iBeacons are not connected to the iOS device, iBeacons are broadcast only and no back communication exist from the phone to the beacon.
Knowing details of other BT 4.0 Centrals connected to a Peripheral are not in line with the the privacy features of Bluetooth 4.0. iOS and other Centrals are are using resolvable private addresses, in order to avoid situation like you are describing.
#barbazoo is correct that you cannot do exactly what you are asking because iBeacons only transmit data -- they have no idea what devices see them.
You can accomplish something similar, however, if you have an app running on each of the iOS devices you mention, and you have a server where you can build a web service. The web service would expose two methods:
reportIBeaconVisible(iBeaconProximityUUID, iBeaconMajor, iBeaconMinor, myPhoneAdvertisingId)
queryVisiblePhones(iBeaconProximityUUID, iBeaconMajor, iBeaconMinor)
The app would report each iBeacon it sees using the first method, passing the iBeacon's identifiers, along with the phone's advertising identifier to the server.
The app could then use the second method to ask the server what other phones have seen the exact same iBeacon, which would return a list of phone advertising identifiers.
You'd have to have logic on the phone to only report data to the server at a reasonable frequency. You'd also need code on the server to automatically delete phone records in the list if the phones haven't reported seeing a beacon in a certain time interval.

What is the best server side solution for a real-time GPS tracking system

Well, I tried to ask this question as a comment on this question, but I thought that maybe no one will notice it, so I decided to ask it as a separate one.
The question is about how to do real-time GPS tracking system things; if we have the following scenario:
Rather than connecting a GPS receiver to a PC, the user will have a mobile device with an integrated GPS receiver.
Location data will be sent over mobile network using GPRS data connection to a server side.
The data will be processed and a KML path file will be created and updated on time intervals and used to track the user using Google Earth.
The question is: what is the best method to accomplish this scenario for the server side; is it a web service, a web application, a windows service, a windows application or what exactly? Taking into account that the system will serve a number of users simultaneously, and that more users may use the system in the future(scalability issues).
Thank you in advance and I highly appreciate any help :)
What kind of device are you using exactly, something like this or something more sophisticated / configurable? If we assume that the device sends its data over TCP, I would consider the following approach with separate input/output processes:
Input: a process listening specific TCP port and storing incoming coordinates to database with a device id. Preferably, your listening loop must be able to handle simultaneous connections without them blocking each other.
Output: web application reading coordinates from database for a given device id and displaying them through the Google Earth API.
Use whatever programming language(s) you are familiar with.
For me there is a technical limitation/risk here -> the mobile device, and its connectivity.
1) What are your requirements? Do you need to support various mobile devices or will you focus on only one platform ?
2) More importantly, you have to understand that GPRS data connections differ from a PC connected to the Internet. There are various connection restrictions imposed by different mobile operators.
If I was to design such a system in order to minimise those risks I would go with a web server running on port 80 which the mobile devices would upload their Long/Lat through POST (or even GET to simplify things).
EDIT: Regarding scalability, it would be very easy to scale things up in the future using tried&tested load-balancing techniques.
EDIT2: Whichever technology you decide to use, i would HIGHLY recommend that the first thing you do is to mock up a prototype. Those connection restrictions could be show-stoppers. Ideally you need to explore them before you have made any serious investment.