System Tools

Apex core system tools

System Tools

The Syrus 4 system tools are applications that are in charge of enabling/disabling and resetting specific hardware functionalities. They can also be used to interact with some Linux applications such as hostapd which is used for bringing up a hotspot. And finally the tools serve as a way to create functionalities such as tracking criterias, geofences and more, which is useful for fleet management.

These applications are accessed via the shell with apx- as a command prefix.

The standard response of these system tool command is JSON, thus you may find it useful to use jq to get a specific result.

# returns the last gps point
$ sudo apx-gps state | jq .LATEST_POINT
{"lat":25.945318,"lon":-80.452825,"alt":12.492,"speed":0.019,"heading":0,"epoch":1607006801}

# returns the first 5 geofences in the namespace applications
$ sudo apx-geofences getstatus applications | jq '.[0:5]'

# returns the name of all the geofences in the namespace applications
$ sudo apx-geofences getstatus applications | jq '.[] | {name: .geo_name}'

Result codes

They can be consulted by echoing the Linux exit status code $?. The most common result codes are:

  • 0: Action executed
  • 1: Catchall for general errors
  • 2: Misuse of shell builtins (according to bash documentation)
  • 22: Invalid argument
  • 90: Response too long
  • 126: Command invoked cannot execute
  • 127: Command not found
  • 128: Invalid argument to exit
  • 128+n: Fatal error signal “n”
  • 130: Script terminated by Control-C
  • 255+: Exit status out of range

Note that the sudo must always be in front of the apx command you want to send

Accelerometer / Microcontroller

apx-imu

Inertial measurement unit manager for the accelerometer and device's gyroscope. Allows you to set thresholds related to the accelerometer.

 sudo apx-imu [option]
 sudo apx-imu [parameter] [value]
[option]description
self_testStarts the accelerometer self-test. If the second parameter is not used it returns the motion state. It forces some of the events (motion, collision, hard_braking, etc) to be triggered.
self_alignmentGet/set the state of the self-alignment proccess. Take into account that the vehicle must be stopped/stationary on a level surface when starting this process.
config_listReturns the list with all the configured parameters.
eventsReturns the list with the last 25 acceleration events.
helpPrints this help message.

Use the following options to set/get the different parameters related to the accelerometer. If the second argument is not specified, it returns the value configured

Warning

Note that the CFG_ parameters require that the self_alignment procedure be previously done.

[parameter]description
MOTION_THRESHOLDFrom 10 to 500, Default: 30 (30*1 milli-g = 30 milli-g)
CFG_FORWARD_COLLISIONFrom -1000 to -15000, Default: -2000 milli-g
CFG_BACKWARD_COLLISIONFrom 1000 to 15000, Default: 2000 milli-g
CFG_LAT_COLLISION_FROM_RIGHTFrom -1000 to -15000, Default: -2000 milli-g
CFG_LAT_COLLISION_FROM_LEFTFrom 1000 to 15000, Default: 2000 milli-g
CFG_HARSH_FWD_ACCELERATIONFrom 200 to 600, Default: 260 milli-g
CFG_HARD_BRAKINGFrom -200 to -600, Default: -260 milli-g
CFG_CORNERING_RIGHTFrom -200 to -600, Default: -400 milli-g
CFG_CORNERING_LEFTFrom 200 to 600, Default: 400 milli-g

The alignment process can be found in the CONNECT page.

This process is required to trigger any of the acceleration signals that SyrusJS can trigger.

To get the status of the alignment process you can query:

sudo apx-imu self_alignment

The device will return one of these states

ALIGNMENT_CURRENT_STATE% completeddescription
11%Deleting previous alignment data
210%Waiting for GNSS signal
330%Running initial stage. Computing recorded data
450%Running second stage. Waiting for GNSS signal
570%Waiting for vehicle speed to go over 30kph
680%Waiting for a valid braking event
790%Braking event detected. Computing recorded data
8100%Alignment process done

Examples:

# Start the self alignment process:
$ sudo apx-imu self_alignment true

# Set the motion threshold to 40 milli-g:
$ sudo apx-imu MOTION_THRESHOLD 40

# Read the value of the harsh forward acceleration threshold:
$ sudo apx-imu CFG_HARSH_FWD_ACCELERATION

# Read the list of parameters configured:
$ sudo apx-imu config_list
{"MOTION_THRESHOLD":30,"CFG_FORWARD_COLLISION":-2000,"CFG_BACKWARD_COLLISION":2000,"CFG_LAT_COLLISION_FROM_RIGHT":-2000,"CFG_LAT_COLLISION_FROM_LEFT":2000,"CFG_HARSH_FWD_ACCELERATION":260,"CFG_HARD_BRAKING":-260,"CFG_CORNERING_RIGHT":-350,"CFG_CORNERING_LEFT":350}

apx-uchip

Tool to manage the microcontroller of the device. Note that this is done automatically after an apx-os-update

 sudo apx-uchip [option]
[option]description
updateStarts the updating of the microcontroller that it is in charge of controlling peripherals and power-saving mode
versionIt returns the current version of microcontroller application
check_updateIt returns "Update available" or "Updated" depending on if the microcontroller is updated or not

Example:

# Starts microchip update
$ sudo apx-uchip update

# Checks the version of the microcontroller
$ sudo apx-uchip version

Applications

syrus-apps-manager

Install, run, and manage applications on the device.

# syrus-apps-manager [option] [argument_1] [argument_2] [argument_3]
                                           [option]description
helpPrints this help message
install-appinstall an app from .zip file on the device, makes it available to create instances, takes as argument_1 the path where the zip file exists
update-app · download-appdownload a new version of the app from the repository declared for the app, takes as argument_1 the name of the app and argument_2 the new version to download, if argument_2 is omitted it will try to download the stable version if available
list-appslist the available apps installed on the device
delete-appdelete an app on a specific version, takes as argument_1 the app and argument_2 the version of the app
check-updateschecks for updates on every app thats exposes a repository on the manifest
list-instanceslist all the instances of apps running on the device
create-instancecreate an instance from a previously installed app on the device, argument_1 is the name of the instance, argument_2 the name of the app, and the argument_3 the version
update-instanceupdate an instance to a different version, takes as argument_1 the name of the instance and argument_2 as the version
delete-instancedelete an instance, takes as argument_1 the name of the instance
start · stop · restartstart,stop or restart one instance, takes as argument_1 the name of the instance
get-runningreturn a list of only running instances
statusreturn the status of one instance, takes as argument_1 the name of the instance
send-messageSend a message (via nc) to applications that expose a unix socket.
start-shellStart a shell (via nc) with applications that expose a unix socket.

Warning

Note that instances must start with lowercase, and contain no spaces or special characters.

Examples:

Manual application installation from source

$ cd /data/downloads
$ wget https://server.com/applications/customApp/1.0.0.zip
$ syrus-apps-manager install-app customApp /data/downloads/1.0.0.zip

Example using syrusjs

$ wget https://syrus4.dctserver.com/apex/applications/syrusjs/1.29.1.zip -O /data/downloads/1.29.1.zip
$ syrus-apps-manager install-app /data/downloads/1.29.1.zip
$ syrus-apps-manager create-instance test_instance syrusjs 1.29.1
$ syrus-apps-manager start test_instance
# Update syrusjs application 
$ syrus-apps-manager update-app syrusjs 1.29.1</span></b></p>

# Update an instance of syrusjs
$ syrus-apps-manager update-instance syrusjs 1.29.1</span></b></p>

# Send commands to a syrusjs instance
$ syrus-apps-manager send-message __cloud_syrusjs 'get signal_value isON'
signal value=true

$ syrus-apps-manager send-message __cloud_syrusjs 'get value $net_wifi.ip_address'
192.168.1.148

# Start a shell with syrusjs
$ syrus-apps-manager start-shell __cloud_syrusjs
get signals
define signal ...

Audio

apx-tts

Tool to convert text to speech in different languages. Use the apx-bt tool to pair to a compatible bluetooth device first.

 sudo apx-tts [language] [message]
[language]description
en-USEnglish
en-GBGreat Britain
de-DEGerman
es-ESSpanish
fr-FRFrance
it-ITItalian

[message] is the actual message to say

Examples

$ sudo apx-tts en-US 'Testing text to speech'

$ sudo apx-tts es-ES 'Una prueba de texto a voz'

Bluetooth

apx-bt

Bluetooth tool with BLE functions and pairing with compatible with bluetooth headsets. If you're looking for the text to speech function, check out the apx-tts tool.

 sudo apx-bt [action] [option]

