22#ifndef CO_GATEWAY_ASCII_H
23#define CO_GATEWAY_ASCII_H
34#define CO_CONFIG_GTW (0)
37#if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII) != 0) || defined CO_DOXYGEN
141#ifndef CO_GTWA_RESP_BUF_SIZE
142#define CO_GTWA_RESP_BUF_SIZE 200U
146#ifndef CO_GTWA_STATE_TIMEOUT_TIME_US
147#define CO_GTWA_STATE_TIMEOUT_TIME_US 1200000U
208#if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_SDO) != 0) || defined CO_DOXYGEN
218 size_t (*dataTypePrint)(
CO_fifo_t* fifo,
char* buf,
size_t count,
bool_t end);
240 size_t (*readCallback)(
void* object,
const char* buf,
size_t count,
uint8_t* connectionOK);
241 void* readCallbackObject;
252 size_t respBufOffset;
260#if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_SDO) != 0) || defined CO_DOXYGEN
267 const CO_GTWA_dataType_t* SDOdataType;
269#if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_NMT) != 0) || defined CO_DOXYGEN
272#if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_LSS) != 0) || defined CO_DOXYGEN
284#if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_LOG) != 0) || defined CO_DOXYGEN
289#if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_PRINT_HELP) != 0) || defined CO_DOXYGEN
290 const char* helpString;
291 size_t helpStringOffset;
293#if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_PRINT_LEDS) != 0) || defined CO_DOXYGEN
295 uint8_t ledStringPreviousIndex;
314#
if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_SDO) != 0) || defined CO_DOXYGEN
317#
if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_NMT) != 0) || defined CO_DOXYGEN
320#
if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_LSS) != 0) || defined CO_DOXYGEN
323#
if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_PRINT_LEDS) != 0) || defined CO_DOXYGEN
341 size_t (*readCallback)(
void*
object,
const char* buf,
size_t count,
uint8_t* connectionOK),
342 void* readCallbackObject);
374#if (((CO_CONFIG_GTW)&CO_CONFIG_GTW_ASCII_LOG) != 0) || defined CO_DOXYGEN
CANopen Indicator specification (CiA 303-3 v1.4.0)
CANopen Layer Setting Service - master protocol.
CANopen Network management and Heartbeat producer protocol.
CANopen Service Data Object - client protocol.
Interface between CAN hardware and CANopenNode.
static size_t CO_fifo_getSpace(CO_fifo_t *fifo)
Get free buffer space in CO_fifo_t object.
Definition CO_fifo.h:123
size_t CO_fifo_write(CO_fifo_t *fifo, const uint8_t *buf, size_t count, uint16_t *crc)
Write data into CO_fifo_t object.
void CO_GTWA_log_print(CO_GTWA_t *gtwa, const char *message)
Print message log string into fifo buffer.
void CO_GTWA_initRead(CO_GTWA_t *gtwa, size_t(*readCallback)(void *object, const char *buf, size_t count, uint8_t *connectionOK), void *readCallbackObject)
Initialize read callback in Gateway-ascii object.
void CO_GTWA_process(CO_GTWA_t *gtwa, bool_t enable, uint32_t timeDifference_us, uint32_t *timerNext_us)
Process Gateway-ascii object.
#define CO_GTWA_RESP_BUF_SIZE
Size of response string buffer.
Definition CO_gateway_ascii.h:141
CO_GTWA_respErrorCode_t
Response error codes as specified by CiA 309-3.
Definition CO_gateway_ascii.h:153
static size_t CO_GTWA_write(CO_GTWA_t *gtwa, const char *buf, size_t count)
Write command into CO_GTWA_t object.
Definition CO_gateway_ascii.h:369
CO_ReturnError_t CO_GTWA_init(CO_GTWA_t *gtwa, CO_SDOclient_t *SDO_C, uint16_t SDOclientTimeoutTime_ms, bool_t SDOclientBlockTransfer, CO_NMT_t *NMT, CO_LSSmaster_t *LSSmaster, CO_LEDs_t *LEDs, uint8_t dummy)
Initialize Gateway-ascii object.
static size_t CO_GTWA_write_getSpace(CO_GTWA_t *gtwa)
Get free write buffer space.
Definition CO_gateway_ascii.h:351
CO_GTWA_state_t
Internal states of the Gateway-ascii state machine.
Definition CO_gateway_ascii.h:187
@ CO_GTWA_respErrorReqNotSupported
100 - Request not supported
Definition CO_gateway_ascii.h:155
@ CO_GTWA_respErrorCANactive
305 - CAN active (at init or start-up)
Definition CO_gateway_ascii.h:173
@ CO_GTWA_respErrorLostGuardingMessage
200 - Lost guarding message
Definition CO_gateway_ascii.h:163
@ CO_GTWA_respErrorInternalState
102 - Request not processed due to internal state
Definition CO_gateway_ascii.h:157
@ CO_GTWA_respErrorUnsupportedNet
106 - Unsupported net
Definition CO_gateway_ascii.h:161
@ CO_GTWA_respErrorLSSparameterStoringFailed
504 - LSS parameter storing failed
Definition CO_gateway_ascii.h:179
@ CO_GTWA_respErrorNone
0 - No error or idle
Definition CO_gateway_ascii.h:154
@ CO_GTWA_respErrorSyntax
101 - Syntax error
Definition CO_gateway_ascii.h:156
@ CO_GTWA_respErrorLSSnodeIdNotSupported
502 - LSS node-ID not supported
Definition CO_gateway_ascii.h:177
@ CO_GTWA_respErrorErrorPassive
300 - Error passive
Definition CO_gateway_ascii.h:169
@ CO_GTWA_respErrorLSSmanufacturer
501 - LSS implementation- / manufacturer-specific error
Definition CO_gateway_ascii.h:176
@ CO_GTWA_respErrorTimeOut
103 - Time-out (where applicable)
Definition CO_gateway_ascii.h:158
@ CO_GTWA_respErrorCANbufferOverflow
303 - CAN buffer overflow
Definition CO_gateway_ascii.h:171
@ CO_GTWA_respErrorCANinit
304 - CAN init
Definition CO_gateway_ascii.h:172
@ CO_GTWA_respErrorRunningOutOfMemory
600 - Running out of memory
Definition CO_gateway_ascii.h:181
@ CO_GTWA_respErrorLostConnection
201 - Lost connection
Definition CO_gateway_ascii.h:164
@ CO_GTWA_respErrorBootUp
205 - Boot-up
Definition CO_gateway_ascii.h:168
@ CO_GTWA_respErrorHeartbeatLost
203 - Heartbeat lost
Definition CO_gateway_ascii.h:166
@ CO_GTWA_respErrorBusOff
301 - Bus off
Definition CO_gateway_ascii.h:170
@ CO_GTWA_respErrorNoDefaultNodeSet
105 - No default node set
Definition CO_gateway_ascii.h:160
@ CO_GTWA_respErrorLSSmediaError
505 - LSS command failed because of media error
Definition CO_gateway_ascii.h:180
@ CO_GTWA_respErrorPDOalreadyUsed
400 - PDO already used
Definition CO_gateway_ascii.h:174
@ CO_GTWA_respErrorWrongNMTstate
204 - Wrong NMT state
Definition CO_gateway_ascii.h:167
@ CO_GTWA_respErrorNoDefaultNetSet
104 - No default net set
Definition CO_gateway_ascii.h:159
@ CO_GTWA_respErrorLSSbitRateNotSupported
503 - LSS bit-rate not supported
Definition CO_gateway_ascii.h:178
@ CO_GTWA_respErrorPDOlengthExceeded
401 - PDO length exceeded
Definition CO_gateway_ascii.h:175
@ CO_GTWA_respErrorHeartbeatStarted
202 - Heartbeat started
Definition CO_gateway_ascii.h:165
@ CO_GTWA_respErrorUnsupportedNode
107 - Unsupported node
Definition CO_gateway_ascii.h:162
@ CO_GTWA_ST_LSS_INQUIRE_ADDR_ALL
LSS 'lss_inquire_addr', all parameters.
Definition CO_gateway_ascii.h:199
@ CO_GTWA_ST_LSS_SWITCH_SEL
LSS 'lss_switch_sel'.
Definition CO_gateway_ascii.h:194
@ CO_GTWA_ST_LED
print 'status' of the node
Definition CO_gateway_ascii.h:204
@ CO_GTWA_ST_LSS_ALLNODES
LSS 'lss_allnodes'.
Definition CO_gateway_ascii.h:201
@ CO_GTWA_ST_LSS_STORE
LSS 'lss_store'.
Definition CO_gateway_ascii.h:197
@ CO_GTWA_ST_LSS_CONF_BITRATE
LSS 'lss_conf_bitrate'.
Definition CO_gateway_ascii.h:196
@ CO_GTWA_ST_LOG
print message 'log'
Definition CO_gateway_ascii.h:202
@ CO_GTWA_ST_WRITE
SDO 'write' (download)
Definition CO_gateway_ascii.h:191
@ CO_GTWA_ST_IDLE
Gateway is idle, no command is processing.
Definition CO_gateway_ascii.h:188
@ CO_GTWA_ST_READ
SDO 'read' (upload)
Definition CO_gateway_ascii.h:190
@ CO_GTWA_ST_WRITE_ABORTED
SDO 'write' (download) - aborted, purging remaining data.
Definition CO_gateway_ascii.h:192
@ CO_GTWA_ST__LSS_FASTSCAN
LSS '_lss_fastscan'.
Definition CO_gateway_ascii.h:200
@ CO_GTWA_ST_LSS_INQUIRE
LSS 'lss_inquire_addr' or 'lss_get_node'.
Definition CO_gateway_ascii.h:198
@ CO_GTWA_ST_LSS_SET_NODE
LSS 'lss_set_node'.
Definition CO_gateway_ascii.h:195
@ CO_GTWA_ST_HELP
print 'help' text
Definition CO_gateway_ascii.h:203
@ CO_GTWA_ST_LSS_SWITCH_GLOB
LSS 'lss_switch_glob'.
Definition CO_gateway_ascii.h:193
#define CO_CONFIG_GTWA_LOG_BUF_SIZE
Size of message log buffer in ASCII gateway object.
Definition CO_config.h:683
#define CO_CONFIG_GTWA_COMM_BUF_SIZE
Size of command buffer in ASCII gateway object.
Definition CO_config.h:676
#define NULL
NULL, for general usage.
Definition CO_driver.h:123
unsigned int uint16_t
UNSIGNED16 in CANopen (0006h), 16-bit unsigned integer.
Definition CO_driver.h:132
unsigned long int uint32_t
UNSIGNED32 in CANopen (0007h), 32-bit unsigned integer.
Definition CO_driver.h:133
uint_fast8_t bool_t
Boolean data type for general use.
Definition CO_driver.h:126
signed int int16_t
INTEGER16 in CANopen (0003h), 16-bit signed integer.
Definition CO_driver.h:128
unsigned char uint8_t
UNSIGNED8 in CANopen (0005h), 8-bit unsigned integer.
Definition CO_driver.h:131
signed long int int32_t
INTEGER32 in CANopen (0004h), 32-bit signed integer.
Definition CO_driver.h:129
CO_ReturnError_t
Return values of some CANopen functions.
Definition CO_driver.h:449
CANopen Gateway-ascii object.
Definition CO_gateway_ascii.h:228
CO_fifo_t commFifo
CO_fifo_t object for command (not pointer)
Definition CO_gateway_ascii.h:246
LEDs object, initialized by CO_LEDs_init()
Definition CO_LEDs.h:90
Parameters for LSS fastscan CO_LSSmaster_IdentifyFastscan.
Definition CO_LSSmaster.h:323
LSS master object.
Definition CO_LSSmaster.h:95
NMT consumer and Heartbeat producer object.
Definition CO_NMT_Heartbeat.h:136
SDO client object.
Definition CO_SDOclient.h:151
Fifo object.
Definition CO_fifo.h:55
The LSS address is a 128 bit number, uniquely identifying each node.
Definition CO_LSS.h:150