Take control of your SAP testing with UiPath Test Suite
Jornada Formativa Qualcomm y Movilforum: Alljoyn
1. Open Source. Open Possibilities.
Overview of the AllJoyn™
Development Framework
Nick Clarey
January 11, 2013
2. Agenda
What is AllJoyn?
What About Other Peer-to-peer Solutions?
AllJoyn Fundamentals
Add AllJoyn to an Android Application
Add AllJoyn to a Unity Application
Q&A
PAGE 2 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
4. Why Peer-to-peer (P2P) Is Hard
P2P Friction Developers Face Today
Device Service
Discovery Discovery
Pairing Platforms
Security Radios
Ad Hoc Transient
Networking Devices
PAGE 4 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
5. AllJoyn Makes Peer-to-peer Frictionless
DISCOVER ADAPT MANAGE INTEROPERATE EXCHANGE
devices and to apps and transports like Wi-Fi across disparate Information in
applications devices and Wi-Fi Direct programming a secure manner
around you coming and message routing languages,
and going across them operating systems,
and bearers
PAGE 5 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
6. What Is AllJoyn?
Open Source Application Development Framework to Enable
Ad Hoc, Proximity-based, Peer-to-peer Networking
AllJoyn brings proximity awareness to mobile apps, unleashing a whole new set
of user experiences to smartphones, tablets, PCs, TVs and more
PAGE 6 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
7. AllJoyn is a Software Framework
Applications
Open Sourced (Apache 2.0 License)
Third-
Multiplayer Party
JamJoyn™ Media Social Chat or OEM
Gaming Enables Developers to Easily Add P2P
Experiences to Their Apps
AllJoyn Development Framework S
C++ Java JavaScript Objective-C CLR O o
p u Application Layer Discovery
e r (What services are running on nearby
Network Cross- Wireless- devices that are reachable)
Discovery Security Pairing n c
Management Platform Optimized
e
Application Layer Security
(What information can a service access
Wi-Fi Direct Wi-Fi BT on your phone, what’s off limits)
Chipset Interoperate Across Different OS
and Bearers
(Developer does not need to know
anything about Wi-Fi, Wi-Fi Direct,
Android, Windows, etc.)
Tablets Mobiles Televisions Laptop/PC
PAGE 7 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
8. What New Experiences Can AllJoyn Enable?
ENTERTAINMENT
MULTISCREEN COLLABORATIVE
& GAMING
EXPERIENCES EXPERIENCES
EXPERIENCES
AllJoyn Ushers
in New User
Experiences for
Smartphones, Tablets,
PCs & TVs
GAMES OFFICE SOCIAL IMAGING TV
APPS NETWORKING APPS CONNECTIONS
PAGE 8 Open Source. Open Possibilities.
Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
9. Open Source. Open Possibilities.
What About Other
P2P Solutions?
PAGE 9
10. What About Existing Protocols?
AllJoyn DLNA® UPnP Bonjour
Other peer-to-peer
Multiple wireless transports platforms focus on
Application Centric
their own ecosystem
Device Centric
Could be standards
Network management that are slow to change
and fixed in design
App development
framework
Media streaming & security AllJoyn is a complete
package that works
Control plane across different operating
systems and programming
Discovery languages to provide
a complete solution
IP Transport
PAGE 10 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
12. AllJoyn Fundamentals
AllJoyn is a distributed software bus
Each device runs a bus daemon
Applications communicate directly only with the daemon
Daemons on each device communicate with daemons on other devices
Daemons do message routing and namespace management
Bus formation is ad hoc
Based on proximal discovery
Abstracts multiple discovery mechanisms
Protocol is transport independent
Supports Wi-Fi currently
Working on Wi-Fi Direct
PAGE 12 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
13. What Operating Systems and Languages?
TODAY LANGUAGE BINDINGS
Android Windows® 7 C++
Linux C
2.1 (Éclair) and newer and XP (native implementation)
iOS/OS X Windows® RT Windows® 8 Java C# Objective C
(Unity)
IN DEVELOPMENT/DEMONSTRATED
JavaScript C#
(General)
AllJoyn is open source and available
http://www.alljoyn.org
PAGE 13 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
14. AllJoyn Distributed Software Bus
Device 1 Conceptually peers are
applications not devices.
AppX AppY
IP or Bluetooth Applications communicate
Local socket with a local daemon
Daemon
Daemons handle routing
between devices
Device 2 Device 3
AppX AppZ AppY AppZ
Daemon Daemon
PAGE 14 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
15. Ad Hoc Bus Formation
Device Device
Client App Find-Name Advertise-Name Service
App
request request
Eureka!
Daemon Daemon
Actual discovery mechanism is transport dependent:
On Wi-Fi a light-weight IP multicast protocol
On Wi-Fi Direct pre-association discovery
PAGE 15 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
16. Ad Hoc Bus Formation
Device Device
Service
Client App
App
Peer Session
Daemon distributed bus Daemon
Once connected daemons form a single bus with a shared namespace
Peers can discover when other peers join or leave the bus
Peers can make RPC calls and send and receive events
Session reference counting keeps device-to-device connections alive
Multicast events can be sent to all peers in the session
PAGE 16 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
17. Object Model
AllJoyn applications expose their functionality via objects
These are typically organized in a hierarchy
Objects implement interfaces (one or more)
Interfaces are composed of members, which fall into three categories
Methods – classic OO object interaction
Signals – asynchronous event notification
Can be broadcast, multicast, or point-to-point
Properties – data members
These are accessed by built-in get/set methods
PAGE 17 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
18. Bus Attachments, Objects, Proxy Objects
An application needs Bus Objects implement interfaces Proxy Bus Objects are local
a Bus Attachment to Bus Objects path names look like file representations of remote
communicate with the bus paths, e.g. /org/AllJoyn/Games/chess Bus Objects.
Bus Attachments provide a root (/) Bus Object have methods than can be Applications use proxy bus
for the object hierarchy called remotely objects to make method
calls to remote objects
Bus Objects can emit signals
Application Application
Bus Attachment Bus Attachment
Proxy
Event Object
handler Bus
PAGE 18 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
19. Connect to the AllJoyn Bus
mBus = new BusAttachment(getClass().getName(), BusAttachment.RemoteMessage.Receive);
This object represents
mBus.useOSLogging(true);
the connection to the
mBus.setDebugLevel("ALLJOYN_JAVA", 7);
bus (daemon)
mBus.registerBusListener(new LocalBusListener());
status = mBus.connect();
Connect the
if(Status.OK != status) {/*ERROR */}
attachment to the bus
Application Application
Bus Attachment Connect Bus Attachment
Bus
PAGE 19 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc. * Code snippets licensed under the Apache License, version 2.0 http://www.apache.org/licenses/LICENSE-2.0
20. Register Bus Objects
/* Define an interface that will be your AllJoyn interface for P2P communication */
@BusInterface (name = "org.alljoyn.bus.samples.training")
Define the Interface that
public interface AllJoynTrainingInterface {
@BusMethod(signature = "s")
represents the methods
public void TraningMethod(String arg) throws BusException; of your P2P application
}
class TrainingService implements AllJoynTrainingInterface, BusObject { Implement the interface
public void TraningMethod(String arg) { /* some code */ } and BusObject so we can
} register this with the bus
Create an object for the
theService = new TrainingService();
Status status = mBus.registerBusObject(theService, “/TrainingService”);
service and register with
if(Status.OK != status) {/*ERROR */} the AllJoyn Bus
Application Application
Bus Attachment Bus Attachment
Bus Bus
Connected Object
Tree
PAGE 20 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc. * Code snippets licensed under the Apache License, version 2.0 http://www.apache.org/licenses/LICENSE-2.0
21. Register Signal Handler
/* Define an interface that will be your AllJoyn interface for P2P communication */
@BusInterface (name = "org.alljoyn.bus.samples.training")
Define the Interface that
public interface AllJoynTrainingInterface {
@BusSignal(signature = "s")
represents the methods of your
public void SignalMethod(String arg) throws BusException; P2P application
}
/* in the application register the class that implements the SignalMethod handler*/
Let the Bus know what class
status = mBus.registerSignalHandlers(this);
contains the handler for signals
if(Status.OK != status) {/*ERROR */}
/* Here is the handler */
This method executes when a
@BusSignalHandler(iface = “com.alljoyn.bus.samples.training”, signal = “SignalMethod")
public void SignalMethod(String arg) { /* some code */ }
signal is sent out assuming device
is connected on same session
Application Application
Bus Attachment Bus Attachment
Signal
Handler
Bus
Connected
PAGE 21 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc. * Code snippets licensed under the Apache License, version 2.0 http://www.apache.org/licenses/LICENSE-2.0
22. Advertise Well-Known Name
Status status = mBus.advertiseName(“com.alljoyn.org.samples.training”, SessionOpts.TRANSPORT_ANY);
if(Status.OK != status) {
Register with the bus that we
/*ERROR – Failed to advertise name*/
status = mBus.releaseName(“com.alljoyn.org.samples.training”);
are going to be aliased the
} com.alljoyn.org.samples.training class
“com.alljoyn.org.samples.training”
Application Application
Bus Attachment Advertise Bus Attachment
Signal
Handler
Bus
Connected
PAGE 22 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc. * Code snippets licensed under the Apache License, version 2.0 http://www.apache.org/licenses/LICENSE-2.0
23. Discover Well-Known Names
class LocalBusListener extends BusListener {
public void foundAdvertisedName(String name, short transport, String namePrefix) {
}
public void lostAdvertisedName(String name, short transport, String namePrefix) {
Listener class for discovery
}
public void nameOwnerChanged(String busName, String previousOwner, String newOwner) {
events. This is where we are
} informed of other services
}
…
...
Status status = mBus.findAdvertisedName(“com.alljoyn.org.samples.training”);
if(Status.OK != status) {/*ERROR */}
…
… Look for a com.alljoyn.org.samples.training service
“com.alljoyn.org.samples.training”
Application Application
Bus Attachment findAdvertised Bus Attachment
Signal
Handler
Bus Bus
Listener
Connected Connected
PAGE 23 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc. * Code snippets licensed under the Apache License, version 2.0 http://www.apache.org/licenses/LICENSE-2.0
24. Create a Session
class MySessionPortListener extends SessionPortListener {
public boolean acceptSessionJoiner(short sessionPort, String joiner, SessionOpts sessionOpts) {
Listener class for session events.
return true;
} Lets us accept sessions and
public void sessionJoined(short sessionPort, final int sessionId, String joiner) { informs when users join.
mBus.setSessionListener(sessionId, new MySessionListener());
}
}
--------------
Mutable.ShortValue agreedUponPort = new Mutable.ShortValue(55); /* value can be 1 to 32767 (max short) */
SessionOpts sessionOpts = new SessionOpts();
sessionOpts.traffic = SessionOpts.TRAFFIC_MESSAGES; We create the session based on
sessionOpts.isMultipoint = true;
the Session Options we pass. We
sessionOpts.proximity = SessionOpts.PROXIMITY_ANY;
sessionOpts.transports = SessionOpts.TRANSPORT_ANY; can specify the transport interface
Status status = mBus.bindSessionPort(agreedUponPort, sessionOpts, new MySessionPortListener()); here for the supported types
if(Status.OK != status) { /*ERROR – Could not create a session*/ }
Application Application
Session
Port Bus Attachment Bus Attachment
Listener
Signal
Handler
Bus
Connected
Session Session on port 55
Listener
PAGE 24 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc. * Code snippets licensed under the Apache License, version 2.0 http://www.apache.org/licenses/LICENSE-2.0
25. Join a Session
short agreedUponPort = 55; /* value can be 1 to 32767 (max short) */
SessionOpts sessionOpts = new SessionOpts();
Mutable.IntegerValue sessionId = new Mutable.IntegerValue(); We have already found the name
Status status = mBus.joinSession(“com.alljoyn.org.sample.training”, agreedUponPort , sessionId, so we now join the session
sessionOpts, new MySessionListener());
if(Status.OK == status) {
/* NOW CONNECTED */
} else if(status == Status.ALLJOYN_JOINSESSION_REPLY_ALREADY_JOINED) {
/* ALREADY JOINED */
class MySessionListener extends SessionListener {
} else { public void sessionLost(int sessionId) { }
/* ERROR */ public void sessionMemberAdded(int sessionId, String uniqueName) {}
} public void sessionMemberRemoved(int sessionId, String uniqueName) {}
}
True or False
acceptSessionJoiner
Status.OK
sessionJoined
Application joinSession
Application
Session
Port Bus Attachment Bus Attachment
Listener
Signal
Handler
Bus Bus
Listener
Connected Connected
Session Session on port 55
Listener
PAGE 25 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc. * Code snippets licensed under the Apache License, version 2.0 http://www.apache.org/licenses/LICENSE-2.0
26. Open Source. Open Possibilities.
Add AllJoyn to
an Android Application
PAGE 26
27. Steps to Add AllJoyn to Existing Application
Download complete documentation here:
https://www.alljoyn.org/docs-and-downloads/documentation/guide-alljoyn-development-using-java-sdk
https://www.alljoyn.org/docs-and-downloads/documentation/alljoyn-android-environment-setup-guide
First: Import AllJoyn libraries
Create libs folder that contains:
alljoyn.jar
armeabi/liballjoyn_java.so
Second: Modify manifest to include permissions
Third: Add AllJoyn code
PAGE 27 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
28. AllJoyn for Android as a Service
When an Activity implements AllJoyn the connection does not persist
unless the activity is active
This can be used but is not recommended
A Service can startup on device power on
Complex AllJoyn interactions or delays will block a UI thread
Depending on AllJoyn interface design remote devices can communicate
to show notifications or toasts
NOTE: The service is waiting for AllJoyn callback and does not consume device resources,
so battery performance is maintained
PAGE 28 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.
29. Open Source. Open Possibilities.
Add AllJoyn to a
Unity Application
PAGE 29
30. Add AllJoyn Unity Extension to Existing Application
Supported platforms
Currently supports Android & Windows desktop
iOS support in development
Download complete documentation here:
https://www.alljoyn.org/docs-and-downloads/documentation/alljoyn-unity-setup-quick-start-guide
First: Import AllJoyn extension
Drop the AllJoynAgent prefab into your scene
Second: Modify manifest to include permissions
Third: Add AllJoyn code
Development using Unity Editor w/ C# scripts
PAGE 30 Open Source. Open Possibilities.
MAY CONTAIN U.S. AND INTERNATIONAL EXPORT CONTROLLED INFORMATION. Qualcomm Innovation Center, Inc.