log-mini-base-mt

Description

This library provides functions for the

  • myDatalogMINIamr
  • myDatalogMINI BLE

OVERVIEW

Abstract:
This library provides functions for the myDatalog MINI.
Supported rapidM2M devices:
  • myDatalog MINI amr:
    • Firmware: 00v002 and higher
  • myDatalog MINI BLE:
    • Firmware: n.a.
If you use this library in your IoT app, you should specify the minimum required version of the firmware under "required HW & FW" in the project settings.
OperationMode:
Todo
SetupMode:
Todo

BASIC

MINIGW_DISPLAY_TIMEOUT - 30

Default timeout after which the display will turn off [sec]

MINIGW_LONG_BUTTON_PRESS - 3000

Default time after which the circle segments on the display should be completely filled and the setup mode should be started [ms]

MINIGW_TIME_CHECK_GSM - 180

Time for the RSSI-measurement in setup mode [s]

MINIGW_ERROR_x:

myDatalog MINI Base Library errors

MINIGW_ERROR_NOT_INITIALIZED = -2 - The library is not initialized (call minigw_Init() to initialize the library)
MINIGW_ERROR_ALREADY_INIT = -3 - The library was already initialized (i.e. minigw_Init() was called twice)
MINIGW_ERROR_INVALID_TIMEOUT = -4 - An invalid display active timeout was provided
MINIGW_ERROR_UPLINK_NOT_INIT = -5 - The ~uplink library is not initialized
MINIGW_OPERATION_x:

Operation mode screens

MINIGW_OPERATION_NORMAL - Normal operation
MINIGW_OPERATION_TRANSPORT - Transport mode
MINIGW_OPERATION_SERVICE_SENSOR - Battery service for the sensor
MINIGW_OPERATION_SERVICE_GW - Battery service for the gateway
MINIGW_OPERATION_ERROR - Error
MINIGW_SETUP_x:

Setup mode screens

MINIGW_SETUP_BLE_CONNECT - Display connecting BLE
MINIGW_SETUP_TX_START - Display connecting uplink
MINIGW_SETUP_TX_ACTIVE - Display uplink active; sync data
MINIGW_SETUP_CHECK_GSM - Display RSSI measurement ongoing
MINIGW_SETUP_RSSI_RESULT - Display RSSI result
MINIGW_OPERATION_ERROR_x:

Error codes during operation

MINIGW_OPERATION_ERROR_E02 - Error E02: last connection not successful
MINIGW_OPERATION_ERROR_E03 - Error E03: last measurement not successful
MINIGW_OPERATION_ERROR_EXX - Unspecified error
MINIGW_COUNTER_INX:

Counter inputs to use

MINIGW_COUNTER_IN1 - counter input 1
MINIGW_COUNTER_IN2 - counter input 2
MINIGW_COUNTER_IN3 - counter input 3
MINIGW_COUNTER_IN4 - counter input 4
MINIGW_DIGITAL_INX:

Digital inputs to use

MINIGW_DIGITAL_IN1 - digital input 1
MINIGW_DIGITAL_IN2 - digital input 2
MINIGW_DIGITAL_IN3 - digital input 3
MINIGW_DIGITAL_IN4 - digital input 4
minigw_Init(iDisplayActiveTimeout=MINIGW_DISPLAY_TIMEOUT)

Initializes the myDatalog MINI Base Library. It is mandatory to initialize the ~uplink library beforehand (using uplinkInit()).

iDisplayActiveTimeout : s32 - Defines how long the display should be active before it is deactivated in order to save energy [sec].
returns : s32
OK - The library was successfully initialized
MINIGW_ERROR_ALREADY_INIT - minigw_Init() was already called (see MINIGW_ERROR_x)
MINIGW_ERROR_INVALID_TIMEOUT - iDisplayActiveTimeout was set to 0 (see MINIGW_ERROR_x)
MINIGW_ERROR_UPLINK_NOT_INIT - ~uplink library not initialized (see MINIGW_ERROR_x). Call uplinkInit() beforehand.
minigw_DisplayOff()

Turns off all LEDs of the display (e.g. deactivates the display)

returns : s32
OK - If successful
MINIGW_ERROR_NOT_INITIALIZED - The library is not initialized (see MINIGW_ERROR_x)
minigw_UpdateInputStatus(iIn1=0, iIn2=0, iIn3=0, iIn4=0)

Function needs to be called when some input changes it's state. It transfers the states of the inputs (GPIOs) to the library.

in1 : s32 - Status of Input 1
in2 : s32 - Status of Input 2
in3 : s32 - Status of Input 3
in4 : s32 - Status of Input 4
returns : s32
OK - If successful
MINIGW_ERROR_NOT_INITIALIZED - The library is not initialized (see MINIGW_ERROR_x)
minigw_DisplayButtonPressed(iMaxDuration=MINIGW_LONG_BUTTON_PRESS)

Function needs to be called when the button is pressed. The timeout after which the display is deactivated is reset and the animation with the circle segments filling in clockwise direction is started.

