VicCommand, References

This document contains list of commands you can send to Njord or Bitfrost with VicCommand Cloud App.

When Njord receives a command, it will confirm with a blink. Njord can blink more than once for some commands. You may turn off LED with SetLed false.


AddStep [FUNCTION-ID] [OPERAND] [int:arg0] [int:arg1] [int:arg2] [int:arg3] [int:arg4]

Add a single step of parameters to a sequence in a driver. To modify existing arguments, use ModParam.

Parameter: arg0, arg1, arg2, arg3 and arg4 are integers from 0 to 255 .

Available FUNCTION-ID:

  • FID_READ_REGISTER
  • FID_WRITE_REGISTER
  • FID_READ_PIN
  • FID_WRITE_PIN
  • FID_DELAY

Available OPERAND:

  • STEP_LSHIFT
  • STEP_RSHIFT
  • STEP_UNDEFINED
  • STEP_OR
  • STEP_PASS
  • STEP_NEGATE

Blink

Blink the LED on Njord once.


ClearDriver

Clears pre-selected driver, the driver must be disabled before clear in order to properly de-register ISR and to properly enter low-power mode. If user attempts to clear driver which is not disabled, the device will return Resource In Use (error code 2)

/* Clear driver 4 */

SetDriver SEQ_ENTER_LOWPWR DRIVER_4
EnableDriver false
ClearDriver

ClearSeq

Clears and disables pre-selected Sequence, the driver must be disabled before clearing sequence.

/* Clear Sequence for driver 4 */

SetDriver SEQ_ENTER_LOWPWR DRIVER_4
EnableDriver false
ClearSeq

EnableDriver [bool: enable]

Enables or disables (true/false) preselected driver. When driver is enabled a default configuration sequence will be executed followed by registration of an interrupt pin, if specified. When disable is executed, interrupt will be de-registered and enter-low-power sequence will be executed.

/* Enable driver 4 */

SetDriver SEQ_INIT_DEVICE DRIVER_4
EnableDriver true

ExecuteSeq

Executes pre-selected sequence, response can be true/false. If true, the device responds with raw result.


GetCrc

Returns calculated CRC for selected driver.


GetDrivers

Returns drivers currently installed on a Njord.


GetFirmwareVersion

Retrieve firmware version.


ModParam [int:step] [int:arg0] [int:arg1] [int:arg2] [int:arg3] [int:arg4]

Substitute existing parameters in the Njord with new ones. Set driver before running this function.

/* Set driver and sequence, and then modify the parameters */

SetDriver SEQ_READ_1 DRIVER_1
ModParam 0 65 0 227 2 4
ExecuteSeq true

SetDriver [SEQUENCE] [DRIVER]

Selects sequence and driver to perform operations on. If driver is set to DRIVER_ALL (255), all drivers are selected.

Available Sequences:

  • SEQ_INIT_DEVICE
  • SEQ_ENTER_LOWPWR
  • SEQ_EXIT_LOWPWR
  • SEQ_DEFAULT_CONFIG
  • SEQ_READ_1
  • SEQ_READ_2
  • SEQ_READ_3
  • SEQ_READ_4
  • SEQ_ISR
  • SEQ_USER_DEFINED

Available Drivers:

  • DRIVER_0
  • DRIVER_1
  • DRIVER_2
  • DRIVER_3
  • DRIVER_4
  • DRIVER_5
  • DRIVER_6
  • DRIVER_ALL

Note: for many applications, sequence doesn't have any impact on your commands. Use SEQ_INIT_DEVICE is sufficient.

/* In this example, we want to perform commands on driver 2 */
/* and then disable the driver */

SetDriver SEQ_INIT_DEVICE DRIVER_2
EnableDriver false

SetDriverType [TYPE]

Set driver type. The driver type acts as an identifier for the driver. Choose a type that can represent the driver's functionality. It will make it easier to identify measurement data. Following default types are available:

  • SENSOR_NO_SENSOR
  • SENSOR_SI7050_TEMP
  • SENSOR_SI7020_HUMIDITY
  • SENSOR_SWITCH
  • SENSOR_INTERNAL_ADC
  • SENSOR_LTC1864L_ADC
  • SENSOR_420MA_LOOP
  • SENSOR_UART
  • SENSOR_ACCELEROMETER
  • SENSOR_DIGITAL_MIC
  • SENSOR_AMBIENT_LIGHT
  • SENSOR_CO2_MODULE
  • SENSOR_CUSTOM_1
  • SENSOR_CUSTOM_2
  • SENSOR_CUSTOM_3
  • SENSOR_CUSTOM_4
/* Set driver 2 as a temperature sensor */

SetDriver SEQ_INIT_DEVICE DRIVER_2
SetDriverType SENSOR_SI7050_TEMP

SetInterrupt [int:rate] [int:pin] [int:level] [int:pull-up]

Configures PIN as an input for interrupt notifications for a driver.


SetLed [bool:on/off]

Enables/disabled (true/false) the on-board LED. When LED is disabled, Njord will not acknowledge commands received with blinking LED.


SetNetworkId [bool: reboot] [int: networkID]

Set new network ID for a Njord and can also instruct the node to reboot itself after network ID is set. If incorrect network ID is attempted to be set, the device will return Invalid value.

Warning: When Njord is set with a new network ID, it will try to connect to a gateway with the same ID. The gateway that Njord previously was attached, will no longer accept any connection from the Njord.

/* Set Network ID to 3000 and reboot */

SetNetworkId true 3000

SetNodeOff

This command will turn of Njord.



SetSampleRate [int:samplerate]

Sets sample rate for selected drivers, samplerate parameter is in milliseconds. The minimum sample rate is 100 milliseconds. Sample rate change can only occur if a driver is enabled, disabled drivers will not have their sample rate updated.

/* Set sample rate for driver 3 to 5 minutes (300000 milliseconds) */

SetDriver SEQ_INIT_DEVICE DRIVER_3
SetSampleRate 300000

SetScratchPad [int:offset] [array of bytes in hex]

Offset: from 0 to 255.

array: hex string without space.

Use this command to temporally store values to memory. Write a multi-byte array to the specified memory address from given offset in the scratchpad memory. No spaces are allowed between the bytes of the array. If you want to persist your data to flash, then use StoreScratchPad true. 

NOTE: StoreScratchPad true has a write cycle up to 1000 times. When the flash memory is worn out, it is no longer possible to persist your data.

 

/* Set (hex) 0xAA, 0xBB, 0xCC, 0xDD to memory at offset 12 */

SetScratchPad 12 aabbccdd

StoreScratchPad [bool:store/load]

Store or load bytes from scratchpad memory to/from flash.

/* To store from memory to flash */
StoreScratchPad true

/* To load from flash to memory*/
StoreScratchPad false

SetSeqType [TYPE]

Set Sequence for current selected driver. Normally, when you select a driver through command SetDriver, you also select Sequence. If you want to switch to another Sequence without using SetDriver, then this is the command to use. See SetDriver for list of available Sequences.

Note: for many applications, sequence doesn't have any impact on your commands. Use SEQ_INIT_DEVICE is sufficient.


SetSlot [int: slot]

The slot number acts as an identifier for the driver (just like driver's type, see SetDriverType), you will easier identify measurement data based on slot.

Valid slot is from 0 to 255.


StoreDriver [bool:store/load]

Store or load selected driver. Pass in 'true' argument to store and 'false' to load.