Actions

[action]description
helpPrints this help message.
onWill enable the Bluetooth module.
offWill disable the Bluetooth module.
statusWill display core application version, prioritized audio, device MAC, device name, and the mode configured.
scanFollowed by time in seconds. Application will scan for nearby devices for up to 30 seconds.
pairFollowed by address. Will begin the pairing process with the device address. Device needs to have been previously scanned.
pair_forcedFollowed by address. Will force a pair process with the address.
connectFollowed by address. Attempt a connection with a previously paired device
unpairFollowed by address. Will unpair a previously paired device.
disconnectFollowed by address. Will disconnect a previously connected device.
switch_audioFollowed by address. Will declare the device to be the main source of audio.
infoFollowed by address. Will display information about the device.
info_allThis will display information about all of the recently discovered devices, if those devices are paired, or if they are paired and connected.
historyThis will display information about all of the devices that were discovered by the scanning process since last activation of the Bluetooth module
list_discoveredReturns the list of all the devices that have been discovered by the scanning process. Note: A device might be scanned and added to the list of paired devices but not appear in the list of discovered devices. Recommended to check both lists.
list_pairedReturns the list of all the paired devices.
list_connectedReturns the list of all paired and connected devices.
restartThis will restart the application module.
resetThis command resets everything regarding the application. All information about the devices, connections, and pairs will be lost.
routed_audioThis will display the address of the device producing audio.
soc_audioRoutes prioritized audio device to allow audio from SOC.
mdm_audioRoutes prioritized audio device to allow audio from MDM.
[option]description
device_addressDevice MAC address. A single string of hexadecimal is expected for the device_address
time_in_secondsTime in seconds.

Note that the switch_audio option is only relevant when you have multiple compatible speakers paired to the Syrus, and you want to switch which speaker to use to playback the audio without having to disconnect them.

Examples:
# Start a scan for nearby bluetooth devices for 15 seconds.
$ sudo apx-bt scan 15

# List discovered Bluetooth devices after scanning
$ sudo apx-bt list_discovered
{"C83432DA6A1C":"Family Room TV","000664EDF530":"CricutAIR2-F530","E8ABFB463615":"Boltune BT-BH010","84A444220FA2":"[TV]Samsung LED55"}

# Pair to a discovered bluetooth device with the MAC address: 02:06:EF:66:43:0A
$ sudo apx-bt pair E8ABFB463615

BLE Functions

 sudo apx-bt advertising [mode,flag,duration]
 sudo apx-bt auth [argument_1]
 sudo apx-bt change_auth [argument_1] [argument_2]
 sudo apx-bt send [argument_1] [argument_2]
[action]description
advertisingFollowed by desired parameters to enable or disable advertising, which type of advertising to do, and for how long to advertise. All of these values are separated by commas: mode,flag,duration. Refer to Advertising Table to configure which type of advertising to use. If not followed by anything shows parameters used.
authFollowed by the password. Only usuable from the BLE device that is connected.
change_authTakes two arguments. The old password and the new password that BLE devices must use for authentication. Passwords must be of 1 to 30 characters long and cannot contain spaces. Only 0-9,a-z,and A-Z characters are allowed.
sendFollowed characteristic and message. This command takes two arguments where the first argument is the characteristic to notify and the second argument is the message to send to the device that is subscribed for notifications. The message can be any NULL terminated string. Refer to Valid Characteristics.
pingUsed for maintaining a keep alive communication between a BLE device and this unit. Will return "pong".
change_nameTakes one argument. Will change both the Bluetooth name of the device and the BLE name being advertised by the device. The name will always lead with Syrus 4G. The name can be up to 15 alphanumeric characters.
Advertising
[mode,flag,duration]description
modeEither 0 or 1 for disable and enable respectively.
flagTo get the desired on state flag, simply add the hex numbers from Number.
durationA value in seconds between 30 to 300 seconds. A number more than 300 will force advertising duration to be 600 which means advertising is continuous, meaning advertising will always be on.
NumberNot addedAdded
0x001Local Random AddressLocal Public Address
0x002Non DiscoverableDiscoverable
0x004Non ConnectableConnectable
0x010Advertise Name OffAdvertise Name
0x020Advertise Tx Pwr OffAdvertise Tx Pwr
0x040No AppearanceAdvertise Appearance
0x100Peer Random AddressPeer Public Address
characteristicDescription
eventsTo be used for events that occurred
user_apps_consoleTo be used by internal user applications that wish to communicate with external user applications.
Examples:
# Advertising is enabled, discoverable (`0x002`), connectable (`0x004`), and the name is advertised (`0x010`) for 200 seconds.
$ sudo apx-bt advertising 1,0x16,200

# Send a json string to the events 
$ sudo apx-bt send events {"len":5,"value":"hello"}

Counters

apx-counter

Start device counters for ignition, distance and other metrics.

 sudo apx-counter [action] [namespace]
 sudo apx-counter [action] [namespace] [key] [value]
[action]description
startMust be followed by namespace. Will start the desired namespace. Creates it if it doesn't exist.
stopMust be followed by namespace. Will stop the desired namespace.
resetMust be followed by namespace. Will stop the desired namespace and resets the counter key values.
resetallSame as above only that thresholds are reset to default values.
setMust be followed by namespace key value. Key has its value set to value.
getMust be followed by namespace key. Will return the value of the key.
getallMust be followed by namespace. Will return the value of all of the keys.
deleteMust be followed by namespace. Will delete the namespace.
listNot followed by anything. Will list information about all known counters.
helpPrints this help message
[key]description
ODOMETERDistance traveled in meters with ignition on.
IGNITION_TIMETotal time ignition has been on in seconds.
IDLE_TIMETotal time ignition has been on in seconds with no distance traveled after the time defined in BEGIN_IDLE_TIME.
OVER_SPEEDTotal time in seconds that the speed has exceeded the threshold value defined in SPEED_THRESHOLD
OVER_RPMTotal time in seconds that the RPM has exceeded the threshold value defined in RPM_THRESHOLD
HARD_BRAKESTotal number of hard brakes produced.
HARSH_FWD_ACCELERATIONTotal number of harsh accelerations produced.
DISTANCEThe distance traveled in meters with no ignition.
RPM_THRESHOLDKey to define an RPM value that the vehicle must exceed to begin incrementing OVER_RPM
SPEED_THRESHOLDKey to define a speed value (km/h) that the vehicle must exceed to begin incrementing OVER_SPEED
BEGIN_IDLE_TIMEKey to define how long to wait in minutes before incrementing IDLE_TIME.

The namespace can be up to 50 characters long with no spaces. We recommend you define a schema: type:name:counter like driver:john:0

Examples:

# start custom counter
$ sudo apx-counter start custom1

# set the speed threshold to 100km/h for custom1
$ sudo apx-counter set custom1 SPEED_THRESHOLD 100

# get all the values of custom1 counters
$ sudo apx-counter getall custom1

ECU

apx-ecu

Tool to configure and read data from a vehicle's onboard computer using the CAN Bus.

 sudo apx-ecu [<action>] [--arguments]
[action]description
configureThis may take two arguments or no arguments. The valid arguments are --interface and --interface_mode, where --interface is the interface to configure and --interface_mode is the desired mode for that interface. When no arguments are used, this will return the current configuration used by the ecumonitor.
listen_modeThis may take one or no arguments. This will force ecumonitor to not send data to the specified interface. The valid argument is --listen_mode. If no argument is given then this will return the current listen_mode being used.
list_parametersNot followed by any arguments. Returns a JSON of all the parameters read with the unique id and value.
logThis takes three arguments. The valid arguments are --log_time, --file_name, and --log_interface. Where --log_time is the time in seconds starting from 1 second up to 40 seconds to save to the log file --file_name from the --log_interface. The file name is a relative file path name and only letters and numbers are allowed for the file name. All logs are saved in /data/users/syrus4g/ecumonitor/ecu_logs/.
stopNot followed by any arguments. Halts operation of ecumonitor until it is reconfigured; this will make the configuration section from ecumonitor.conf obsolete.
restartNot followed by any arguments. Restarts the ecumonitor.
versionNot followed by any arguments. Will return the version of this tool and the version of the ecumonitor core application.
decodeThis may take two arguments. The valid arguments are --unique_id and --value. This will decode the --value from the --unique_id returning a different JSON based on the unique_id to decode. If no arguments are passed then the list of valid unique_ids will be printed.
clearNot followed by any arguments. Will clear any previous returned by list_parameters command.
helpReturns this help message.
Argumentsdescription
configure[--interface=<interface>] [--interface_mode=<interface_mode>]
listen_mode[--listen_mode=<listen_mode>]
log[--log_time=<time_in_seconds>] [--file_name=<file_name>] [--log_interface=<interface>]
decode[--unique_id=<unique_id>] [--value=<value>]
Valid interface
PRIMARY_CAN
SECONDARY_CAN
Valid interface_mode
J1939_250KHZ
J1939_250KBPS
J1939_500KHZ
J1939_500KBPS
ACCESSORIES_XXXYHZ
ACCESSORIES_XXXYBPS
DISABLED