When all circle segments are filled, setup mode is started.
iMaxDuration : s32 - Time after which the circle segments on the display should be completely filled and the setup mode should be started [ms] (1000 - 10000 ms)
returns : s32
OK - If successful
MINIGW_ERROR_NOT_INITIALIZED - The library is not initialized (see MINIGW_ERROR_x)
ERROR - iMaxDuration was set to an invalid value
minigw_DisplayButtonReleased()

Function needs to be called when the button is released. The timeout after which the display is deactivated is reset and the circle animation is stopped.

returns : s32
OK - If successful
MINIGW_ERROR_NOT_INITIALIZED - The library is not initialized (see MINIGW_ERROR_x)
minigw_DisplayRSSI(iRSSI)

Shows the GSM/UMTS/LTE signal strength (mobile network connection).

The cell symbol and the number of circle segments showing the RSSI level will light up.
iRSSI : s32 - Signal strength [dBm] to be displayed
RSSI [dBm]Segments
-200 … -125
-124 … -110▮ ▮
-109 … -100▮ ▮ ▮ ▮
-99 … -70▮ ▮ ▮ ▮ ▮ ▮
-69 … -1▮ ▮ ▮ ▮ ▮ ▮ ▮ ▮
returns : s32
OK - If successful
MINIGW_ERROR_NOT_INITIALIZED - The library is not initialized (see MINIGW_ERROR_x)
minigw_DisplaySOC(iSOC)

Shows the state of charge in % (SOC).

The battery symbol and the number of circle segments showing the SOC level will light up.
iSOC : s32 - State of charge [%] to be displayed
SoC [%]Segments
0 … 4
5 … 9▮ ▮
10 … 39▮ ▮ ▮
40 … 89▮ ▮ ▮ ▮ ▮
90 … 100▮ ▮ ▮ ▮ ▮ ▮ ▮ ▮
returns : s32
OK - If successful
MINIGW_ERROR_NOT_INITIALIZED - The library is not initialized (see MINIGW_ERROR_x)
minigw_DisplayOperatingMode(iMode, iCircle=0)

Displays the corresponding operation mode screen

iMode : MINIGW_OPERATION_x - Screen to be displayed
MINIGW_OPERATION_NORMAL - Normal operation
The green info symbol and the circle segments showing the state of the digital inputs will light up.
MINIGW_OPERATION_TRANSPORT - Transport mode
The display is turned off.
MINIGW_OPERATION_SERVICE_SENSOR - Battery service for the sensor
The yellow info symbol will light up.
MINIGW_OPERATION_SERVICE_GW - Battery service for the gateway
The blue info symbol will be shown.
MINIGW_OPERATION_ERROR - Error
The red info symbol and the circle segments showing the actual error will light up. (See MINIGW_OPERATION_ERROR_x)
iCircle : s32 - Additional information that is displayed via the circle segments (Depending on the screen to be displayed)
MINIGW_OPERATION_NORMAL
Information on which of the digital inputs the contact is closed
Bit0 - Contact at input 1 is closed
Bit1 - Contact at input 2 is closed
Bit2 - Contact at input 3 is closed
Bit3 - Contact at input 4 is closed
MINIGW_OPERATION_ERROR
Error code to be displayed (use MINIGW_OPERATION_ERROR_x)
returns : s32
OK - If successful
MINIGW_ERROR_NOT_INITIALIZED - The library is not initialized (see MINIGW_ERROR_x)
minigw_DisplaySetupMode(iState,iCircle=0)

Displays the corresponding setup mode screen

iState : MINIGW_SETUP_x - Screen to be displayed
MINIGW_SETUP_BLE_CONNECT - Display connecting BLE
The blue info symbol, the settings symbol and the circle animation will be shown.
MINIGW_SETUP_TX_START - Display connecting uplink
The settings symbol, the blinking cell symbol and the circle animation will be shown.
MINIGW_SETUP_TX_ACTIVE - Display uplink active; sync data
The settings symbol, the cell symbol and the circle animation will be shown.
MINIGW_SETUP_CHECK_GSM - Display RSSI measurement ongoing
The settings symbol and the circle segments showning the remaining time of the setup mode will light up.
MINIGW_SETUP_RSSI_RESULT - Display RSSI result
The settings symbol, the cell symbol, the info-symbol (color depends on the result) and the circle segments showing the average result of the RSSI-measurement in the setup mode will light up.
iCircle : s32 - Additional information that is displayed via the circle segments (depending on the screen to be displayed)
MINIGW_SETUP_CHECK_GSM
Duration of the RSSI measurement: Time that the measurement of the signal strength should last [sec].
The number of circle segments displayed is calculated in proportion to MINIGW_TIME_CHECK_GSM.
MINIGW_SETUP_RSSI_RESULT
Result of setup mode: signal strength to be displayed [dBm].
RSSI [dBm]SegmentsInfo symbol
-200 … -125red
-124 … -115▮ ▮red
-114 … -110▮ ▮ ▮red
-109 … -105▮ ▮ ▮ ▮yellow
-104 … -100▮ ▮ ▮ ▮ ▮yellow
-99 … -90▮ ▮ ▮ ▮ ▮ ▮yellow
-89 … -70▮ ▮ ▮ ▮ ▮ ▮ ▮green
-69 … -1▮ ▮ ▮ ▮ ▮ ▮ ▮ ▮green
returns : s32
OK - If successful
MINIGW_ERROR_NOT_INITIALIZED - The library is not initialized (see MINIGW_ERROR_x)
minigw_ResetActiveTimeout(iNewTimeout=0)

