How to install & execute
From AMTech WikiDocs
Contents
Os and core components
Manual installation of initial components and prerequesites
- Installs Ubuntu OS on a Raspberry PI
- Boot PI and update packages:
-
sudo apt-get update
-
sudo apt-get dist-upgrade
- Install java 7 (if LLRPReader is needed)
-
sudo add-apt-repository ppa:webupd8team/java
-
sudo apt-get update
-
sudo apt-get install oracle-java7-installer
- Install nodejs 5.x by adding this repository 'deb https://deb.nodesource.com/node_5.x xenial main' with:
-
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
- and then:
-
sudo apt-get install -y nodejs
- Installs and configures Bluetooth core libraries
-
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev
- Allow nodejs program to bind to ports under 1024 (required by snmp related plugin):
-
sudo setcap 'cap_net_bind_service=+ep' /usr/bin/nodejs
- Allow nodejs to read from bluetooth devices (require by bluetooth related plugins):
-
sudo setcap 'cap_net_raw+eip' /usr/bin/nodejs
- Allow non-privileged users (belonging to gpio group) to run GPIO commands:
-
git clone git://github.com/quick2wire/quick2wire-gpio-admin.git
-
cd quick2wire-gpio-admin
-
make
-
sudo make install
M2MBridge installation
- Install git:
-
sudo apt-get install git
- Clone git repository (https://github.com/AMTechMX/M2MBridge.git)
- Delete unneeded plugins from /.../M2MBridge/plugins/xxx (optional)
- Install packages for m2mBridge core and plug-ins (https://docs.npmjs.com/cli/install:)
- Execute
npm install --save
at:- M2MBridge directory
- Each plugin directory
- LLRPReader plugin depends on java module and you should use the following options in the the
npm install
call: -
GYP_DEFINES="armv7l=0 javalibdir=/usr/lib/jvm/java-7-oracle/jre/lib/arm/server/" CCFLAGS='-march=armv7' CXXFLAGS='-march=armv7' npm install
- If you get this error; var cwd = process.cwd(); Error: No such file or directory #200
M2MBridge execution
- Customize the bridge configuration bridgeConfig,json, defining the templateId with the bridge instance from DAP to clone Cloud Configuration
- Execute node m2mbridge.js (located in the M2MBridge directory)
Tools for configuration
- If you want to connect a device (like the LLRP Reader) to your PI by sharing you network you may want to run:
-
nm-connection-editor
- Find there the connection that represents your ethernet card and configure in IPv4 Settings the method Shared to other computers
- If you want to guess the IP that is assigned through DHCP to a device connected by using the previously mentioned option, you can inspect the syslog with:
-
grep DHCPREQUEST /var/log/syslog
The ansible way
Remote debugging =
- Install VSCode in your machine https://code.visualstudio.com/
- If you need to modify the node code at the Raspberry Pi while debugging setup a share directory using samba
- Install Samba
sudo apt-get install samba samba-common-bin -y
- At M2MBridge directory run node --debug-brk M2MBridge.js
- If you want to modify