Functions

app_api.c File Reference

API to use KMS interface. More...

#include <gtk/gtk.h>
#include "vos.h"
#include "support.h"
#include "expat.h"
#include "app_api.h"
#include "net_remote.h"
#include "net_local.h"
#include "app_main.h"
#include "app_itf.h"
Include dependency graph for app_api.c:

Functions

vos_res_t app_api_connect (u32 in_u32_app_id, char *in_pc_local_login, char *in_pc_local_password, char *in_pc_remote_ip_addr, char *in_pc_remote_login, char *in_pc_remote_password)
 This function is used to connect an application to a Knet Agent.
vos_res_t app_api_disconnect (void)
 This function is used to disconnect an application from a Knet Agent.
vos_res_t app_api_req_position (u32 in_u32_period, char *in_pc_name)
 This message requests the current GPS position.
vos_res_t app_api_req_areatrig (u32 in_u32_id, s32 in_s32_lat, s32 in_s32_long, u32 in_u32_radius, area_way_e in_e_way, char *in_pc_name)
 This message programs an area detection (geofencing).
vos_res_t app_api_req_call (char *in_pc_ident, call_act_e in_e_call_act)
 This command performs call request & action.
vos_res_t app_api_req_change_gsm_volume (u32 in_u32_vol)
 This command change the volume of GSM module output.
vos_res_t app_api_req_change_tone_volume (u32 in_u32_vol)
 This command change the volume of the tone of the GSM module.
vos_res_t app_api_req_sms (char *in_pc_ident, bool in_b_binary_sms, char *in_pc_msg)
 This command sends a SMS to a remote phone.
vos_res_t app_api_req_smstrig (char *in_pc_name)
 This message programs SMS trigger.
vos_res_t app_api_req_gsmtrig (char *in_pc_name)
 This message programs GSM network event trigger.
vos_res_t app_api_req_calltrig (char *in_pc_name)
 This message programs GSM call event trigger.
vos_res_t app_api_req_rssi (u32 in_u32_period, char *in_pc_name)
 This message requests the current rssi level.
vos_res_t app_api_req_input (io_type_e in_e_type, u32 in_u32_id, u32 in_u32_period, char *in_pc_name)
 This message provides a command to an input.
vos_res_t app_api_req_inputtrig (io_type_e in_e_type, u32 in_u32_id, io_way_e in_e_way, u32 in_u32_value, u32 in_u32_hysteresis, char *in_pc_name)
 This message programs an input threshold trigger.
vos_res_t app_api_req_output (io_type_e in_e_type, u32 in_u32_id, u32 in_u32_value)
 This message commands to output an analog or digital value.
vos_res_t app_api_req_pulse (u32 in_u32_id, u32 in_u32_value, u32 in_u32_delay, u32 in_u32_period, char *in_pc_name)
 This message commands a pulse mode on a digital output.
vos_res_t app_api_req_stats (bool in_b_local_version, u32 in_u32_period, char *in_pc_name)
 This command allows to periodically receive statistic information.
vos_res_t app_api_req_statstrig (char *in_pc_name)
 This command allows to receive stats information only when an (dis)connect event occurs in WANESY network.
vos_res_t app_api_req_version (bool in_b_local_version)
 This message requests the version of knet agent.
vos_res_t app_api_req_system (bool in_b_local_version, system_act_e in_e_act, bearer_class_e in_e_class)
 This service allows to manually perform system operations.
vos_res_t app_api_req_wakeup (u8 in_u8_hh, u8 in_u8_mm)
 This service program an RTC wakeup.
vos_res_t app_api_req_dota (char *in_pc_ref, bool in_b_install_now)
 This message permits to upgrade any file in the device or a set of files.
vos_res_t app_api_req_appping (void)
 This message signals to knet agent that application is alive.

Detailed Description

API to use KMS interface.

Author:
KLK
Version:
1.0
Date:
March 10, 2011

