Device Services

Classes

class  ApparatusFramework::LogFileDevice
class  ApparatusFramework::SerialDevice
class  ApparatusFramework::RingBuffer
class  ApparatusFramework::SerialPortIf
class  ApparatusFramework::TcpClientDevice
class  ApparatusFramework::TcpServerDevice
class  ApparatusFramework::WatchdogDevice
class  ApparatusFramework::WinFile
class  ApparatusFramework::WinFileSys
class  ApparatusFramework::ComponentMgr
class  ApparatusFramework::ConsoleDevice
class  ApparatusFramework::DeviceMgr
class  ApparatusFramework::File
class  ApparatusFramework::FileDevice
class  ApparatusFramework::FileMgr
class  ApparatusFramework::FileSystem
class  ApparatusFramework::NullDevice
class  ApparatusFramework::SerialPortListener

Modules

 Baudrate definition
 Parity definition
 Stopbit definition
 Timeout definition
 CharacterSize definition

Enumerations

enum  ApparatusFramework::TcpServerDeviceIoCtlCmdEnum { ApparatusFramework::TCPSERVER_DEVICE_SET_KEEPALIVE, ApparatusFramework::TCPSERVER_DEVICE_SET_HOST, ApparatusFramework::TCPSERVER_DEVICE_SET_PORT, ApparatusFramework::TCPSERVER_DEVICE_CONNECT_ON_OPEN }
enum  ApparatusFramework::TcpServerDeviceRetVal { ApparatusFramework::TCPSERVER_DEVICE_CONNECTION_ABORTED = -512, ApparatusFramework::TCPSERVER_DEVICE_CONNECTION_CLOSED }
enum  ApparatusFramework::LogFileDeviceIoCtlCmdEnum {
  ApparatusFramework::LOG_FILE_DEVICE_SET_MAX_NUMBER_OF_FILES, ApparatusFramework::LOG_FILE_DEVICE_SET_MAX_FILE_SIZE, ApparatusFramework::LOG_FILE_DEVICE_SET_LOG_PATH, ApparatusFramework::LOG_FILE_DEVICE_SET_BASE_FILE_NAME,
  ApparatusFramework::LOG_FILE_DEVICE_SET_LOG_FILE_EXTENSION
}
enum  ApparatusFramework::SerialPortRetVal {
  ApparatusFramework::SERIAL_PORT_SUCCESS = 0, ApparatusFramework::SERIAL_PORT_INVALID_PARAMETER = 1, ApparatusFramework::SERIAL_PORT_PORT_ALREADY_OPEN = 2, ApparatusFramework::SERIAL_PORT_OPEN_PORT_FAILED = 3,
  ApparatusFramework::SERIAL_PORT_GET_COMM_STATE_FAILED = 4, ApparatusFramework::SERIAL_PORT_SET_COMM_STATE_FAILED = 5, ApparatusFramework::SERIAL_PORT_GET_COMM_TIMEOUTS_FAILED = 6, ApparatusFramework::SERIAL_PORT_SET_COMM_TIMEOUTS_FAILED = 7,
  ApparatusFramework::SERIAL_PORT_SET_COMM_MASK_FAILED = 8, ApparatusFramework::SERIAL_PORT_EMPTY_BUFFERS_FAILED = 9, ApparatusFramework::SERIAL_PORT_START_COMM_THREAD_FAILED = 10, ApparatusFramework::SERIAL_PORT_NO_COMM_DEVICE = 11,
  ApparatusFramework::SERIAL_PORT_RESTORE_COMM_STATE_FAILED = 12, ApparatusFramework::SERIAL_PORT_RESTORE_COMM_TIMEOUTS_FAILED = 13, ApparatusFramework::SERIAL_PORT_WAIT_COMM_EVENT_FAILED = 14, ApparatusFramework::SERIAL_PORT_READ_FILE_FAILED = 15,
  ApparatusFramework::SERIAL_PORT_TRANSFERRED_BYTES_INCORRECT = 16, ApparatusFramework::SERIAL_PORT_WRITE_FILE_FAILED = 17, ApparatusFramework::SERIAL_PORT_FATAL_ERROR = 18, ApparatusFramework::SERIAL_PORT_STILL_WRITING = 19,
  ApparatusFramework::SERIAL_PORT_INPUT_BUFFER_FULL = 20, ApparatusFramework::SERIAL_PORT_OUTPUT_BUFFER_FULL = 21, ApparatusFramework::SERIAL_PORT_INPUT_BUFFER_NOT_ENOUGH_DATA = 22, ApparatusFramework::SERIAL_PORT_SETUP_COMM_FAILED = 23,
  ApparatusFramework::SERIAL_PORT_READ_TIMEOUT = 24, ApparatusFramework::SERIAL_PORT_WRITE_TIMEOUT = 25
}
enum  ApparatusFramework::FileDeviceIoCtlCmdEnum { ApparatusFramework::FILE_DEVICE_SET_FILE_ATTRIBUTES }
enum  ApparatusFramework::FileMgrReturnCodes {
  ApparatusFramework::FILE_MGR_SUCCESS = 0, ApparatusFramework::FILE_MGR_DIR_NOT_FOUND = -0x800, ApparatusFramework::FILE_MGR_NAME_TOO_LONG, ApparatusFramework::FILE_MGR_FILESYS_INVALID,
  ApparatusFramework::FILE_MGR_DIR_ALREADY_MOUNTED
}
enum  ApparatusFramework::FileSysReturnCodes { ApparatusFramework::FILE_SYS_SUCCESS = 0, ApparatusFramework::FILE_SYS_REMOVE_FAILED = -0x800 }

