Sie sind auf Seite 1von 15

Intel Do-It-Yourself Challenge

The network interface


Cdric Andreolli
www.Intel-Software-Academic-Program.com
paul.guermonprez@intel.com
Intel Software
2013-02-08

Agenda

Agenda
Introduction
Using Java sockets
A threaded application
A small server
Conclusion

Introduction

Introduction
For now, we've seen how to control the pololu card
with the phone.
Even if you can use the sensors, GPS, compass,
accelerometer, internet, etc, to create a smart
application that control your card, it is sometimes
interesting to have a manual control.
This set of slides will help you expose the
functionalities of the card through a
network interface.

Using Java sockets

Using Java sockets


Java offers an efficient an simple way to
manipulate network sockets.
You can basically use 2 different classes :
ServerSocket : allows you to accept incoming
connections.
Socket : Allows you to manipulate a socket, the
connection can be done via the connect()
method.

Using Java sockets


In addition to the philosophy that differs between
the client socket (Socket) and the server socket
(ServerSocket), there is a fundamental
difference when using a ServerSocket and a
socket.
In order to connect to a ServerSocket, the IP of
the device must be known and must be public.
We also want to use our Android application over
a 2G/3G/4G network.

Using Java sockets


The phone inside the 3G network can't be joined
directly.

Using Java sockets


Because of this limitation (the phone inside the
3G network doesn't have a public IP), we can't
use a ServerSocket.
The solution is to use an intermediate server with
a public IP. This server will use ServerSocket
attributes and will tunneled the data. (see next
slide)

Using Java sockets


Here is a scheme of the proposed solution :

Conclusion

Conclusion
Through the 2 previous set of slides, we've seen
how to develop a server application that controls
the pololu card via bluetooth or via USB.
Those course are also a good illustration of the
Android course.
You should be able to program some nice
Android applications right now !

License Creative Commons - By 3.0


You are free:
to Share to copy, distribute and transmit the work
to Remix to adapt the work
to make commercial use of the work
Under the following conditions:
Attribution You must attribute the work in the manner specified by the author or licensor (but not in
any way that suggests that they endorse you or your use of the work).
With the understanding that:
Waiver Any of the above conditions can be waived if you get permission from the copyright holder.
Public Domain Where the work or any of its elements is in the public domain under applicable law,
that status is in no way affected by the license.
Other Rights In no way are any of the following rights affected by the license:
Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations;
The author's moral rights;
Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.

Notice For any reuse or distribution, you must make clear to others the license terms of this work.
The best way to do this is with a link to this web page.
http://creativecommons.org/licenses/by/3.0/

Das könnte Ihnen auch gefallen