Manually configure network adapters on Android Things

Viewed 1373

I am trying to configure an Android Things client running on a Raspberry Pi 3b to connect to a third party device on a different network. I did hours of research, but couldn´t find a working solution.

Topology

The Topology consists of one Raspberry PI, the router and a third party device. The Raspberry PI is connected to the router via LAN and WLAN for failure safety and is part of the same network as the router.

The Problem

There is a third party device physically connected to the same router, but it has a different network configured. The configuration of the device can not be changed. Please have a look at the topology below.

I am able to connect to the third party device using MacOS or Windows by setting a static IP and changing the subnet mask of the network adapter to the same as the target.

The question: Is there a way to configure Android Things or modify the topology to access this device? (See red line in topology)

Note: I am aware of the messy way how this connection should work ✌

Topology

2 Answers

I would suggest you to refer to LoWPAN package from android things.

This package has several class which can help you to achieve your goal.

"How you can achieve this?", read below:

  1. You can create a scan operation using LowpanScanner class which will provide you callback from LowpanScanner.Callback class with LowpanBeaconInfo.

  2. Now use LowpanIdentity class object for network info provided from getLowpanIdentity() method of LowpanBeaconInfo class.

  3. How you should connect to device in this provided network? Try to join them using LowpanProvisioningParams class if it helps.

Reference to com.google.android.things.lowpan

Note: (personally, i have't tried it out but hoping that it's the best shot which would work for you, let me know if it works or not)

I know it's not much but hope this helps !


More about LoWPAN:

LoWPAN is an acronym of IPv6 over "Low-Power Wireless Personal Area Networks". It was originated from the idea that "the Internet Protocol could and should be applied even to the smallest devices," and that low-power devices with limited processing capabilities should be able to participate in the Internet of Things.

LoWPAN group has defined encapsulation and header compression mechanisms that allow IPv6 packets to be sent and received over IEEE 802.15.4 based networks. IPv4 and IPv6 are the work horses for data delivery for local-area networks, metropolitan area networks, and wide-area networks such as the Internet. Likewise, IEEE 802.15.4 devices provide sensing communication-ability in the wireless domain. The inherent natures of the two networks though, are different. Read More from here.

You can try to setup a virtual network, so you can use both, from adb shell execute this with "su" privileges:

ifconfig eth0:1 192.168.50.53 netmask 255.255.255.0
Related