My Project
Classes | Macros | Typedefs | Enumerations | Functions
CansimAPI.h File Reference
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>

Go to the source code of this file.

Classes

struct  tagCanMessage
 This structure contains all possible options for the configuration of a CAN message for transmitting by Cansim using 'Cansim::AddMessage'. Provides an alternative option to call the method 'Cansim::AddMessage' with all these arguments, but does same thing. After the method call the structure may be destroyed. More...
 
struct  tagRecvMsgCansim
 

Macros

#define DllExport   __attribute__ ((visibility("default")))
 

Typedefs

typedef void * CansimHandler
 
typedef void(* PrintFunc) (const char *)
 
typedef enum LOG_LEVELS_CANSIM LOG_LEVELS_CANSIM
 
typedef struct tagCanMessage CanMessage
 
typedef struct tagCanMessagePtrCanMessage
 
typedef struct tagRecvMsgCansim RecvMsgCansim
 
typedef struct tagRecvMsgCansimPtrRecvMsgCansim
 

Enumerations

enum  LOG_LEVELS_CANSIM { ERROR_LEVEL_CANSIM , INFO_LEVEL_CANSIM , COMM_LEVEL_CANSIM }
 

Functions

DllExport uint8_t DLC2length (uint8_t *DLC)
 This method converts DLC to length according to: https://elearning.vector.com/mod/page/view.php?id=368. More...
 
DllExport CansimHandler NewCansim (void)
 
DllExport void DeleteCansim (CansimHandler Handle)
 
DllExport int32_t ConnectCansim (CansimHandler Handle, const char *COMPort, const uint32_t ReadTimeout, const uint32_t WriteTimeout)
 Open serial connection to the CANSim4. More...
 
DllExport void DisconnectCansim (CansimHandler Handle)
 Method to close Cansim's communication port. More...
 
DllExport int32_t StartReceiverCansim (CansimHandler Handle)
 This method starts thread for receiving messages. Designed for receiving asynchronous messages.
If you do not need to receive asynchronous messagess (methods: Cansim::RequestMessage, Cansim::RequestSignal) than there is not any benefit if started.
NOTE: For terminating use: Cansim::StopReceiver. More...
 
DllExport void StopReceiverCansim (CansimHandler Handle)
 Stop the receiver thread - check Cansim::StartReceiver. More...
 
DllExport void DebugCommCansim (CansimHandler Handle, const char *FileName)
 
DllExport int32_t ResetCansim (CansimHandler Handle)
 Reset Cansim device. It means that all messages, signals, etc. will be removed even default messages, transmitting cansim version. And load predefined messages from a flash memory. More...
 
DllExport int32_t RebootCansim (CansimHandler Handle, const bool Jump)
 This method cause Cansim reboot. Takes about 2 seconds. More...
 
DllExport int32_t BootloaderCansim (CansimHandler Handle)
 Cansim bootloader (regime "F"). More...
 
DllExport int32_t GetVersionCansim (CansimHandler Handle)
 Get the cansim firmware api version. More...
 
DllExport int32_t AddMessageCansim (CansimHandler Handle, const PtrCanMessage Msg, const uint8_t *Data)
 This method add and configure CAN message to the cansim device to transmit. More...
 
DllExport int32_t RemoveMessageCansim (CansimHandler Handle, const uint16_t MsgHandler)
 Removes message from Cansim,. More...
 
DllExport int32_t EnableMessageCansim (CansimHandler Handle, const uint16_t MsgHandler)
 Enable message transmission to the CAN bus. More...
 
DllExport int32_t DisableMessageCansim (CansimHandler Handle, const uint16_t MsgHandler)
 Disable message transmission to the CAN bus. More...
 
DllExport int32_t SetMessageDataCansim (CansimHandler Handle, const uint16_t MsgHandler, const uint8_t *Data, const uint8_t *DataMask, const bool Async, const bool response)
 Set the CAN Message value. More...
 