Note: Where XXX is the baud rate and Y is either K(Kilo) or M(Mega).

Valid listen_mode
NONE
PRIMARY_CAN
SECONDARY_CAN
PRIMARY_N_SECONDARY
ALL

Examples:

# Configure the primary ECU cables to work with J1939 @ 250 KBPS
$ sudo apx-ecu configure --interface=PRIMARY_CAN --interface_mode=J1939_250KBPS

# Set the listen only mode for SECONDARY CAN 
$ sudo apx-ecu listen_mode --interface=SECONDARY_CAN

# Decode a J1939 data trouble code*
$ sudo apx-ecu decode --unique_id=feca_3-6 --value=2114126001
{"spn":177,"fmi":3,"cm":0,"oc":126}
# Note this requires the definition of PGN: `feca` start_position: `3-6` in your ecumonitor.conf

# Perform a candump for 40 seconds from 2 CAN interfaces
$ sudo apx-ecu restart
$ sudo apx-ecu clear
$ sudo apx-ecu configure --interface=PRIMARY_CAN --interface_mode=J1939_500KBPS
$ sudo apx-ecu configure --interface=SECONDARY_CAN --interface_mode=J1939_250KBPS
$ sudo apx-ecu log --log_time=40 --log_interface=PRIMARY_CAN --file_name=logTruck500.log
$ sudo apx-ecu log --log_time=40 --log_interface=SECONDARY_CAN --file_name=logTruck250.log
$ sudo apx-ecu list_parameters
# Note that underscores are not allowed for the name of the log file

# clear and list ecu parameters
$ sudo apx-ecu clear
$ sudo apx-ecu list_parameters

Ethernet

apx-ethernet

Manage the ethernet interface on the device. Allows you to configure DHCP mode or other network configuration.

 sudo apx-ethernet [action]
 sudo apx-ethernet config [dhcp_mode] [ip/mask] [gateway] [dns] [dhcp_enabled]
[action]description
onPower on the ethernet interface
offPower off the ethernet interface. It helps to save energy
resetExecutes a transition in the reset pin of the LAN controller
stateReturns the interface state, MAC, IP, Broadcast, MASK, RX bytes and TX bytes
configWith this option you can configure DHCP mode, IP/MASK, Gateway, DNS, and DHCP Server mode
routeUse this option for forwarding the ethernet traffic to another interface, it allows you to have internet access by specifying the output interface. Valid modes are: wlan0, ppp0, both and none.
helpPrints this help message

Examples:

# Configure the ethernet in DHCP mode
$ sudo apx-ethernet config dhcp

# Set the IP address of the ethernet interface
$ sudo apx-ethernet config 192.168.5.5/24

# Configure the ethernet network with dhcp enabled
$ sudo apx-ethernet config 192.168.5.5/24 192.168.5.255 8.8.8.8 yes
# Where: 192.168.5.5/24 = Device IP/Mask
#        192.168.5.255  = Gateway address
#        8.8.8.8        = DNS
#        yes            = DHCP server enabled

# Route ethernet traffic to both wlan0 and ppp0 interface
$ sudo apx-ethernet route both

# Check the ethernet state
$ sudo apx-ethernet state
{"state":"Enabled","mac":"9C:1D:58:3D:5A:90","ip":"","bcast":"","mask":"","rx_bytes":"0","tx_bytes":"0","routing":"both"}

Geofences

apx-geofences

Tool that adds and removes geofences on the device. Note that a maximum of 3000 geofences can be saved as of apex version 20.12

Add a geofence

 sudo apx-geofences add [namespace] [group] [type] [name] [radius] lon,lat [...]
$ sudo apx-geofences add places parks circular country_village_park 100 -80.305340,25.943784
parametersdescription
[namespace]Name of the namespace. If no namespace, specify an empty string "". Max 30 characters
[group]Name of the group. If no group, specify an empty string "". Max 30 characters, min 3 characters
[type]Type of geofence. Must be circular or poly
[name]Name of the geofence. Max 50 characters
[radius]Optional Radius of the geofence in meters, required for circular geofences. Min 50 meters. Max 20000 meters.
[lon,lat]Longitude and latitude coordinates in the format decimal degrees: -80.3471745,25.917071. Max 500 pairs of coordinates. Minimum of 3 pairs of coordinates for a poly type geofence

Remove a geofence

 sudo apx-geofences remove [namespace] [group] [name]
$ sudo apx-geofences remove places parks country_village_park

Remove all geofences of a namespace

 sudo apx-geofences remove [namespace]
$ sudo apx-geofences remove places

Get a list of all namespaces that exist

$ sudo apx-geofences getns
["places","shopping_malls"]

To get all the information of the geofences of a specific namespace

 sudo apx-geofences getall [namespace]
$ sudo apx-geofences getall places
[{"namespace":"places","group":"group","geo_name":"norman_jean","type":"poly","n_vertices":4,"vertices":["-80.33352400,25.93546900","-80.32843900,25.93494800","-80.32832100,25.93337500","-80.33331000,25.93355800"]}]

where:

  • namespace: Name of the namespace
  • group: Name of the group
  • geo_name: Name of the geofence
  • type: poly or circular
  • radius: Radius of circular geofence in meters
  • n_vertices: Number of lon,lat pairs in the geofence
  • vertices: Lon,lat pairs

To count the number of geofences that exist in namespace[s]

 sudo apx-geofences count [namespace]
$ sudo apx-geofences count places
4

To get the current state of each geofence of a specific namespace

 sudo apx-geofences getstatus [namespace]
$ sudo apx-geofences getstatus places
[{"group":"parks","geo_name":"country_village_park","is_inside":false,"time":1623959290}]

where:

  • group: Name of group
  • geo_name: Name of geofence
  • is_inside: True if device is currently inside the geofence

To get the current version of the tool

$ sudo apx-geofences version
{"version": "0.0.5"}
RETURN_CODESdescription
0OK
22Invalid argument
80Max number of geofences reached
81Geofence not found
82Missing parameter
127Unknown command

Example:

# Create a polygonal geofence around 25.935469,-80.333524 25.934948,-80.328439 25.933375,-80.328321 25.933558,-80.333310
$ sudo apx-geofences add places parks poly park_norman_jean -80.333524,25.935469 -80.328439,25.934948 -80.328321,25.933375 -80.333310,25.933558

# Print the geofences that are in the namespace places
$ sudo apx-geofences getall places
[{"namespace":"places","group":"parks","geo_name":"park_norman_jean","type":"poly","n_vertices":4,"vertices":["-80.33352400,25.93546900","-80.32843900,25.93494800","-80.32832100,25.93337500","-80.33331000,25.93355800"]}]

apx-geofences-manager

Tool to import and export geofences massively on the device.

 sudo apx-geofences-manager [option] [arguments]
[option]description
importCreate geofences in batch using syruslang scripting command, the tool requires arguments: namespace and path.
exportExport geofences to a single file. Accepts arguments: format, namespace, and file.
              [arguments]description
--removeRemove all geofences in the namespace before start importing
--dry-runRun command to proccess without creating geofences
--format | -fFormat to be exported, accepted values are: syruslang,geojson
--namespace | -nNamespace to be export or imported
--path | -pPath to file destination where import geofences or path where to export destination. Must be a syrus.conf and contains syruslang script language or a .geojson with valid geojson data
# Import geofences from '/data/downloads/geofences.syrus.conf' with the namespace 'sample_geo' to the device.
$ sudo apx-geofences-manager import -p /data/downloads/geofences.syrus.conf -n sample_geo

# Export geofences on the device from the namespace: 'sample_geo' into Syruslang format with the name: '/data/downloads/geofences_applications.syrus.conf'
$ sudo apx-geofences-manager export -f syruslang -n sample_geo -p /data/users/syrus4g/geofences_applications.syrus.conf
{"results":"ok","geofences":10}

GNSS/GPS

apx-gps

