Skip navigation links

Package com.xconns.peerdevicenet

PeerDeviceNet enables P2P, M2M connection and communication among mobile,IoT devices (phones, tablets, etc.).

See: Description

Package com.xconns.peerdevicenet Description

PeerDeviceNet enables P2P, M2M connection and communication among mobile,IoT devices (phones, tablets, etc.).

At mobile devices, PeerDeviceNet runtime (Router) runs as android services in a background process. Currently it includes the following services
  1. ConnectionService, supports the following functions:
    1. connect, disconnect networks, detect attachments and detachments (wifi, wifi direct, mobile hotspot).
    2. perform peer devices discovery
    3. handle device connections and disconnections.
  2. GroupService, supports the following functions:
    1. join/leave communication group, detect peer devices joining or leaving.
    2. send messages to peers in group and receive messages from peers in group.

PeerDeviceNet APIs provides asynchronous messaging interfaces between clients and Router services (Connection Service and Group Service). Router services will expose their APIs as asynchronous messages (or one-way AIDL methods). Similarly clients will provide async messaging (or one-way AIDL methods) APIs to allow Router services to call back or notify clients for events such as network attachment and detachment, peer device connection and disconnection.

Both runtime/Router and api have been published as two jar/aar files at Maven Central. You can download the latest jars from MavenCentral Site, or grab via Maven or gradle as following:

  1. API: peerdevicenet-api.jar
    1. maven
    2. <dependency>
      <groupId>com.xconns.peerdevicenet</groupId>
      <artifactId>peerdevicenet-api</artifactId>
      <version>1.1.8</version>
      </dependency>
    3. gradle
      com.xconns.peerdevicenet:peerdevicenet-api:1.1.8
  2. Runtime: peerdevicenet-router.aar
    1. maven
    2. <dependency>
      <groupId>com.xconns.peerdevicenet</groupId>
      <artifactId>peerdevicenet-router</artifactId>
      <version>1.1.8</version>
      <packaging>aar</packaging>
      </dependency>
    3. gradle
      com.xconns.peerdevicenet:peerdevicenet-router:1.1.8

These asynchronous messaging apis between clients and Router services can be accessed in three ways:

  1. intent actions
  2. Intent API provides high level access to Router's features. To use this API, all you need is to have PeerDeviceNet (Router) installed on users devices to gain the runtime support. Apps send normal android intents using PeerDeviceNet specific action names and pack message data as intent "extra" data items with PeerDeviceNet specific keys. All the PeerDeviceNet action names are defined at Router.Intent class and "extra" data keys at Router.MsgKey class which you get when you add the client jar file to your project.
  3. one-way AIDL methods
  4. To access Router services thru these apis, you can use directly access aidl apis or use client wrapper classes RouterConnectionClient and RouterGroupClient. These wrapper classes also handle some common book-keeping for you. There is also DeviceInfo class and NetInfo class used at aidl apis which defines information about devices and networks.
  5. messages sent thru Messengers
  6. This api defines a group of PeerDeviceNet specific message ids to allow apps use android's "Messenger" design pattern to talk to Router services. Apps use messengers to send message data as a bundle with data items indexed by keys. All the PeerDeviceNet message ids are defined at Router.MsgId class and message data keys at Router.MsgKey class.
Skip navigation links