DllExport int32_t GetHandlerCansim (CansimHandler Handle, const uint8_t CanMap, const uint8_t CanGatewayNumber, const uint32_t CanID, const bool ExtendedCanID, const bool FastSlowSend, const bool FD)
 Get the specified message handler by Cansim request. More...
 
DllExport int32_t EnableRequestCansim (CansimHandler Handle, const uint16_t ReqHandler)
 Enable message request. More...
 
DllExport int32_t DisableRequestCansim (CansimHandler Handle, const uint16_t ReqHandler)
 Disable message request. More...
 
DllExport int32_t RemoveRequestCansim (CansimHandler Handle, const uint16_t ReqHandler)
 Remove message request - does not freeing memory, but lowering cansim's CPU usage. More...
 
DllExport int32_t RequestMessageCansim (CansimHandler Handle, const uint8_t CanMap, const uint32_t CanID, const bool Enabled, const bool ExtendedCanID, const uint8_t DLC, const bool CheckDLC, const bool ReturnID, const uint8_t *Mask)
 Method provide receiving specific CAN bus message to the serial line. Message register by this method is sent to the serial port asynchronously without request. More...
 
DllExport int32_t RequestSignalCansim (CansimHandler Handle, const int32_t MsgHandler, const uint16_t StartSymbol, const uint16_t StopSymbol)
 This method gets a signal from a message specified by the requested message handler. Signal range is specified by start and stop symbol and must not exceed 16 bit. Difference StopSymbol - StartSymbol must not exceed 15.**. More...
 
DllExport int32_t SignalReadValue32Cansim (CansimHandler Handle, const uint16_t SigHandler, uint32_t *Value, uint32_t *TimeFromReceive, bool GetLatest)
 This method reads cached 32 bit value of the signal registered by Cansim::RequestSignal. More...
 
DllExport int32_t SignalReadValue64Cansim (CansimHandler Handle, const uint16_t SigHandler, uint64_t *Value, uint32_t *TimeFromReceive, bool GetLatest)
 This method reads cached 64 bit value of the signal registered by Cansim::RequestSignal. More...
 
DllExport int32_t AddSignalCansim (CansimHandler Handle, const uint16_t MsgHandler, const uint8_t Group, const uint16_t StartSymbol, const uint16_t StopSymbol, const uint8_t MuxInfo)
 This method adds a signal to a message specified by handler. Signal range is specified by start and stop symbol and must not exceed 16 bit. It also allows add counter as a specific signal.
Both StartSymbol and StoptSymbol symbols are included to the signal range. Difference StopSymbol - StartSymbol must not exceed 15. More...
 
DllExport int32_t SignalChangeValueCansim (CansimHandler Handle, const uint16_t SigHandler, const uint16_t Value, const bool async, const bool response)
 Change value of signal specified by handler. More...
 
DllExport int32_t BlobRemoveCansim (CansimHandler Handle)
 Remove blob from cansim memory. More...
 
DllExport int32_t RemoveSignalCansim (CansimHandler Handle, const uint16_t SigHandler)
 Remove CAN signal specified by its handler. It does not freeing a memory but lowering Camsim's CPU load. More...
 
DllExport int32_t ExecuteSignalChangeCansim (CansimHandler Handle, const bool response)
 Execute signals change triggered on this event. It may be single signal groups or single signal which were not changed asynchronously. Signal group has to be >= 30! More...
 
DllExport int32_t SetSignalControlCansim (CansimHandler Handle, const uint16_t SigHandler, const uint8_t ControlNumber, const uint32_t MinValue, const uint32_t MidValue, const uint32_t MaxValue)
 Set the Signal Control object TODO! More...
 
DllExport int32_t ChangeSignalSgroupCansim (CansimHandler Handle, const uint8_t Sgroup, const uint16_t Value)
 Change signals values in whole group. Signal group has to be < 30! More...
 
DllExport int32_t AddCrcCansim (CansimHandler Handle, const uint8_t *S_PDU_Kennungsfolge)
 
DllExport int32_t ChangeCrcCansim (CansimHandler Handle, const uint16_t MsgHandler, uint8_t *S_PDU_Kennungsfolge)
 