Allows you to control the GNSS/GPS interface on the device.

 sudo apx-gps [option]
       [option]       description
antennaPower on/off the GPS antenna. When powering on, 3.3 Volts are placed on GPS antenna connector
cold-startUse this option to execute a gps cold start. It depends on the gps engine selected
engineUse this option to select between xm1110 or quectel. If second argument is not used it returns the gps engine selected
filterUse this option to configure the gps anti-drift filter, it receives as parameters the HDOP, motion and speed(km/h). Valid range: 1.0 <= HDOP <= 5.0; Motion true/false; 0 <= speed < 100
helpPrints this help message
hot-startUse this option to execute a gps hot start. It depends on the gps engine selected
nmeaUse this option to configure the gps nmea output. It depends on the gps engine selected
positionUse this option to consult the current GPS position
powerPower on/off/reset the XM1110 or Quectel GPS interface. It depends on the gps engine selected
stateUse this option to consult the current state of GPS
update-rateUse this option to chage the gps nmea sentece output frequency. It depends on the gps engine selected. Valid options are 1, 5 and 10 Hz
warm-startUse this option to execute a gps warm start. It depends on the gps engine selected

Examples:

# Get the gps state
$ sudo apx-gps state
{"TIME":"2021-06-17T20:26:35Z","ENGINE":"xm1110","VERSION":"1.3.1","FIX":3,"LATEST_POINT":{"lat":25.783475,"lon":-80.293563,"alt":17.040,"speed":0.963,"heading":115.27,"epoch":1623959390}}
# Where: TIME           = GMT Timestamp in ISOFORMAT
#        ENGINE         = GPS chip
#        VERSION        = GPS version
#        FIX            = Fix quality, 1: 'Fix not available', 2: '2D', 3: '3D' (http://aprs.gids.nl/nmea/)
#        LATEST_POINT
#            lat        = Latitude
#            lon        = Longitude
#            alt        = Altitude in meters above mean sea level
#            speed      = Speed in km/h
#            heading    = Heading in degrees from North, increasing eastwardly
#            epoch      = GPS epoch timestamp

# Perform a warm-start on the GPS module
$ sudo apx-gps warm-start

# Update the GPS frequency to report 5 times a second
$ sudo apx-gps frequency 5

# Turn on the gps antenna
$ sudo apx-gps antenna on

# Change the GPS anti-drift filter to hdop of 2.0, movement detected, with speed of 5 km/h
$ sudo apx-gps filter 2.0 true 5

# Get the latest location
$ sudo apx-gps position
"http://maps.google.com/maps?q=25.783560,-80.293480"

Inputs/Outputs

apx-io

Tool that manages the device's general purpose inputs and outputs.

 sudo apx-io [action] [key] [value]
[action]description
setMust be followed by key and value. Will set desired output for the device.
getMust be followed by key. Will obtain the value of the desired key
getallMust be followed by key. Will obtain all of the values for the desired key
helpPrints all the usages

set

[key]: OUT1, OUT2, OUT3, and OUT4

[value]: true or false

get

[key]: OUT1, OUT2, OUT3, OUT4, IGN, IN1, IN2, IN3, IN4, IN5, IN6, IN7, PWR, MOT, SO1, SO2, SO3, SO4, TIG, AN1, AN2, DAN, BAT

getall

[key]: outputs, inputs, analogs

Examples:

# Get the value of all the analog inputs:
$ sudo apx-io getall analogs
{"BAT":4.047,"DAN":11,"AN1":0,"AN2":0}

# Activate output 2:
$ sudo apx-io set OUT2 true

LTE-Modem

apx-mdm

Tool to manage the LTE module of the device. Allows you to configure the APN and other configuration related parameters as well as perform actions like sending an SMS, enabling airplane mode, or converting text to speech.

 sudo apx-mdm [option]
 sudo apx-mdm [parameter] [value]
 sudo apx-mdm [action] [value]
[option]description
onPower on the LTE module by using the driver circuit
offPower off the LTE module by using the driver circuit
resetApplies a pulse in the reset pin of the LTE module. It is an electrical reset.
helpPrints this help message

Use the following keys to set/get a parameter. If second argument is not present, it returns the parameter value.

[parameter]description
apnThe access point name.
pinThe SIM card PIN
userThe username for the apn
passThe password to acess the apn
sim_sw_intervalThe time interval in hours for changing from external SIM to embedded when no data connection is reached (default: 4)
sim_priorityWith this parameter, you can specify the sim card to use: e-sim (default) or sim-card
keep_aliveThe time interval in minutes to check the data connection
call_validationUse 'true' for validating the phone number before answering the call, it depends on the authorized phone list added with phone_book option. By default, the device validates the phone number before answering the call
sms_validationUse 'true' for validating the phone number before processing the incoming sms, it depends on the authorized phone list added with phone_book option. By default, the device validates the phone number before processing the incoming sms
phone_bookUse this option to add, remove and consult the authorized phone book list
stateUse this option to consult the current state of the LTE modem device. It returns a json object that shows information about the network registration and configuration parameters

Use the following keys to execute some actions in the LTE modem device. These actions are executed by the syrus-mdm application.

[action]description
airplane_modeUse true for entering in airplane mode and false for returning to normal mode.
restartUse this option for executing a software reset that is controlled by the modem application.
send_smsUse this option for sending an SMS.
start_callUse this option for starting a voice call.
end_callUse this option for ending an established voice call.
ttsText to speech. Use this option to turn text into speech by using the Bluetooth speaker connected.

Examples:

# Set the APN of the regular SIM card (not embedded)
$ sudo apx-mdm apn mycarrierapn.com

# Set the priority of the SIM card used to the regular SIM (not embedded):
$ sudo apx-mdm sim_priority sim-card

# Add phone number to the phone book:
$ sudo apx-mdm phone_book add 3013333333

# Send an SMS to 3013333333
$ sudo apx-mdm send_sms 3013333333 'Testing Syrus4 SMS'

# Start a call with the number: 3013333333
$ sudo apx-mdm start_call '3013333333'

# Speak command
$ sudo apx-mdm tts 'Testing text to speech'

# Get the state of the LTE modem
$ sudo apx-mdm state
{"manufacturer":"Quectel","revision":"EG25GGBR07A06M2G","model":"EG25","imei":"867698040023056","sim_imsi":"732123200007701","sim_state":"Not in Use","sim_type":"EMBEDDED","sim_id":"89883234500011949724","gsm_reg":1,"modem_state":"ON","gprs_reg":1,"rat":"FDD LTE","mcc_mnc":310260,"band":"LTE BAND 2","operator":"Wireless","esim_state":"READY","ip":"25.130.16.168","esim_imsi":"310260859157280","esim_id":"8901260852391572807F","rssi":15,"no_conn_time":0,"lac":8181,"cid":"24A8F0E","sim_sw_interval":8,"keep_alive":15,"sim_priority":"e-sim","apn":"super"}

apx-ppp

Manages the ppp connection to the internet with the specified profile.

 sudo apx-ppp [option] profile
[option]description
startStarts the pppd deamon with the profile specified
stopStops the pppd process
stateReturns 0 if daemon is running and ppp0 interface has an IP, 1 otherwise
helpPrints this help message

Example:

$ sudo apx-ppp start default

Onewire

Manage devices that communicate via the 1-wire bus system like temperature probes and IButtons.

apx-onewire

Use this Apex tool to add/remove onewire devices to or from the whitelists found in /data/users/syrus4g/onewire/. This tool also allows to get information about the onewire devices connected.

sudo apx-onewire [type] [action]
sudo apx-onewire [type] [action] [argument_1] [argument_2] ... [argument_n]
type
ibutton
temperature
[action]description
addFollowed by argument_1 and argument_2. Will add the alias found in argument_1 with the onewire id number found in argument_2 to the white list based on the valid type. Alias cannot be empty, must be of 50 characters or less, and cannot contain the character ':'. The onewire id must be exactly 16 characters long therefore you must place padding with leading zeros to complete the 16 digits.
removeFollowed by argument_1. The argument_1 can be either the alias or the onewire id which will be removed from the white list based on the valid type.
remove_allNot followed by any arguments. Will remove all of the onewire devices based on the type specified from the corresponding white list.
getFollowed by argument_1. The argument_1 can be either the alias or the onewire id. Returns an object with information about the onewire device based on the type given.
get_allNot followed by any arguments, returns an array of objects for all the onewire devices based on the type specified.
get_lastNot followed by any arguments, returns an object of the last onewire device that was connected based on the type specified.
restartNot followed by any arguments, not preceded by a type, will restart the onewire application.
resetNot followed by any arguments, not preceded by a type, will reset the onewire application. Deleting all white list files as well as previous information about past onewire devices.
helpNot followed by any arguments, not preceded by a type, will print this message.
versionNot followed by any arguments, not preceded by a type, will return the core and the tool version.
statusNot followed by any arguments, not preceded by a type, will return the status of the onewire bus. 0 meaning operation is normal. -1 meaning that there is a fault in the onewire bus.

