m2mb API docs  25.30.004.0
m2mb API sets documentation
m2mb_sys.h File Reference

Base system functions for m2m application, following operations can be performed: -get/set operating modes: -Online Indicates that the device can make data traffic and make calls. More...

Go to the source code of this file.

Data Structures

struct  M2MB_SYS_OPERATING_MODE_T
 
struct  M2MB_SYS_GET_OPERATING_MODE_RESP_T
 
struct  M2MB_SYS_GENERIC_RESP_T
 

Typedefs

typedef HANDLE M2MB_SYS_HANDLE
 
typedef void(* m2mb_sys_ind_callback) (M2MB_SYS_HANDLE h, M2MB_SYS_IND_E sys_event, UINT16 resp_size, void *resp_struct, void *userdata)
 

Enumerations

enum  M2MB_SYS_OP_MODE_E {
  M2MB_SYS_OP_MODE_ONLINE, M2MB_SYS_OP_MODE_LOW_POWER, M2MB_SYS_OP_MODE_FACTORY_TEST_MODE, M2MB_SYS_OP_MODE_OFFLINE,
  M2MB_SYS_OP_MODE_UNKNOWN, M2MB_SYS_OP_MODE_MAX_VAL
}
 
enum  M2MB_SYS_IND_E { M2MB_SYS_NULL_RESP, M2MB_SYS_GET_OPERATING_MODE_RESP, M2MB_SYS_SET_OPERATING_MODE_RESP, M2MB_SYS_OPERATING_MODE_CHANGED_IND }
 
enum  M2MB_SYS_ERR_CAUSE_E { M2MB_SYS_ERR_OK, M2MB_SYS_ERR_UNKNOWN }
 

Functions

M2MB_RESULT_E m2mb_sys_init (M2MB_SYS_HANDLE *h, m2mb_sys_ind_callback callback, void *userdata)
 m2mb_sys_init initializes SYS service for current client. More...
 
M2MB_RESULT_E m2mb_sys_deinit (M2MB_SYS_HANDLE h)
 m2mb_sys_deinit deinitializes SYS service for current client. More...
 
M2MB_RESULT_E m2mb_sys_get_operating_mode (M2MB_SYS_HANDLE h)
 m2mb_sys_get_operating_mode gets information about the current operating mode. More...
 
M2MB_RESULT_E m2mb_sys_set_operating_mode (M2MB_SYS_HANDLE h, M2MB_SYS_OP_MODE_E operatingMode, BOOLEAN persistent)
 m2mb_sys_set_operating_mode sets the operating mode. More...
 

Detailed Description

Base system functions for m2m application, following operations can be performed: -get/set operating modes: -Online Indicates that the device can make data traffic and make calls.

m2m/m2m_generic/common/m2mb_inc/m2mb_sys.h

-Low Power Lowest power consumption state from which the device can return to Online mode; indicates that the device has temporarily disabled RF. If persistent flag is set, this mode persists even if the device is reset. Currently, persistent flag applies only to Low Power mode.

-Factory Test Mode Special mode for manufacturer use.

-Offline Phone has deactivated RF and partially shutdown; the device must be power cycled before it can reacquire service from this mode.

@notes Dependencies: m2m/m2m_generic/common/m2mb_inc/m2mb_types.h

Author
mb_
Date
29/08/2017

Enumeration Type Documentation

◆ M2MB_SYS_OP_MODE_E

Enumerator
M2MB_SYS_OP_MODE_ONLINE 

Online

M2MB_SYS_OP_MODE_LOW_POWER 

Low power

M2MB_SYS_OP_MODE_FACTORY_TEST_MODE 

Factory Test mode

M2MB_SYS_OP_MODE_OFFLINE 

Offline

Function Documentation

◆ m2mb_sys_deinit()

M2MB_RESULT_E m2mb_sys_deinit ( M2MB_SYS_HANDLE  h)

m2mb_sys_deinit deinitializes SYS service for current client.

m2mb_sys_deinit deinitialize SYS service for current client freeing the handle passed as first parameter. Call to m2mb_sys_deinit should be performed in order to release memory resources when handle is no more used.

Parameters
[in]hfirst parameter is the handle to the SYS service, that will be deinitialized by the function.
Returns
M2MB_RESULT_SUCCESS on success.
refer to M2MB_RESULT_E for different values.
Note

m2mb_sys_deinit(&h);

M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_SYS_HANDLE h = NULL;
struct myStruct myUserdata;
retVal = m2mb_sys_init(&h, myCallback, (void*)myUserdata);
//... use SYS APIs ...
retVal = m2mb_sys_deinit(h);
if ( retVal == M2MB_RESULT_SUCCESS )
printf( "m2mb_sys_deinit succeeded");

◆ m2mb_sys_get_operating_mode()

M2MB_RESULT_E m2mb_sys_get_operating_mode ( M2MB_SYS_HANDLE  h)

m2mb_sys_get_operating_mode gets information about the current operating mode.

The function is asynchronous. This means that the function returns immediately, but the signal information is received in the callback previously set by the m2mb_sys_init function.

The response event received in the callback will be the M2MB_SYS_GET_OPERATING_MODE_RESP. The resp_struct must be casted to the M2MB_SYS_GET_OPERATING_MODE_RESP_T type.

Parameters
[in]hthe handle to the SYS service, previously initialized by the m2mb_sys_init function.
Returns
M2MB_RESULT_SUCCESS on success.
refer to M2MB_RESULT_E for different values.
Note

m2mb_sys_get_operating_mode(h);