DllExport int32_t DisableCrcCansim (CansimHandler Handle, const uint16_t MsgHandler)
 
DllExport int32_t GetInternalThreadStatus (CansimHandler Handle)
 
DllExport int32_t ReadAsyncMsgCansim (CansimHandler Handle, const int32_t MsgHandler, PtrRecvMsgCansim DataStruct, uint8_t *Data, const uint8_t Length)
 Read buffered asynchronous message - nonblocking. More...
 
DllExport int32_t ReadEepromCansim (CansimHandler Handle, const uint16_t address, const uint8_t length, uint8_t *data)
 Read Cansim internal EEPROM memory. More...
 
DllExport int32_t WriteEepromCansim (CansimHandler Handle, const uint16_t address, const uint8_t length, const uint8_t *data)
 Write to internal EEPROM memory. More...
 
DllExport int32_t GetTimeCansim (CansimHandler Handle, time_t *time)
 Get the Cansim unix time. More...
 
DllExport int32_t SetTimeCansim (CansimHandler Handle, time_t time)
 Set the Cansim unix time. More...
 
DllExport int32_t SetPrintFileCansim (CansimHandler Handle, FILE *PrintStream, LOG_LEVELS_CANSIM Level)
 
DllExport int32_t ClearPrintFileCansim (CansimHandler Handle, FILE *PrintStream, LOG_LEVELS_CANSIM Level)
 
DllExport int32_t SetPrintFunctionCansim (CansimHandler Handle, PrintFunc, LOG_LEVELS_CANSIM Level)
 
DllExport int32_t ClearPrintFunctionCansim (CansimHandler Handle, PrintFunc, LOG_LEVELS_CANSIM Level)
 
DllExport void PrintfErrCansim (CansimHandler Handle, const char *Text,...)
 
DllExport void PrintfInfCansim (CansimHandler Handle, const char *Text,...)
 

Macro Definition Documentation

◆ DllExport

#define DllExport   __attribute__ ((visibility("default")))

CAN Sim DLL API (c)2019-2020 Digiteq automotive

Typedef Documentation

◆ CanMessage

typedef struct tagCanMessage CanMessage

◆ CansimHandler

typedef void* CansimHandler

◆ LOG_LEVELS_CANSIM

◆ PrintFunc

typedef void(* PrintFunc) (const char *)

◆ PtrCanMessage

typedef struct tagCanMessage * PtrCanMessage

◆ PtrRecvMsgCansim

◆ RecvMsgCansim

Enumeration Type Documentation

◆ LOG_LEVELS_CANSIM

Enumerator
ERROR_LEVEL_CANSIM 

Error messages

INFO_LEVEL_CANSIM 

Informative/non-critical messages

COMM_LEVEL_CANSIM 

Serial communication

Function Documentation

◆ AddCrcCansim()

DllExport int32_t AddCrcCansim ( CansimHandler  Handle,
const uint8_t *  S_PDU_Kennungsfolge 
)

◆ AddMessageCansim()

DllExport int32_t AddMessageCansim ( CansimHandler  Handle,
const PtrCanMessage  Msg,
const uint8_t *  Data 
)
Parameters
Msg- Check tagCanMessage. Can be destroyed after executing this command.
Data
Returns
int32_t
If the return value bigger than zero so it is message handler. It is 16 bit unsigned integer.
If the response is smaller than zero - some error ocurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - invalid message.
-22 - invalid message length.
-23 - cansim is out of memory.

◆ AddSignalCansim()