This file contains functions to call KMS interface


Function Documentation

app_api_connect ( u32  in_u32_app_id,
char *  in_pc_local_login,
char *  in_pc_local_password,
char *  in_pc_remote_ip_addr,
char *  in_pc_remote_login,
char *  in_pc_remote_password 
)

This function is used to connect an application to a Knet Agent.

Parameters:
in_u32_app_id is the id of this application for Knet agent (values 0 and 255 are not allowed).
in_pc_local_login is the KMS login for local agent.
in_pc_local_password is the KMS password for local agent.
in_pc_remote_ip_addr is IP address of the device.
in_pc_remote_login is the KMS login for local agent.
in_pc_remote_password is the KMS password for local agent.

Referenced by main().

Here is the call graph for this function:

app_api_req_areatrig ( u32  in_u32_id,
s32  in_s32_lat,
s32  in_s32_long,
u32  in_u32_radius,
area_way_e  in_e_way,
char *  in_pc_name 
)

This message programs an area detection (geofencing).

Parameters:
in_u32_id specify the id of the area.
in_s32_lat is the latitude of the center of the area
in_s32_long is the latitude of the center of the area
in_u32_radius is the radius of the area
in_e_way is the in/out detection mode
in_pc_name is the id of the request used to stop the trigger (Max length is 19 characters)
app_api_req_call ( char *  in_pc_ident,
call_act_e  in_e_call_act 
)

This command performs call request & action.

Parameters:
in_pc_ident gives the phone number of the destination.
in_e_call_act indicates the action to be performed

Referenced by on_button_connect_clicked().

app_api_req_calltrig ( char *  in_pc_name  ) 

This message programs GSM call event trigger.

Parameters:
in_pc_name is the id of the request used to stop the trigger (Max length is 19 characters)

Referenced by app_cb_connect_ind(), and app_cb_ind_system().

app_api_req_change_gsm_volume ( u32  in_u32_vol  ) 

This command change the volume of GSM module output.

Parameters:
in_u32_vol absolute value of volume to setup
app_api_req_change_tone_volume ( u32  in_u32_vol  ) 

This command change the volume of the tone of the GSM module.

Parameters:
in_u32_vol absolute value of the volume to setup
app_api_req_dota ( char *  in_pc_ref,
bool  in_b_install_now 
)

This message permits to upgrade any file in the device or a set of files.

Parameters:
in_pc_ref is the absolute full pathname of the upgrade package.
in_b_install_now specify if it is necessary to reboot now or not.
app_api_req_gsmtrig ( char *  in_pc_name  ) 

This message programs GSM network event trigger.

Parameters:
in_pc_name is the id of the request used to stop the trigger (Max length is 19 characters)
app_api_req_input ( io_type_e  in_e_type,
u32  in_u32_id,
u32  in_u32_period,
char *  in_pc_name 
)

This message provides a command to an input.

Parameters:
in_e_type informs the type of the I/O : digital, adc, apc, temperature or counter
in_u32_id is the number of the I/O
in_u32_period specify the period of sending "input" message, in second. 0 means once.
in_pc_name is the id of the request used to stop the trigger (Max length is 19 characters)

Referenced by app_cb_connect_ind(), and app_cb_ind_system().

app_api_req_inputtrig ( io_type_e  in_e_type,
u32  in_u32_id,
io_way_e  in_e_way,
u32  in_u32_value,
u32  in_u32_hysteresis,
char *  in_pc_name 
)

This message programs an input threshold trigger.

Parameters:
in_e_type informs the type of the I/O : digital, adc, apc, temperature.
in_u32_id is the number of the I/O.
in_e_way threshold passing/edge mode
in_u32_value equals to the threshold programming (only for adc & temperature)
in_u32_hysteresis is the value for up and down transition (only for adc & temperature)
in_pc_name is the id of the request used to stop the trigger (Max length is 19 characters)

