Studer Innotec Xtender Serial Communication C Library 1.5.0

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Enumerations Enumerator Macros Pages
Data Structures | Macros | Enumerations | Functions
scom_data_link.h File Reference

Go to the source code of this file.

## Data Structures
struct | scom_frame_flags_t
| decoded content of frame_flags byte More...
struct | scom_service_flags_t
| decoded content of service_flags byte More...
struct | scom_frame_t
| a structure representing a frame More...

## Macros
#define | SCOM_NBR_ELEMENTS(array) (sizeof(array)/sizeof((array)[0]))
| return the number of elements of an array (index max + 1) More...
#define | SCOM_MIN(a, b) ((a) < (b) ? (a) : (b))
| return the minimum from two values
#define | SCOM_MAX(a, b) ((a) > (b) ? (a) : (b))
| return the maximum from two values
#define | SCOM_FRAME_HEADER_SIZE 14
| the size of the frame header

## Enumerations
enum | scom_error_t { SCOM_ERROR_NO_ERROR = 0x0000, SCOM_ERROR_INVALID_FRAME = 0x0001, SCOM_ERROR_DEVICE_NOT_FOUND = 0x0002, SCOM_ERROR_RESPONSE_TIMEOUT = 0x0003, SCOM_ERROR_SERVICE_NOT_SUPPORTED = 0x0011, SCOM_ERROR_INVALID_SERVICE_ARGUMENT = 0x0012, SCOM_ERROR_GATEWAY_BUSY = 0x0013, SCOM_ERROR_TYPE_NOT_SUPPORTED = 0x0021, SCOM_ERROR_OBJECT_ID_NOT_FOUND = 0x0022, SCOM_ERROR_PROPERTY_NOT_SUPPORTED = 0x0023, SCOM_ERROR_INVALID_DATA_LENGTH = 0x0024, SCOM_ERROR_PROPERTY_IS_READ_ONLY = 0x0025, SCOM_ERROR_INVALID_DATA = 0x0026, SCOM_ERROR_DATA_TOO_SMALL = 0x0027, SCOM_ERROR_DATA_TOO_BIG = 0x0028, SCOM_ERROR_WRITE_PROPERTY_FAILED = 0x0029, SCOM_ERROR_READ_PROPERTY_FAILED = 0x002A, SCOM_ERROR_ACCESS_DENIED = 0x002B, SCOM_ERROR_OBJECT_NOT_SUPPORTED = 0x002C, SCOM_ERROR_MULTICAST_READ_NOT_SUPPORTED = 0x002D, SCOM_ERROR_INVALID_SHELL_ARG = 0x0081, SCOM_ERROR_STACK_PORT_NOT_FOUND = 0x0082, SCOM_ERROR_STACK_PORT_INIT_FAILED = 0x0083, SCOM_ERROR_STACK_PORT_WRITE_FAILED = 0x0084, SCOM_ERROR_STACK_PORT_READ_FAILED = 0x0085, SCOM_ERROR_STACK_BUFFER_TOO_SMALL = 0x0086, SCOM_ERROR_STACK_PROPERTY_HEADER_DOESNT_MATCH = 0x0087 }
| scom error types More...
enum | scom_service_t { SCOM_READ_PROPERTY_SERVICE = 0x1, SCOM_WRITE_PROPERTY_SERVICE = 0x2 }
| service identifier of service_id
enum | scom_format_t { SCOM_FORMAT_INVALID_FORMAT = 0, SCOM_FORMAT_BOOL = 1, SCOM_FORMAT_FORMAT = 2, SCOM_FORMAT_ENUM = 3, SCOM_FORMAT_ERROR = 4, SCOM_FORMAT_INT32 = 5, SCOM_FORMAT_FLOAT = 6, SCOM_FORMAT_STRING = 7, SCOM_FORMAT_DYNAMIC = 8, SCOM_FORMAT_BYTE_STREAM = 9 }
| data format More...

## Functions
void | scom_initialize_frame (scom_frame_t *frame, char *buffer, size_t buffer_size)
| initialize a frame structure More...
void | scom_encode_request_frame (scom_frame_t *frame)
| encode a frame in its buffer More...
void | scom_decode_frame_header (scom_frame_t *frame)
| decode the frame header from its buffer More...
void | scom_decode_frame_data (scom_frame_t *frame)
| decode the frame data from its buffer More...
size_t | scom_frame_length (scom_frame_t *frame)
| return the total frame length More...

