/*
|
* dsp_report.cpp
|
*
|
* Created on: 2025Äê7ÔÂ22ÈÕ
|
* Author: 86189
|
*/
|
|
#ifndef DSP_REPORT_CPP_
|
#define DSP_REPORT_CPP_
|
#include <cstring>
|
#include "dsp_report.h"
|
|
void ReportStatus::device_status_push(short ID , short* value, int numOfValue)
|
{
|
int i;
|
int found =0;
|
|
if(numOfValue > 16) numOfValue =16 ;
|
|
for(i = 0; i< device_status_count; i++){
|
if(dev_status[i].ID == ID){
|
found = 1;
|
break;
|
}
|
}
|
|
if(found){
|
memcpy(dev_status[i].value , value, numOfValue*sizeof(short));
|
}
|
else{
|
dev_status[device_status_count].ID = ID;
|
memcpy(dev_status[device_status_count].value, value, numOfValue*sizeof(short));
|
device_status_count++;
|
device_status_count &= 15;
|
}
|
}
|
|
int ReportStatus::get_device_status_ptr(char* data, int data_len)
|
{
|
int size = device_status_count*sizeof(struct dsp_status_t);
|
if(data_len < size) {
|
return 0;
|
}
|
|
memcpy(data, dev_status, size);
|
device_status_count =0; //reset
|
return size;
|
}
|
|
#endif /* DSP_REPORT_CPP_ */
|