1. 增加切换节目的Api接口
This commit is contained in:
parent
77d6431d38
commit
f2103a6f46
@ -90,5 +90,19 @@ void from_xml(const HXml &xml, ScreenShot2 &data)
|
||||
data.rawData = cat::HCatBuffer::FromBase64(xml.at("image").GetAttribute("data"));
|
||||
}
|
||||
|
||||
void to_xml(HXml &xml, const SwitchProgramInfo &data)
|
||||
{
|
||||
if (data.guid.Empty() == false) {
|
||||
xml["program"] = {"guid", data.guid};
|
||||
} else {
|
||||
xml["program"] = {"index", data.index};
|
||||
}
|
||||
}
|
||||
|
||||
void from_xml(const HXml &xml, SwitchProgramInfo &data)
|
||||
{
|
||||
data.guid = xml.at("program").GetAttribute("guid");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -131,6 +131,25 @@ void to_xml(HXml &xml, const ScreenShot2 &data);
|
||||
void from_xml(const HXml &xml, ScreenShot2 &data);
|
||||
|
||||
|
||||
///< 切换节目和获取当前节目guid
|
||||
struct SwitchProgramInfo
|
||||
{
|
||||
cat::HCatBuffer guid;
|
||||
int index;
|
||||
|
||||
SwitchProgramInfo()
|
||||
: index(0)
|
||||
{}
|
||||
|
||||
static bool MatchSet(const cat::HCatBuffer &item) { return item == "SwitchProgram"; }
|
||||
static cat::HCatBuffer SetMethod() { return "SwitchProgram"; }
|
||||
static bool MatchGet(const cat::HCatBuffer &item) { return item == "GetCurrentPlayProgramGUID"; }
|
||||
static cat::HCatBuffer GetMethod() { return "GetCurrentPlayProgramGUID"; }
|
||||
};
|
||||
void to_xml(HXml &xml, const SwitchProgramInfo &data);
|
||||
void from_xml(const HXml &xml, SwitchProgramInfo &data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -47,16 +47,17 @@ int HSDKInfo::ParseInfo(tinyxml2::XMLElement *outNode, const cat::HCatBuffer &me
|
||||
#define UPDATE_GET_NODE(obj) \
|
||||
if (UpdateGetNode(obj, method, xml)) { ++result; }
|
||||
|
||||
UPDATE_NODE(lightInfo);
|
||||
UPDATE_NODE(systemVolumeInfo);
|
||||
UPDATE_NODE(tcpSercerInfo);
|
||||
UPDATE_NODE(timeInfo);
|
||||
UPDATE_NODE(ethInfo);
|
||||
UPDATE_NODE(wifiInfo);
|
||||
UPDATE_NODE(pppoeInfo);
|
||||
UPDATE_NODE(systemVolumeInfo);
|
||||
UPDATE_NODE(deviceNameInfo);
|
||||
UPDATE_NODE(lightInfo);
|
||||
UPDATE_NODE(tcpSercerInfo);
|
||||
UPDATE_NODE(switchTimeInfo);
|
||||
UPDATE_NODE(relayInfo);
|
||||
UPDATE_NODE(timeInfo);
|
||||
UPDATE_NODE(switchProgramInfo);
|
||||
|
||||
UPDATE_GET_NODE(deviceInfo);
|
||||
UPDATE_GET_NODE(screenShot2);
|
||||
|
||||
@ -34,6 +34,7 @@ struct HSDKInfo
|
||||
SwitchTimeInfo switchTimeInfo; ///< 开关机
|
||||
RelayInfo relayInfo; ///< 继电器
|
||||
TimeInfo timeInfo; ///< 时间
|
||||
SwitchProgramInfo switchProgramInfo; ///< 切换节目和获取当前节目的guid
|
||||
|
||||
///< 下面是只有获取项的
|
||||
DeviceInfo deviceInfo; ///< 设备信息
|
||||
|
||||
@ -117,6 +117,7 @@ HBool UpdateItem(IHDProtocol protocol, ISDKInfo info, int updateItem)
|
||||
GET_SET_ITEM(kGetDeviceNameInfo, kSetDeviceNameInfo, info->deviceNameInfo);
|
||||
GET_SET_ITEM(kGetSwitchTimeInfo, kSetSwitchTimeInfo, info->switchTimeInfo);
|
||||
GET_SET_ITEM(kGetRelayInfo, kSetRelayInfo, info->relayInfo);
|
||||
GET_SET_ITEM(kGetCurrProgramGuid, kSetCurrProgramGuid, info->switchProgramInfo);
|
||||
|
||||
GET_ITEM(kGetDeviceInfo, info->deviceInfo);
|
||||
GET_DATA_ITEM(kGetScreenShot, info->screenShot2);
|
||||
@ -781,6 +782,17 @@ const char *GetRelayInfoInternalPloyEnd(sdk::ISDKInfo info, int index)
|
||||
return info->relayInfo.internal.ploys.at(index).end.ConstData();
|
||||
}
|
||||
|
||||
void SetCurrProgramGuid(sdk::ISDKInfo info, const char *guid, int index)
|
||||
{
|
||||
info->switchProgramInfo.guid = cat::HCatBuffer(guid);
|
||||
info->switchProgramInfo.index = index;
|
||||
}
|
||||
|
||||
const char *GetCurrProgramGuid(sdk::ISDKInfo info)
|
||||
{
|
||||
return info->switchProgramInfo.guid.ConstData();
|
||||
}
|
||||
|
||||
const char *GetDevceInfoId(ISDKInfo info)
|
||||
{
|
||||
return info->deviceInfo.device.id.ConstData();
|
||||
|
||||
@ -47,6 +47,8 @@ enum eUpdateItem {
|
||||
kSetSwitchTimeInfo = 0x1017, ///< 设置开关机信息
|
||||
kGetRelayInfo = 0x1018, ///< 获取继电器信息
|
||||
kSetRelayInfo = 0x1019, ///< 设置继电器信息
|
||||
kGetCurrProgramGuid = 0x1020, ///< 获取当前节目guid
|
||||
kSetCurrProgramGuid = 0x1021, ///< 设置当前节目guid
|
||||
|
||||
///< 没有设置项, 只有获取项
|
||||
kGetDeviceInfo = 0x2000, ///< 获取设备信息
|
||||
@ -242,6 +244,16 @@ HD_API const char * DLL_CALL GetRelayInfoInternalPloyStart(ISDKInfo info, int in
|
||||
HD_API const char * DLL_CALL GetRelayInfoInternalPloyEnd(ISDKInfo info, int index);
|
||||
|
||||
|
||||
/**
|
||||
* @brief SetCurrProgramGuid 设置当前节目的guid
|
||||
* @param info 信息体
|
||||
* @param guid 节目guid
|
||||
* @param index 节目索引(和节目guid互斥)
|
||||
*/
|
||||
HD_API void DLL_CALL SetCurrProgramGuid(ISDKInfo info, const char *guid, int index);
|
||||
|
||||
HD_API const char * DLL_CALL GetCurrProgramGuid(ISDKInfo info);
|
||||
|
||||
|
||||
///< 下面是获取
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user