## Detailed Description

interface to send and receive scom frames (the Data Link Layer)

## Macro Definition Documentation

#define SCOM_NBR_ELEMENTS | ( |  | array) |  | (sizeof(array)/sizeof((array)[0]))

return the number of elements of an array (index max + 1)

Parameters

  array | variable of array type

## Enumeration Type Documentation

enum scom_error_t

scom error types

Enumerator
SCOM_ERROR_NO_ERROR | a value to indicate not error occurred
SCOM_ERROR_INVALID_FRAME | malformed frame on the datalink layer
SCOM_ERROR_DEVICE_NOT_FOUND | wrong dst_addr field
SCOM_ERROR_RESPONSE_TIMEOUT | no response of the server
SCOM_ERROR_SERVICE_NOT_SUPPORTED | wrong service_id field
SCOM_ERROR_INVALID_SERVICE_ARGUMENT | wrong service_data
SCOM_ERROR_GATEWAY_BUSY | gateway (for example XCOM-232i) busy
SCOM_ERROR_TYPE_NOT_SUPPORTED | the object_type requested doesn't exist
SCOM_ERROR_OBJECT_ID_NOT_FOUND | not object with this object_id was found
SCOM_ERROR_PROPERTY_NOT_SUPPORTED | the property identified by property_id doesn't exist
SCOM_ERROR_INVALID_DATA_LENGTH | the field property_data has an invalid number of bytes
SCOM_ERROR_PROPERTY_IS_READ_ONLY | a write to this property is not allowed
SCOM_ERROR_INVALID_DATA | this value is impossible for this property
SCOM_ERROR_DATA_TOO_SMALL | the value is below the minimum limit
SCOM_ERROR_DATA_TOO_BIG | the value is above the maximum limit
SCOM_ERROR_WRITE_PROPERTY_FAILED | write is possible, but failed
SCOM_ERROR_READ_PROPERTY_FAILED | read is possible, but failed
SCOM_ERROR_ACCESS_DENIED | insufficient user access
SCOM_ERROR_OBJECT_NOT_SUPPORTED | this object id, through existent, is not supported by the current implementation of the gateway
SCOM_ERROR_MULTICAST_READ_NOT_SUPPORTED | Read operation is not supported when used on multicast addresses
SCOM_ERROR_INVALID_SHELL_ARG | the command line tool used received the wrong arguments
SCOM_ERROR_STACK_PORT_NOT_FOUND | the port configured to be used doesn't exist or it is not possible to open it
SCOM_ERROR_STACK_PORT_INIT_FAILED | the initialization of the port failed
SCOM_ERROR_STACK_PORT_WRITE_FAILED | a write operation on the port failed
SCOM_ERROR_STACK_PORT_READ_FAILED | a read operation on the port failed
SCOM_ERROR_STACK_BUFFER_TOO_SMALL | the buffer provided to the client stack are too small to handle the operation
SCOM_ERROR_STACK_PROPERTY_HEADER_DOESNT_MATCH | the header of a property access response is not equal the response

enum scom_format_t

data format

See Also
  Xtender serial protocol technical specification

## Function Documentation

void scom_decode_frame_data | ( | scom_frame_t * | frame) |  |

decode the frame data from its buffer

This function call be called after the reception of frame->data_length byte in frame->buffer. frame->last_error will contain SCOM_ERROR_INVALID_FRAME if the data checksum is invalid or the frame is misformed.

void scom_decode_frame_header | ( | scom_frame_t * | frame) |  |

decode the frame header from its buffer

This function call be called after the reception of SCOM_FRAME_HEADER_SIZE byte in frame->buffer. frame->last_error will contain SCOM_ERROR_INVALID_FRAME if the checksum is invalid or the header is misformed.

void scom_encode_request_frame | ( | scom_frame_t * | frame) |  |

encode a frame in its buffer

The frame must have been initialized with scom_initialize_frame(). The frame fields src_addr, dst_addr, service_id and data_length must have a valid value.

size_t scom_frame_length | ( | scom_frame_t * | frame) |  |

return the total frame length

This function can be called after scom_decode_frame_header() to know how many bytes we expect to receive.

void scom_initialize_frame | ( | scom_frame_t * | frame,
|  | char * | buffer,
|  | size_t | buffer_size
| ) |  |

initialize a frame structure

Parameters

  frame | the structure to initialize
  buffer | the buffer used to encode the data
  buffer_size | the size of a buffer, allowing user defined size