Index: NVDataMgmt.c =================================================================== diff -u -r0d9e958dbe92ab81e3a749307eb5e1be93ec1cff -r33154cde2aaf919b95e678f513131295ca937d42 --- NVDataMgmt.c (.../NVDataMgmt.c) (revision 0d9e958dbe92ab81e3a749307eb5e1be93ec1cff) +++ NVDataMgmt.c (.../NVDataMgmt.c) (revision 33154cde2aaf919b95e678f513131295ca937d42) @@ -193,19 +193,6 @@ char disinfectionDate [ MAX_DATE_CHARACTERS ]; ///< Disinfection date (char array) U16 crc; ///< Disinfection date CRC } LAST_DISINFECTION_RECORD_T; - -/// Log data struct -typedef struct -{ - U32 epochTime; ///< Log data time in epoch - U32 eventCode; ///< Log data event code - U32 subCode; ///< Log data sub code - F32 data1; ///< Log data 1 - F32 data2; ///< Log data 2 - F32 data3; ///< Log data 3 - F32 data4; ///< Log data 4 - F32 data5; ///< Log data 5 -} LOG_DATA_T; #pragma pack(pop) // Private variables @@ -277,6 +264,7 @@ static READ_DATA_T mytest; static CALIBRATION_DATA_T calTest; static SERVICE_DATA_T service; +static MFG_DATA_T mfgD; // REMOVE THIS CODE /************************************************************************* @@ -325,12 +313,12 @@ * The getMfgData returns the data in the struct that hold manufacturing * record to buffer that the caller has provided * @details - * Inputs : U08* (buffer) + * Inputs : MFG_DATA_T* (buffer) * Outputs : none * @param none * @return none *************************************************************************/ -void getMfgData ( U08* buffer ) +void getMfgData ( MFG_DATA_T* buffer ) { memcpy ( buffer, (U08*)&mfgRecord.mfgData, sizeof(MFG_DATA_T) ); } @@ -362,12 +350,12 @@ * The getCalibrationData returns the data in the struct that hold calibration * record to buffer that the caller has provided * @details - * Inputs : U08* (buffer) + * Inputs : CALIBRATION_DATA_T* (buffer) * Outputs : none * @param none * @return none *************************************************************************/ -void getCalibrationData ( U08* buffer ) +void getCalibrationData ( CALIBRATION_DATA_T* buffer ) { memcpy ( buffer, (U08*)&calibrationRecord.calData, sizeof(CALIBRATION_DATA_T) ); } @@ -404,12 +392,12 @@ * The getServiceDate returns the data in the struct that holds service * date to buffer that the caller has provided * @details - * Inputs : U08* (buffer) + * Inputs : SERVICE_DATA_T* (buffer) * Outputs : none * @param none * @return none *************************************************************************/ -void getServiceDate ( U08* buffer ) +void getServiceDate ( SERVICE_DATA_T* buffer ) { memcpy ( buffer, (U08*)&serviceRecord.serviceData, sizeof(SERVICE_DATA_T) ); } @@ -419,19 +407,19 @@ * The writeLogData checks if the queue is not full and if it is not, it calls * enqueue to schedule a job for writing the log data * @details - * Inputs : U08* (data) + * Inputs : LOG_DATA_T* (data) * Outputs : BOOL * @param none * @return BOOL *************************************************************************/ -BOOL writeLogData ( U08* data, U32 length ) +BOOL writeLogData ( LOG_DATA_T* data ) { BOOL status = FALSE; // If the header is corrupted, no more data is allowed to be written - if ( !isQueueFull() ) //&& logRecord.logHeader.isHdrCorrupted == FALSE ) + if ( !isQueueFull() && logRecord.logHeader.isHdrCorrupted == FALSE ) { - enqueue ( NVDATAMGMT_WRITE, NVDATAMGMT_EEPROM, 0, data, 0, length ); + enqueue ( NVDATAMGMT_WRITE, NVDATAMGMT_EEPROM, 0, (U08*)&data, 0, sizeof(LOG_DATA_T) ); status = TRUE; } @@ -1170,20 +1158,23 @@ { // TODO: REMOVE THIS CODE logData.epochTime = 1582583436; - logData.eventCode = NVDATAMGMT_DEVICE_TURNED_ON; - logData.subCode = 14587; - logData.data1 = 2.4; + logData.eventCode = NVDATAMGMT_DISINFECTION_STARTED; + logData.subCode = 147856; + logData.data1 = 3.3; logData.data2 = 13; logData.data3 = 223.58; - logData.data4 = 80.125; - logData.data5 = 68; + logData.data4 = 200.14; + logData.data5 = 25; + //getCalibrationData(&calTest); + + //mytest.status = NVDATAMGMT_READ_IDLE; //mytest.externalBuffer = readBufferForTest; char a[10] = {'0','3','-', '0','3','-','2','0','2','0'}; //setDisinfectionDate ( a); - writeLogData ( (U08*)&logData, 32 ); + writeLogData ( &logData ); //readLogData ( &mytest, sizeof(readBufferForTest) ); //readLogData ( &mytest, sizeof(readBufferForTest) ); @@ -1195,8 +1186,9 @@ memcpy(service.currentServiceDate, a, 10); memcpy(service.nextServiceDate, a, 10); //setServiceDate(service); - //setTreatmentTime(750); + //getServiceDate ( &service ); + /*MFG_DATA_T test; char sys[7] = {'A', 'B', 'C', 'D', '3', '6', '7'}; char hw[5] = {'3', '4', '5', '6', '7'};