Examples:

# add ibutton with alias: 'driver 1'
$ sudo apx-onewire ibutton add 'driver 1' 0123456789123401

# read all ibuttons
$ sudo apx-onewire ibutton get_all
{"ibuttons":[{"alias":"driver 1","id":"0012331241412401","whitelisted":true,"connected":false,"conn_epoch":null,"disc_epoch":null}]}

# add temperature alias for room1
$ sudo apx-onewire temperature add room1 3501144D2797AA28

# read all temperatures
$ sudo apx-onewire temperature get_all
{"temperatures":[{"alias":"room1","id":"3501144d2797aa28","value":null,"connected":false,"epoch":1619786506}]}

Power Save

apx-psm

Tool to manage the device's power save mode. The power save mode is ON by default where the device goes into a low power consumption mode after 5 minutes without the ignition wire detected. This behavior can be overwritten with this tool. Syrus 4 consumes ~200mA when using GNSS, modem and wifi, thus it's recommended to always have a power save mode configured, to avoid any issues with a car's battery for example.

Default PSM_STRING: IGN:0,SLP:300;IGN,MIN:720;300

 sudo apx-psm [action] [PSM_string]
[action]description
immediateThis action is not followed by PSM_string, instead it orders the device to enter Power Save Mode with the previously loaded configuration. When a previous PSM doesn't exist the device will use the default PSM.
modeMust be followed by PSM_string and the only valid format is sleep_condition;wakeup_condition;wait_time. Signals for the conditions are separated by commas (,) and conditions are separated by semicolons (;). All of the sleep_condition signals must have a valid value of 0 or 1 and the colon (:) character must be used to separate between signal and value. Note: MIN is the only signal for wakeup_condition that has a value. SLP signal cannot exist without a MIN signal and vice versa. Be sure to encapsulate PSM_string with "Quotation Marks"
helpPrints this message.
guideGuides the user on how to properly create a Power Save Mode string. Note The device will be configured with the results of this guide.

Configuration of the [PSM_string]
First enter the sleep_condition. This is the condition the device must meet so that it will go into Power Save Mode. This condition is broken into signal:value separated by commas where only the valid signals below are allowed and the only valid values are 0 (inactive) or 1 (active)

sleep_condition signalsdescription
IGNIgnition state.
IN1Input 1 state.
IN2Input 2 state.
IN3Input 3 state.
IN4Input 4 state.
IN5Input 5 state.
IN6Input 6 state.
IN7Input 7 state.
PWRExternal power state.
MOTMotion state.
SO1Short-circuit on output 1.
SO2Short-circuit on output 2.
SO3Short-circuit on output 3.
SO4Short-circuit on output 4.
TIGIgnition from main power supply state.
SLPTime to wait for the device to go back into sleep mode in seconds (300 - 65535 seconds)

Next enter the wakeup_condition. This is the condition that lets the device know how it should return from the Power Save Mode. The device will wake up upon any of the given wake up signals being met. Only use the valid wake up condition signals described below. The only signal that uses a value is 'MIN' and this signal lets the device know how often to wake up. Example: MIN:10 will wake up every 10 minutes.

wakeup_condition signalsdescription
IN1Will wake up based any change detected in input 1.
IN2Will wake up based any change detected in input 2.
IN3Will wake up based any change detected in input 3.
IN4Will wake up based any change detected in input 4.
IN5Will wake up based any change detected in input 5.
IN6Will wake up based any change detected in input 6.
IN7Will wake up based any change detected in input 7.
IGNWill wake up upon ignition signal change.
PWRWill wake up upon external power source signal change.
SO1Wake up due to a short in output 1.
SO2Wake up due to a short in output 2.
SO3Wake up due to a short in output 3.
SO4Wake up due to a short in output 4.
MOTWill let the device wake up upon motion being detected.
MINLets the device know how often, in minutes, to wake up. 1 - 65536 (note this needs a value)

Lastly, enter the wait_time. This is the time the sleep condition must be met and sustained before the device will into Power Save Mode. This number is defined in seconds. The wait time must be between 300 seconds (5 minutes) or 65536 seconds (18 hours) inclusive.

Note that there is no way to remove the power save mode, however you can configure it in a way that it never falls asleep

Examples:

# Set the power save mode to go to sleep after 240 seconds (4min) (240) of no ignition detected (IGN:0), wake up for 5 minutes (SLP:300) every 10 minutes (MIN:10) or end the power save mode when motion is detected (MOT).
$ sudo apx-psm mode "IGN:0,SLP:300;MOT,MIN:10;240"

# Set the power save mode to go to sleep after 300 seconds (300) of no movement detected (MOT:0), and wake up only when input1 is detected (IN1).
$ sudo apx-psm mode "MOT:0;IN1;300"

# Set the power save mode to go to sleep after 5 minutes (300) of no movement or ignition (MOT:0,IGN:0), wake up every 2 hours (MIN:120) for 3 minutes (SLP:180) or end the power save mode when INPUT 1, or IGNITION, or MOTION is detected (IN1,IGN,MOT).
$ sudo apx-psm mode "MOT:0,IGN:0,SLP:180;IN1,IGN,MOT,MIN:120;300"

Serial Interface

Manage the serial RS-232 interface of the device to communicate with accessories via the serial port.

apx-serial

Configures the RS-232 serial interface in different modes for communication with serial accessories such as Satcom & Sigfox communicator, fatigue sensor, or a mobile data terminal.

 sudo apx-serial [option]
 sudo apx-serial mode [argument_1]
 sudo apx-serial console [command]
 sudo apx-serial modem [argument_1] [argument_2]
 sudo apx-serial fatigue_sensor [argument_1]
 sudo apx-serial mdt [argument_1]
 sudo apx-serial mdt settings [argument_n] 
[option]description
modeUse this option to select the mode in which the user serial port will be used. By default the serial port is in console mode. If argument_1 is not found it returns the current mode.

Selecting the mode

[argument_1]description
consoleWhen the device is in console mode, you can use apx commands for interacting with the syrus device, for example, you can consult the state of the device inputs by sending apx-io getall inputs through a serial terminal at 115200 8 n 1
modemUsed when Satcom or Sigfox accessories are connected. In modem mode you can use the following options: state, send
fatigue_sensorUsed when communicating with a fatigue sensor accessory. In this mode you can use the following options: state,list,sensitivity,min_speed,speeding,max_photos,speaker_volume,auto_upload,upload,capture_photo,delete_photos
mdtWhen the device is in MDT mode you can use the following options: state,send,settings

Console mode

$ sudo apx-serial mode console

 sudo apx-serial console [command]
$ sudo apx-serial console apx-gps position

Send apex commands to the device and receive a response via the serial interface

[command]description
apx-apex commnd to send to the device

Modem mode

$ sudo apx-serial mode modem

 sudo apx-serial modem [argument_1] [argument_2]

Used to communicate with other serial capable modem devices/accessories like the Syrus Satcom and Sigfox Communicator.

[argument_1]description
stateUse this option to consult the current state of the serial modem device
sendUse this option to send data through the serial modem device, max 340 characters with the serial-modem satcom.
buffer_sizeFollowed by argument_2 to configure the size of serial modem buffer. Range from 10 to 500. Default 100. If no argument provided it returns the current value.
clear_bufferUse this option to to clear the serial modem buffer.
Modem Examples:
# Configure the serial port in modem mode
$ sudo apx-serial mode modem

# Configure the serial port in modem mode, which is used when Satcom or Sigfox accessories are connected, in the example below, 50 is an optional parameter for configuring the size of the buffer for the serial modem.
# The range of the buffer is from 10 to 500. Default is 100.
$ sudo apx-serial modem buffer_size 50

# Consult the current state of the serial modem device.
$ sudo apx-serial modem state
{"state":"connected","type":"satcom","id":"300234062206840","signal":3,"version":15,"buff_size":50,"buff_count":1}

# To send a message
$ sudo apx-serial modem send ">REV331852148....;ID=35...<"
# Note that it returns an error if the modem mode is not active. and if the message length is greater than 340 characters

