Continuing from the previous posts, I would like to write about setting up the development environment for using the Chord Android SDK and give an overview of the main classes to be used for your first program (to come in a later article).
This is towards aiding android developers in writing apps for the Samsung Android Contest.
- Download the Samsung Chord SDK available here
- Download the Samsung Chord SDK emulator also available here (need to accept the license agreement in order to download both)
- Add the Eclipse plugin for Chord SDK as described in "Chord SDK Emulator Guide ver1.2".
- You can download sample apps from the chord sdk link and run it on the emulator.
- The screen shot shows the basic interface of the sample demo. Of course, this can meaning fully execute only after you start the Chord Relay server in the eclipse environment which shows the console and how the UDP broadcast is happening from the emulator. This allows you to do basic stuff like Starting Chord, Joining and leaving a channel.
While the above shows the basics in terms of getting up the first Samsung chord SDK app to work, we need to understand what the Android SDK gives us and what are the classes we have to use to create our own app.
What are the basic classes and interfaces provided by the Chord Android SDK? All of the fundamental ones are described here:
ChordManager This forms the core of the SDK. This is used to create a Node and helps in managing which nodes are connected to which channels. If you want to know more about channels and nodes, please refer the previous article.
This is the class that hides all the network complexity from the developer. These are the basic features provided by this class:
- Tells you the list of available network interfaces like wi-fi or Mobile Access Point etc.
- It gives you an option to start and stop chord
- It gives you an option to leave or join a channel
- Helps you list all the channels the node has joined
- And also provides a way to hook up a network listener to respond to changes in the network status.
Most of the main service or game or whatever your application is aiming to achieve through node interactions should be through using the Chord Manager. However, your app the game or service will also have to provide implementation for 3 listeners:
- INetworkListener- ChordManagerhas to listen on this listener to understand the changes in the network state whether connected or disconnected to the network (of choice wifi, wifi direct etc.)
- IChordChannelListener It is through this listener you will have to implement all actions that need to happen when a node joins the network or leaves a network. Through this you also need to implement what happens when a file/data is received or sent.
- IChordManagerListener is a listener that needs to be implemented when you start your ChordManager. This is required to handle the changes when a ChordManagerstarts. Also, after starting, the ChordManager, if there is an error or a network disconnect, what should the ChordManagerdo is defined in the implementation of this listener.
The above 4 classes/listeners help in implementing your own service that can be used with all your nodes in the network.
However, while you have the entire above service ready, you need to decide which channels are you interested in interacting with? It could be the public channel or a private channel with a specific name or even many at a time.
The specific channel implementations are those classes that a developer needs to develop by implementing the IChordChannelInterface.
The interface provides the methods for sending and receiving data.
So, in summary, you have the crux of what you really want to do in your own implementation of the IChordChannel.
However, the ChordManagerhelps you manage connecting and communicating with various nodes in the private or public channels by using 3 listeners.
It is as simple as that. Hope this clarifies the Samsung Chord SDK a bit in order for you to be able to take part in the Samsung Smart App Challenge.
Sponsored by Samsung
0 comments:
Post a Comment