WizziLab / modem_ref_v5_3_217

Dependents:   modem_ref_helper_for_v5_3_217

Embed: (wiki syntax)

« Back to documentation index

modem_ref.h File Reference

modem_ref.h File Reference

========================================================================={{{ Copyright (c) 2013-2016 WizziLab / All rights reserved / =========================================================================}}} More...

Go to the source code of this file.

Typedefs

typedef int( fx_serial_send_t )(u8 *buffer1, u8 size1, u8 *buffer2, u8 size2)
 Send concatenation of 2 buffers of given size over serial link.
typedef void( fx_read_t )(u8 fid, u32 offset, u32 length, int id)
 Called when ALP-Read is requested by the modem.
typedef void( fx_write_t )(u8 fid, void *data, u32 offset, u32 length, int id)
 Called when ALP-Write is requested by the modem.
typedef void( fx_read_fprop_t )(u8 fid, int id)
 Called when ALP-Read-file-properties is requested by the modem.
typedef void( fx_flush_t )(u8 fid, int id)
 Called when ALP-Flush is requested by the modem.
typedef void( fx_delete_t )(u8 fid, int id)
 Called when ALP-Delete is requested by the modem.
typedef void( fx_udata_t )(void *data, u32 length)
 Called when Unsollicited Data is received by the Modem (i.e.
typedef void( fx_lqual_t )(u8 ifid, int per)
 Called when LQUAL URC is generated by the modem.
typedef void( fx_ldown_t )(u8 ifid)
 Called when LDOWN URC is generated by the modem.
typedef void( fx_reset_t )(void)
 Called when RESET URC is generated by the modem.
typedef void( fx_boot_t )(u8 cause, u16 nb_boot)
 Called when BOOT URC is generated by the modem.
typedef void( fx_busy_t )(u8 busy)
 Called when BUSY URC is generated by the modem.
typedef void( fx_itf_busy_t )(u8 ifid, u32 busy)
 Called when BUSY URC is generated by the modem.
typedef void( action_callback_t )(u8 terminal, s8 err, u8 id)
 Type of function called on response(s) generated by an 'action' function.

Functions

protected void modem_input (u8 flowid, u8 *payload, u8 size)
 Modem Configuration.
public void modem_open (fx_serial_send_t *send, modem_callbacks_t *callbacks)
 Open Wizzilab Modem Driver.
public int modem_get_id (action_callback_t *cb)
 Request an ID to perform modem operations.
public int modem_free_id (u8 id)
 Release an ID.
public void modem_read_file (u8 fid, void *data, u32 offset, u32 length, u8 id)
 Read a file on Modem.
public void modem_read_fprop (u8 fid, alp_file_header_t *data, u8 id)
 Read a file-properties on Modem.
public void modem_read_fprop_root (u8 fid, alp_file_header_t *data, u8 *root_key, u8 id)
 Read a file-properties on Modem with ROOT privileges.
public void modem_write_fprop (u8 fid, alp_file_header_t *data, u8 id)
 Write a file-properties on Modem.
public void modem_write_fprop_root (u8 fid, alp_file_header_t *data, u8 *root_key, u8 id)
 Write a file-properties on Modem with ROOT privileges.
public void modem_write_file (u8 fid, void *data, u32 offset, u32 length, u8 id)
 Write a file on Modem.
public void modem_write_file_root (u8 fid, void *data, u32 offset, u32 length, u8 *root_key, u8 id)
 Write a file on Modem with ROOT privileges.
public void modem_flush_file (u8 fid, u8 id)
 Flush a file on Modem.
public void modem_flush_file_root (u8 fid, u8 *root_key, u8 id)
 Flush a file on Modem with ROOT privileges.
public void modem_declare_file (u8 fid, alp_file_header_t *hdr, u8 local, u8 id)
 Declare a local file to the Modem.
public void modem_create_file (u8 fid, alp_file_header_t *hdr, u8 id)
 Creates a file on the Modem.
public void modem_delete_file (u8 fid, u8 id)
 Deletes a file on the Modem.
public void modem_notify_file (u8 fid, u32 offset, u32 length, u8 id)
 "Notify" a local file using its D7AActP properties.
public void modem_send_raw_alp (u8 *payload, u32 length, u8 id)
 Execute specific ALP payload on Modem.

Detailed Description

========================================================================={{{ Copyright (c) 2013-2016 WizziLab / All rights reserved / =========================================================================}}}

Wizzilab Modem Reference Driver Implementation Source code should be disclosable and easily portable to any architecture.

Definition in file modem_ref.h.


Typedef Documentation

typedef void( action_callback_t)(u8 terminal, s8 err, u8 id)

Type of function called on response(s) generated by an 'action' function.

Different functions of this kind can be associated to different IDs through 'get_id'. 'Action' function are subsequently called with relevant ID.

Parameters:
terminal: '1' at the last call for this ID, '0' otherwise
err: ALP Error code
id: ID of the request

Definition at line 290 of file modem_ref.h.

typedef void( fx_boot_t)(u8 cause, u16 nb_boot)

Called when BOOT URC is generated by the modem.

Parameters:
cause: Cause of the boot 'H':Pin/Hardware reset 'P':POR reset 'S':Software reset 'L':Low-power reset 'W':Watchdog reset
nb_boot: Number of boots since last POR

Definition at line 241 of file modem_ref.h.

typedef void( fx_busy_t)(u8 busy)

Called when BUSY URC is generated by the modem.

Parameters:
busy: 0 if not busy, else busy

Definition at line 249 of file modem_ref.h.

typedef void( fx_delete_t)(u8 fid, int id)

Called when ALP-Delete is requested by the modem.

Function must perform required actions to fullfil the request then should call 'respond'

Parameters:
fid: File ID
id: ID of the request

Definition at line 186 of file modem_ref.h.

typedef void( fx_flush_t)(u8 fid, int id)

Called when ALP-Flush is requested by the modem.

Function must perform required actions to fullfil the request then should call 'respond'

Parameters:
fid: File ID
id: ID of the request

Definition at line 175 of file modem_ref.h.

typedef void( fx_itf_busy_t)(u8 ifid, u32 busy)

Called when BUSY URC is generated by the modem.

Parameters:
ifid: interface file id
busy: busy time in seconds

Definition at line 258 of file modem_ref.h.

typedef void( fx_ldown_t)(u8 ifid)

Called when LDOWN URC is generated by the modem.

LDOWN URC is setup by the user through 'modem_enable_urc' LDOWN is generated for a particular interface (IFID) after a (configurable) number of consecutive transmission have failed.

Parameters:
ifid: Interface File ID from which LDOWN is issued

Definition at line 219 of file modem_ref.h.

typedef void( fx_lqual_t)(u8 ifid, int per)

Called when LQUAL URC is generated by the modem.

LQUAL URC is setup by the user through 'modem_enable_urc'. LQUAL gives percentage of successfully sent packets on a particular interface (IFID).

Parameters:
ifid: Interface File ID from which LQUAL is issued
per: Packet Error Rate in %

Definition at line 208 of file modem_ref.h.

typedef void( fx_read_fprop_t)(u8 fid, int id)

Called when ALP-Read-file-properties is requested by the modem.

Function must perform required actions to fullfil the request then should call 'respond_fprop' (or 'respond' in case of error)

Parameters:
fid: File ID
id: ID of the request

Definition at line 164 of file modem_ref.h.

typedef void( fx_read_t)(u8 fid, u32 offset, u32 length, int id)

Called when ALP-Read is requested by the modem.

Function must perform required actions to fullfil the request then should call 'respond_read' (or 'respond' in case of error)

Parameters:
fid: File ID
offset: Access Offset in bytes
length: Access Size in bytes
id: ID of the request

Definition at line 139 of file modem_ref.h.

typedef void( fx_reset_t)(void)

Called when RESET URC is generated by the modem.

LDOWN URC is setup by the user through 'modem_enable_urc'

Parameters:
ifid: Interface File ID from which LDOWN is issued

Definition at line 228 of file modem_ref.h.

typedef int( fx_serial_send_t)(u8 *buffer1, u8 size1, u8 *buffer2, u8 size2)

Send concatenation of 2 buffers of given size over serial link.

Parameters:
buffer1: Pointer to the 1st data buffer to be sent
size1: Size in bytes of the 1st buffer to be sent
buffer2: Pointer to the 2nd data buffer to be sent
size2: Size in bytes of the 2nd buffer to be sent
Returns:
number of bytes sent.
Note:
either buffers can be of size zero.
buffer1 is used for WC header
buffer2 is used actual payload

Definition at line 120 of file modem_ref.h.

typedef void( fx_udata_t)(void *data, u32 length)

Called when Unsollicited Data is received by the Modem (i.e.

peer notifications etc).

Parameters:
data: Pointer to the data buffer
length: Data Size in bytes

Definition at line 196 of file modem_ref.h.

typedef void( fx_write_t)(u8 fid, void *data, u32 offset, u32 length, int id)

Called when ALP-Write is requested by the modem.

Function must perform required actions to fullfil the request then should call 'respond'

Parameters:
fid: File ID
data: Pointer to the destination data buffer
offset: Access Offset in bytes
length: Access Size in bytes
id: ID of the request

Definition at line 153 of file modem_ref.h.


Function Documentation

public void modem_create_file ( u8  fid,
alp_file_header_t *  hdr,
u8  id 
)

Creates a file on the Modem.

Parameters:
fid: File ID
hdr: ALP File Header.
id: User ID

Definition at line 578 of file modem_ref.cpp.

public void modem_declare_file ( u8  fid,
alp_file_header_t *  hdr,
u8  local,
u8  id 
)

Declare a local file to the Modem.

Once declared, the file becomes virtually part of Modem's file-system and can:

  • be remotely accessed (depending on its permissions)
  • be "Notified" through notify_file use
    Note:
    The file must exist locally.
    Modem will access the file when needed using ALP commands.
    Parameters:
    fid: File ID
    hdr: ALP File Header.
    local: File is local.
    id: User ID

Definition at line 567 of file modem_ref.cpp.

public void modem_delete_file ( u8  fid,
u8  id 
)

Deletes a file on the Modem.

Parameters:
fid: File ID
id: User ID

Definition at line 600 of file modem_ref.cpp.

public void modem_flush_file ( u8  fid,
u8  id 
)

Flush a file on Modem.

Parameters:
fid: File ID
id: User ID

Definition at line 539 of file modem_ref.cpp.

public void modem_flush_file_root ( u8  fid,
u8 *  root_key,
u8  id 
)

Flush a file on Modem with ROOT privileges.

Parameters:
fid: File ID
root_key: Pointer to the ROOT key
id: User ID

Definition at line 549 of file modem_ref.cpp.

public int modem_free_id ( u8  id )

Release an ID.

Parameters:
id: ID to release.
Returns:
ID value, -1 if ID was not in use.

Definition at line 398 of file modem_ref.cpp.

public int modem_get_id ( action_callback_t cb )

Request an ID to perform modem operations.

Parameters:
cb: Function called on responses generated for this ID.
Returns:
Positive ID value, -1 if no more IDs available.

Definition at line 382 of file modem_ref.cpp.

protected void modem_input ( u8  flowid,
u8 *  payload,
u8  size 
)

Modem Configuration.

Parse packets and handles calls to relevant callbacks.

Parameters:
flowid: WizziCom FlowID.
payload: pointer to payload buffer.
size: payload size in bytes.

Definition at line 80 of file modem_ref.cpp.

public void modem_notify_file ( u8  fid,
u32  offset,
u32  length,
u8  id 
)

"Notify" a local file using its D7AActP properties.

Note:
The file must exist locally and must have been 'declared'.
Parameters:
fid: File ID
offset: Access Offset in bytes
length: Access Size in bytes
id: User ID

Definition at line 589 of file modem_ref.cpp.

public void modem_open ( fx_serial_send_t send,
modem_callbacks_t *  callbacks 
)

Open Wizzilab Modem Driver.

Parameters:
send: User function implementing serial output.
callbacks: Set of functions called by the driver upon reception of commands
Returns:
0

Definition at line 411 of file modem_ref.cpp.

public void modem_read_file ( u8  fid,
void *  data,
u32  offset,
u32  length,
u8  id 
)

Read a file on Modem.

Parameters:
fid: File ID
data: Pointer to the destination data buffer
offset: Access Offset in bytes
length: Access Size in bytes
id: User ID

Definition at line 438 of file modem_ref.cpp.

public void modem_read_fprop ( u8  fid,
alp_file_header_t *  data,
u8  id 
)

Read a file-properties on Modem.

Parameters:
fid: File ID
data: Pointer to the destination data buffer
id: User ID

Definition at line 449 of file modem_ref.cpp.

public void modem_read_fprop_root ( u8  fid,
alp_file_header_t *  data,
u8 *  root_key,
u8  id 
)

Read a file-properties on Modem with ROOT privileges.

Parameters:
fid: File ID
data: Pointer to the destination data buffer
root_key: Pointer to the ROOT key
id: User ID

Definition at line 460 of file modem_ref.cpp.

public void modem_send_raw_alp ( u8 *  payload,
u32  length,
u8  id 
)

Execute specific ALP payload on Modem.

Parameters:
payload: pointer to ALP Payload to be executed on Modem
length: ALP Payload size
id: User ID

Definition at line 629 of file modem_ref.cpp.

public void modem_write_file ( u8  fid,
void *  data,
u32  offset,
u32  length,
u8  id 
)

Write a file on Modem.

Note:
Writing can trigger a 'notification' depending on file properties.
Parameters:
fid: File ID
data: Pointer to the source data buffer
offset: Access Offset in bytes
length: Access Size in bytes
id: User ID

Definition at line 507 of file modem_ref.cpp.

public void modem_write_file_root ( u8  fid,
void *  data,
u32  offset,
u32  length,
u8 *  root_key,
u8  id 
)

Write a file on Modem with ROOT privileges.

Note:
Writing can trigger a 'notification' depending on file properties.
Parameters:
fid: File ID
data: Pointer to the source data buffer
offset: Access Offset in bytes
length: Access Size in bytes
root_key: Pointer to the ROOT key
id: User ID

Definition at line 519 of file modem_ref.cpp.

public void modem_write_fprop ( u8  fid,
alp_file_header_t *  data,
u8  id 
)

Write a file-properties on Modem.

Parameters:
fid: File ID
data: Pointer to the header data
id: User ID

Definition at line 479 of file modem_ref.cpp.

public void modem_write_fprop_root ( u8  fid,
alp_file_header_t *  data,
u8 *  root_key,
u8  id 
)

Write a file-properties on Modem with ROOT privileges.

Parameters:
fid: File ID
data: Pointer to the header data
root_key: Pointer to the ROOT key
id: User ID

Definition at line 489 of file modem_ref.cpp.