SmartConfig for iOS objC helper class

Hi all,

I wrote this small helper singleton class that should make the process of smartconfig in iOS a simpler process.

Note: you need to download the TI libraries (see readme).


Hey @frlobo thanks for sharing! This is a timely time to share this :smile: . You are probably already aware that we are planning on open sourcing our Spark iOS application just like we have for our Android app so others can use our mobile app templates to get going quick.

In a nutshell, the challenges that prevent us from open souring it are related to licensing–we need to jump through some hoops before we can open source it. Having your code available might make it easier for us to do this, much appreciated.

My Pleasure to help! If I can help in any other way, let me know!

1 Like

@frlobo Tnks a lot for you help. But, im not so good in programing, i have done all the steps from the readme until this part: ("How to use:). I don’t know where i have to implement the codes, and how to call the processes with a button. Cand you help with some exemple with the implematantion of the code? Or explain more how to use this in my code.

In any case,

Tnks alot.

Extremely sorry for this long delay… I was absent!

here’s a small demo that might help…

First copy all the LLSmartConfCenter stuff to your project by dragging and ticking in the “copy files if necessary”…

You will also need the CC3x stuff downloaded from Texas Instruments copied into your project, or included as per T.I instructions…

Now for our demo:

Open your AppDelegate.m file in XCODE.

After :

#import "AppDelegate.h"


#import "LLSmartConfCenter.h"

Then, right after @implementation AppDelegate,

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

With :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    LLSmartConfCenter *smartConfCenter = [LLSmartConfCenter sharedCenter]; //Instantiate the singleton.
    //You can set this manually or use this convenience method:
    //If manually, substitute the = [smartConf... With @"BaseStatioName"
    NSString *ssidOfWifiRouter = [smartConfCenter ssidForConnectedNetwork];
    NSString *wifiPassword = @"myPassword"; // The password of WiFi Base Station.
    NSString *encryptionKey = @"sparkdevices2013";  //This key was set by Spark.
    NSLog(@"The SSID of your network is sopposed to be %@", ssidOfWifiRouter);
    // The following line, starts broadcasting the settings to connect to
    // your wifi router to spark.. Make Sure Spark is in SSID setup mode.
    [smartConfCenter beginConfigForSSID:ssidOfWifiRouter
                        completionBlock:^(LLSmartConfStatus status) {
                            NSLog(@"Pairing Complete. All Done Now.. Hopefully :)");
                            ; //This line will run after pairing stopped or complete. Read the status.
    return YES;

NOTE: This will not work on the simulator. It has to be run on your device.

I hope I am not missing any steps… It’s been a long time since I did this.

Let me know if it works!