Set Azure IoT Edge Module Device Wide Setting - azure-iot-hub

Is there a way to set a twin setting that is visible to all edge Modules running on a device? Rather than repeat the same setting inside each edge module's twin definition?

You can define a reported property on edge device twin that all modules can read from.
I was also checking if you could add Device Configurations to address edge modules but that looks like to be not possible as of today. You could add a feature request for that here.

Related

Android Emulator connect external storage Device while running

I have an App that needs to detect, if a USB Storage device is getting mounted. Can i simulate the mounting of an USB Storage Device while the Emulator is already running? This way i can debug the behavior of my app.
As i know, for registering the mounting and unmounting of the USB Storage Device i can use the StorageVolumeCallback(). What do i have to do to write a simple .txt File to that attached USB Storage Device?
Im having trubble to create a StorageManager inside my ViewModel because i do not have access to the Context.
Im thankful for any Tipp related to USB Storage Management at all.
Info:
API Version: 31
IDE: Android Studio
Language: Kotlin
Edit:
So i do not necessarily need to have a external usb drive mounted at startup. If its possible with adb it would be great if i could just forward a usb Pendrive to the running emulator when i need it. Something like adb connectUsbDevice -deviceid=****,vendorid=***
There isn't a .NET library I'm aware of which can do this. However, please refer to this post where the brilliant answer shows how to do this interfacing with the Win 32 API.
How do I disable a system device programmatically?
You'll need a combination of this, and a WMI query to find an attached PnP device of type storage. As a clue:
using (var searcher = new ManagementObjectSearcher(#"SELECT * FROM Win32_USBHub"))
{
collection = searcher.Get();
}
Change Win32_USBHub to the correct class if this isn't giving you what you're looking for.
EDIT: Be warned. If you're disabling storage devices, make sure they're not in use. That's what the "Safely remove USB" option is for in Windows.
Another option, if you don't need to emulate this in code, use a real USB storage device inserted in the system and use PowerShell to get, disable, and enable the device.
The Cmdlets you'll need are:
Get-PnpDevice
Disable-PnpDevice
Enable-PnpDevice

OpenThread Border Router setup on RPi Zero W

I am currently building a cost efficient Open Thread network. In my setup i have few Full thread devices and Minimal Thread Device which will be sending data to cloud via Border Router. I have currently setup a RCP design Open Thread Border Router on RPi 3B+ by following the open thread docs and its working fine.
Doc Link: Open Thread Border Router Build and Configuration
Now as i want my final product to be as cost efficient as it can be, i would like to consider using RPi Zero W for setting up my Open Thread Border Router. So i was following the same steps mentioned in OTBR doc to setup it on RPi Zero W, i came across this line in Step 3 which states " Before you continue, make sure your configured hardware platform is connected to the internet using Ethernet. The bootstrap script disables the platform's WiFi interface and the setup script requires internet connectivity to download and install several packages. "
But my RPi Zero W only have WiFi interface. So i wanted to know, is it even possible to run OTBR setup on RPi Zero W ?
I have also read in docs that "Open Thread Border Router (OTBR) provides support for the Raspberry Pi 3B or newer (RPi) platform". But have anyone tried the same setup on RPi Zero W and was successful ? Because in the end as i said, i would like my final product to be as cost effective as possible.
Also find the attachment of the error i am facing:
If you are not setting NETWORK_MANAGER=1 when running ./script/setup, I think it would work with just the Wi-Fi interface.
You can try running the following setup command:
INFRA_IF_NAME=wlan0 ./script/setup

How do I get valid lastActivityTime and cloudToDeviceMessageCount values for an IoTHub device?

When I query the device twins for my active devices, either in code (via the C# SDK or in the Device Explorer), lastActivityTime is always "0001-01-01T00:00:00Z" and cloudToDeviceMessageCount is always 0. Valid fields appear to be deviceId, the etags, status, connectionState, and lastUpdated on the properties metadata fields. Is there additional configuration or provisioning I need to do to obtain the additional information?
We can start to see the Device twins get updated only if we have any status updated from any particular devices, Please see the below images for a detailed steps to demonstrate the device twin updated properties. For example if your device is shutdown or disabled as explained in the below images.
Steps: VS code the easy way.
1) Go to the Azure portal-->IoT Hub -->Device and 'Disable' its connection
2) Go to VS code , right click the device and select 'Get Device Info'
3) You will see the device twin is reported as the status is "Disconnected" and even the 'StatusUpdatedTime and 'LastActivity' are also reported for the first time and will continue to keep reporting if there is an activity on the particular device.
Steps: Device Explorer, the easy way
1) Open the Device Explorer Twin, Messages to Device-->Select your device and send a Message. You can use the VS Code to Get Device info again as showed in the previous step. Here in the below image you can see the "cloudToDeviceMessageCount":1 , keep on sending further messages from Device explorer and check the message count.
More info can be obtained from Understand and use device twins in IoT Hub.
Step: Cloud to device messaging: Azure Portal
Please read more info about Cloud to device Messaging
Step: Using Azure IoT service SDK NuGet package. C# Sample App C2D
Happy Azure IoT Learning