Resets the timeout after which the display is deactivated.

The function resets the display active timeout and overrides the currently configured timeout if desired.
iNewTimeout : s32 - The new display active timeout that should be used [sec]
-1 - Disables the display active timeout (i.e. display is permanently active)
0 - Only reset the display active timeout. The value specified during minigw_Init() or the last call of minigw_ResetActiveTimeout() is used for the timeout.
>0 - Sets the display active timeout to the passed value and resets the display active timeout countdown. This value is now used for the timeout if no new value is specified when calling minigw_ResetActiveTimeout().
returns : s32
OK - If successful.
MINIGW_ERROR_NOT_INITIALIZED - The library is not initialized (see MINIGW_ERROR_x).
minigw_CounterInit(input, filtertime)

Init a counter.

The function inits a counter with specific filtertime.
input : s32 - The counter input which is used for counting (see MINIGW_COUNTER_INX).
filtertime : s32 - The minimal time to count an impulse ([ms]).
returns : s32
OK - If successful.
ERROR_ALREADY_SUBSCRIBED - If counter is already initialized.
ERROR_NOT_SUPPORTED - If input is used from another module.
ERROR - In case of invalid parameter or any other error.
minigw_CounterClose(input)

Close and deinit a counter.

The function deinitializes a counter and reset all used pins. The count value is not reset here.
input : s32 - The counter input which should be closed (see MINIGW_COUNTER_INX).
returns : s32
OK - If successful.
ERROR_NOT_SUPPORTED - If input is used from another module.
ERROR - In case of invalid parameter or any other error.
minigw_GetCounter(input)

Get value of a counter.

Read the actual value of the counter. The count value don't reset here.
input : s32 - The counter input which should be read (see MINIGW_COUNTER_INX).
returns : s32
> = 0 - Actual counted value [-].
ERROR - If not initialized.
minigw_ResetCounter(input)

Get and reset last value.

Read out the last value and reset the counter to 0.
input : s32 - The counter input which should be reseted (see MINIGW_COUNTER_INX).
returns : s32
> = 0 - Actual counted value [-].
ERROR - If not initialized.
minigw_DigitalInit(input)

Init a digital input.

The function inits a digital input.
input : s32 - The digital input which is used as digital in (see MINIGW_DIGITAL_INX).
returns : s32
OK - If successful.
ERROR_ALREADY_SUBSCRIBED - If digital input is already initialized.
ERROR_NOT_SUPPORTED - If input is used from another module.
ERROR - In case of invalid parameter or any other error.
minigw_DigitalClose(input)

Close and deinit a digital input.

The function deinitializes a digital input.
input : s32 - The digital input which is used as digital in (see MINIGW_DIGITAL_INX).
returns : s32
OK - If successful.
ERROR_NOT_SUPPORTED - If input is used from another module.
ERROR - In case of invalid parameter or any other error.
minigw_DigitalGet(input)

Get state of a digital input.

Read the pin state of the digital input.
input : s32 - The digital input which state should be read (see MINIGW_DIGITAL_INX).
returns : s32
RM2M_GPIO_LOW - For "low" at the input.
RM2M_GPIO_HIGH - For "high" at the input.
ERROR_BAD_STATE - If the relevant input was not configured as digital input.
ERROR_NOT_SUPPORTED - If input is used from another module.
<OK - If an error occurs, see Terror

Expert DLO

Advanced_Config:
/** ---------------------------------------------------------------------------- * log-mini-base-mt: Counter Stuck Detection Config * ----------------------------------------------------------------------------- */ #define MINIGW_STUCK_CALLBACK 0

MINIGW_STUCK_CALLBACK

  • Activate or deactivate the callback for the stuck detection.
  • The default value is 0 which is also used if not defined.
  • MINIGW_STUCK_CALLBACK >= 1
    • minigw_StuckDetectionCallback
    /** ---------------------------------------------------------------------------- * log-mini-base-mt: Digital Input Config * ----------------------------------------------------------------------------- */ #define MINIGW_DIGITAL_FEED_TIME_US 1000

    MINIGW_DIGITAL_FEED_TIME_US

  • Time in µs the feed pins of the inputs are energized when calling minigw_DigitalGet.
  • The default value is 1000 which is also used if not defined.
  • minigw_StuckDetectionCallback(iChannel, iStuckState)

    Stuck state changed

    This function is called up when the stuck state changed. The stuck detection is only active if a channel is used in counter mode.
    iChannel : MINIGW_COUNTER_INX - Input on which the change occured
    iStuckState : s32 - State to which the input changed to
    OK - Stuck resolved
    ERROR - Stuck detected

    On this page

    log-mini-base-mt