| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- #ifndef SCPI_ERRQ_H
- #define SCPI_ERRQ_H
- #include "app/queue/queue.h"
- #include "app/queue/queue_ex.h"
- typedef queue_t errq_t;
- ///
- /// \brief Initialize SCPI error queue
- /// \param self Pointer to the queue.
- /// \param buffer Pointer to the user buffer to be used as storage
- /// \param capacity Capacity of the user buffer storage
- /// \return true if no error or false otherwise
- ///
- static inline bool errq_init(queue_t * self, void * buffer, size_t capacity )
- {
- return( QUEUE_RC_NOERROR == queue_init(self, buffer, capacity ) );
- }
- // errq_push
- // @self - Pointer to the record queue.
- // @errorCode - SCPI error code
- // @message - error textual description, null-terminated string
- // Return: true if no error occurred, false otherwise
- bool errq_push( errq_t * self, int16_t errorCode, const char * message );
- // errq_peek
- // Retrieves an information about SCPI error stored in the top of SCPI Error FIFO.
- // DO NOT remove element from the log.
- // @self - Pointer to the record queue.
- // @errorCode - pointer to the variable to store SCPI error code
- // @message - pointer to buffer to store error textual description
- // @msgBufSize - pointer to the variable where the size of the buffer @message is stored. After successful operation
- // the value will be modified to the length of message stored to @message
- // Return: true if no error occurred, false otherwise
- bool errq_peek( errq_t * self, int16_t * perrorCode, char * message, size_t * msgBufSize );
- // errq_pop
- // Retrieves an information about SCPI error stored in the top of SCPI Error FIFO.
- // DO remove element from the log.
- // @self - Pointer to the record queue.
- // @errorCode - pointer to the variable to store SCPI error code
- // @message - pointer to buffer to store error textual description
- // @msgBufSize - pointer to the variable where the size of the buffer @message is stored. After successful operation
- // the value will be modified to the length of message stored to @message
- // Return: true if no error occurred, false otherwise
- bool errq_pop( errq_t * self, int16_t * perrorCode, char * message, size_t * msgBufSize );
- // errq_removetop
- // Remove element from the SCPI Error log.
- // @self - Pointer to the record queue.
- // Return: true if no error occurred, false otherwise
- bool errq_removetop( errq_t * self );
- // errq_isempty
- // Check is the error queue is empty
- // @self - Pointer to the record queue.
- // Return: true if no error records is stored in queue, false otherwise
- bool errq_isempty( errq_t * self );
- // errq_clear
- // Clears error queue
- // @self - Pointer to the record queue.
- // Return: none
- void errq_clear( errq_t * self );
- #endif
|