Fatigue Sensor mode

$ sudo apx-serial mode fatigue_sensor

 sudo apx-serial fatigue_sensor [argument_1]

Used to communicate with a fatigue sensor. The photos captured by the fatigue sensor are automatically stored in: /data/users/syrus4g/fatigue_sensor.

[argument_1]description
stateUse this option to consult the current state of the sensor
listIt returns the list of the photos stored in the device memory
sensitivityUse this option to consult/configure the sensor sensitivity. Range 2-11. Default 3. If no argument provided it returns the current value.
min_speedUse this option to consult/configure the warning start-up speed. Range 10-60. Default 10 km/h. If no argument provided it returns the current value.
speedingUse this option to consult/configure the sensor speed alarm rate. Range 50-150. Default 50 kph. If no argument provided it returns the current value.
max_photosUse this option to consult/configure the max number of photos that can be stored in the device memory. Range 10-100. Default 25. If no argument provided it returns the current value.
speaker_volumeUse this option to consult/configure the sensor speaker volume. Range 0-2. Default 2. If no argument provided it returns the current value.
auto_uploadUse this option to consult/configure the auto_upload mode, when enabled, the application will automatically upload the photos to the syrus4 server. 0: disabled, 1: enabled. Default disabled
uploadUse this option to upload the photos to the syrus4 server
capture_photoUse this option to capture a photo
delete_photosUse this option to delete all the photos stored
sensitivityapproximate delay time in seconds to alarm
22.2 seconds
32.9 seconds
43.7 seconds
54.5 seconds
65.3 seconds
76.1 seconds
86.9 seconds
97.7 seconds
108.5 seconds
1115 seconds
speaker_volumevolume equivalent
0Speaker Off
1Low
2High

Auto-upload

The auto-upload feature is used to automatically upload photos to DCT's server. In a future release we'll provide access to download the photos from DCT's server, if you're using Syruslang

Note that the photos captured by the fatigue sensor use the following format:

epoch-photo_description.jpeg

Where photo description can be any of the following:

  • fatigue_alarm: driver fatigue detected
  • fatigue_remind: driver fatigue reminder
  • fatigue_warning: driver fatigue warning
  • distraction: driver distracted
  • no_portrait: driver not detected
  • photo: regular photo captured with fatigue sensor
Fatigue Sensor Examples:
# To change the sensitivity so it's more sensitive
$ sudo apx-serial fatigue_sensor sensitivity 2

# To change the minimum speed used to trigger warnings to 25kph
$ sudo apx-serial fatigue_sensor min_speed 25

# To check the state of the fatigue sensor
$ sudo apx-serial fatigue_sensor state
{"state":"connected","sensitivity":3,"speaker_volume":2,"min_speed":10,"speeding":50,"max_photos":10,"nbr_photos":10,"latest_photo":"1616001062-photo.jpeg"}

# To list photos captured by fatigue sensor
$ sudo apx-serial fatigue_sensor list
["1615580038-distraction.jpeg","1615580071-fatigue_alarm.jpeg","1615580119-distraction.jpeg","1615580207-fatigue_alarm.jpeg","1615580231-distraction.jpeg","1615580295-photo.jpeg","1615580324-photo.jpeg","1615580361-distraction.jpeg","1615997099-photo.jpeg","1616001062-photo.jpeg"]

MDT mode

$ sudo apx-serial mode mdt

 sudo apx-serial mdt [argument_1]
 sudo apx-serial mdt settings [baudrate] [type] [timeout] [max_size] [header] [tail] [mask] [offset]

Places the device in an MDT mode, which allows you to receive and send data via the serial interface in a packaged format based on different criterias such as the size, time, and header among others.

[argument_1]description
stateReturns a json with the current state and configuration parameters
sendFor sending data to the serial port
settingsFor setting up the mdt mode

MDT Settings

[argument_n]description
baudrateThe serial port baud rate. Valid values are 1200, 4800, 9600, 19200, 38400, 57600 and 115200
typeFor this version only x is supported (hexadecimal mode)
timeoutIt is the time that the application waits before sending the packed data when at least one byte has been received. Range 0-900s. Use 0 to ignore this setting
max_sizeWhen this limit is reached the application sends the packed data. Range 0-1024. Use 0 for ignoring this setting
headerThe protocol head, up to 4 bytes, for example 0x0b0c. Up to 4 hexadecimal bytes. Use 0 for ignoring this setting
tailThe protocol tail, up to 4 bytes, for example 0x0d0a. Up to 4 hexadecimal bytes. Use 0 for ignoring this setting
maskThe mask used, up to 4 bytes. Use the mask for filtering the data, depending on it, the application only packages the data if the corresponding byte array changes. The mask is only applied if the header and offset are configured. Use 0 for ignoring this setting.
offsetThe number of bytes after the last byte of the header for applying the mask configured. Range 0-1024. Use 0 for ignoring this setting

Note that if only the tail is configured, the application will package the data every time the tail is received.

For scenarios walking you through some sample MDT configurations refer to the connect section.

MDT mode examples
# For setting the serial mode to mdt
$ sudo apx-serial mode mdt

# To set the mdt mode with
# baudrate of 115200, in HEX mode, a timeout of 10 seconds, 
# max size of 20 bytes, a header of 0x0A, tail of 0x0B, 
# a mask of 0x01, and an offset of 5
$ sudo apx-serial mdt settings 115200 x 10 20 0a 0b 01 5

# For getting the state of the serial mode
$ sudo apx-serial mode mdt
{"mode":"enabled","baudrate":115200,"type":"x","timeout":10,"max_size":20,"header":"0a","tail":"0b","mask":"01","offset":5}

# To send a message with '3132330D0A' to the serial port
$ sudo apx-serial mdt send '3132330d0a'

apx-serial-slctr

Manages the input serial interface of the device. You can only select between one of RS-232, J1708, or RS485.

 sudo apx-serial-slctr [option]
[option]description
0RS232. It is the default option
1J1708 bus
2RS485
helpPrints this help message

Example:

# Send the following command to enable the J1708 bus as the input serial interface.
$ sudo apx-serial-slctr 1

System

apx-about

Information about the system and it's resources.

$ sudo apx-about
{"ram":{"total":506084,"used":107824,"free":229732,"available":404616},"cpu":{"currF":1000,"usage":19.1926,"governor":"ondemand","stats":{"300":1319.28,"600":16152.25,"720":132.79,"800":52.43,"1000":299.93}},"rootfs":{"total":444018,"free":187666},"datafs":{"total":2255680,"free":2078392},"uptime":17958,"loadAvg":[1.83,1.71,1.65],"apexVersion":"apex-20.22-rc.8","releaseDate":"20200604000110","kernelVersion":"5.4.20-g738552d0b0","hostname":"syrusrouter"}

apx-core

Apex package manager for installing and removing software packages.

 sudo apx-core [option]
[option]description
listList the DCT-Apex packages installed
updateDownloads the package list from the DCT repository. It gets the list of the newest packages with its dependencies and returns the list of the DCT packages available for updating
recoverAllows to recover from broken packages when installing doesn't finish correctly
installInstall one or several packages at a time by providing their names
removeRemoves a software package from apex system
reinstallRemoves the package and reinstall it
add_dev_repoAdds the DCT developer repository to the package manager. It enables some linux packages to be installed. To get the list of the available packages, please consult https://apex.digitalcomtech.com/dev-packages.txt
rm_dev_repoRemoves the DCT developer repository
helpPrints the help message

Example:

# list dct-apex packages installed
$ sudo apx-core list

# install latest versions of syrus-gps and syrus-ecu packages
$ sudo apx-core install syrus-gps syrus-ecu

# install specific version of syrus-gps
$ sudo apx-core install syrus-gps=1.0-r0.1

apx-ext-memory

Tool that prepares an external storage device such as an SD card to be compatible with Apex OS.

 apx-ext-memory <command> [<args=value>]
[command]description
format [OPTIONS]Prepares the external device in order it can be used by the operating system. Warning!, this process will erase all the data stored in this device.
status [OPTIONS]Returns a json object with general information about the state of the external memory selected with --type
helpPrints this help
[OPTIONS]description
-t, --typeThe type of external memory conneced (sd or usb)
-yUse this option to force the format without asking for confirmation

Examples:

$ sudo apx-ext-memory format --type=sd

$ sudo apx-ext-memory status --type=sd

apx-leds

Tool that manages the device's LEDs.

$ sudo apx-leds [color] [mode]

[color] = red, green, yellow, or blue

