Transfer code from App to WiFi module - ios

The app I am working on is to control model trains. The train manufacturer has provided the code that would operate the train (for example, ring bell, move forward, etc.).
The WiFi module I would use for the app broadcasts a WiFi Network. In the Settings section of the iPad, the WiFi network can be located and connected to without the need of a password.
I need to figure out how my app can connect to that same WiFi network. From there each button on the app would be programmed to the specific manufacturer provided code. For example, the bell button has a specific code that when pressed that code is sent from the iPad to the WiFi module by way of the WiFi network. The the WiFi module is connected to a Command Base by way of a serial port. So the WiFi module sends the code to the Command Base. The Command Base then sends the code through 2.4Ghz frequency to the train where in our example it will ring its bell.
Any suggestions to programming the buttons & connecting to the WiFi network is appreciated. Thanks!

Apple does not allow you to change system settings like wifi network with your app. You simply need to instruct the user. You CAN provide them a link to the settings page however:
NSURL* settingsURL = [NSURL URLWithString:#”prefs:root=WIFI”]]; // objective c
[[UIApplication sharedApplication] openURL:settingsURL];
let settingsURL = NSURL(string: "prefs:root=WIFI") // swift
UIApplication.sharedApplication().openURL(settingsURL)

Related

iOS AFNetworking: Multiple WiFi Networks

Have a quick question on AFNetworking (2.0) Reachability Manager.
I have the code (iOS-Objective C) for checking the status of WiFi via Reachability Manager and all works fine-Good.
What happens when I have turned "ON" multiple WiFi networks in my device?
How does AFNetworking determine if WiFi is down or active?
If i am not wrong, when one WiFi network goes down, the other WiFi network will automatically be active right - i'm i making sense?
And finally, is it possible to have "AFNetworking" monitor for a specific "WiFi" network by a "WiFi Network Name" or something like that.
Cheers

Use Wifi Instead of Bluetooth in game development kit

I am using GameKit to connect 2 device (peer to peer) way.
I don't want to use bluetooth to connect the devices - I want to use the local wifi router.(the router does not have internet access).
I am able to do every thing using bluetooth but not wifi - I even modified this line:
picker.connectionTypesMask = GKPeerPickerConnectionTypeNearby;
to
picker.connectionTypesMask = GKPeerPickerConnectionTypeNearby | GKPeerPickerConnectionTypeOnline;
but this simple change added a tab saying online, when I tap it it does nothing and when I tap the other tab that says nearby it connects using bluetooth. What's the problem?

iOS WiFi notification API

Is there a way to programmatically subscribe to WiFi notifications on iOS?
For example, assuming the user has not disabled WiFi notifications, when they are within range of a WiFi network, the operating system provides a notification of available networks. Can an app subscribe to this notification and provide it's own notification to the user?
Could the app could even check the SSID to see if it is a specific network, and then perform some action?
Have a look at the Reachability demo and the System Configuration classes.
This SO question covers this ground and the SSID's: IOS notification of wifi connection including SSID
It looks like the Captive Network Support might also be useful, ito finding the names of networks to which the user is not connected.

Is there a callback/delegate to tell that the device is back to be connected (to carrier service or wifi) after offline?

Assume a device was offline with no service neither WiFi to begin with, is there a callback/delegate to tell that the device is back to be connected once the service or WiFi is available? or do we have to proactively pull the status?
You could check it with the Rechability class:
The Reachability sample application demonstrates how to use the SystemConfiguration framework to monitor the network state of an iPhone or iPod touch. In particular, it demonstrates how to know when IP can be routed and when traffic will be routed through a Wireless Wide Area Network (WWAN) interface such as EDGE or 3G.
here is an Example

Detecting Whether an iPhone has roamed from wifi to 3G or vice versa

G'day Guys,
I've been using the reachability API with reachability status callbacks to determine whether an application is connected over 3G or wifi. It's an application that acts as a voice extension for an existing piece of hardware and as such we're using the VoIP APIs to run in the background and accept calls etc.
Is there a definitive way other than using reachability status callbacks to determine whether you can access a particular IP endpoint or not? I could use an ASIHTTPRequest and then check if it timed out but that may cause potential problems for me in the long run.
I'm not looking for a programmatical answer but more any insights other developers would have on how to manage a roaming between the two in the background if you have a persistent connection. Basically if the device roams over to 3G I need to destroy the session on the device and if it roams back over to Wifi I need to recreate the session.
Any feedback or advice would be welcome.
The Reachability APIs will provide the connection change notifications to your app so that you can know when the connectivity changed from WWAN to wifi. It will not tell you if you've changed from Edge to 3G or LTE unfortunately. The Reachability API also has methods to test reachability to a specific host. So, in your app you can listen for the notifications that the connection method has changed, then when it does change test reachability to your target host and at that time make the decision whether to rebuild the session or leave it intact.

Resources