Network access in a windows phone 7 background agent - networking

I have an app that uses a background agent to access the web and the local network via wi-fi - not cellular. When the phone is locked, the wi-fi network is not available when the background agent runs - at least on the Samsung Focus Flash phone. I also have an older LG Quantum phone which seems to work ok when the background agent runs - at least when it is plugged in. I'm trying it now without being plugged in to see if that accounts for the difference in behaviour.
(UPDATE: IF the Samsung Flash Focus is plugged in (charging), it also provides wi-fi access when the background agent starts, so that explained the difference in behaviour between the Samsung and the LG Quantum.
So, now the ONLY question remaining is "How can you force the phone to turn on the wi-fi when the background agent starts AND it is NOT plugged in?" )
I use the method NetworkInterface.GetIsNetworkAvailable() to test if the wi-fi network or any network is available when the background agent starts and also use
DeviceNetworkInformation.ResolveHostNameAsync(
new DnsEndPoint("microsoft.com", 80),
NameResolutionCallback,
null);
to determine which network is actually used.

On Windows Phone 7, WiFi only stays if one of the following conditions is true:
AC Power
Back light on
Data activity
Now, I believe some apps have a way to spoof data activity (something about background audio I think), but I am not sure how to.
See: http://lumiatips.com/keep-wifi-alive-for-windows-phone-homebrew.html

I think what you want is to make background agent run every 30 minutes or so. If that is correct then I am afraid there is no way to do that. When the device is inactive windows phone does not schedule background agent to save battery. This is a good design.
However once you touch the power button and get the lock screen the background agent of your app should run in 2 - 3 seconds or so. That serves the purpose most of the time.
Generally background agent while making a network call, turns on the network be is Wifi or cellular.

Related

Need help for a deeper understanding of BLE

I have to write a BLE application on an embedded device and there are some features where I'm not sure if BLE supports that or whether I've to create some wrapper around everything or if it's maybe not possible at all. The gerenal descriptions of Bluetooth and BLE I found around the internet usually only cover the overall functionality but don't go in too much detail. If this post gets too complex I'll split it up into different smaller ones.
I use the STM32 BlueNRG-MS chip
1. Discoverability (resolved)
The user has to be able to disable the BLE function in case there are several devices in reach. I see that there are functions aci_gap_set_discoverable() or aci_gap_set_non_discoverable() but altough I set it to not discoverable I can still see it in the LightBlue App on my mobile. How would I correctly disable the BLE functionality of a device to make sure no one can see it or connect to it?
Update: Okay that has been a mistake from my end, if I call the aci_gap_set_non_discoverable() function it is actually undiscoverable. So that's fine.
2. Only accept connections of paired devices
I'd like to achieve a behavior such that, if you have an unpaired phone you have to set the BLE device into a pairing mode in order to connect. If the phone has already been paired, the BLE device shall accept the connection request regardless of whether it's currently in pairing mode or not. Is this what the whitelist should be there for or do I have to do this manually by saving the address of the device after successful pairing? If whitelist is the right approach, I read that newer phones cause issues with whitelisting because they change their address on a regular basis, how can I handle this? That's actually where I thought I'm gonna work with the "discoverability".
3. Automatically reconnect
I'm not sure if this topic has to be handled on the BLE device or on the mobile phone. E.g. my phone is paired with my car's radio, so whenever the phone is in the car it automatically connects - how is this done? It's still the phone that acts as central device I assume?

how get the images from the flying drone to the phone or cloud