Referenced by app_cb_connect_ind(), and app_cb_ind_system().

app_api_req_output ( io_type_e  in_e_type,
u32  in_u32_id,
u32  in_u32_value 
)

This message commands to output an analog or digital value.

Parameters:
in_e_type informs the type of the I/O : digital or dac.
in_u32_id is the number of the I/O.
in_u32_value is the value to set.
app_api_req_position ( u32  in_u32_period,
char *  in_pc_name 
)

This message requests the current GPS position.

Parameters:
in_u32_period specify the period of sending a Position message, in second. 0 means once.
in_pc_name is the id of the request used to stop the trigger (Max length is 19 characters)

Referenced by app_cb_connect_ind(), and app_cb_ind_system().

app_api_req_pulse ( u32  in_u32_id,
u32  in_u32_value,
u32  in_u32_delay,
u32  in_u32_period,
char *  in_pc_name 
)

This message commands a pulse mode on a digital output.

Parameters:
in_u32_id is the number of the I/O.
in_u32_value is the value to set.
in_u32_delay is the duration of the pulse value.
in_u32_period is the period of the pulse, if null, the pulse is done only once.
in_pc_name is the id of the request used to stop the trigger (Max length is 19 characters)
app_api_req_rssi ( u32  in_u32_period,
char *  in_pc_name 
)

This message requests the current rssi level.

Parameters:
in_u32_period specify the period of sending a RSSI message, in second. 0 means once.
in_pc_name is the id of the request used to stop the trigger (Max length is 19 characters)
app_api_req_sms ( char *  in_pc_ident,
bool  in_b_binary_sms,
char *  in_pc_msg 
)

This command sends a SMS to a remote phone.

Parameters:
in_pc_ident gives the phone number of the destination.
in_b_binary_sms indicates if it is a binary SMS or not.
in_pc_msg provides the SMS body in text format or data part of the PDU hexastring if it is a binary SMS.
app_api_req_smstrig ( char *  in_pc_name  ) 

This message programs SMS trigger.

Parameters:
in_pc_name is the id of the request used to stop the trigger (Max length is 19 characters)
app_api_req_stats ( bool  in_b_local_version,
u32  in_u32_period,
char *  in_pc_name 
)

This command allows to periodically receive statistic information.

Parameters:
in_b_local_version is TRUE if we want to speak to local agent or FALSE to remote agent.
in_u32_period specify the period of sending STATS message, in second. 0 eans once.
in_pc_name is the id of the request used to stop the trigger (Max length is 19 characters)
app_api_req_statstrig ( char *  in_pc_name  ) 

This command allows to receive stats information only when an (dis)connect event occurs in WANESY network.

Parameters:
in_pc_name is the id of the request used to stop the trigger (Max length is 19 characters)

Referenced by app_cb_connect_ind(), and app_cb_ind_system().

app_api_req_system ( bool  in_b_local_version,
system_act_e  in_e_act,
bearer_class_e  in_e_class 
)

This service allows to manually perform system operations.

Parameters:
in_b_local_version is TRUE if we want to speak to local agent or FALSE to remote agent.
in_e_act specify the kind of command ( disconnect, handover, reboot, poweroff, reload )
in_e_class specify the class of new bearer (gprs, ethernet, wlan) for handover or disconnect, "none" for other commands

Referenced by app_cb_ind_input(), app_cb_ind_inputtrig(), app_cb_ind_stopreq(), and app_cb_ind_system().

app_api_req_version ( bool  in_b_local_version  ) 

This message requests the version of knet agent.

Parameters:
in_b_local_version is TRUE if we want to speak to local agent or FALSE to remote agent.
app_api_req_wakeup ( u8  in_u8_hh,
u8  in_u8_mm 
)

This service program an RTC wakeup.

Parameters:
in_u8_hh specify the hour to wakeup
in_u8_mm specify the minut to wakeup