#include "FocusStatus.h" FocusStatus::FocusStatus() { m_LayerIndex = 0; m_ScanServoTemp = 0.0f; m_PDSupplyVoltage = 0.0f; //PD供电电压 m_DSPCoreSupplyVoltage = 0.0f; //DSP核心供电电压 m_DSPIOVoltage = 0.0f; //DSP输入输出电压 m_AnalogSectionVoltage = 0.0f; //模拟区电压 m_ADConverterSupplyVoltage = 0.0f; //AD转换供电电压 m_PDSupplyCurrent = 0.0f; //PD供电电流 m_LowState = 0; m_HighState = 0; m_StopEven = 0; } FocusStatus::~FocusStatus() { } void FocusStatus::CreateIfNoExist(SQLite::Database* db) { if (db == nullptr)return; char buffer[1024]; if (db->tableExists(TABLE_NAME))return; string createsql = "CREATE TABLE IF NOT EXISTS %s(%s INTEGER PRIMARY KEY AUTOINCREMENT,%s INTEGER,%s LONG,\ %s INTEGER,%s INTEGER,%s REAL, %s REAL,%s REAL,%s REAL, %s REAL,%s REAL,%s REAL,\ %s INTEGER,%s INTEGER,%s INTEGER)"; sprintf_s(buffer, sizeof(buffer), createsql.c_str(), TABLE_NAME.c_str(), FIELD_ID.c_str(), FIELD_SCAN_ID.c_str(), FIELD_INSERT_TIME.c_str(), FIELD_JOB_ID.c_str(), FIELD_LAYER_INDEX.c_str(), FIELD_SCAN_SERVO_TEMP.c_str(), FIELD_PD_SUPPLY_VOLTAGE.c_str(), FIELD_DSP_CORE_SUPPLY_VOLTAGE.c_str(), FIELD_DSP_IO_VOLTAGE.c_str(), FIELD_ANALOG_SECTION_VOLTAGE.c_str(), FIELD_AD_CONVERTER_SUPPLY_VOLTAGE.c_str(), FIELD_PD_SUPPLY_CURRENT.c_str(), FIELD_LOW_STATE.c_str(), FIELD_HIGH_STATE.c_str(), FIELD_STOP_ENEN.c_str() ); db->exec(buffer); sprintf_s(buffer, sizeof(buffer), "CREATE INDEX IF NOT EXISTS idx_%s_%s ON %s (%s)", TABLE_NAME.c_str(), FIELD_JOB_ID.c_str(), TABLE_NAME.c_str(), FIELD_JOB_ID.c_str() ); db->exec(buffer); } const string FocusStatus::TABLE_NAME="FocusStatus"; const string FocusStatus::FIELD_ID="Id"; const string FocusStatus::FIELD_SCAN_ID="ScanId"; const string FocusStatus::FIELD_INSERT_TIME="InsertTime"; const string FocusStatus::FIELD_JOB_ID="JobId"; const string FocusStatus::FIELD_LAYER_INDEX="LayerIndex"; const string FocusStatus::FIELD_SCAN_SERVO_TEMP="ScanServoTemp"; const string FocusStatus::FIELD_PD_SUPPLY_VOLTAGE="PDSupplyVoltage"; const string FocusStatus::FIELD_DSP_CORE_SUPPLY_VOLTAGE="DSPCoreSupplyVoltage"; const string FocusStatus::FIELD_DSP_IO_VOLTAGE="DSPIOVoltage"; const string FocusStatus::FIELD_ANALOG_SECTION_VOLTAGE="AnalogSectionVoltage"; const string FocusStatus::FIELD_AD_CONVERTER_SUPPLY_VOLTAGE="ADConverterSupplyVoltage"; const string FocusStatus::FIELD_PD_SUPPLY_CURRENT="PDSupplyCurrent"; const string FocusStatus::FIELD_LOW_STATE="LowState"; const string FocusStatus::FIELD_HIGH_STATE="HighState"; const string FocusStatus::FIELD_STOP_ENEN="StopEven";