[mode]description
onColor led fully on. This option is not valid for red led
offColor led fully off. This option is not valid for red led
heartbeatColor led simulates a heart beat thump-thump-pause
onebeat50ms on - 1000ms off
high_freq10Hz, 50ms on - 50ms off
low_freq1Hz, 500ms on - 500ms off
flash10ms on - 5000ms off

Examples:

$ sudo apx-leds blue high_freq

$ sudo apx-leds red heartbeat

apx-logger

Tool for communicating with the SyrusCloud remote diagnostic application.

 sudo apx-logger [action]
 sudo apx-logger [level] [value]
[level]description
critCritical level message
errorError level message
warnWarning level message
infoInfo level message
  • crit, error, warn - types are sent to the syrus-cloud as soon as network connection be ready
  • info - these messages are queued into the syrus-cloud's buffer and when a new connection is established they are transmitted
[value]description
messageThe message that is going to be sent to the syrus-cloud, enclosed in "quotes"

Examples:

$ sudo apx-logger info "This is an information message for the cloud, it will be queued"

$ sudo apx-logger crit "This is a critical message for the cloud, it will be sent immediately"

apx-os-update

Tool that updates the device's operating system. Careful when forcing the update of the OS over the air as it can consume a lot of data.

 sudo apx-os-update [option]
[option]description
checkCheck if an update is available in the dctserver
startStart the update by using the dctserver or by specifying the location
forceThe same as start but without checking the network interface
stateReturn the state of the current update process
helpPrints the help message

Examples:

sudo apx-os-update check
{"mess":"Update available"}
# if in progress...
{"mess":"Update in progress. This will take a few minutes"}

# start an upgrade to the latest stable version
$ sudo apx-os-update start

# update from an SD card mounted on the device
$ sudo apx-os-update start /media/usdp2/apex-20.10

apx-system

Tool to check general system information of the device, and reboot/restart it.

 sudo apx-system [option]
[option]description
aboutIt returns a json object with general information about the system
rebootUse this option for rebooting/restarting the apex OS
full_stateIt returns the full state of the system depending on the epoch received
set_nameUse this option for changing the system name, it is highly recommended to use a name that starts with syrus. Remember that the user session needs to be restarted in order for the change to be applied
restartUse this option for restarting syrus running services.
set_data_filesUse this option to set syrus4g as the owner of /data applications and configuration files
helpPrints the help message

Examples:

# Will return a json object with all the information available
$ sudo apx-system full_state 0
{"system":{"apex":{"version":"20.35-rc.1","date":"20200911213938","kernel":"5.4.20-g738552d0b0","epoch":1601657925},"ram":{"total":506084,"epoch":1601657925},"dataFs":{"total":2255680,"epoch":1601657925},"rootFs":{"total":444018,"epoch":1601657925},"uptime":{"since":"2020-10-02_14:59:58","epoch":1601657925},"epoch":1601657925},"gps":{"engine":{"name":"","epoch":1601657925},"filter":{"hdop":,"motion":,"speed":,"epoch":1601657925},"epoch":1601657925},"mobile":{"sim":{"type":"e-sim","swInterval":8,"epoch":1601657925},"gnss":{"state":"","epoch":1601657925},"rf":{"apn":"","keepAlive":15,"epoch":1601657925},"nbrAuth":{"call":,"sms":,"epoch":1601657925},"epoch":1601657925},"core":{"apex":{"bist":"0.0.12-r0.0","rules":"1.0.0-r0","start":"1.0.3-r0.1","tools":"1.0.9-r0.0","uchip":"1.0.3-r0.2","epoch":1601657925},"syrus":{"api":"1.5.2-r0.1","bt":"0.0.5-r0.0","bt-tools":"1.0.0-r0","counters":"1.0.3-r0.1","ecu":"1.0.1-r0.1","geofences":"0.0.5-r0.0","gps":"1.1.1-r0.0","imu":"1.0.9-r0.0","interface":"1.0.3-r0.0","mdm":"1.1.1-r0.3","ui":"0.10.1-r0.0","watcher":"0.0.3-r0.1","epoch":1601657925},"epoch":1601657925},"epoch":1601657925}

# Will return a json object with information that has a timestamp newer than the reference
$ sudo apx-system full_state 1599573699

# Restart the gps module
$ sudo apx-system restart syrus-gps

apx-user

 sudo apx-user [option] [argument_1] [argument_2] [argument_3]
[option]description
checkuserIt returns "Valid User" if the user's password validation is successful, receives username as [argument_1] and password as [argument_2]
changepassIt returns "Password Updated" if password has been successfully changed, receives username as [argument_1], the current password as [argument_2], and the new password as [argument_3]
helpPrints the help message

Note that passwords must be between 6 to 63 characters long

Examples:

$ sudo apx-user changepass syrus4g 123456 mynewpass

apx-watcher

Used to manage the keep-alive messages with syrus cloud remote management interface.

USAGE:

$ apx-watcher <command> [<args=value>]
COMMANDS:Description
set [OPTIONS]Set the connection time and always on flag
helpPrint this help
statusReturns a json object with general information about the state of the syrus-watcher application
                   OPTIONSDescription
-c, --conn_timeTime in minutes used for sending the keep alive message to the syrus cloud. The default value is 480 minutes = 8 hours. Use 0 for disabling the syrus-watcher task, if this task is disabled the device will not connect with the syrus-cloud
-a, --always_onThe flag used to control the connection with syrus-cloud. 0: Disabled, 1: Enabled (Default)

Example:

# To change the keep-alive message with Syrus Cloud (https://cloud.digitalcomtech.com) to every 10 minutes and disable always_on
sudo apx-watcher set --conn_time=10 --always_on=0

# to check the status of apx-watcher
sudo apx-watcher status
{"conn_time":10,"always_on":0}

Tracking

apx-tracking

Tool that's used to manage tracking criterias' on the device. The tracking notification will trigger whenever any one of the criteria is met. Heading and distance notifications depend on valid GPS.

Create or edit a tracking criteria

 sudo apx-tracking set [namespace] [heading] [time] [distance]
parametersdescription
[namespace]The name used as a reference to identify the tracking criteria. Max 60 characters.
[heading]The heading delta threshold for triggering notifications based on heading changes. Use 0 to disable. Range (0-180)
[time]The time limit in seconds for triggering tracking notifications. Use 0 to disable. Range (0-86400)
[distance]The distance threshold in meters for triggering tracking notifications based on the traveled distance. Use 0 to disable. Range (0-100000)

Get tracking resolutions for namespace

If namespace is not specified, it returns a list with all the tracking criteria configured.

 sudo apx-tracking get [namespace]
optiondescription
[namespace]The name used as a reference to identify the tracking criteria. Max 30 characters.

Get all tracking resolutions defined

$ sudo apx-tracking getall

Delete a namespace

 sudo apx-tracking delete [namespace]
optiondescription
[namespace]The name used as a reference to identify the tracking criteria. Max 30 characters.

Examples:

# To set a tracking criteria for triggering notifications every 30 minutes
$ sudo apx-tracking set 0 1800 0

# To set a tracking criteria for triggering notifications every 35°, or 60 seconds, or 500 meters.
$ sudo apx-tracking set 35 60 500

# Return all tracking criterias configured
$ sudo apx-tracking getall
{"syrusjs_parked":[0,0,0],"syrusjs_still":[0,15,0]}

Video

This tool configures the actions to be carried out in the processing of video files.

apx-video

 sudo apx-video <command> [<args=value>]
 sudo apx-video <command> [--status=<value>] [--camera=<value>]
 sudo apx-video <command> [--name=<value>] [--camera=<value>] [--time_win=<value>]
                                        <command>description
set [OPTIONS]Set the general configuration. (Destination and Reserved space)
add_camera [OPTIONS]Add a new camera to the configuration file.
rm_camera [OPTIONS]Remove a camera from the configuration file.
record [OPTIONS]Start or stop the video recording for a specified camera/cameras stored in the configuration file.
create_clip [OPTIONS]Find the video files from history location in a specified time window for one camera or all. Cameras stored in the configuration file and creates a video clip.
always_recording [OPTIONS]Set always run video record at the start of the application.
timeline [OPTIONS]Get history timeline information per camera in a max range of one day (24 hours).
restart [OPTIONS]Restart the core application of the chosen module.
statusShows the status of the cameras stored in the config file.
               <command>[OPTIONS]