DllExport int32_t AddSignalCansim ( CansimHandler  Handle,
const uint16_t  MsgHandler,
const uint8_t  Group,
const uint16_t  StartSymbol,
const uint16_t  StopSymbol,
const uint8_t  MuxInfo 
)
Parameters
MsgHandlerHandler of an existing CAN bus message provided by the Cansim.
Group- User defined group or direct group of signals (for group control): **Notes for current Cansim's firmware version 1.00:
**User defined signals:
  1. Value of user signal has to be bigger than 29
  2. If you want to do async change but in all user group use Cansim::ExecuteSignalChange
  3. If you want to change all values in one group use Cansim::ChangeSignalSgroup
    **Notes for direct signals:
  1. All direct signals groups are listed in the enum GROUPS
  2. To load initial value of the controller has to call Cansim::ExecuteSignalChange. Then cansim set current value of switch or potentiometer without necessity of change manually state.
  3. Potentiometers resolution is 0 - 0x0fff. In the case different signal length cansim adjusts the range automatically.
  4. Switches 2. pos 0 - 1
  5. Switches 3. pos 0 - 1 - 2
  6. When you use: Cansim::ChangeSignalSgroup. Then is a value rewrote till reboot.
StartSymbol- Position of first bit of signal in the message's data. (From 0)
StopSymbol- Position of last bit of signal in the message's data. (From 0)
MuxInfo- Can set counter signal (cumulating values)
Returns
int32_t
If the return value bigger than zero so it is signal handler. It is 16 bit unsigned integer.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - invalid add signal call (invalid input data, too many signals).

◆ BlobRemoveCansim()

DllExport int32_t BlobRemoveCansim ( CansimHandler  Handle)
Returns
int32_t
If the function succeeds, the return value is zero.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed by cansim.

◆ BootloaderCansim()

DllExport int32_t BootloaderCansim ( CansimHandler  Handle)
Returns
int32_t
If the function succeeds, the return value is zero.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed by cansim.

◆ ChangeCrcCansim()

DllExport int32_t ChangeCrcCansim ( CansimHandler  Handle,
const uint16_t  MsgHandler,
uint8_t *  S_PDU_Kennungsfolge 
)

◆ ChangeSignalSgroupCansim()

DllExport int32_t ChangeSignalSgroupCansim ( CansimHandler  Handle,
const uint8_t  Sgroup,
const uint16_t  Value 
)
Parameters
Sgroup- Signal group number.
Value- New value of the signal.
Returns
int32_t
If the function succeeds, the return value is zero.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed in cansim

◆ ClearPrintFileCansim()

DllExport int32_t ClearPrintFileCansim ( CansimHandler  Handle,
FILE *  PrintStream,
LOG_LEVELS_CANSIM  Level 
)

◆ ClearPrintFunctionCansim()

DllExport int32_t ClearPrintFunctionCansim ( CansimHandler  Handle,
PrintFunc  ,
LOG_LEVELS_CANSIM  Level 
)

◆ ConnectCansim()

DllExport int32_t ConnectCansim ( CansimHandler  Handle,
const char *  COMPort,
const uint32_t  ReadTimeout,
const uint32_t  WriteTimeout 
)
Parameters
COMPort- Name or path to serial port. (e.g. COM3 - windows, /dev/ttyS1 - unix based systems)
ReadTimeout- Read timeout in millisecond.
WriteTimeout- Write timeout in millisecond.
Returns
int32_t
If the function succeeds, the return value is zero. If the function fails value is less than zero and problem is caused by the serial link.

◆ DebugCommCansim()

DllExport void DebugCommCansim ( CansimHandler  Handle,
const char *  FileName 
)

Open debugging file with all messages.

Parameters
[in]FileNameif NULL close file, if !=NULL open a file specified.

◆ DeleteCansim()

DllExport void DeleteCansim ( CansimHandler  Handle)
Parameters
Handle

◆ DisableCrcCansim()

DllExport int32_t DisableCrcCansim ( CansimHandler  Handle,
const uint16_t  MsgHandler 
)

◆ DisableMessageCansim()

DllExport int32_t DisableMessageCansim ( CansimHandler  Handle,
const uint16_t  MsgHandler 
)
Parameters
MsgHandlerMessage handler provided by Cansim
Returns
int32_t
0 - OK
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - invalid message.

◆ DisableRequestCansim()

DllExport int32_t DisableRequestCansim ( CansimHandler  Handle,
const uint16_t  ReqHandler 
)
Parameters
ReqHandler- Handler to the requested message.
Returns
int32_t
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed by cansim.

