141 lines
4.8 KiB
C
141 lines
4.8 KiB
C
|
|
#ifndef __Model_Model2SliceI_h__
|
|||
|
|
#define __Model_Model2SliceI_h__
|
|||
|
|
|
|||
|
|
#include "Model2Slice.h"
|
|||
|
|
#include <map>
|
|||
|
|
#include <string>
|
|||
|
|
|
|||
|
|
#include <Ice/OutputStream.h>
|
|||
|
|
#include <Ice/Ice.h>
|
|||
|
|
#include <Ice/Proxy.h>
|
|||
|
|
#include "drsdk/dsfapi.h"
|
|||
|
|
#include "drsdk/drsdk_inner.h"
|
|||
|
|
#include <vector>
|
|||
|
|
#include <log4cplus/LOG.h>
|
|||
|
|
#include <dirent.h>
|
|||
|
|
#include <sys/stat.h>
|
|||
|
|
#include <pace/P99Component.h>
|
|||
|
|
using namespace log4cplus;
|
|||
|
|
|
|||
|
|
namespace iPlature
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
class EventReceiverI : public virtual EventReceiver
|
|||
|
|
{
|
|||
|
|
public:
|
|||
|
|
|
|||
|
|
EventReceiverI(){};
|
|||
|
|
virtual ~EventReceiverI(){};
|
|||
|
|
/**
|
|||
|
|
* transfore string
|
|||
|
|
*/
|
|||
|
|
std::string replaceString(std::string str, const std::string& from, const std::string& to);
|
|||
|
|
/**
|
|||
|
|
* split string
|
|||
|
|
*/
|
|||
|
|
std::vector<std::string> splitString(const std::string& str, const std::string& delimiter);
|
|||
|
|
|
|||
|
|
//对外SDK回调
|
|||
|
|
void recvCallBackSDK(const int32 nBatchId, dsfapi::TagRecord* pTagRecord, int32* pErrorCode, const int32 nTagCount);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief init
|
|||
|
|
* @common call dr_sdk_init
|
|||
|
|
* @param [in] DRSdkConnectParam
|
|||
|
|
* @param [in] DRSdkOption
|
|||
|
|
* @return if success 0 ,else sdk error code
|
|||
|
|
* @version 10/29/2024 wangkexiong Initial Version
|
|||
|
|
*/
|
|||
|
|
virtual ::Ice::Int Init(const DRSdkConnectParam& tDRSdkConnectParam,
|
|||
|
|
const DRSdkOption& tDRSdkOption,
|
|||
|
|
const Ice::Current& current);
|
|||
|
|
|
|||
|
|
virtual ::Ice::Int CacheRelation(const Ice::Current& current);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief obtain Model json conf
|
|||
|
|
* @common call SDK DR_Get_Model_Json
|
|||
|
|
* @param [in] objName model names: namespace::Obj.A
|
|||
|
|
* @param [out] sModeJsonString model json conf
|
|||
|
|
* @return 0 if success else error code
|
|||
|
|
* @version 09/29/2024 wangkexiong Initial Version
|
|||
|
|
*/
|
|||
|
|
virtual ::std::string GetModelJson(const ::std::string& objName, const Ice::Current& current);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
virtual ::AP::ByteSeqSeq readData(const ::Ice::StringSeq& tagNames, const Ice::Current& current);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief get object calue
|
|||
|
|
* @common
|
|||
|
|
* @param [in] objectName object name :namespcae::Obj
|
|||
|
|
* @param [out] objectName object name :namespcae::Obj
|
|||
|
|
* @return successfully 0 else errorcode
|
|||
|
|
* @version 09/29/2024 wangkexiong Initial Version
|
|||
|
|
*/
|
|||
|
|
virtual ::AP::ByteSeqSeq readObjValue(const ::std::string& objectName,
|
|||
|
|
const Ice::Current& current);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief get object data
|
|||
|
|
* @comm call dr_read_object_data
|
|||
|
|
* @param [in] objectName object name
|
|||
|
|
* @param [out] ObjectTyle object type
|
|||
|
|
* @return successfully 0,else error code
|
|||
|
|
* @version 09/29/2024 wangkexiong Initial Version
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
virtual ::AP::ByteSeqSeq readObjectTyle(const ::std::string& strObjectName, const Ice::Current& current);
|
|||
|
|
|
|||
|
|
virtual void recvCallBack(const ::Ice::StringSeq& tagNames,
|
|||
|
|
const ::AP::ByteSeqSeq& tagValues,
|
|||
|
|
const Ice::Current& current)=0;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief regist tag for async reading
|
|||
|
|
* @common call SDK dr_async_reg_tag then call recvCallBack <EFBFBD><EFBFBD>supoort single regist,batch regist,model regist
|
|||
|
|
* @param [in] tagNames tag names :namespace::Obj.A
|
|||
|
|
* @param [in] nIntervalMs subscribe difference
|
|||
|
|
* @return 0 if success
|
|||
|
|
* @version 09/29/2024 wangkexiong Initial Version
|
|||
|
|
*/
|
|||
|
|
virtual ::Ice::Int regist(const ::Ice::StringSeq& tagNames,
|
|||
|
|
::Ice::Int nIntervalMs,
|
|||
|
|
const Ice::Current& current);
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* @brief Send control commands onlytag name or tag names no module
|
|||
|
|
* @common call SDK dr_control_data ,support signale set,batch set,not support moudle set
|
|||
|
|
* @param [in] tagNames tag names : namespace::Obj.A
|
|||
|
|
* @param [in] tagValues tag values
|
|||
|
|
* @param [in] num num of tag
|
|||
|
|
* @return if success 0 ,else sdk error code
|
|||
|
|
* @version 09/29/2024 wangkexiong Initial Version
|
|||
|
|
*/
|
|||
|
|
virtual ::Ice::Int setControlData(const ::Ice::StringSeq& tagNames,
|
|||
|
|
const ::AP::ByteSeqSeq& tagValues,
|
|||
|
|
::Ice::Int num,
|
|||
|
|
const Ice::Current& current);
|
|||
|
|
virtual ::Ice::Int unregist(int nBatchID,const Ice::Current& current);
|
|||
|
|
|
|||
|
|
|
|||
|
|
private:
|
|||
|
|
|
|||
|
|
bool case_insensitive_compare(const char* str1, const char* str2);
|
|||
|
|
const char* getenv_case_insensitive(const char* name);
|
|||
|
|
bool makeDirectory(const std::string& path);
|
|||
|
|
std::vector<std::string> findFileName(const std::string& path);
|
|||
|
|
int parseConfigFile(const std::string& filePath);
|
|||
|
|
int parseConfigFiles(const std::vector<std::string>& filePaths);
|
|||
|
|
|
|||
|
|
dsfapi::DRSdkContext* g_pContext;
|
|||
|
|
std::map<std::string, std::string> g_confMap;
|
|||
|
|
dsfapi::DRSdkConnectParam g_tConnectParam;
|
|||
|
|
dsfapi::DRSdkOption g_tOption;
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endif
|