43 for (i = 0; i < CLB_SUB_CNT; ++i)
64 if (subsys > CLB_SUB_MAX && subsys !=
CLB_SUB_ALL)
return false;
91 if (subsys > CLB_SUB_MAX && subsys !=
CLB_SUB_ALL)
return false;
109 #define DEFAULT_RATE 1
118 for (i = 0; i < len; ++i)
138 for (i = 0; i < len; ++i)
157 const int size = (80 + 6) * CLB_SUB_CNT;
166 for (i = 0; i < CLB_SUB_CNT; ++i)
197 uint8_t buf[3 * CLB_SUB_CNT];
202 for (i = 0; i < CLB_SUB_CNT; ++i)
208 for (i = 0; i < CLB_SUB_CNT; ++i)
223 uint8_t * cur = evt.
cur;
229 if (evt.
cur == cur + 2)
return true;
233 if (offset == -1)
return false;
234 if (!
msgTxEvent(EVT_CLB_UPDATE_VARS, &evt))
return false;
267 #define MAX_VARS TOTAL_VAR_SIZE + (TOTAL_VAR_COUNT * 4) + 2
273 uint8_t buf[MAX_VARS];
282 for (i = 0; i < len; ++i)
317 for (i = 0; i < len; ++i)
322 logInfo(
"Subscribe variable %08x failed", varId);
340 for (i = 0; i < len; ++i)
#define TOTAL_VAR_COUNT
Total number of variables.
bool errHas()
Returns whether there is an error pending.
ClbEvent
All state change events.
bool dbReadU8(DataBuffer *buf, uint8_t *byte)
Reads an unsigned byte.
bool xsWriteDB(int varID, DataBuffer *source)
Writes variable from target data buffer into variable structure.
bool dbSkip(DataBuffer *buf, size_t skipSize)
Skips a number of bytes in the buffer.
Provides access to all variables of the various subsystems.
bool dbWriteI16(DataBuffer *buf, int16_t i)
Writes a short (16 bits signed) integer.
bool msgTxEvent(int msgType, DataBuffer *buf)
Invoked to send an event.
ClbState clbState(int idx)
Returns the current clbSubState for the specified subsystem.
System start up and management.
bool dbReadU16(DataBuffer *buf, uint16_t *u)
Reads a unsigned short (16 bits unsigned) integer.
bool dbWriteI32(DataBuffer *buf, int32_t i)
Writes an 32 bits signed integer.
bool clbEvent(int idx, ClbEvent event)
Request a subsystem to go to a certain state.
bool evtClbEmitUpdate()
Emit an update.
void clbClearErrorState(int idx)
Clears the error state of the specific subsystem.
static int vidVarSize(int varID)
Returns the total size of the variable.
bool xsVarExists(int varID)
Returns whether or not the specified variable exists.
bool clbStateError(int idx, int *code, const char **message)
Retrieves the error of a subsystem (if any).
uint8_t clbSys2Idx[6]
Mapping from subsystem ID to index.
static bool msgTxCurError(MsgId *id)
Invoke to reply the current global error.
static void dbReset(DataBuffer *buf)
Resets the buffer to its initial state.
Defines a DataBuffer structure.
bool monSubscribeVar(int32_t varId, int rate)
Subscribe to a variable.
Handles MCF packed messages from the higher protocol layer.
void monUnsubscribeVar(int32_t varId)
Unsubscribe to a variable.
int clbSubId(int idx)
Returns the subsystem ID code for the provided index.
Manages the global system error.
void errPrint(bool clear)
Prints the last error.
bool msgTxReply(MsgId *id, DataBuffer *buf)
Invoke to send a reply.
bool msgTxError(MsgId *id, int errCode, const char *errMsg, const char *name)
Invoke to send an error response.
void sysBoardTemp(uint16_t *brdTemp, uint16_t *brdTempFrq)
Returns the board temperature with a fractional part.
bool xsReadDB(int varID, DataBuffer *target)
Reads variable into target data buffer from variable structure.
void errClear()
Clears the current error.
bool msgRxBufCheck(DataBuffer *buf)
Checks the received buffer, and logs an error if there is something wrong.
#define CLB_SUB_ALL
Indicates all subsystems. Can be used in clbStateGoto.
This module is responsible for distributing error codes.
bool dbWriteU8(DataBuffer *buf, uint8_t byte)
Writes a unsigned byte.
#define LOG_DEF(NAME,...)
Define a logger for a module.
The CLB stare module tracks is responsible for state management of the various sub-systems on the CLB...
If defined, events will not require an acknowledge.
int monUpdate(DataBuffer *buffer, int offset, int rate)
Write update variable information into the specified buffer.
bool dbWriteString(DataBuffer *buf, const char *s, int max)
Writes a String as 'sort of' UTF-8 encoding, as defined in the Java DataOuput and DataInput writeUTF ...
The monitor module is responsible for sending variables to the remote party based on subscription...
bool dbReadI32(DataBuffer *buf, int32_t *i)
Reads an 32 bits signed integer.
#define MON_MAX_BLOB
Maximim blob size.
static bool vidIsReadable(int varID)
Checks if a variable is readable.
bool evtClbEmitStateChange()
Indicates the CLB to emit a state change event to the slow control.
Implements a generic logger facility.
void sysLoad(uint8_t *values)
Gives the system load in percentage.
Access provides 'introspective' access to process variables.
#define DB_BUF_INIT(PTR, LEN)
Simple buffer initialization.
uint8_t * cur
Current Pointer.
static bool msgTxReplyAck(MsgId *id)
Replies a simple ACK with no content.
bool evtClbEmitUpdateVars(int rate)
Indicates it should emit an vars update.
#define logInfo(MSG,...)
Write a log message with formatting on info level.
#define E_NOTSUPPORTED
Generic error: not supported.
static bool vidIsWritable(int varID)
Checks if a variable is readable.
Defines the variable ID format.
uint8_t clbStatus(int idx)
Returns the current subsystem status.
bool dbWriteU32(DataBuffer *buf, uint32_t u)
Writes an 32 bits unsigned integer.
bool dbWriteU16(DataBuffer *buf, uint16_t u)
Writes a unsigned short (16 bits unsigned) integer.