123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- #pragma once
- #include <string>
- #include <algorithm>
- using namespace std;
- #include "DIOS.Dev.MouldDefine.hpp"
- #include "DME.BasicMoulds.hpp"
- #pragma warning (disable:4244) // warning C4244: “初始化”: 从“double”转换到“float”,可能丢失数据
- namespace DIOS::Dev::Detail
- {
- namespace DME
- {
- static const char* DeviceDriverType = "{00000020-2345-6789-4567-567890123456}";//"{E5F6G7H8-2345-6789-4567-567890123456}";
- static const char* DMEUnitType = "{19103172-3456-7890-6789-789012345678}";
- namespace AttrKey
- {
- static const char* CalibrateValue = "CalibrateValue";
- static const char* MeasurementInterval = "MeasurementInterval"; //连续测量时数据返回时间间隔
- static const char* Position = "Position";//距离起止点
- static const char* Range = "Range"; //量程
- static const char* Frequency = "Frequency";//频率
- static const char* Resolution = "Resolution";//分辨率 1(1mm),2(0.1mm)
- static const char* Distance = "Distance";//距离
- static const char* LaserState = "LaserState";//激光状态
- static const char* ConnectionStatus = "ConnectionStatus";
- static const char* MeasureSID = "MeasureSID";//测量的SID
- static const char* MeasureAngle = "MeasureAngle";//测量的角度
- }
- namespace ActionKey
- {
- static const char* FetchDistance = "FetchDistance"; //获取距离
- static const char* SetLaserState = "SetLaserState"; //设置打开或者关闭激光
- static const char* ShutDown = "ShutDown"; //关机
- }
- //##################################################################################################
- //定义具体设备属性
- #define UNIT_DATA_INT(NAME, KEY) \
- class NAME :public IntMould\
- {\
- using super = IntMould;\
- public:\
- NAME(int initialvalue, int lower, int upper, int accuracy)\
- :super(KEY, initialvalue, lower, upper, accuracy)\
- {}\
- ~NAME() {}\
- };\
- #define UNIT_DATA_INT_withLimit(NAME, KEY, INIT, MIN, MAX, ACC) \
- class NAME :public IntMould\
- {\
- using super = IntMould;\
- public:\
- NAME(int initialvalue = INIT, int lower = MIN, int upper = MAX, int accuracy = ACC)\
- :super(KEY, initialvalue, lower, upper, accuracy)\
- {}\
- ~NAME() {}\
- };\
- #define UNIT_DATA_FLOAT(NAME, KEY) \
- class NAME :public FloatMould\
- {\
- using super = FloatMould;\
- public:\
- NAME(float initialvalue, float lower, float upper, float accuracy)\
- :super(KEY, initialvalue, lower, upper, accuracy)\
- {}\
- ~NAME() {}\
- };\
- #define UNIT_DATA_STR(NAME, KEY) \
- class NAME :public StringMould\
- {\
- using super = StringMould;\
- public:\
- NAME(std::string initialvalue)\
- :super(KEY, initialvalue)\
- {}\
- ~NAME() {}\
- };\
- UNIT_DATA_INT(DistanceMould, AttrKey::Distance);
- UNIT_DATA_INT(LaserStateMould, AttrKey::LaserState);
- UNIT_DATA_INT(ConnectionStatusMould, AttrKey::ConnectionStatus);
-
- //-----------------------------------------------------------------------------
- // ConfigInfo
- //-----------------------------------------------------------------------------
- namespace ConfKey
- {
- static const char* DiosVender = "Vender";
- static const char* DiosModel = "Model";
- static const char* DiosConfig = "DeviceConfig";
- static const char* DiosAttribute = "Attribute";
- static const char* DiosDescription = "Description";
- static const char* DiosSCFType = "SCFType";
- static const char* DiosSCFTCPIP = "TCPIP";
- static const char* DiosSCFCOM = "COM";
- static const char* DiosSCFIP = "ip";
- static const char* DiosSCFPort = "port";
- static const char* DiosSCFBaudrate = "baudrate";
- static const char* DiosSCFBytesize = "bytesize";
- static const char* DiosSCFParity = "parity";
- static const char* DiosSCFStopbits = "stopbits";
- static const char* DiosIsConnect = "IsConnect";
- //20220412 新增 <ConfigToolInfo> 以及其内部属性,主要用于webconfig
- static const char* DiosConfigToolInfo = "ConfigToolInfo";
- static const char* DiosAttributeInfo = "AttributeInfo";
- static const char* DiosAttributeKey = "AttributeKey";
- static const char* DiosAttributeDescripition = "AttributeDescripition";
- static const char* DiosAccess = "Access";
- static const char* DiosType = "Type";
- static const char* DiosRangeMin = "RangeMin";
- static const char* DiosRangeMax = "RangeMax";
- static const char* DiosListNum = "ListNum";
- static const char* DiosListInfo = "ListInfo";
- static const char* DiosList = "List";
- static const char* DiosRequired = "Required";
- static const char* DiosDefaultValue = "DefaultValue";
- static const char* DiosInnerKey = "InnerKey";
- static const char* DiosPathID = "PathID";
- }
- }
- }
|