You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
955 B
41 lines
955 B
#ifndef __DATA_BINARY_LOGGING_HEADERS__
|
|
#define __DATA_BINARY_LOGGING_HEADERS__
|
|
|
|
typedef enum E_BLOG_STATUS{
|
|
BLOG_RECORD_EMPTY = 0,
|
|
BLOG_RECORD_OK = 1,
|
|
BLOG_RECORD_BUSY = 2,
|
|
BLOG_RECORD_DELETED = 255
|
|
}BLOG_STATUS;
|
|
|
|
typedef struct S_BLOG_RECORD{
|
|
uint8_t crc;
|
|
uint8_t * data;
|
|
uint32_t size;
|
|
uint32_t uts;
|
|
uint8_t status;
|
|
}BLOG_RECORD;
|
|
|
|
|
|
typedef enum E_BLOG_STATUS{
|
|
}BLOG_STATUS;
|
|
|
|
class binaryStorage{
|
|
private:
|
|
uint64_t m_nCurrentSize;
|
|
uint32_t m_nPartSize;
|
|
uint32_t m_nRecordsCount;
|
|
basicMutex m_mOpProtector;
|
|
char m_cFileName[MAX_PATH];
|
|
public:
|
|
explicit binaryStorage( CSTR StorageName, uint32_t partitionSize = 0 );
|
|
virtual ~binaryStorage();
|
|
getCounts();
|
|
uint32_t fetch_first( uint32_t ts );
|
|
uint32_t fetch_last( uint32_t ts );
|
|
BLOG_RECORD * getRecord( uint32_t id );
|
|
bool validate();
|
|
bool updateRecord( uint32_t id, uint8_t *data, uint32_t size );
|
|
};
|
|
|
|
#endif
|