Functions

void ApparatusFramework::CanOpen (char *portName)
void ApparatusFramework::CanClose ()
unsigned char ApparatusFramework::CanSend (unsigned short CANStandard11Identifier, unsigned char *pData, unsigned short dataLength, unsigned char destinationPriority)
void f_can_init ()
int f_can_receive (int busId, Message *pMsg)
int f_can_send (int busId, Message *pMsg)
void CANReceivedMessage (int busId, unsigned short CANStandard11Identifier, unsigned char *pData, unsigned short dataLength)

Detailed Description

An apparatus needs to communicate with its environment typically via many different devices. Ethernet, CAN, RS232 and many others might need to be supported. Although the drivers for these devices are always HW-specific, the interface of a character device can be generalized.

The Device Services package provides generic interfaces to character devices and files. They are an object oriented equivalent to the abstractions used by POSIX. These generic interfaces allow for easy switching between devices and between target and simulation environment.


Enumeration Type Documentation

Possible commands for ioCtl

Enumerator:
FILE_DEVICE_SET_FILE_ATTRIBUTES 

C standard attribute string ("r", "w", etc.)

Definition at line 64 of file FileDevice.h.

Defines the return values of FileMgr functions.

Enumerator:
FILE_MGR_SUCCESS 

Operation successfully completed

FILE_MGR_DIR_NOT_FOUND 

Directory or path was not found

FILE_MGR_NAME_TOO_LONG 

Name of path is too long

FILE_MGR_FILESYS_INVALID 

Given file system is not valid

FILE_MGR_DIR_ALREADY_MOUNTED 

Directory has already been mounted

Definition at line 61 of file FileMgr.h.

Defines the return values of FileSystem functions.

Enumerator:
FILE_SYS_SUCCESS 

Operation successfully completed

FILE_SYS_REMOVE_FAILED 

File removal failed

Definition at line 56 of file FileSystem.h.

Possible commands for ioCtl

Enumerator:
LOG_FILE_DEVICE_SET_MAX_NUMBER_OF_FILES 
LOG_FILE_DEVICE_SET_MAX_FILE_SIZE 
LOG_FILE_DEVICE_SET_LOG_PATH 
LOG_FILE_DEVICE_SET_BASE_FILE_NAME 
LOG_FILE_DEVICE_SET_LOG_FILE_EXTENSION 

Definition at line 61 of file LogFileDevice.h.

Serial port Return Values. Please note that additional generic error codes are defined for all char devices.

