All Things CC:

All things Commuication & Computing….

SSDP Service/Device Discovery [Part 2, ROM]

leave a comment »

To begin my project – a Remote OSGi Manager (ROM) as described in my first part here, the first task I picked up was to try developing  a very rudimentary app that would discover the RTCOA Thermostat using the SSDP protocol. As you can see from the screenshot – it is really rudimentary user interface but my focus was to get my MVC right, and more importantly get the network interface going for the project. [BTW if you observe carefully – you can see the “Marvell” code that has been used in the RTCOA Thermostat].

 

 

Screen_shot_2012-04-10_at_6

 

After much searching and reviewing samples, I decided to go with the Cocoa Async Sockets, and I have ended up using them for all of the network interface in my iOS/iPad app. I got started with the AsyncUdpSocket to leverage it for running SSDP based discovery of the RTCOA Thermostat. The screenshot above was the start. I took the SSDP objects (serviceSSDP.m, serviceSSDP.h) and moved them to the bigger project. Also as a first step – the SSDP discovery code stopped after discovering the first controller. Given that in my project I was going to support multiple controllers, I ended up modifying the code to take into account that I should be able to discover multiple controllers (or devices) and then add them to a NSMutableArray.

 

 

//
//  serviceSSDP.h
//  SimpleSSDPDiscovery
//
//  Created by Ashu Joshi on 3/1/12.
//  Copyright (c) 2012 Movinture, LLC. All rights reserved.
//

 

#import <Foundation/Foundation.h>
#import “AsyncUdpSocket.h”
#import “connectedLifeController.h”

 

@interface serviceSSDP : NSObject

 

// This is the string that is Multicast to Discover the Controller
@property (strong, nonatomic) NSString *discoverControllerString;
// The Controller would respond with the string below upon discovery being received
@property (strong, nonatomic) NSString *responseStringFromController;
// The list of discovered controllers
@property (strong, nonatomic) NSMutableArray *controllerList;

 

@property (strong, nonatomic) connectedLifeController *currentController;

@property (strong, nonatomic) AsyncUdpSocket *ssdpSocket;

 

– (BOOL)startControllerDiscoveryProcess;

– (BOOL)startControllerDiscoveryProcess:(NSMutableArray *)listOfControllers;

@end

 

Once I got the Thermostat to discover using SSDP discovery code using iOS/iPad, I turned my attention to the Plug Computer. I created the framework for my bundle (OSGi terminology for an application). And the first thing I did was to implement code built out code in Java to run a SSDP “advertise” service on the Plug Computer. Before even migrating or trying the code on the Plug Computer I tried the code on my PC/Mac using Eclipse, once it was working I migrated it as a bundle/service in the OSGi framework on the Plug Computer. This code uses threading so that it is always running on the Plug Computer.

 

In the next part I will give an overview of the Java/OSGi code and the network interface implemented….
Advertisement

Written by Ashu Joshi

April 10, 2012 at 7:46 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: