Wiicom API Lib
 Tutto Strutture dati File Funzioni Variabili Ridefinizioni di tipo (typedef) Tipi enumerati (enum) Valori del tipo enumerato Definizioni Gruppi
Riferimenti per il file C:/WIICOM-SVN/Sviluppo/Software/library/wiicom_lib/trunk/wiicom_libcommunication.h

Compact module function library. Continua...

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "wiicom_libutil.h"

Vai al codice sorgente di questo file.

Strutture dati

struct  t_wiicom_comm_msg
 Command/message structure type. Continua...
 
struct  t_dtype_size
 Struct definition for CMD_DTYPE_SIZE. Continua...
 
struct  t_wiicom_comm_compact_net
 Struct definition for the Compact module network configuration. Continua...
 
struct  t_wiicom_comm_compact_uart
 Struct definition for the Compact module UART configuration. Continua...
 
struct  t_wiicom_comm_compact_info
 Struct definition for the Compact module information data. Continua...
 

Definizioni

#define WIICOM_CMD_MAX_BUFFER_DATA   65536
 
#define CANBUS_OUTPUT_XML_SIGNALS_FILTER   0
 Canbus output type. Continua...
 
#define CANBUS_OUTPUT_XML_MESSAGES_FILTER   1
 
#define CANBUS_OUTPUT_XML_ALL   2
 
#define CANBUS_OUTPUT_CSV_SIGNALS_FILTER   3
 
#define CANBUS_OUTPUT_CSV_MESSAGES_FILTER   4
 
#define CANBUS_OUTPUT_CSV_ALL   5
 
#define CANBUS_OUTPUT_DISABLED   8
 
#define CANBUS_INPUT_CSV_ALL   0
 Canbus input type. Continua...
 
#define CANBUS_INPUT_CSV_MESSAGES_FILTER   1
 
#define CANBUS_INPUT_DISABLED   2
 

Tipi enumerati (enum)

enum  t_wiicom_comm_action {
  CMD_ACT_READONESHOT, CMD_ACT_WRITE, CMD_ACT_READPERIODIC, CMD_ACT_READTRIGGERED,
  CMD_ACT_WRITESILENT, CMD_ACT_num_values
}
 Types of actions that can be requested by a command to the Compact module. Continua...
 
enum  t_wiicom_cmd_data_type {
  CMD_DTYPE_BAND, CMD_DTYPE_POWERMODE, CMD_DTYPE_MACADDRESS, CMD_DTYPE_SCANCHANNEL,
  CMD_DTYPE_SCANSSID, CMD_DTYPE_NWTYPE, CMD_DTYPE_SECURITYTYPE, CMD_DTYPE_DATARATE,
  CMD_DTYPE_POWERLEVEL, CMD_DTYPE_PSK, CMD_DTYPE_SSID, CMD_DTYPE_IBSSMODE,
  CMD_DTYPE_IBSSCHANNEL, CMD_DTYPE_DHCPMODE, CMD_DTYPE_IPADDR, CMD_DTYPE_NETMASK,
  CMD_DTYPE_GATEWAY, CMD_DTYPE_DNSIP, CMD_DTYPE_DOMAINNAME, CMD_DTYPE_LISTENINTERVAL,
  CMD_DTYPE_SOCKETTYPE, CMD_DTYPE_MODULESOCKET, CMD_DTYPE_DESTSOCKET, CMD_DTYPE_DESTIPADDR,
  CMD_DTYPE_SAVEPARGROUP, CMD_DTYPE_USDB_AI, CMD_DTYPE_USDB_AO, CMD_DTYPE_USDB_DI,
  CMD_DTYPE_USDB_DO, CMD_DTYPE_USDB_BUS, CMD_DTYPE_USDB_PERIOD, CMD_DTYPE_USDB_TRIGGER,
  CMD_DTYPE_USDB_TIMESTAMP, CMD_DTYPE_UART_STOPBITS, CMD_DTYPE_UART_PARITY, CMD_DTYPE_UART_BAUDRATE,
  CMD_DTYPE_UART_DATABITS, CMD_DTYPE_SOCKETCONFIG, CMD_DTYPE_INFO_ALL, CMD_DTYPE_INFO_ALIAS,
  CMD_DTYPE_CANDB_MSG, CMD_DTYPE_CANDB_SIG, CMD_DTYPE_CAN_MSG, CMD_DTYPE_CAN_SIG,
  CMD_DTYPE_CANPORTCONFIG, CMD_DTYPE_DIOCONFIG, CMD_DTYPE_ADVANCED, CMD_DTYPE_CANDB_MSG_INPUT,
  CMD_DTYPE_I2C, CMD_DTYPE_CANBUS_FILTER, CMD_DTYPE_USERTASK, CMD_DTYPE_POWERSAVE,
  CMD_DTYPE_POWERSAVE_SLEEPNOW, CMD_DTYPE_POWERSAVE_SETRUNNINGCOUNTER, CMD_DTYPE_num_values
}
 Types of data that can be read or can be sent to your Compact. Continua...
 
enum  t_compact_net_rf_power { RF_POWER_LOW, RF_POWER_MEDIUM, RF_POWER_HIGH }
 Types of RF power level. Continua...
 
enum  t_compact_net_datarate {
  DATA_RATE_AUTO, DATA_RATE_1Mbs, DATA_RATE_2Mbs, DATA_RATE_5P5Mbs,
  DATA_RATE_11Mbs, DATA_RATE_6Mbs, DATA_RATE_9Mbs, DATA_RATE_12Mbs
}
 Types of wireless data rate speed. Continua...
 
enum  t_wiicom_cmd_canbus_input { CSV_ALL, CSV_MESSAGES_FILTER, DISABLED }
 

Funzioni

void wiicom_comm_reset (int8_t b_reset_all, t_wiicom_comm_msg *cmd_msg)
 Function that cleans up the data communication structure. Continua...
 
void wiicom_comm_print (FILE *fp, t_wiicom_comm_msg *cmd_msg)
 Function that prints the contents of the communication data structure. Continua...
 
void wiicom_comm_elab (uint8_t *rxData, uint32_t num_rxData, t_wiicom_comm_msg *cmd_msg, void(*callback)(t_wiicom_comm_msg *), void(*callback_error)(t_wiicom_comm_msg *))
 Function that extracts datas from a buffer messages/commands sent by your Compact module. Continua...
 
void wiicom_comm_createCommand (t_wiicom_comm_msg *cmd_msg, uint16_t par_msg_cnt, uint8_t par_destination, uint16_t par_action)
 Function that initializes the communication data structure for send a new command to a Compact module. Continua...
 
uint8_t wiicom_comm_addToDataBlock (t_wiicom_comm_msg *cmd_msg, uint16_t par_type, uint8_t par_data_cnt, uint8_t par_data_idx, uint8_t *par_data)
 Function that adds a datablock to a given communication data structure. Continua...
 
void wiicom_comm_closeCommand (t_wiicom_comm_msg *cmd_msg)
 Function which finalizes the communication data structure, the command is ready to be sent to your Compact. Continua...
 
uint8_t wiicom_comm_getDataBlock (t_wiicom_comm_msg *cmd_msg, uint16_t par_type, uint8_t par_data_cnt, uint8_t par_data_idx, uint8_t *par_data)
 Function that extracts a datablock from communication data structure. Continua...
 
void wiicom_comm_cmd_msgTOrow (t_wiicom_comm_msg *cmd_msg, uint8_t *rowData, uint16_t *rowData_length)
 Function that converts the content of a communication data structure in a sequence of bytes. Continua...
 
uint8_t wiicom_comm_recivIScomplete (t_wiicom_comm_msg *cmd_msg)
 function that checks if a command/message has been received completely Continua...
 
uint8_t wiicom_comm_sendCommand (t_wiicom_comm_msg *cmd_msg, const char *ip, uint16_t port)
 Function that sends a command to a Compact module and, if provided, returns the response. Continua...
 
uint8_t wiicom_comm_sendCommand_socket (t_wiicom_comm_msg *cmd_msg, int socketfd)
 Function that sends a command to a Compact module on pre-open socket and, if provided, returns the response. Continua...
 
uint8_t wiicom_comm_get_compact_info (const char *ip, uint16_t port, t_wiicom_comm_compact_info *info_struct)
 Function that read Compact module information. Continua...
 
uint8_t wiicom_comm_set_compact_alias (const char *ip, uint16_t port, char *alias)
 Function that set Compact module alias. Continua...
 
uint8_t wiicom_comm_get_compact_uart (const char *ip, uint16_t port, t_wiicom_comm_compact_uart *uart_struct)
 Function that read Compact module UART configuration. Continua...
 
uint8_t wiicom_comm_set_compact_uart (const char *ip, uint16_t port, t_wiicom_comm_compact_uart *uart_struct)
 Function that set Compact module UART configuration. Continua...
 
uint8_t wiicom_comm_get_compact_net (const char *ip, uint16_t port, t_wiicom_comm_compact_net *net_struct)
 Function that read Compact module network configuration. Continua...
 
uint8_t wiicom_comm_set_compact_net (const char *ip, uint16_t port, t_wiicom_comm_compact_net *net_struct)
 Function that set Compact module network configuration. Continua...
 
uint8_t wiicom_comm_get_compact_dio (const char *ip, uint16_t port, uint8_t num_dio, uint8_t *b_enabled, uint8_t *type)
 
uint8_t wiicom_comm_set_compact_dio (const char *ip, uint16_t port, uint8_t num_dio, uint8_t b_enabled, uint8_t type)
 
uint8_t wiicom_comm_get_compact_canbus (const char *ip, uint16_t port, uint32_t *speed, uint8_t *output_type, uint8_t *input_type)
 
uint8_t wiicom_comm_set_compact_canbus (const char *ip, uint16_t port, uint32_t speed, uint8_t output_type, uint8_t input_type)
 
uint8_t wiicom_comm_sendMsgCanbus (const char *ip, uint16_t port, uint32_t idmsg, uint8_t b_extendedMsg, uint8_t dlc, uint8_t *data)
 
uint8_t wiicom_comm_sendMsgCanbus_socket (int socketfd, uint32_t idmsg, uint8_t b_extendedMsg, uint8_t dlc, uint8_t *data)
 
uint8_t wiicom_comm_parseMsgCanbus (const char *recivData, uint16_t recivedDataLength, uint32_t *idmsg, uint8_t *b_extendedMsg, uint8_t *dlc, uint8_t *data)
 

Variabili

const t_dtype_size CMD_DTYPE_SIZE []
 Array containing the length of each data type t_wiicom_cmd_data_type and the max data count The length of a data type can be obtained by: CMD_DTYPE_SIZE[CMD_DTYPE_IPADDR].bytes_size The result obtained in this example is 4 The max data count of a data type can be obtained by: CMD_DTYPE_SIZE[CMD_DTYPE_IPADDR].max_data_count The result obtained in this example is 1. Continua...
 

Descrizione dettagliata

Compact module function library.

A library that allows you to communicate with the Wiicom Compact modules

Autore
Marco Malano
WIICOM s.r.l
Versione
1.1.0
Data
2012
Attenzione
This library depends on wiicom_libutil and on wiicom_libsocket
Every function that expects a result, in case of an error, set the Wiicom errno and print to stderr the error occurred.
Nota
None.

Documentazione delle definizioni

#define CANBUS_INPUT_CSV_ALL   0

Canbus input type.

#define CANBUS_INPUT_CSV_MESSAGES_FILTER   1
#define CANBUS_INPUT_DISABLED   2
#define CANBUS_OUTPUT_CSV_ALL   5
#define CANBUS_OUTPUT_CSV_MESSAGES_FILTER   4
#define CANBUS_OUTPUT_CSV_SIGNALS_FILTER   3
#define CANBUS_OUTPUT_DISABLED   8
#define CANBUS_OUTPUT_XML_ALL   2
#define CANBUS_OUTPUT_XML_MESSAGES_FILTER   1
#define CANBUS_OUTPUT_XML_SIGNALS_FILTER   0

Canbus output type.

#define WIICOM_CMD_MAX_BUFFER_DATA   65536

Maximum length of data you can send or receive from the Wiicom Compact modules

Documentazione dei tipi enumerati

Types of wireless data rate speed.

Valori del tipo enumerato
DATA_RATE_AUTO 
DATA_RATE_1Mbs 
DATA_RATE_2Mbs 
DATA_RATE_5P5Mbs 
DATA_RATE_11Mbs 
DATA_RATE_6Mbs 
DATA_RATE_9Mbs 
DATA_RATE_12Mbs 

Types of RF power level.

Valori del tipo enumerato
RF_POWER_LOW 
RF_POWER_MEDIUM 
RF_POWER_HIGH 
Valori del tipo enumerato
CSV_ALL 
CSV_MESSAGES_FILTER 
DISABLED 

Types of data that can be read or can be sent to your Compact.

Valori del tipo enumerato
CMD_DTYPE_BAND 

Band (1 bytes)

CMD_DTYPE_POWERMODE 

PowerMode (1 bytes) 0=Power Saving Disabled, 1=RF+Baseband+Control disabled, 2=RF+Baseband disabled)

CMD_DTYPE_MACADDRESS 

Mac address (6 bytes)(MSBfirst)

CMD_DTYPE_SCANCHANNEL 

Channel (4 bytes)(LSB first)

CMD_DTYPE_SCANSSID 

Ssid (32 bytes)(string)

CMD_DTYPE_NWTYPE 

Network type (1 bytes) 1=INFRASTRUCTURE_MODE, 0=OPEN_MODE (ad hoc), 2=SECURITY_MODE (ad hoc)

CMD_DTYPE_SECURITYTYPE 

Security type (1 bytes) 0=OPEN, 1=WPA1, 2=SECURITY_WPA2, 3=SECURITY_WEP

CMD_DTYPE_DATARATE 

Data rate (1 bytes) 0=DATA_RATE_AUTO,1, 2,5, 11, 6, 9, 12

CMD_DTYPE_POWERLEVEL 

Power level (1 bytes) 0=POWER_LEVEL_LOW, 1=POWER_LEVEL_MEDIUM, 2=POWER_LEVEL_HIGH

CMD_DTYPE_PSK 

Password (64 bytes)(string)

CMD_DTYPE_SSID 

Ssid (32 bytes) (string)

CMD_DTYPE_IBSSMODE 

Ibssmode (1 bytes) 1=IBSS_CREATOR (ad hoc), 0=IBSS_JOINER (infrastructure)

CMD_DTYPE_IBSSCHANNEL 

Ibss channel (1 bytes) if IBSSMODE creator then set channel: 2.5GHz channels are 1-14

CMD_DTYPE_DHCPMODE 

Dhcp mode (1 bytes) 0=DHCP_MODE_DISABLE, 1=DHCP_MODE_ENABLE

CMD_DTYPE_IPADDR 

Ip addrress (4 bytes)(MSBfirst)

CMD_DTYPE_NETMASK 

Netmask (4 bytes)(MSBfirst)

CMD_DTYPE_GATEWAY 

Ip gateway (4 bytes)(MSBfirst)

CMD_DTYPE_DNSIP 

Ip dns (4 bytes)(MSBfirst)

CMD_DTYPE_DOMAINNAME 

Domain name (42 bytes)(string)

CMD_DTYPE_LISTENINTERVAL 

Listen interval (2 bytes)(LSBfirst) frequency of module wake-up from AP (to set when in power save) [unit: AP beacons]

CMD_DTYPE_SOCKETTYPE 

Not implemented

CMD_DTYPE_MODULESOCKET 

Not implemented

CMD_DTYPE_DESTSOCKET 

Not implemented

CMD_DTYPE_DESTIPADDR 

Not implemented

CMD_DTYPE_SAVEPARGROUP 

0=none, 1=save network par in ROM, 2= save UART par in ROM, 3= save socket par in ROM
4= save alias name, 5=save CANBUS DB par in ROM, 6=save CANBUS PORT par in ROM, 7= save DIO par in ROM
8= save advance par in ROM (automatically reset to 0 after saving)

CMD_DTYPE_USDB_AI 

Not implemented

CMD_DTYPE_USDB_AO 

Not implemented

CMD_DTYPE_USDB_DI 

Not implemented

CMD_DTYPE_USDB_DO 

Not implemented

CMD_DTYPE_USDB_BUS 

Not implemented

CMD_DTYPE_USDB_PERIOD 

Not implemented

CMD_DTYPE_USDB_TRIGGER 

Not implemented

CMD_DTYPE_USDB_TIMESTAMP 

Not implemented

CMD_DTYPE_UART_STOPBITS 

UART stop bit (1 bytes)

CMD_DTYPE_UART_PARITY 

UART parity (1 bytes)

CMD_DTYPE_UART_BAUDRATE 

UART baud rate (4 bytes)

CMD_DTYPE_UART_DATABITS 

1 byte - reserved

CMD_DTYPE_SOCKETCONFIG 

18 byte array (byte order MSB first):
MAXSOCKETS=8
byte[0] = socketIdx; socket idx [0-MAXSOCKETS]
byte[1] = socketEnable; 0=disabled, 1=enabled
byte[2][3] = socketType; 0=TCP Client, 1=UDP, 2=TCP Server (Listening TCP)
byte[4][5] = localPort; client/server sockets
byte[6][7] = destPort; only client sockets
byte[8][9][10][11] = destIP; only client sockets
byte[12] = tcpConnCloseRule; 0=never, 1=data_tx_timeout, 2=data_rx_timeout, 3= data_tx/rx_timeout
byte[13][14][15][16] = tcpConnCloseTimeout; 0=none, 1 - 4294967296 = timeout [ms]
byte[17] = socketMult; number of multiple sockets (server only): 1 = single socket, [2-MAXSOCKETS]=multiple socket

CMD_DTYPE_INFO_ALL 

67 byte array (byte order MSB first):
byte[0][31] = swVersion firmware version (string)
byte[32] = compactType 'S' = server, 'C'=client/server
byte[33][64] = compactAlias (custom defined name) (string)
byte[65][66] = usdbWifiCmd max size [bytes]

CMD_DTYPE_INFO_ALIAS 

32 byte array (MSBfirst)
compact alias (custom defined name) (string)

CMD_DTYPE_CANDB_MSG 
CMD_DTYPE_CANDB_SIG 

5 byte array (byte order MSB first): byte[0][3] msgId; = CAN message - msg ID byte[4] msgIdExt; = CAN message - msg IDtype (extended,standard)

CMD_DTYPE_CAN_MSG 

8 byte array (byte order MSB first): byte[0][3] msgId; = CAN signal - msg ID byte[4] msgIdExt; = CAN signal - msg IDtype (extended,standard)) byte[5] startBit; = CAN signal - startbit (0-based) byte[6] length; = CAN signal - length [bit] byte[7] byteOrder; = CAN signal - byte order (MOTOROLA=1,INTEL=0)

CMD_DTYPE_CAN_SIG 

Reserved

CMD_DTYPE_CANPORTCONFIG 

4 byte array (MSBfirst) = CAN signal - raw value

CMD_DTYPE_DIOCONFIG 

11 byte array (byte order MSB first): byte[0][3] speed; = CAN speed [bps] byte[4] prseg; = CAN PRSEG register (0-7) byte[5] seg1ph; = CAN SEG1PH register (0-7) byte[6] seg2ph; = CAN SEG1PH register (0-7) byte[7] sjw; = CAN SJW register (0-3) byte[8] sam; = CAN SAM register: 0=one_sample, 1=three_samples byte[9] output; = CAN output type: 0=signals, 1=messages byte[10] input; = CAN input type: 0=signals, 1=messages

CMD_DTYPE_ADVANCED 

3 byte array (byte order MSB first): byte[0] idx; = I/O idx byte[1] enable; = I/O enable (0|1) byte[2] type; = I/O type (0=input | 1=output)

CMD_DTYPE_CANDB_MSG_INPUT 

12 byte array (byte order MSB first):
byte[0][1] = uartPort
byte[2][3] = canPort
byte[4][5] = d4ioPort
byte[6][7] = uart2WifiMinData
byte[8][9] = uart2WifiMaxWaitMs
byte[10][11] = d4ioPollingTimeMs
byte[12][44] = initString

CMD_DTYPE_I2C 

5 byte array (byte order MSB first): byte[0][3] msgId; = CAN message - msg ID byte[4] msgIdExt; = CAN message - msg IDtype (extended,standard)

CMD_DTYPE_CANBUS_FILTER 

7 byte array (byte order MSB first):
uint32 = frequency
uint8 = outputType uint16 = offset CANBUS filter type, 0=normal, 1=controller-based

CMD_DTYPE_USERTASK 

16bit user task scheduler execution, in seconds 8bit auto reboot OFF/ON

CMD_DTYPE_POWERSAVE 
CMD_DTYPE_POWERSAVE_SLEEPNOW 

uint8 type; uint16 bootDelayTime; uint32 sleepTime; uint32 runningTime; uint8 ledOnSleep;

CMD_DTYPE_POWERSAVE_SETRUNNINGCOUNTER 

uint8 sleepNow; uint32 sleepNowTime;

CMD_DTYPE_num_values 

uint32 runningCounter;Total number of data types available

Types of actions that can be requested by a command to the Compact module.

Valori del tipo enumerato
CMD_ACT_READONESHOT 

Request a read data action to the Compact module

CMD_ACT_WRITE 

Request a write data action to the Compact module

CMD_ACT_READPERIODIC 

Request a periodic read data action to the Compact module

CMD_ACT_READTRIGGERED 

Request a read data action to the Compact module when an event is trigger

CMD_ACT_WRITESILENT 

Request a write data action to the Compact module without echo response

CMD_ACT_num_values 

Total number of actions available

Documentazione delle funzioni

uint8_t wiicom_comm_addToDataBlock ( t_wiicom_comm_msg cmd_msg,
uint16_t  par_type,
uint8_t  par_data_cnt,
uint8_t  par_data_idx,
uint8_t *  par_data 
)

Function that adds a datablock to a given communication data structure.

Parametri
[in,out]cmd_msgcommunication structure to add a given datablock
[in]par_typetype of data added
[in]par_data_cntdata vector number elements to be add; set it only for vector data type, otherwise 1
[in]par_data_idxdata vector index (zero based start index); set it only for vector data type, otherwise 0
[in]par_databuffer containing the data to be added
Restituisce
On success, TRUE is returned, On error, FALSE is returned
void wiicom_comm_closeCommand ( t_wiicom_comm_msg cmd_msg)

Function which finalizes the communication data structure, the command is ready to be sent to your Compact.

Parametri
[in,out]cmd_msgcommunication data structure to be finalized
Restituisce
void
void wiicom_comm_cmd_msgTOrow ( t_wiicom_comm_msg cmd_msg,
uint8_t *  rowData,
uint16_t *  rowData_length 
)

Function that converts the content of a communication data structure in a sequence of bytes.

Parametri
[in]cmd_msgcommunication data structure on which you want to perform the conversion
[out]rowDatathat will contain the binary conversion of the communication data structure
[out]rowData_lengththat will contain the bytes length of binary conversion
Restituisce
void
void wiicom_comm_createCommand ( t_wiicom_comm_msg cmd_msg,
uint16_t  par_msg_cnt,
uint8_t  par_destination,
uint16_t  par_action 
)

Function that initializes the communication data structure for send a new command to a Compact module.

Parametri
[in,out]cmd_msgcommand data structure to be initialized
[in]par_msg_cntnumber of the message to be sent
[in]par_destinationnumber that identifies the recipient
[in]par_actionaction that is required to be performed by the Compact module
Restituisce
void
void wiicom_comm_elab ( uint8_t *  rxData,
uint32_t  num_rxData,
t_wiicom_comm_msg cmd_msg,
void(*)(t_wiicom_comm_msg *)  callback,
void(*)(t_wiicom_comm_msg *)  callback_error 
)

Function that extracts datas from a buffer messages/commands sent by your Compact module.

Parametri
[in]rxDatabuffer containing the messages/commands to be interpreted
[in]num_rxDatanumber of bytes to interpret
[in,out]cmd_msgcommunication data structure to populate
[in]callbackfunction is invoked when a valid command is extracted from the buffer
Caution: If set to NULL will not be executed
[in]callback_errorfunction is invoked when an error occurred on extraction of a command from the buffer
Caution: If set to NULL will not be executed
Restituisce
void
uint8_t wiicom_comm_get_compact_canbus ( const char *  ip,
uint16_t  port,
uint32_t *  speed,
uint8_t *  output_type,
uint8_t *  input_type 
)
uint8_t wiicom_comm_get_compact_dio ( const char *  ip,
uint16_t  port,
uint8_t  num_dio,
uint8_t *  b_enabled,
uint8_t *  type 
)
uint8_t wiicom_comm_get_compact_info ( const char *  ip,
uint16_t  port,
t_wiicom_comm_compact_info info_struct 
)

Function that read Compact module information.

Parametri
[in]ipmodule IP address
[in]portmodule port
[out]info_structinfo data structure that will contain Compact module information
Restituisce
On success, TRUE is returned, On error, FALSE is returned
uint8_t wiicom_comm_get_compact_net ( const char *  ip,
uint16_t  port,
t_wiicom_comm_compact_net net_struct 
)

Function that read Compact module network configuration.

Parametri
[in]ipmodule IP address
[in]portmodule port
[out]net_structnetwork configuration data structure that will contain Compact module network config
Restituisce
On success, TRUE is returned, On error, FALSE is returned
uint8_t wiicom_comm_get_compact_uart ( const char *  ip,
uint16_t  port,
t_wiicom_comm_compact_uart uart_struct 
)

Function that read Compact module UART configuration.

Parametri
[in]ipmodule IP address
[in]portmodule port
[out]uart_structUART configuration data structure that will contain Compact module UART config
Restituisce
On success, TRUE is returned, On error, FALSE is returned
uint8_t wiicom_comm_getDataBlock ( t_wiicom_comm_msg cmd_msg,
uint16_t  par_type,
uint8_t  par_data_cnt,
uint8_t  par_data_idx,
uint8_t *  par_data 
)

Function that extracts a datablock from communication data structure.

Parametri
[in]cmd_msgcommunication data structure from which you want to extract datablock
[in]par_typetype of data to be extracted
[in]par_data_cntdata vector number elements to be extracted, otherwise 1
[in]par_data_idxdata vector index (zero based start index); it sets only for vector data type, otherwise 0
[out]par_datait contains the data extracted
Restituisce
On success, TRUE is returned, On error, FALSE is returned
uint8_t wiicom_comm_parseMsgCanbus ( const char *  recivData,
uint16_t  recivedDataLength,
uint32_t *  idmsg,
uint8_t *  b_extendedMsg,
uint8_t *  dlc,
uint8_t *  data 
)
void wiicom_comm_print ( FILE *  fp,
t_wiicom_comm_msg cmd_msg 
)

Function that prints the contents of the communication data structure.

Parametri
[in]fppointer files on which to perform printing of the data
[in]cmd_msgcommunication data structure that you want to print
Restituisce
void
uint8_t wiicom_comm_recivIScomplete ( t_wiicom_comm_msg cmd_msg)

function that checks if a command/message has been received completely

Parametri
[in]cmd_msgcommunication data structure on which you want to perform the check
Restituisce
On a complete recived command/message, TRUE is returned, otherwise FALSE is returned
void wiicom_comm_reset ( int8_t  b_reset_all,
t_wiicom_comm_msg cmd_msg 
)

Function that cleans up the data communication structure.

Parametri
[in]b_reset_allif set to TRUE cleans the entire structure, if FALSE only the data it contains leaving unchanged the accessories data used internally for the operations of command decoding
[in,out]cmd_msgcommunication data structure to clean
Restituisce
void
uint8_t wiicom_comm_sendCommand ( t_wiicom_comm_msg cmd_msg,
const char *  ip,
uint16_t  port 
)

Function that sends a command to a Compact module and, if provided, returns the response.

Parametri
[in,out]cmd_msgcommunication data structure to be sent to your Compact, after sending the structure will contain the answer of your Compact
[in]ipmodule IP address to send the command
[in]portModule port to send the command
Restituisce
On success, TRUE is returned, On error, FALSE is returned
uint8_t wiicom_comm_sendCommand_socket ( t_wiicom_comm_msg cmd_msg,
int  socketfd 
)

Function that sends a command to a Compact module on pre-open socket and, if provided, returns the response.

Parametri
[in,out]cmd_msgcommunication data structure to be sent to your Compact, after sending the structure will contain the answer of your Compact
[in]socketfda file descriptor for the socket
Restituisce
On success, TRUE is returned, On error, FALSE is returned
uint8_t wiicom_comm_sendMsgCanbus ( const char *  ip,
uint16_t  port,
uint32_t  idmsg,
uint8_t  b_extendedMsg,
uint8_t  dlc,
uint8_t *  data 
)
uint8_t wiicom_comm_sendMsgCanbus_socket ( int  socketfd,
uint32_t  idmsg,
uint8_t  b_extendedMsg,
uint8_t  dlc,
uint8_t *  data 
)
uint8_t wiicom_comm_set_compact_alias ( const char *  ip,
uint16_t  port,
char *  alias 
)

Function that set Compact module alias.

Parametri
[in]ipmodule IP address
[in]portmodule port
[in]aliasstring that contain the new Compact module alias
Restituisce
On success, TRUE is returned, On error, FALSE is returned
uint8_t wiicom_comm_set_compact_canbus ( const char *  ip,
uint16_t  port,
uint32_t  speed,
uint8_t  output_type,
uint8_t  input_type 
)
uint8_t wiicom_comm_set_compact_dio ( const char *  ip,
uint16_t  port,
uint8_t  num_dio,
uint8_t  b_enabled,
uint8_t  type 
)
uint8_t wiicom_comm_set_compact_net ( const char *  ip,
uint16_t  port,
t_wiicom_comm_compact_net net_struct 
)

Function that set Compact module network configuration.

Nota
Psk is save only when security_type is not 0.
Gateway is saved only when nwtype is not 0 (AD-HOC).
Parametri
[in]ipmodule IP address
[in]portmodule port
[in]net_structnetwork configuration data structure that will be set on Compact module
Restituisce
On success, TRUE is returned, On error, FALSE is returned
uint8_t wiicom_comm_set_compact_uart ( const char *  ip,
uint16_t  port,
t_wiicom_comm_compact_uart uart_struct 
)

Function that set Compact module UART configuration.

Parametri
[in]ipmodule IP address
[in]portmodule port
[in]uart_structUART configuration data structure that will be set on Compact module
Restituisce
On success, TRUE is returned, On error, FALSE is returned

Documentazione delle variabili

const t_dtype_size CMD_DTYPE_SIZE[]

Array containing the length of each data type t_wiicom_cmd_data_type and the max data count The length of a data type can be obtained by: CMD_DTYPE_SIZE[CMD_DTYPE_IPADDR].bytes_size The result obtained in this example is 4 The max data count of a data type can be obtained by: CMD_DTYPE_SIZE[CMD_DTYPE_IPADDR].max_data_count The result obtained in this example is 1.