void myCallback(M2MB_SYS_HANDLE h, M2MB_SYS_IND_E sys_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
{
switch(sys_event)
{
//...
case M2MB_SYS_GET_OPERATING_MODE_RESP:
{
printf("GET OPERATING MODE resp is err %d, operatingMode %d, persistent %d",
resp->err, resp->operatingMode_s.operatingMode, resp->operatingMode_s.persistent);
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_SYS_HANDLE h = NULL;
struct myStruct myUserdata;
retVal = m2mb_sys_init(&h, myCallback, (void*)myUserdata);
//...
if ( retVal == M2MB_RESULT_SUCCESS )
printf( "m2mb_sys_get_operating_mode request succeeded");
}

◆ m2mb_sys_init()

M2MB_RESULT_E m2mb_sys_init ( M2MB_SYS_HANDLE *  h,
m2mb_sys_ind_callback  callback,
void *  userdata 
)

m2mb_sys_init initializes SYS service for current client.

m2mb_sys_init initialize SYS service for current client returning the handle that must be passed as first parameter for all SYS actions. Calling the m2mb_sys_init is mandatory before using the SYS service.

Parameters
[in]*hfirst parameter is the handle to the SYS service, that will be initialized by the function. It has to be preallocated and initialized to NULL value.
[in]callbacksecond parameter is the callback that will be called if an event or a response happens.
[in]userdatathird parameter is a pointer to generic user data that will be returned as it is in the callback.
Returns
M2MB_RESULT_SUCCESS on success.
refer to M2MB_RESULT_E for different values.

m2mb_sys_init(&h, myCallback, myUserdata);

void myCallback(M2MB_SYS_HANDLE h, M2MB_SYS_IND_E sys_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
{
//my code
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_SYS_HANDLE h = NULL;
struct myStruct myUserdata;
retVal = m2mb_sys_init(&h, myCallback, (void*)myUserdata);
if ( retVal == M2MB_RESULT_SUCCESS )
printf( "m2mb_sys_init succeeded");
}

◆ m2mb_sys_set_operating_mode()

M2MB_RESULT_E m2mb_sys_set_operating_mode ( M2MB_SYS_HANDLE  h,
M2MB_SYS_OP_MODE_E  operatingMode,
BOOLEAN  persistent 
)

m2mb_sys_set_operating_mode sets the operating mode.

The function is asynchronous. This means that the function returns immediately, but the signal information is received in the callback previously set by the m2mb_sys_init function.

The response event received in the callback will be the M2MB_SYS_SET_OPERATING_MODE_RESP. The resp_struct must be casted to the M2MB_SYS_GENERIC_RESP_T type.

The indication event received in the callback will be the M2MB_SYS_OPERATING_MODE_CHANGED_IND. The resp_struct must be casted to the M2MB_SYS_OPERATING_MODE_T type.

The operation is considered successfully ended when both events above have been received.

Parameters
[in]hthe handle to the SYS service, previously initialized by the m2mb_sys_init function.
[in]operatingModeoperating mode to set
[in]persistentwhether the operating mode must be persistent or not
Returns
M2MB_RESULT_SUCCESS on success.
refer to M2MB_RESULT_E for different values.
Note

m2mb_sys_set_operating_mode(h, operatingMode, persistent);

void myCallback(M2MB_SYS_HANDLE h, M2MB_SYS_IND_E sys_event, UINT16 resp_size, void *resp_struct, void *myUserdata)
{
switch(sys_event)
{
//...
case M2MB_SYS_SET_OPERATING_MODE_RESP:
{
printf("SET OPERATING MODE resp is err %d, result %d", resp->err, resp->result);
}
case M2MB_SYS_OPERATING_MODE_CHANGED_IND:
{
printf("SET OPERATING MODE is operatingMode %d, persistent %d", resp->operatingMode, resp->persistent);
}
//...
}
}
int main()
{
M2MB_RESULT_E retVal = M2MB_RESULT_SUCCESS;
M2MB_SYS_HANDLE h = NULL;
struct myStruct myUserdata;
retVal = m2mb_sys_init(&h, myCallback, (void*)myUserdata);
//...
// setting non persistent M2MB_SYS_OP_MODE_LOW_POWER
if ( retVal == M2MB_RESULT_SUCCESS )
printf( "m2mb_sys_set_operating_mode request succeeded");
}
M2MB_SYS_GET_OPERATING_MODE_RESP_T
Definition: m2mb_sys.h:75
M2MB_SYS_OP_MODE_LOW_POWER
Definition: m2mb_sys.h:48
M2MB_SYS_OPERATING_MODE_T
Definition: m2mb_sys.h:69
m2mb_sys_deinit
M2MB_RESULT_E m2mb_sys_deinit(M2MB_SYS_HANDLE h)
m2mb_sys_deinit deinitializes SYS service for current client.
m2mb_sys_get_operating_mode
M2MB_RESULT_E m2mb_sys_get_operating_mode(M2MB_SYS_HANDLE h)
m2mb_sys_get_operating_mode gets information about the current operating mode.
m2mb_sys_init
M2MB_RESULT_E m2mb_sys_init(M2MB_SYS_HANDLE *h, m2mb_sys_ind_callback callback, void *userdata)
m2mb_sys_init initializes SYS service for current client.
M2MB_SYS_GENERIC_RESP_T
Definition: m2mb_sys.h:81
m2mb_sys_set_operating_mode
M2MB_RESULT_E m2mb_sys_set_operating_mode(M2MB_SYS_HANDLE h, M2MB_SYS_OP_MODE_E operatingMode, BOOLEAN persistent)
m2mb_sys_set_operating_mode sets the operating mode.