set[--destination=<value>] [--reserved_space=<value>]
add_camera[--type=<value>] [--camera_name=<value>] [--ip=<value>] [--port=<value>] [--user=<value>] [--pass=<value>] [--resolution=<value>] [--audio=<value>] [--uri=<value>]
rm_camera[--type=<value>] [--camera=<value>] [--delete_files]
record[--status=<value>] [--camera=<value>]
create_clip[--name=<value>] [--camera=<value>] [--time_win=<value>] [--from=<value>] [--to=<value>]
always_recording[--status=<value>]
timeline[--from=<value>] [--to=<value>] [--camera=<value>]
restart[--module=<value>]
                    FORMATSdescription
[destination]Micro-sd card -> sd, USB device -> usb, Internal memory -> internal
[reserved_space]Reserved space in memory defined in megabytes. e.g --reserved_space=5000 (5000 Mb or 5Gb)
[type]Type of camera you work with. IP ONVIF camera -> onvif, Dashcam -> dashcam, Movon MDSM-7 Camera -> mdsm7
[resolution]Preferred resolution in the output videos. 1080p -> FHD, 720p -> HD, 480p -> SD. Default resolution HD -> 720p.
[audio]Set to true to record audio (must be enabled on the camera). --audio=true or false
[time_win]Time before and after to create a video clip, -time_backward,+time_forward in seconds. e.g --time_win=-60,+30. -60sec = 60 seconds before, +30sec = 30 seconds after. (Max ranges: time_backward = 60sec, time_forward=30sec)
[always_recording]Set to true to enable always ON video recording at the start of the application. --status=true or false. Default true.
[from] [to]Epoch timestamp to retrieve video from timeline ranges. Max range between --from and --to is 24 hours
[module]Network device manager ndm or video

Notice

The always_recording flag is true by default. To disable it you need to set the --status=false

statusdescription
0STARTING
1RUNNING
2FINISHED_BY_EOS
3NOT_RUNNING
4FINISHED_BY_ERROR

Example:

# GENERAL CONFIGURATION
# Set the destination of video recording to an SD card mounted on the Syrus4 with a max space of 2000MB
$ sudo apx-video set --destination=sd --reserved_space=2000


# ADD CAMERAS
# Add an ONVIF IP camera
$ sudo apx-video add_camera --type=onvif --camera_name=cam_1 --ip=192.168.0.52 --user=admin --pass=admin --resolution=FHD --audio=true

# Add a Movon MDSM-7 fatigue sensor camera
$ sudo apx-video add_camera --type=mdsm7 --ip=192.168.0.52 --port=6564

# Add a Dashcam
$ sudo apx-video add_camera --type=dashcam --camera_name=dashcam_1 --ip=192.168.0.52 --user=admin --pass=admin --resolution=FHD --audio=true

# Add a Dashcam with live stream
$ sudo apx-video add_camera --type=dashcam --camera_name=dashcam_2 --uri=rtsp://USERNAME:[email protected]/ch1/sub/video


# REMOVE CAMERAS
# Remove back camera from configuration and delete video files
$ sudo apx-video rm_camera --camera=back_cam --delete_files

# Remove Movon MDSM-7 fatigue camera (keeps files)
$ sudo apx-video rm_camera --type=mdsm7


# START/STOP RECORDING
# Start recording on all cameras
$ sudo apx-video record --status=start

# Stop recording for a particular camera
$ sudo apx-video record --status=stop --camera=front_cam


# CREATE VIDEO CLIPS
# Create a video clip on all cameras called '1632141204_crash' for the last 60 seconds and next 30 seconds
$ sudo apx-video create_clip --name=1632141204_crash --time_win=-60,+30

# Create a video clip called '1632141204_crash' for the last 60 seconds
$ sudo apx-video create_clip --name=1632141204_crash --camera=back_cam --time_win=-60

# Create a video clip from all cameras with a from and to date (see timeline to view the available video ranges)
$ sudo apx-video create_clip --name=1632141204-crash --from=1632111204 --to=1632121204


# ALWAYS RECORDING
# Set always recording to true
$ sudo apx-video always_recording --status=true


# GET TIMELINE
# Get a timeline of the available videos to retrieve a video clip from
$ sudo apx-video timeline --from=1632141204 --to=1632142204

# Get a timeline for a particular camera
$ sudo apx-video timeline --from=1632141204 --to=1632142204 --camera=my_cam
[
  {
    "type": "onvif",
    "name": "front_door",
    "range": [
      "1633090417",
      "1633715624"
    ],
    "ranges": [
      [
        "1633501423",
        "1633501499"
      ]
    ]
  },
  {
    "type": "onvif",
    "name": "rear_door",
    "range": [
      "1632753622",
      "1633715624"
    ],
    "ranges": []
  }
]


# RESTART
# Restart the net device manager module (handles driver fatigue camera mdsm-7 for example)
$ sudo apx-video restart --module=ndm

# Restart the video module
$ sudo apx-video restart --module=video


# STATUS
# Status of the cameras
$ sudo apx-video status
{
    destination: "sd",
    reserved_space: 97540,
    n_cams: 2,
    cameras:[
        {
            name: "CAM1",
            state: 3
        },
        {
            name: "CAM2",
            state: 3
        }
    ]
}

WIFI-BT

apx-wl-pwr

Tool to manage the wifi bluetooth module. Turning it off can help conserve power.

 sudo apx-wl-pwr [action]
[action]description
onPower on the wl1835 MOD
offPower off the wl1835 MOD. WL1835 is a non-removable device, so it cannot be turned off. This option was preserved for compatibility issues

Example:

# Power on wifi/bluetooth module
$ sudo apx-wl-pwr on

apx-hotspot

Manages the hotspot functionality on the device. Allows you to configure the SSID and password when enabling the hotspot. The password is protected with WPA2-PSK security.

 sudo apx-hotspot [action]
 sudo apx-hotspot [option] [value]
[action]description
startIt starts the udhcpd and hostapd services used by hotspot app
stopIt stops the hotspot services
resetIt executes a stop-start in the same call
listIt returns the list of the connected clients to the hotspot
stateReturns status: Enabled/Disabled and other info
helpPrints this help message
[option]description
routeUse this option for forwarding the wlan traffic to another interface, it allows you to have internet access by specifying the output interface, available values: ppp0, eth0
ssidUse this option for changing the network identifier
passUse this option for changing the hotspot password (minimum of 8 characters)
countryUse this option for changing the country_code (2-letter ISO Code)

Note that the range of IP addresses that the hotspot assigns is from: 192.168.9.100 to 192.168.9.254.

If you require working with static IP addresses you can use from 192.168.9.2 to 192.168.9.99

Example:

# To set or change the ssid:
$ sudo apx-hotspot ssid mySSID

# To set or change the passphrase used for authentication:
$ sudo apx-hotspot pass myNewPass1234

# To restart the hotspot service:
$ sudo apx-hotspot reset

# To get the state of the hotspot:
$ sudo apx-hotspot state
{"state":"Enabled","ssid":"mySSID","pass":"myPassword","country":"US","routing":"ppp0"}

# To list the client devices connected to the hotspot:
$ sudo apx-hotspot list
{"stations":[{"mac":"96:f5:bc:51:62:de","rx_bytes":"155189","tx_bytes":"18752","uptime":"79"}]}

# To give internet access using the eth0 as the output interface:
$ sudo apx-hotspot route eth0

# To set the country to Argentina:
$ sudo apx-hotspot country AR

apx-wifi

Tool to manage the wifi interface of the device. Allows you to connect to a wireless network.

 sudo apx-wifi [option]
[option]description
scanIt starts a WIFI scan and returns a list of SSIDs
startIt enables the WIFI interface and starts the service for connecting with preconfigured networks
stopIt stops the WIFI service and disables the interface
resetIt executes a stop-start in the same call
addIt adds a new network to the WIFI configuration file, in this case you have to include the SSID and psk as parameters
removeIt removes a network from the WIFI configuration file, in this case you have to include the SSID as parameter
listIt returns the list of networks configured
stateReturns the state of the WIFI connection
helpPrints this help message

Example:

# To scan the WIFI network and get the list of SSIDs:
$ sudo apx-wifi scan

# To add a new network to the configuration file:
$ sudo apx-wifi add myNet myPass

# To remove a network from the configuration file:
$ sudo apx-wifi remove myNet

# Wi-Fi state
$ sudo apx-wifi state
{"state":"Completed","ssid":"MyAwesomeWifi","signal":"-17","key_mgmt":"WPA2-PSK","mac":"50:33:8B:DD:1E:43","ip":"192.168.1.28","rx_bytes":"871399","tx_bytes":"178166"}

Did this page help you?