Enumerator:
SERIAL_PORT_SUCCESS 
SERIAL_PORT_INVALID_PARAMETER 
SERIAL_PORT_PORT_ALREADY_OPEN 
SERIAL_PORT_OPEN_PORT_FAILED 
SERIAL_PORT_GET_COMM_STATE_FAILED 
SERIAL_PORT_SET_COMM_STATE_FAILED 
SERIAL_PORT_GET_COMM_TIMEOUTS_FAILED 
SERIAL_PORT_SET_COMM_TIMEOUTS_FAILED 
SERIAL_PORT_SET_COMM_MASK_FAILED 
SERIAL_PORT_EMPTY_BUFFERS_FAILED 
SERIAL_PORT_START_COMM_THREAD_FAILED 
SERIAL_PORT_NO_COMM_DEVICE 
SERIAL_PORT_RESTORE_COMM_STATE_FAILED 
SERIAL_PORT_RESTORE_COMM_TIMEOUTS_FAILED 
SERIAL_PORT_WAIT_COMM_EVENT_FAILED 
SERIAL_PORT_READ_FILE_FAILED 
SERIAL_PORT_TRANSFERRED_BYTES_INCORRECT 
SERIAL_PORT_WRITE_FILE_FAILED 
SERIAL_PORT_FATAL_ERROR 
SERIAL_PORT_STILL_WRITING 
SERIAL_PORT_INPUT_BUFFER_FULL 
SERIAL_PORT_OUTPUT_BUFFER_FULL 
SERIAL_PORT_INPUT_BUFFER_NOT_ENOUGH_DATA 
SERIAL_PORT_SETUP_COMM_FAILED 
SERIAL_PORT_READ_TIMEOUT 
SERIAL_PORT_WRITE_TIMEOUT 

Definition at line 52 of file SerialPortIf.h.

Possible commands for ioCtl.

Enumerator:
TCPSERVER_DEVICE_SET_KEEPALIVE 
TCPSERVER_DEVICE_SET_HOST 
TCPSERVER_DEVICE_SET_PORT 
TCPSERVER_DEVICE_CONNECT_ON_OPEN 

Definition at line 66 of file TcpServerDeviceCodes.h.

TcpServer Device Return Values. Please note that additional generic error codes are defined for all char devices.

Enumerator:
TCPSERVER_DEVICE_CONNECTION_ABORTED 
TCPSERVER_DEVICE_CONNECTION_CLOSED 

Definition at line 79 of file TcpServerDeviceCodes.h.


Function Documentation

void ApparatusFramework::CanClose (  ) 

Closes the CAN device.

Returns:
void
void ApparatusFramework::CanOpen ( char *  portName  ) 

Opens the CAN stack for the given device

Parameters:
portName name of the can device to open
Returns:
void
void CANReceivedMessage ( int  busId,
unsigned short  CANStandard11Identifier,
unsigned char *  pData,
unsigned short  dataLength 
)

This function is a callback function, which is called by the CAN device reader thread, as soon as hardware device raises the RX interrupt

Parameters:
busId defines on which CAN communication bus to read
CANStandard11Identifier the CAN 2.0A identifier
pData received data block
dataLength size of data receive in pData
unsigned char ApparatusFramework::CanSend ( unsigned short  CANStandard11Identifier,
unsigned char *  pData,
unsigned short  dataLength,
unsigned char  destinationPriority 
)

Sends message over CAN.

Parameters:
CANStandard11Identifier CAN 2.0A identifier
pData Data to be sent
dataLength Length of data to send
destinationPriority Priority for the the CAN communication
Returns:
unsigned char
void f_can_init (  ) 

This function initializes the low-level CAN interface

Returns:
void
int f_can_receive ( int  busId,
Message pMsg 
)

This function reads a complete CAN message from the CAN device identified by the bud id. The CAN device maintains an internal message list for the incoming messages

Parameters:
busId identifies the device to read from
pMsg holds the received CAN message
Returns:
  • CHAR_DEVICE_SUCCESS
  • CHAR_DEVICE_GENERIC_FAILURE
int f_can_send ( int  busId,
Message pMsg 
)

This function sends a message to the CAN bus

Parameters:
busId identifies the device to write to
pMsg holds the CAN message to send
Returns:
  • CHAR_DEVICE_SUCCESS
  • CHAR_DEVICE_GENERIC_FAILURE
© 2004-2010 bbv Software Services AG / Apparatus Services