Screen Sharing on webRTC

Is it possible to capture desktop screen sharing through webRTC.. As we know that it just captures the screen on the browser tab but is it possible to capture the whole desktop screen like navigating through files on computer or opening and viewing files like pdf etc..
Currently, only "stateless" screen capturing is available in RTCWeb implementations (both chrome & firefox). E.g.
Install chrome extension and then try this demo
Above demo will simply capture screen of "any" opened application's screen. Though, such screen capturing API fails to capture screens of full-screen game applications.
More information available here:
https://developer.chrome.com/extensions/desktopCapture (HTTPs+getUserMedia+postMessage)
Regarding remote desktop sharing from a web-browser, it has a pile
more security risks associated with it compared to screen sharing. The
UI/security aspects will be tough to deal with, and the feature will
be very susceptible to social engineering -- phone call: "this is
Google/Dell/Computer-Management; we've detected your machine has a
virus on it; could you browse to and we'll assist you in
removing it" -- etc. Ref
Yes, it's possible. At least using Chrome. There are several ways of doing it, but the simplest one is:
Add this constaint when you invoke getUserMedia:
constraints.video.mandatory.chromeMediaSource = 'screen'
When starting chrome, use this argument (chrome version > 35):
--enable-usermedia-screen-capturing
You can find an example of sharing screen and recording the shared screen at a remote server repository here:
https://github.com/Kurento/kurento-tutorial-js/blob/develop/kurento-recorder-screen/static/index.js
If you try to execute that example, play close attention to the security restrictions. All signalling needs to travel using TLS. Using raw HTTP will produce chrome to refuse sharing screen.
Yes it is. I recently worked on WebRTC and was able to stream desktop easily. Following links helped me implement my requirements :
Firefox Extension : http://mozilla.github.io/webrtc-landing/
Dont forget to add your *.github.io to about:config -> getUserMedia screensharing allowed domains
Google Chrome extension : https://developer.chrome.com/extensions/samples#search
Open this in Run : Chrome.exe --enable-usermedia-screen-capturing
Other Reference : https://github.com/muaz-khan/WebRTC-Experiment

Geofence API Worklight

I'm developing a Worklight Application that uses Geofence APIs. everything is working on the Worklight web emulator but I dunno how to test this feature on a mobile device.
How can I test going inside a Geofence radius? can I emulate GPS coordinates?
Thanks,
You can use the emulation capabilities in Android (DDMS perspective when using the Eclipse ADT plugins), or in XCode (for iOS). Note that in Android, the timestamps used when manually giving data points start from midnight for the given date.
As mentioned by Srik in the comment above, there also exist additional applications which you can use to feed in mock geo locations (although you may need to turn on the Allow Mock Locations option in the developer settings area).