All Things CC:

All things Commuication & Computing….

Archive for the ‘Development’ Category

Year In Review: Programming

with 2 comments

Beginning of the year I embarked on a getting back in touch with my programming skills… and this year has been really successful. Here is what I accomplished, over the weekends and late nights:

·         I programmed extensively in first of half on the year on IOS, especially IOS5 and iPad. I still need to work on my design skills but I covered a lot of ground Table Views & Controllers, Storyboards, Network Programming, XML parsing, Notifications, Pull To Refresh etc.).

·         I refreshed my programming skills in Java by programming in OSGi Embedded environment…

·         And to complete my journey – I signed up for courses with edX and Coursera on Cloud Programming. I would have liked to do a project or two of mine but I had to be satisfied with the assignments and the tests that were done as a part of the course. I ended up learning about R, Ruby and Rails. I had signed up for a few courses but the three that I completed were:

o   CS169.1x Software As A Service @ edX

o   CS169.2x Software As A Service @ edX

o   Computing for Data Analysis @ Coursera [Data Analysis using R]

Advertisement

Written by Ashu Joshi

December 28, 2012 at 3:30 pm

Posted in Development

Tagged with , , , ,

SSDP Service using Java/OSGi [Part 3, ROM]

leave a comment »

In the last part I talked about how I implemented the SSDP code on the IOS app, to make my device discoverable – it has to be running the “SSDP Advertiser” – or a server that is listening to discovery messages.

The SSDP service runs as a thread when the OSGi bundle is installed and started – “AdvertiseServiceSSDP()”. [The call before that – SocksServer is the class that implements the network interface between the IOS app & the Plug Computer as explained in the project overview.

public void start(BundleContext bc) throws Exception {
    this.bc = bc;
    nServer = new SocksServer(bc);
    advtROMService = new AdvertiseServiceSSDP(bc);
  }

Here is the SSDP code:

public void run() {
String msg = "LISTEN-FOR=THIS MESSAGE";
String chkResponse = "RESPOND-WITH-THIS-MESSAGE";
try {
int port = 1900;
InetAddress listenSSDP = InetAddress.getByName("239.255.255.250");
MulticastSocket ms = new MulticastSocket(port);  // Create socket
ms.joinGroup(listenSSDP);
System.out.println("\n Rcvr started, Ready to Receive... \n");
boolean match = false;
do {
byte[] response = new byte[256];
DatagramPacket rspPkt = new DatagramPacket(response, response.length);
ms.receive(rspPkt);
//System.out.println("\n Done Receiving!\n");
String getResponse;
getResponse = new String(rspPkt.getData());
match = getResponse.regionMatches(0, msg, 0, msg.length());
if (match)
{
System.out.println("Controller found\n");
// Send Response
InetAddress IPAddress = rspPkt.getAddress();
byte[] sendData = new byte[1024];
String sendResponse = chkResponse;
sendResponse += IPAddress.getHostName();
sendResponse += "/:portAddr";
System.out.println(sendResponse);
sendData = sendResponse.getBytes();
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, 1900);
ms.send(sendPacket);
System.out.println("Response Sent");
match = false;
}
} while(match==false);
} catch(Exception ignore) {
System.out.println(ignore.getMessage());
}
}

The above code when running on the Plug Computer(s) allows the IOS app to discover them. Of course the beauty is that this will work for all devices that support OSGi/JVM and have multicast networking support.

Written by Ashu Joshi

May 4, 2012 at 2:48 pm

The Power of Three

leave a comment »

There was a time when building a technology product and its functionality was largely contained into itself – ing was an island was perfectly fine. This was true of both enterprise and consumer products. A Set Top Box (STB) had no need for interactive functionality least of all a “companion application”, or a Thermostat in the house was manually operated. The rise of smartphones, increasing connectedness have changed that. The paradigm has changed. When products are designed and developed – it is no longer just about the hardware & software of the product you are building – it is equally important to design interactivity with a smartphone or tablet application and tying the functionality of the product with cloud services. And as I outlined in one of my previous posts – my re-engagement with programming & development would be at the “intersection” of the three elements:
1. Technology Product
2. Smartphone | Tablet Application
3. Cloud Services

Image

This is what I mean by the title – to deliver the best product experien
ce – the product strategy and planning has to be done keeping the three elements in mind – to bring together the  Power of Three. The challenge I had was wh
ere to get started because each of these areas offers attractive options. I had to filter them – and the primary one was that I wanted to make sure that it did not impede or conflict with my day job. So when I started about three months ago I had to stick to products, technologies that are available to mostly anybody and available openly without requiring any NDA. And here are the choices I made:
1. To use a proxy for the ‘technology product’ – instead of choosing a STB or a Gateway (and I have tons of product management experience in both) – I chose an embedded Linux-based device or server – a Plug Computer. It supports an ARM version of Debian or Ubuntu. And for creating applications on the Plug – I chose to go with OSGi running on open so
urce JVM.
2. The choice for Smartphone or Tablet applications was fairly easy – I chose IOS. And I specifically wanted to focus on programming with the large real estate screen of the iPad. Down the line I may expand this to support two more options – Android Smartphones and GoogleTV…
For Cloud Services – I have two choices Google App Engine or Amazon Web Services – but that the choice is still open…
Let me quickly talk about the application I have in mind though or rather what functionality I want to implement. I am going to write basic code on the Plug Computer that would support a network interface to collect data, diagnostics from the Plug by the IOS App. The code not the Plug would be (or is begin developed) using OSGi/JVM. I intend to incorporate addition to diagnostics, use the Plug to connect to some basic sensors such as Accelerometers or Zigbee Switches and using the network API to communicate the data/events gathered to both the IOS app and the Cloud. As I write this I have made good progress on the initial stuff so far and my subsequent posts would talk about them. But I do have a long way to go, and I am looking forward to it….
[Note: Attached a couple of sketches to illustrate my concepts using the great new Paper App for iPad.]
App

Written by Ashu Joshi

April 2, 2012 at 11:15 am