#ifndef __DY_IPC_H
#define __DY_IPC_H

#include "dy_common.h"
#include "dy_pp.h"
#include "ipc_session.h"

//"ipc/[G_SN]/[src module]/[data topic]"

#define TOPIC_UP_RAW_DATA "raw_data"
#define TOPIC_RT_PROPERTIES_REPORT "Evt_Rpt_Data"
#define TOPIC_RT_EVENT_REPORT "Rsp_EventData"
#define TOPIC_RT_SERVICE_REPORT "Rsp_ServiceData"
#define TOPIC_SET_NODES_CFG "Set_NodesCfg"
#define TOPIC_GET_NODES_CFG "Get_NodesCfg"
#define TOPIC_SET_TEMPL_CFG "Set_NodesTemplate"
#define TOPIC_GET_TEMPL_CFG "Get_NodesTemplate"
#define TOPIC_SET_OBJ_CFG "Set_ObjectModel"
#define TOPIC_GET_OBJ_CFG "Get_ObjectModel"
#define TOPIC_SET_RS485_CFG "Set_RS485Cfg"
#define TOPIC_GET_RS485_CFG "Get_RS485Cfg"
#define TOPIC_SET_VPORTCFG "Set_VPortCfg"
#define TOPIC_GET_VPORTCFG "Get_VPortCfg"
#define TOPIC_SET_HUAYUN_CFG "Set_HuayunCfg"
#define TOPIC_GET_HUAYUN_CFG "Get_HuayunCfg"
#define TOPIC_SET_COMMON_SOCKET_CFG "Set_CommonSocketCfg"
#define TOPIC_GET_COMMON_SOCKET_CFG "Get_CommonSocketCfg"
#define TOPIC_GET_VERSION_ALL "Get_Version_All"
#define TOPIC_SET_GATEWAYSTATUSINTV "Set_GatewayStatusIntv"
#define TOPIC_EVT_NETWORKINFO "Get_NetworkInfo"
#define TOPIC_EVT_CPUMEMINFO "Get_CpuMemInfo"
#define TOPIC_EVT_LORAINFO "Get_LoRaInfo"
#define TOPIC_EVT_RADIOSTATUS "Get_RadioStatus"
#define TOPIC_EVT_WIRELESSSTATIONSTATUS "Get_WirelessStationStatus"
#define TOPIC_EVT_SET_RGLT "Set_Rglt"
#define TOPIC_RSP_RGLT "Rsp_Rglt"
#define TOPIC_SEND_RGLT_SIGNAL_RAW_DATA "Set_Rglt_Raw"
#define TOPIC_EVT_NODESSTATUS "Evt_NodesStatus"
#define TOPIC_SET_LORAWANCFG "Set_LoRaWANCfg"
#define TOPIC_GET_LORAWANCFG "Get_LoRaWANCfg"
#define TOPIC_SET_LORACFG "Set_LoRaCfg"
#define TOPIC_GET_LORACFG "Get_LoRaCfg"
#define TOPIC_SET_RULESENGINECFG "Set_RulesEngineCfg"
#define TOPIC_GET_RULESENGINECFG "Get_RulesEngineCfg"
#define TOPIC_SET_GATEWAYWANTEST "Set_GatewayWANTest"
#define TOPIC_RSP_GATEWAYWANTEST "Get_GatewayWANTest"
#define TOPIC_SET_GATEWAYWANCFG "Set_GatewayWANCfg"
#define TOPIC_GET_GATEWAYWANCFG "Get_GatewayWANCfg"
#define TOPIC_SET_GATEWAYLANCFG "Set_GatewayLANCfg"
#define TOPIC_GET_GATEWAYLANCFG "Get_GatewayLANCfg"
#define TOPIC_SET_GATEWAYUPGRADECMD "Set_GatewayUpgradeCmd"
#define TOPIC_RSP_GATEWAYUPGRADECMD "Set_GatewayUpgradeCmd"
#define TOPIC_SET_NODESUPGRADECMD "Set_NodesUpgradeCmd"
#define TOPIC_RSP_NODESUPGRADECMD "Set_NodesUpgradeCmd"
#define TOPIC_EVT_NODESUPGRADESTATUS "Evt_NodesUpgradeStatus"
#define TOPIC_SET_MACIPBIND "Set_MacIpBind"
#define TOPIC_GET_MACIPBIND "Get_MacIpBind"
#define TOPIC_GET_LANDEVICESTATUS "Get_LanDeviceStatus"
#define TOPIC_RSP_LANDEVICESTATUS "Get_LanDeviceStatus"
#define TOPIC_SET_RADIOCFG "Set_RadioCfg"
#define TOPIC_GET_RADIOCFG "Get_RadioCfg"
#define TOPIC_SET_GATEWAYVAPCFG "Set_GatewayVAPCfg"
#define TOPIC_GET_GATEWAYVAPCFG "Get_GatewayVAPCfg"
#define TOPIC_GET_WIRELESSSCANRESULT "Get_WirelessScanResult"
#define TOPIC_RSP_WIRELESSSCANRESULT "Get_WirelessScanResult"
#define TOPIC_GET_APPSLIST "Get_AppsList"
#define TOPIC_RSP_APPSLIST "Get_AppsList"
#define TOPIC_SET_APPINSTALL "Set_AppInstall"
#define TOPIC_SET_APPREMOVE "Set_AppRemove"
#define TOPIC_SET_DEPENDAPPINSTALL "Set_DependAppInstall"
#define TOPIC_SET_DEPENDAPPREMOVE "Set_DependAppRemove"
#define TOPIC_SET_RULESDEBUG "Set_RulesDebug"
#define TOPIC_EVT_RULESSTACKS "Evt_RulesStacks"
#define TOPIC_SET_CANCFG "Set_CanCfg"
#define TOPIC_GET_CANCFG "Get_CanCfg"
#define TOPIC_SET_LOGSERVERCFG "Set_LogServerCfg"
#define TOPIC_GET_LOGSERVERCFG "Get_LogServerCfg"
#define TOPIC_CMD_RESULT "CmdResult"
#define TOPIC_LORAWAN_DOWN "LoRaWAN_Down"
#define TOPIC_LORAWAN_UP "LoRaWAN_Up"
#define TOPIC_UPGRADE_NODE "Upgrade_Node"
#define TOPIC_NOTIFY_UPGRADE "Notify_Upgrade"
#define TOPIC_GET_WIFISTATUS "Get_WiFiStatus"
#define TOPIC_RSP_WIFISTATUS "Get_WiFiStatus"
#define TOPIC_FIRMWARE_UPGRADE "Firmware_Upgrade"
#define TOPIC_EXE_RUN "Exe_Run"
#define TOPIC_RSP_RUN "Rsp_Run"
#define START_UPGRADE "start_upgrade"
#define STOP_UPGRADE "stop_upgrade"
#define TOPIC_RSP_VERSION_ALL "Get_Version_All"
#define TOPIC_GATEWAY_CONFIG "gateway"
#define TOPIC_SET_SERVERREDIRECT "Set_ServerRedirect"
#define TOPIC_GET_SERVERREDIRECT "Get_ServerRedirect"
#define TOPIC_SET_MULTI_MQTT_CLD "Set_Multi_Cloud_Mqtt"
#define TOPIC_GET_MULTI_MQTT_CLD "Get_Multi_Cloud_Mqtt"
#define TOPIC_SET_NTPSERVERCFG "Set_NTPServerCfg"
#define TOPIC_GET_NTPSERVERCFG "Get_NTPServerCfg"
#define TOPIC_GET_TEMPLATE_LIST "Get_TemplateList"
#define TOPIC_WEBUI_LOGIN "Login"
#define TOPIC_SET_USERNAME_PASS "Set_UsernamePassword"
#define TOPIC_SET_MQTT_BROKER_TEST "Set_BrokerTest"
#define TOPIC_ADD_UPDATE_NODE "Set_AddUpdateNode"
#define TOPIC_DELETE_NODE "Set_DeleteNode"
#define TOPIC_GET_GWINFO "Get_GatewayInfo"
#define TOPIC_SET_SIM_CARD "Set_SimCard"
#define TOPIC_SCRIPT_HB "heartbeat"
#define TOPIC_SCRIPT "script"
#define TOPIC_SET_SUPOS_CFG "Set_SupOS_cfg"
#define TOPIC_GET_SUPOS_CFG "Get_SupOS_cfg"
#define TOPIC_TROUBLESHOOOTING_4G "Troubleshooting_4G"
#define TOPIC_SET_DEBUG_INFO "Set_DebugInfo"
#define TOPIC_REPORT_DEBUG_INFO "Report_DebugInfo"
#define TOPIC_COLLECT_DIAG_INFO "Diag_Run"
#define TOPIC_GET_HISTORY_DATA "Get_HistoryData"
#define TOPIC_GET_CL_HISTORY_DATA "Get_Cl_HistoryData"
#define TOPIC_GET_CL_HISTORY_DATA_REPLY "Get_Cl_HistoryData_reply"
#define TOPIC_SET_DC_TIME_LIMIT "Set_DC_Timelimit"


int send_to_proto_parser(ipc_session_t *sesson, pp_real_time_data_t *real_data);
int send_to_proto_parser_by_app_key(ipc_session_t *sesson, pp_real_time_data_t *real_data, char *app_key);
int app_manager_send_package_info(ipc_session_t *sesson, app_config_t *app_cfg);
int pp_send_tag_data(ipc_session_t *sesson, tag_table_t *ptag);
int gw_common_result(ipc_session_t *sesson, int mi, int code, char *topic);
int get_rglt_data_from_json(pp_regulate_signal_t *rs_data, char *json_str);
char *service_rs_data(service_cfg_t *pservice, char *sn);
int notify_upgrade_run(ipc_session_t *sesson, node_cfg_t *node);
int notify_upgrade_done(ipc_session_t *sesson, node_cfg_t *node);
int get_tag_data_from_str(tag_table_t *tag, char *json_str);
char *downlink_response(char *sn, int status);
#endif
