56 lines
1.9 KiB
C++
56 lines
1.9 KiB
C++
#ifndef WAVE_FEATURE_SET_HPP_
|
|
#define WAVE_FEATURE_SET_HPP_
|
|
|
|
#include <iostream>
|
|
#include <map>
|
|
#include <unordered_set>
|
|
#include <vector>
|
|
#include <stdint.h>
|
|
#include <boost/container/detail/singleton.hpp>
|
|
#include <json/json.h>
|
|
|
|
#define FEATURE_FILTER_CFG "/opt/configenv/feature_filter.json"
|
|
#define WAVE_FILTER_CFG "/opt/configenv/wave_filter.json"
|
|
|
|
typedef struct {
|
|
uint16_t short_addr; // 全局配置的短地址写0
|
|
uint8_t x, y, z;
|
|
} FeatureEntryUploadCfg;
|
|
|
|
typedef struct {
|
|
uint8_t x, y, z;
|
|
} FeatureEntryPrivateCfg;
|
|
|
|
class WaveFeatureSetting {
|
|
public:
|
|
WaveFeatureSetting();
|
|
|
|
// Feature set
|
|
int GetFeatureCfg(uint16_t short_addr, uint8_t &x, uint8_t &y, uint8_t &z); // 获取单个
|
|
void SetFeatureCfg(uint16_t short_addr, uint8_t x, uint8_t y, uint8_t z); // 设置单个传感器
|
|
void SetAllFeatureCfg(std::vector<FeatureEntryUploadCfg> cfg); // 设置所有的
|
|
int GetAllFeatureCfg(std::vector<FeatureEntryUploadCfg> &cfg); // 获取所有的
|
|
void RemoveFeatureCfg(uint16_t short_addr);
|
|
void RemoveAllFeatureCfg();
|
|
|
|
// Wave set
|
|
int GetWaveCfg(uint16_t short_addr, uint8_t &x, uint8_t &y, uint8_t &z); // 获取单个
|
|
void SetWaveCfg(uint16_t short_addr, uint8_t x, uint8_t y, uint8_t z); // 设置单个传感器
|
|
void SetAllWaveCfg(std::vector<FeatureEntryUploadCfg> cfg); // 设置所有的
|
|
int GetAllWaveCfg(std::vector<FeatureEntryUploadCfg> &cfg); // 获取所有的
|
|
void RemoveWaveCfg(uint16_t short_addr);
|
|
void RemoveAllWaveCfg();
|
|
|
|
private:
|
|
void WriteFeatureCfgFile();
|
|
FeatureEntryUploadCfg global_feature_;
|
|
std::map<uint16_t, FeatureEntryPrivateCfg> eigen_map_;
|
|
|
|
void WriteWaveCfgFile();
|
|
FeatureEntryUploadCfg global_wave_;
|
|
std::map<uint16_t, FeatureEntryPrivateCfg> wave_map_;
|
|
};
|
|
|
|
typedef boost::container::dtl::singleton_default<WaveFeatureSetting> wave_feature_set_inst;
|
|
|
|
#endif // WAVE_FEATURE_SET_HPP_
|