we are doing a project on image processing using a camera,raspberry pi3 and a gsm module. Above mentioned things are with a flying drone. I can send a notification message to a mobile using gsm module if required object detected on the cam. But we store that image to view on a webpage or through a mobile app easily. while it's flying it can't connect to the internet. So can you suggest a solution to get those images when it is inside our home wifi range.(any how we can get the images from sd card but i need to get those as soon as possible it detected the wifi) . Thanks in advance
You could consider using "tethering", a.k.a. "Personal Hotspot" in Apple parlance, on your mobile phone.
Basically, you would enable the Personal Hotspot on your iPhone and allow your RPi to connect to it via Wifi. You would have to check your setup, but my iPhone takes IP address 172.20.10.1 for itself and dishes out IP addresses to clients which are the same but with the 1 replaced by a small number under 13.
You can see from here how to setup your RPi to automagically connect to your Hotspot whenever in range. You could also consider fixing a static IP address when on that network, so you know where the RPi will show up for sure.
You would then ensure that Apache, or maybe lighttpd which is lighter weight, is running on your RPi.
Then, your app on the RPi would store its image as image.jpg in Apache's DOCUMENT_ROOT directory, probably /var/www/html/image.jpg but check.
Now, on the iPhone, start Safari and browse to:
http://172.20.10.N/image.jpg
where N is a small number. You should see your image and be able to save it to DropBox or Photos or iCloud Drive for others to see.
Of course, once your RPi is connected to your iPhone's hotspot, it can FTP or ssh copy the image to any website or other server on the Internet it has access to itself.
I have understood your question also I have cheapest solution to build your project. you will be needing 3 modules
ESP8266 (Wifi module)
SD card logger
Camera module(go with your choice, try ESP8266(But I have not tried it))
Combining all these can get your work done. But most instructing part is When connected with wifi it should transmit video to webpage or app and when not connected should log video to SD card
Below is my try to solve your problem, if you have any doubts feel free to ask your question.
ESP8266 is an WiFi module, you can connect it with an hot-spot or an router, similar to any WiFi device's on successful connection it throws 200,OK failing will throw 404 or so. Technically just like any TCP devices it will work. You can connect, disconnect, send and receive data continuously using software(using code you write).
0-code for camera unit starts
1-try connecting WiFi && start the camera and start logging into SD card //InCase if WiFi module takes longer time than usual to connect, this will prevent data from losing
2-if connection failed - continue writing to SD card
3-else(connection made) - start streaming the data && stop the SD card logging and save the file and create a new empty file so that we can save on next connection out without wasting data.
4-check for connection status in regular interval (goto step2).
5-on any external inputs(like click an image)
most important thing: code for your camera interface should work independent from the flight controller code.
-NandhaFrost

How can I display dBi signal strength instead of graphical bars in B315s or any other 4G router?

I got an antenna for my 4G router (Huawei B315s), I want to start aligning and directing this thing to the signal source, but the signal bars are not accurate enough.
Is the there any way to get it to display the signal in dBi?
I have Kali and windows 10. If there is any software on one of them please lead me to it.
Many Huawei routers expose dBm values via an API, which you can access simply with a web browser. On my B310s pointing browser to
http://192.168.64.1/api/device/signal
displays, as an example
-7dB -89dBm -71dBm 12dB 7
the 2nd one is rsrp.
I found I have to open the normal router home page first to make this work.
There's a python package if you want to do fancy stuff like send SMS's
https://pypi.org/project/huawei-lte-api/
Update: I've since found some software that makes this a lot more user friendly - for Android: HuaCtrl; for Windows: LTEInspecteur.
Looks like there is a Windows Utility that can connect to Huawei HiLink devices call Huawei Toolbox. Use the dBm value for RSSI and RSRP as the signal strength indicators for each antenna.

Bluetooth Hands Free Profile (HFP) just call notification, no audio?

I write an QT application on my laptop (Debian 8). I want to be notified if there is a new call on my phone available (Android).
Is it possible to just notify the laptop without being the laptop a headset?
I already managed to get a connection to the HFP, and my laptop gets a 'RING' signal, but when i want to answer the call, my mobile phone shows a bluetooth speaker /headset connected (in call display) and everything what is spoken is lost on both mobile phones.
So it would be great to just notify about a new call.
Thank you!
I assume you want to keep the audio stay at mobile phone side; is there SCO/eSCO connect/disconnect API's on your laptop? if yes, just reject the audio connect request, or disconnect/switch the audio if it connected.
There are may no audio handler on your PC yet so you could not found the audio.

Downloading data to a PIC micro from the web

I have a client that would like a small PIC board that plugs into a PC's USB as a dongle in HID mode. It would basically just transfer small amounts of data over RF to another device across the room.
They would like the data to come from the web. ie. user clicks a link in their browser which wakes up the PIC board and begins a download to the PIC device without the need for another application to visibly popup in front of the user.
I would think this can't be done without the setting up the browser preferences and assigning a custom application to recognize the data file. The security issues with a link initiating this kind of flow of events must be too great unless I'm missing something.
Has anyone done something like what I described above?
You could write a small piece of software that runs in the background on the PC (e.g. a Windows service), and:
Interfaces to the PIC device via USB
Provides a web interface on port 80 or probably some other port, which the browser can then connect to.
If the PIC device is network connected (e.g. has an Ethernet connection, and its own IP address on the network) then the PIC device could provide a web interface to control it. I don't know how feasible it is to fit a small web server onto a PIC though--that would be a tight fit.
Yeah that sequence of events doesn't seem too kosher. Perhaps a browser plugin or a program running on the PC that handles communication between the PIC and web would be better?

Resources