◆ DisconnectCansim()

DllExport void DisconnectCansim ( CansimHandler  Handle)

◆ DLC2length()

DllExport uint8_t DLC2length ( uint8_t *  DLC)
Parameters
DLC- Data Length Code. If the value exceed 0x0f than is trimmed by 0x0f mask.
Returns
uint8_t - Length in bits.

◆ EnableMessageCansim()

DllExport int32_t EnableMessageCansim ( CansimHandler  Handle,
const uint16_t  MsgHandler 
)
Parameters
MsgHandlerMessage handler provided by Cansim
Returns
int32_t
0 - OK
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - invalid message.
-22 - invalid message.

◆ EnableRequestCansim()

DllExport int32_t EnableRequestCansim ( CansimHandler  Handle,
const uint16_t  ReqHandler 
)
Parameters
ReqHandler- Handler to the requested message.
Returns
int32_t
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed by cansim.

◆ ExecuteSignalChangeCansim()

DllExport int32_t ExecuteSignalChangeCansim ( CansimHandler  Handle,
const bool  response 
)
Returns
int32_t
If the function succeeds, the return value is zero.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed in cansim

◆ GetHandlerCansim()

DllExport int32_t GetHandlerCansim ( CansimHandler  Handle,
const uint8_t  CanMap,
const uint8_t  CanGatewayNumber,
const uint32_t  CanID,
const bool  ExtendedCanID,
const bool  FastSlowSend,
const bool  FD 
)
Parameters
CanMapMask of Cansim's CAN bus ports
CanGatewayNumberNumber of Default CAN with gateway
CanIDCan ID
ExtendedCanIDEnables Extended CAN ID.
FastSlowSendEnables Fast Slow Send
FDEnables CAN FD
Returns
int32_t
If the return value bigger than zero so it is message handler. It is 16 bit unsigned integer.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - invalid message.

◆ GetInternalThreadStatus()

DllExport int32_t GetInternalThreadStatus ( CansimHandler  Handle)

◆ GetTimeCansim()

DllExport int32_t GetTimeCansim ( CansimHandler  Handle,
time_t *  time 
)
Parameters
Handle- Cansim handler
time- time from cansim - internally max size 32bit.
Returns
int32_t - 0 success

◆ GetVersionCansim()

DllExport int32_t GetVersionCansim ( CansimHandler  Handle)
Returns
int32_t
If the function succeeds, the return value is zero.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed by cansim. Else return API version of cansim (from version 1.00 - returns 100) If cansim's firmware does not contain this command than returns 0

◆ NewCansim()

DllExport CansimHandler NewCansim ( void  )
Returns
CansimHandler

◆ PrintfErrCansim()

DllExport void PrintfErrCansim ( CansimHandler  Handle,
const char *  Text,
  ... 
)

◆ PrintfInfCansim()

DllExport void PrintfInfCansim ( CansimHandler  Handle,
const char *  Text,
  ... 
)

◆ ReadAsyncMsgCansim()

DllExport int32_t ReadAsyncMsgCansim ( CansimHandler  Handle,
const int32_t  MsgHandler,
PtrRecvMsgCansim  DataStruct,
uint8_t *  Data,
const uint8_t  Length 
)
Parameters
Handle- handler to the Cansim.
MsgHandler- Handler of message registered by Cansim::RequestMessage
DataStruct- Structure for asynchronous messages.
Data- Pointer to allocated space for CAN messages data.
NOTE: If is member Data = NULL, than data are not copied (could save some time).
Length- Length of the allocated buffer. If is smaller than CAN message payload length, than are copied only lower bytes
Returns
int32_t
If the function succeeds, the return value is bigger or equal to zero. And returns number of bytes written to Data. Value less 0 could means that message has not been received yet.

◆ ReadEepromCansim()

DllExport int32_t ReadEepromCansim ( CansimHandler  Handle,
const uint16_t  address,
const uint8_t  length,
uint8_t *  data 
)
Parameters
Handle- Cansim handler
address- Start address to read
length- Data length in bytes
data- Output data buffer, must be >= length
Returns
int32_t - 0 success

◆ RebootCansim()

DllExport int32_t RebootCansim ( CansimHandler  Handle,
const bool  Jump 
)
Parameters
Jumpif true reboot is realized by jump, else by watchdog
timeout- maximal timeout for the operation in ms
Returns
int32_t
If the function succeeds, the return value is zero.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed by cansim.

◆ RemoveMessageCansim()

DllExport int32_t RemoveMessageCansim ( CansimHandler  Handle,
const uint16_t  MsgHandler 
)
Parameters
MsgHandlerMessage handler provided by Cansim
Returns
int32_t
0 - OK
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - invalid message.
-22 - invalid message.

◆ RemoveRequestCansim()

DllExport int32_t RemoveRequestCansim ( CansimHandler  Handle,
const uint16_t  ReqHandler 
)
Parameters
ReqHandler- Handler to the requested message.
Returns
int32_t
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed by cansim.

◆ RemoveSignalCansim()

DllExport int32_t RemoveSignalCansim ( CansimHandler  Handle,
const uint16_t  SigHandler 
)
Parameters
SigHandler- handler of the signal
Returns
int32_t
If the function succeeds, the return value is zero.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed in cansim

◆ RequestMessageCansim()

DllExport int32_t RequestMessageCansim ( CansimHandler  Handle,
const uint8_t  CanMap,
const uint32_t  CanID,
const bool  Enabled,
const bool  ExtendedCanID,
const uint8_t  DLC,
const bool  CheckDLC,
const bool  ReturnID,
const uint8_t *  Mask 
)
Parameters
CanMap- Map of cansim CAN bus ports where message will be received.
CanID- ID of received message.
Enabled- Enable request.
ExtendedCanID- Enable extended CAN ID
DLC- Data Length Code of the message
CheckDLC- Enable DLC check
ReturnID- Received message (from the cansim not CAN bus), will be identified by lower 16 bits of CAN ID, if false than by cansim's handler
Mask- Mask of tracking bits (message will be send only if bits matching mask are different), if is not specified than is substituted mask according to DLC
Returns
int32_t
Success if the return value bigger than zero and this value is 16 bit Cansim's handler to the message.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed by cansim.

◆ RequestSignalCansim()

DllExport int32_t RequestSignalCansim ( CansimHandler  Handle,
const int32_t  MsgHandler,
const uint16_t  StartSymbol,
const uint16_t  StopSymbol 
)
Parameters
MsgHandler- Handler of an existing request CAN bus message provided by the Cansim.
StartSymbol- Position of first bit of signal in the message's data. (From 0)
StopSymbol- Position of last bit of signal in the message's data. (From 0)
Returns
int32_t
If the return value bigger than zero so it is signal handler. It is 16 bit unsigned integer.
If the response is smaller than zero - some error occurred:
-1 - invalid request signal call.

◆ ResetCansim()

DllExport int32_t ResetCansim ( CansimHandler  Handle)
Returns
int32_t
If the response is smaller than zero - some error ocurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed by cansim.

◆ SetMessageDataCansim()

DllExport int32_t SetMessageDataCansim ( CansimHandler  Handle,
const uint16_t  MsgHandler,
const uint8_t *  Data,
const uint8_t *  DataMask,
const bool  Async,
const bool  response 
)
Parameters
MsgHandlerMessage handler provided by Cansim
DataNew data buffer
DataMaskData buffer mask (mask bit which will be changed)
asyncSend message asynchronous (as soon as possible)
responsebool true if you are interested in the cansim's answer
Returns
int32_t
0 - OK
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - invalid message.

◆ SetPrintFileCansim()

DllExport int32_t SetPrintFileCansim ( CansimHandler  Handle,
FILE *  PrintStream,
LOG_LEVELS_CANSIM  Level 
)

◆ SetPrintFunctionCansim()

DllExport int32_t SetPrintFunctionCansim ( CansimHandler  Handle,
PrintFunc  ,
LOG_LEVELS_CANSIM  Level 
)

◆ SetSignalControlCansim()

DllExport int32_t SetSignalControlCansim ( CansimHandler  Handle,
const uint16_t  SigHandler,
const uint8_t  ControlNumber,
const uint32_t  MinValue,
const uint32_t  MidValue,
const uint32_t  MaxValue 
)
Parameters
SigHandler
ControlNumber
MinValue
MidValue
MaxValue
Returns
int32_t
If the function succeeds, the return value is zero.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - problem while command was executed in cansim

◆ SetTimeCansim()

DllExport int32_t SetTimeCansim ( CansimHandler  Handle,
time_t  time 
)
Parameters
Handle- Cansim handler
time- UNIX time to write - internally max size 32bit.
Returns
int32_t - 0 success

◆ SignalChangeValueCansim()

DllExport int32_t SignalChangeValueCansim ( CansimHandler  Handle,
const uint16_t  SigHandler,
const uint16_t  Value,
const bool  async,
const bool  response 
)
Parameters
SigHandlerHandler of signal
ValueNew value of signal
asyncif true signal is change as soon as possible, else after SignalChangeExecute
Returns
int32_t
If the function succeeds, the return value is zero.
If the response is smaller than zero - some error occurred:
Range from -1 to -10 is inhered from Cansim::SendData. Tx issue.
Range from -11 to -20 is inhered from Cansim::GetResponse. Rx issue.
-21 - invalid change signal call.

◆ SignalReadValue32Cansim()

DllExport int32_t SignalReadValue32Cansim ( CansimHandler  Handle,
const uint16_t  SigHandler,
uint32_t *  Value,
uint32_t *  TimeFromReceive,
bool  GetLatest 
)
Parameters
SigHandler- Handler of the requested message.
Value- Pointer to allocated space for return value. If is nullptr, than command is nonsense.
TimeFromReceive- Get time since message has been read from serial. Milliseconds.
If is nullptr, than it save some time.
GetLatest- NOT IMPLEMENTED.
In future: If true than is returned last received signal else next message in buffer (queue).
Returns
int32_t
If the return value bigger than zero so it is signal value. It is maximal 16 bit unsigned integer.
If the response is smaller than zero - some error ocured:
-1 - Any cached signal value yet.
-2 - invalid request signal call.
-3 - Thread does not run.
-1000 - NOT IMPLEMENTED.

◆ SignalReadValue64Cansim()

DllExport int32_t SignalReadValue64Cansim ( CansimHandler  Handle,
const uint16_t  SigHandler,
uint64_t *  Value,
uint32_t *  TimeFromReceive,
bool  GetLatest 
)
Parameters
SigHandler- Handler of the requested message.
Value- Pointer to allocated space for return value. If is nullptr, than command is nonsense.
TimeFromReceive- Get time since message has been read from serial. Milliseconds.
If is nullptr, than it save some time.
GetLatest- NOT IMPLEMENTED.
In future: If true than is returned last received signal else next message in buffer (queue).
Returns
int32_t
If the return value bigger than zero so it is signal value. It is maximal 16 bit unsigned integer.
If the response is smaller than zero - some error ocured:
-1 - Any cached signal value yet.
-2 - invalid request signal call.
-3 - Thread does not run.
-1000 - NOT IMPLEMENTED.

◆ StartReceiverCansim()

DllExport int32_t StartReceiverCansim ( CansimHandler  Handle)
Returns
int32_t
If the function succeeds, the return value is zero and thread is successfully started.
If the function fails value is less than zero and thread does not run.

◆ StopReceiverCansim()

DllExport void StopReceiverCansim ( CansimHandler  Handle)

◆ WriteEepromCansim()

DllExport int32_t WriteEepromCansim ( CansimHandler  Handle,
const uint16_t  address,
const uint8_t  length,
const uint8_t *  data 
)
Parameters
Handle- Cansim handler
address- Start address to write
data- Data to write
length- Data length
Returns
int32_t - 0 success