4.2.1 Start Master and Gateway
The instructions in this section are slightly different from Section 4.1.1 since the gateway software in run on an IoT board (either Edison or Raspberry Pi). Therefore, after starting Master, we will access the IoT board remotely to start the gateway program.
Note: Before entering this section, if you have run the example in the last section, you need to follow the instructions in the Section 4.1.5 to flush the cache files.
On the computer, download the source code from github as follows.
git clone -b release0.4 http://github.com/wukong-m2m/wukong-darjeeling
Build infuser
cd <path_of_source_code>/wukong-darjeeling/src/infuser/ gradle
Copy the configuration file for Master
cd <path_of_source_code>/wukong-darjeeling/wukong/config/ cp master.cfg.dist master.cfg
Check the network information for Master.
ifconfig # In this case, the network interface of Master is eth0. # The IP address of Master is 192.168.4.17
Note: This IP address will be the MASTER_IP at step 9.
Start Master
cd <path_of_source_code>/wukong-darjeeling/wukong/master/ python master_server.py
From the computer, open a new terminal and use the SSH command to connect to the IoT board. Although we use Edison in this section, the same operations can be used on Raspberry Pi.
ssh root@<IP address of Intel Edison board>
Download the source code to the IoT board after SSH is successful started.
git clone -b release0.4 http://github.com/wukong-m2m/wukong-darjeeling
Copy the configuration file for gateway.
cd <path_of_source_code>/wukong-darjeeling/wukong/gateway/ cp gtwconfig.py.dist gtwconfig.py
Configure gtwconfig.py according to the network information.
ifconfig # Use this command to check network interface of IoT board. # In this case, the network interface of Edison is wlan0.
vim gtwconfig.py # if you cannot use vim, please install it with "opkg install vim" # Change MASTER_IP to IP address of your computer # Change TRANSPORT_INTERFACE_ADDR to network interface of IoT board
Start gateway program on the IoT board
cd <path_of_source_code>/wukong-darjeeling/wukong/gateway/ python start_gateway.py