-
Notifications
You must be signed in to change notification settings - Fork 29
SWAPdmt (command line version)
This is the command-line version of the original graphical utility. This command-line application was developed in order to avoid most installation and compatibility problems of wxPython on recent versions of Windows. Due to its simplicity and ease of maintenance, SWAPdmt-cmd includes some features lacking in the GUI version, like control of regular outputs and wireless upload of firmware. SWAPdmt-cmd is in fact called to become the reference configuration tool for SWAP networks to the detriment of the GUI version.
SWAPdmt-cmd (SWAP Device Management Tool) is a command-line application designed to configure, read, control and upgrade SWAP nodes wirelessly. This application is based on pyswap and is entirely written in Python
Before installing SWAPdmt, you should check that your computer meets the following requirements:
Once the above requirements met, you can start installing SWAPdmt as follows:
1- Download the latest version of our Python tools. You will find there all the necessary to install pyswap and SWAPdmt.
2- Enter the pyswap directory and install the package with this command
# python setup.py install
At this point you should have all the necessary to run SWAPdmt from a terminal.
SWAPdmt can be run with or without parameters. If no parameter is passed as argument, SWAPdmt will take the necessary information from the (xml) configuration files in config/.
# python swapdmt.py
When passing arguments to the application, the config files will be updated with the new information. Running "python swapdmt.py --help" is the best way to check for possible arguments:
python swapdmt.py --help
usage: swapdmt.py [-h] [--port PORT] [--speed SPEED] [--channel CHANNEL]
[--netid NETID] [--address ADDRESS] [--security SECURITY]
optional arguments:
-h, --help show this help message and exit
--port PORT Serial port connected to modem
--speed SPEED Serial baud rate (bps)
--channel CHANNEL RF channel
--netid NETID Network ID
--address ADDRESS SWAP address of modem
--security SECURITY Security flag
Numeric parameters such as address, RF channel or Network ID can be passed either in decimal or hexadecimal format:
python swapdmt.py --address 1 --netid 0x1234 --channel 0
After calling SWAPdmt and once the SWAP server is initialized, you should see a ">>" prompt in the terminal. At this point you can enter any of the available interactive commands.
Interactive mode is the normal mode of operation of SWAPdmt. This means that the SWAP server is running and that the application has control over the SWAP modem. When in this mode, the user has access to the full set of interactive commands. Running "help" will show all the available commands.
>> help
SWAPdmt commands and syntax:
help Print help
quit Quit application
traffic <on|off> Print or hide SWAP traffic
hexfile <path to hex file> Enter hex file for SWAP firmware upgrade
list nodes Print list of nodes detected in the SWAP network
clear nodes Clear list of nodes detected in the SWAP network
node <addr> channel [<new_channel>] Print or set RF channel of node
node <addr> netid [<new_netid>] Print or set SWAP network ID of node
node <addr> address [<new_addr>] Print or set SWAP address of node
node <addr> txinterval [<new_interval>] Print or set Tx interval of node
node <addr> reg <reg_id> [<new_reg_value>] Print or set register value
node <addr> details Print product details of node
node <addr> restart Restart node (if it's not sleeping)
node <addr> program Program node wirelessly with hex file
Command: help
Print list of interactive commands and options.
Command: quit
Quit application.
Command: traffic <on|off>
Display (traffic on) or hide (traffic off) wireless traffic (SWAP packets) getting to the modem and leaving the modem.
Command: hexfile
Define path to the HEX file containing new firmware for a wireless node
Command: list nodes
Print list of nodes previously detected in the SWAP network. SWAPdmt needs the nodes to be restarted at least once. Once detected, all node information is saved so that the utility will be able to interact with the node without having to rediscover it on each session. Calling "clear nodes" will empty the current list.
Command: clear nodes
Empty list of discovered nodes. This is sometimes useful when you need to rediscover a node having the address of an old node or when you want to start working with a new SWAP network.
Command: node channel [<new_channel>]
Print current or set new RF channel for node, where is the current address of the node and <new_channel> is the new channel number. If the channel number is omitted then the current channel of the node will be showed from the terminal. SWAPdmt and node need to share the same RF channel in order to communicate between them.
Command: node netid [<new_netid>]
Print current or set new SWAP Network ID for node, where is the current address of the node and <new_netid> is the new network id. If the new ID is omitted then the current Network ID of the node will be showed from the terminal. SWAPdmt and node need to share the same Network ID in order to communicate between them.
Command: node address [<new_addr>]
Print current or set new device address for node, where is the current address of the node and <new_addr> is the new address. If the new address is omitted then the current node address will be showed from the terminal.
Command: node txinterval [<new_interval>]
Print current or set new transmission interval for node, where is the current address of the node and <new_interval> is the new transmission interval. If the new ID is omitted then the current Tx Interval of the node will be showed from the terminal.
Command: node reg <reg_id> [<new_reg_value>]
If <new_reg_value> is omitted, print value of register with ID passed as argument (reg_id). Ex: print value of register 0x0C from node 0x26:
>> node 0x26 reg 0x0C
Current register value is 0 (0x0)
if <new_reg_value> is specified then set new register value. Ex: set register 0x0C from node 0x26 to 37:
>> node 0x26 reg 0x0C 37
Got confirmation from node. New register value is 37
Command: node details
Print details about node with address passed as argument (). Example:
>> node 0x26 details
SWAP address : 0x26
Developer : panStamp
Product name : Binary/PWM output module
Regular registers :
Register ID : 0xb
Register name : Binary outputs
Register value : 0x00
Endpoint name : Binary_0_38
Endpoint value : 0x00
Endpoint name : Binary_1_38
Endpoint value : 0x00
Endpoint name : Binary_2_38
Endpoint value : 0x00
Endpoint name : Binary_3_38
Endpoint value : 0x00
Endpoint name : Binary_4_38
Endpoint value : 0x00
Endpoint name : Binary_5_38
Endpoint value : 0x00
Endpoint name : Binary_6_38
Endpoint value : 0x00
Endpoint name : Binary_7_38
Endpoint value : 0x00
Register ID : 0xc
Register name : PWM outputs
Register value : 0x00000025
Endpoint name : PWM_output_0_38
Endpoint value : 0x25
Endpoint name : PWM_output_1_38
Endpoint value : 0x00
Endpoint name : PWM_output_2_38
Endpoint value : 0x00
Endpoint name : PWM_output_3_38
Endpoint value : 0x00
Command: node restart
Restart node with address
Command: node program
Put node with address in wireless programming mode. This will lead the node to query the contents of the HEX file previously defined with hexfile. This command needs the remote device to have panStamp's SWAP firmware loader installed.