Wiki

Clone wiki

scapi / Home

SCAPI

SCAPI is a command line tool which runs on Raspberry Pi devices and communicates through TCP/IP with Micset Scada application. It allows reading/writing IO GPIO ports and some periferials. SCAPI uses WiringPI to access GPIO`s and peripherials

Usage

Just run "scapi" file under raspberry pi terminal with sudo priviledges. Server address and port are obtained from the device host, but can be optionally set as application arguments. How to run with default address and port: $pi@raspberry: sudo ./scapi How to run with optional address and port: $pi@raspberry: sudo ./scapi -a 192.169.0.152 -p 7438 Scapi Raspberry PI TCP/IP server (http://www.micset.net) Options: -v, --version Displays version information. -h, --help Displays this help. -a <ip address> Server address -p <port> Server port which server will listen -l Enable logging to file. Disabled by default If you enable logging, log file will be created in the same directory where the scapi is. When it exceeds 30 MB it will be deleted and recreated due to keep small footprint.

Specification

Every tcp packet must end with CRLF Packet has the following format:

Capture.PNG

Where "XX" is Raspberry BCM pin number. ##Examples

(Set pin 17 value to HIGH and pin mode to output)

#!c++

GP17=1 mode 1;

(Set pin 17 value to LOW)

#!c++

GP17=0;

(Read pin 17 value)

#!c++
GP17 = ?;

(Set pin 17 value to HIGH and pin 9 to low)

#!c++

GP17=1;GP9=0;

(Set pin 17 mode to output and pin 9 to input)

#!c++

GP17=1 mode 1;GP9=1 mode 0;

If the packet is sent succesfully server will response with the same string or with the error description. The "mode" keyword is not returned in the response. If the pin mode couldn`t be set successfully corresponding error string is returned.

Updated