|
|
@@ -1,3 +1,4 @@
|
|
|
+<<<<<<< HEAD
|
|
|
#include "modbus.h"
|
|
|
#include "common.h"
|
|
|
#include "list.h"
|
|
|
@@ -137,8 +138,8 @@ int cascade_slave_init(void)
|
|
|
slave_handle_t *sh=&slHandle;
|
|
|
GlobalDeviceManager* mgr=get_dm();
|
|
|
|
|
|
- if(mgr->_globalDevInfo.product_pwr_type == SmartPDU_AC ||
|
|
|
- mgr->_globalDevInfo.product_pwr_type == SmartPDU_DC) // single AC
|
|
|
+ if(mgr->_global_device_info->product_pwr_type == SmartPDU_AC ||
|
|
|
+ mgr->_global_device_info->product_pwr_type == SmartPDU_DC) // single AC
|
|
|
{
|
|
|
if(sh->map)
|
|
|
{
|
|
|
@@ -191,9 +192,9 @@ int cascade_slave_init(void)
|
|
|
static void slave_read(slave_handle_t *sh, uint32_t addr,int num,uint32_t reg_type,uint32_t type)
|
|
|
{
|
|
|
GlobalDeviceManager* mgr=get_dm();
|
|
|
-
|
|
|
- if(mgr->_globalDevInfo.product_pwr_type == SmartPDU_AC ||
|
|
|
- mgr->_globalDevInfo.product_pwr_type == SmartPDU_DC){
|
|
|
+
|
|
|
+ if(mgr->_global_device_info->product_pwr_type == SmartPDU_AC ||
|
|
|
+ mgr->_global_device_info->product_pwr_type == SmartPDU_DC){
|
|
|
if(addr >= DEV_CHN_REG && addr <= ALL_SET_SWITCH_REG)
|
|
|
{
|
|
|
if(type == TYPE_U16)
|
|
|
@@ -331,9 +332,9 @@ void cascade_slave_write(uint32_t addr, uint16_t val)
|
|
|
slave_handle_t *sh=&slHandle;
|
|
|
GlobalDeviceManager* mgr=get_dm();
|
|
|
uint16_t buff[128] = {0};
|
|
|
-
|
|
|
- if(mgr->_globalDevInfo.product_pwr_type == SmartPDU_AC
|
|
|
- || mgr->_globalDevInfo.product_pwr_type == SmartPDU_DC)
|
|
|
+
|
|
|
+ if(mgr->_global_device_info->product_pwr_type == SmartPDU_AC
|
|
|
+ || mgr->_global_device_info->product_pwr_type == SmartPDU_DC)
|
|
|
{
|
|
|
switch(addr)
|
|
|
{
|
|
|
@@ -347,7 +348,7 @@ void cascade_slave_write(uint32_t addr, uint16_t val)
|
|
|
break;
|
|
|
if((start_chn+1) == _globalPowerMangerTemp->product_ch_id)
|
|
|
{
|
|
|
- if(mgr->_globalDevInfo.product_pwr_type == SmartPDU_AC){
|
|
|
+ if(mgr->_global_device_info->product_pwr_type == SmartPDU_AC){
|
|
|
_globalPowerMangerTemp->product_ch_start_delay=val;
|
|
|
g_switch_set_ac_single_s_start_time_delay(&__globalDeviceManage._globalRelaySampManger,_globalPowerMangerTemp->product_saddr,
|
|
|
_globalPowerMangerTemp->product_ch_addr,val);
|
|
|
@@ -378,7 +379,7 @@ void cascade_slave_write(uint32_t addr, uint16_t val)
|
|
|
break;
|
|
|
if((start_chn+1) == _globalPowerMangerTemp->product_ch_id)
|
|
|
{
|
|
|
- if(mgr->_globalDevInfo.product_pwr_type == SmartPDU_AC){
|
|
|
+ if(mgr->_global_device_info->product_pwr_type == SmartPDU_AC){
|
|
|
_globalPowerMangerTemp->product_ch_stop_delay=val;
|
|
|
g_switch_set_ac_single_s_stop_time_delay(&__globalDeviceManage._globalRelaySampManger,_globalPowerMangerTemp->product_saddr,
|
|
|
_globalPowerMangerTemp->product_ch_addr,val);
|
|
|
@@ -459,9 +460,9 @@ void cascade_slave_write(uint32_t addr, uint16_t val)
|
|
|
int ret = 0;
|
|
|
|
|
|
_globalPowerMangerTemp->product_ch_start_delay = val;
|
|
|
- if (__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_Tree
|
|
|
- ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One
|
|
|
- ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One_B
|
|
|
+ if (__globalDeviceManage._global_device_info->product_pwr_type == SmartPDU_Tree_AC_Tree
|
|
|
+ ||__globalDeviceManage._global_device_info->product_pwr_type == SmartPDU_Tree_AC_One
|
|
|
+ ||__globalDeviceManage._global_device_info->product_pwr_type == SmartPDU_Tree_AC_One_B
|
|
|
)
|
|
|
{
|
|
|
printf("hwllo every one stop time !!!!\n");
|
|
|
@@ -499,9 +500,9 @@ void cascade_slave_write(uint32_t addr, uint16_t val)
|
|
|
int ret = 0;
|
|
|
|
|
|
_globalPowerMangerTemp->product_ch_stop_delay = val;
|
|
|
- if (__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_Tree
|
|
|
- ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One
|
|
|
- ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One_B)
|
|
|
+ if (__globalDeviceManage._global_device_info->product_pwr_type == SmartPDU_Tree_AC_Tree
|
|
|
+ ||__globalDeviceManage._global_device_info->product_pwr_type == SmartPDU_Tree_AC_One
|
|
|
+ ||__globalDeviceManage._global_device_info->product_pwr_type == SmartPDU_Tree_AC_One_B)
|
|
|
{
|
|
|
ret = g_switch_set_t_ac_stop_time_delay(&__globalDeviceManage._globalRelaySampManger,
|
|
|
_globalPowerMangerTemp->product_saddr, (_globalPowerMangerTemp->product_ch_addr - 1) * 3, val / 1000);
|
|
|
@@ -543,9 +544,9 @@ void cascade_slave_write(uint32_t addr, uint16_t val)
|
|
|
{
|
|
|
t_ac_CtrlType=_globalTACManager->product_ph_outputType;
|
|
|
}
|
|
|
- if (t_ac_CtrlType == 2&&(__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_Tree
|
|
|
- ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One
|
|
|
- ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One_B))
|
|
|
+ if (t_ac_CtrlType == 2&&(__globalDeviceManage._global_device_info->product_pwr_type == SmartPDU_Tree_AC_Tree
|
|
|
+ ||__globalDeviceManage._global_device_info->product_pwr_type == SmartPDU_Tree_AC_One
|
|
|
+ ||__globalDeviceManage._global_device_info->product_pwr_type == SmartPDU_Tree_AC_One_B))
|
|
|
{
|
|
|
if(_globalPowerMangerTemp->product_ch_type == AC_SINGLE_S_TYPE || _globalPowerMangerTemp->product_ch_type == AC_SINGLE_B_TYPE)
|
|
|
{
|
|
|
@@ -612,7 +613,7 @@ void cascade_slave_write(uint32_t addr, uint16_t val)
|
|
|
sts |= ENABLE_TAC_STIME;
|
|
|
sts |= ENABLE_TAC_ETIME;
|
|
|
}*/
|
|
|
- if (__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One)
|
|
|
+ if (__globalDeviceManage._global_device_info->product_pwr_type == SmartPDU_Tree_AC_One)
|
|
|
{
|
|
|
g_switch_set_t_ac_phchn_ctrl(&__globalDeviceManage._globalRelaySampManger,
|
|
|
_globalPowerMangerTemp->product_saddr,
|
|
|
@@ -651,3 +652,652 @@ void cascade_slave_write(uint32_t addr, uint16_t val)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+=======
|
|
|
+#include "modbus.h"
|
|
|
+#include "common.h"
|
|
|
+#include "list.h"
|
|
|
+#include "switch_ctrl.h"
|
|
|
+#include "cascade.h"
|
|
|
+#include "sqlite_handle.h"
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+#define DEV_CHN_REG (4000)
|
|
|
+#define OUT_INFO_REG (4001)
|
|
|
+#define IN_TOTAL_REG (4385)
|
|
|
+#define TEM_HUMAN_REG (4389)
|
|
|
+#define CHN_SWITCH_REG (4390)
|
|
|
+#define CHN_OPEN_DLA_REG (4454)
|
|
|
+#define CHN_CLOSE_DLA_REG (4518)
|
|
|
+#define CHN_SET_OPEN_DLA_REG (5000)
|
|
|
+#define CHN_SET_CLOSE_DLA_REG (5064)
|
|
|
+#define CHN_SET_SWITCH_STA_REG (5128)
|
|
|
+#define ALL_SET_SWITCH_REG (5192)
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+enum{
|
|
|
+ TYPE_U16,
|
|
|
+ TYPE_U32
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+enum {
|
|
|
+ DS_R_DEV_CHN = 0,
|
|
|
+ DS_R_OUT_INFO,
|
|
|
+ DS_R_IN_TOTAL,
|
|
|
+ DS_R_TEMP_HUM,
|
|
|
+ DS_R_SWITCH_STA,
|
|
|
+ DS_R_OPEN_DELAY,
|
|
|
+ DS_R_CLOSE_DELAY,
|
|
|
+ DS_W_OPEN_DELAY,
|
|
|
+ DS_W_CLOSE_DELAY,
|
|
|
+ DS_W_CHN_SWITCH_STA,
|
|
|
+ DS_W_ALL_CHN_STA
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+#define TREE_DEV_CHN_REG (6000)
|
|
|
+#define TREE_INPUT_A_REG (6001)
|
|
|
+#define TREE_INPUT_B_REG (6009)
|
|
|
+#define TREE_INPUT_C_REG (6017)
|
|
|
+#define TREE_CHN_TOTAL_REG (6025)
|
|
|
+#define TREE_CHN_PH_REG (6665)
|
|
|
+#define TREE_TEMP_HUM_REG (8585)
|
|
|
+#define TREE_CHN_SWITCH_STA_REG (8587)
|
|
|
+#define TREE_CHN_OPEN_DLA_REG (8651)
|
|
|
+#define TREE_CHN_CLOSE_DLA_REG (8715)
|
|
|
+#define TREE_CHN_SET_OPEN_DLA_REG (9000)
|
|
|
+#define TREE_CHN_SET_CLOSE_DLA_REG (9064)
|
|
|
+#define TREE_CHN_SET_SWITCH_STA_REG (9128)
|
|
|
+#define TREE_ALL_SET_SWITCH_REG (9192)
|
|
|
+
|
|
|
+enum {
|
|
|
+ TREE_R_DEV_CHN,
|
|
|
+ TREE_R_INPUT_ALL_A,
|
|
|
+ TREE_R_INPUT_ALL_B,
|
|
|
+ TREE_R_INPUT_ALL_C,
|
|
|
+ TREE_R_CHN_TOTAL,
|
|
|
+ TREE_R_CHN_PH_INFO,
|
|
|
+ TREE_R_TEMP_HUM,
|
|
|
+ TREE_R_SWITCH_STA,
|
|
|
+ TREE_R_OPEN_DELAY,
|
|
|
+ TREE_R_CLOSE_DELAY,
|
|
|
+ TREE_W_OPEN_DELAY,
|
|
|
+ TREE_W_CLOSE_DELAY,
|
|
|
+ TREE_W_CHN_SWITCH_STA,
|
|
|
+ TREE_W_ALL_CHN_STA
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+static inline GlobalDeviceManager* get_dm(void)
|
|
|
+{
|
|
|
+ return &__globalDeviceManage;
|
|
|
+}
|
|
|
+static inline GlobalDeviceManager* get_dm2(void)
|
|
|
+{
|
|
|
+ return &__globalDeviceManage2;
|
|
|
+}
|
|
|
+
|
|
|
+static mmap_modbus_t modbus_single[] = {
|
|
|
+ [DS_R_DEV_CHN ]{.offset = DEV_CHN_REG },
|
|
|
+ [DS_R_OUT_INFO ]{.offset = OUT_INFO_REG },
|
|
|
+ [DS_R_IN_TOTAL ]{.offset = IN_TOTAL_REG },
|
|
|
+ [DS_R_TEMP_HUM ]{.offset = TEM_HUMAN_REG },
|
|
|
+ [DS_R_SWITCH_STA ]{.offset = CHN_SWITCH_REG },
|
|
|
+ [DS_R_OPEN_DELAY ]{.offset = CHN_OPEN_DLA_REG },
|
|
|
+ [DS_R_CLOSE_DELAY ]{.offset = CHN_CLOSE_DLA_REG },
|
|
|
+ [DS_W_OPEN_DELAY ]{.offset = CHN_SET_OPEN_DLA_REG },
|
|
|
+ [DS_W_CLOSE_DELAY ]{.offset = CHN_SET_CLOSE_DLA_REG },
|
|
|
+ [DS_W_CHN_SWITCH_STA]{.offset = CHN_SET_SWITCH_STA_REG },
|
|
|
+ [DS_W_ALL_CHN_STA ]{.offset = ALL_SET_SWITCH_REG },
|
|
|
+};
|
|
|
+
|
|
|
+static mmap_modbus_t modbus_three[] = {
|
|
|
+ [TREE_R_DEV_CHN ]{.offset = TREE_DEV_CHN_REG},
|
|
|
+ [TREE_R_INPUT_ALL_A ]{.offset = TREE_INPUT_A_REG },
|
|
|
+ [TREE_R_INPUT_ALL_B ]{.offset = TREE_INPUT_B_REG },
|
|
|
+ [TREE_R_INPUT_ALL_C ]{.offset = TREE_INPUT_C_REG },
|
|
|
+ [TREE_R_CHN_TOTAL ]{.offset = TREE_CHN_TOTAL_REG },
|
|
|
+ [TREE_R_CHN_PH_INFO ]{.offset = TREE_CHN_PH_REG },
|
|
|
+ [TREE_R_TEMP_HUM ]{.offset = TREE_TEMP_HUM_REG },
|
|
|
+ [TREE_R_SWITCH_STA ]{.offset = TREE_CHN_SWITCH_STA_REG},
|
|
|
+ [TREE_R_OPEN_DELAY ]{.offset = TREE_CHN_OPEN_DLA_REG },
|
|
|
+ [TREE_R_CLOSE_DELAY ]{.offset = TREE_CHN_CLOSE_DLA_REG },
|
|
|
+ [TREE_W_OPEN_DELAY ]{.offset = TREE_CHN_SET_OPEN_DLA_REG},
|
|
|
+ [TREE_W_CLOSE_DELAY ]{.offset = TREE_CHN_SET_CLOSE_DLA_REG},
|
|
|
+ [TREE_W_CHN_SWITCH_STA ]{.offset = TREE_CHN_SET_SWITCH_STA_REG},
|
|
|
+ [TREE_W_ALL_CHN_STA ]{.offset = TREE_ALL_SET_SWITCH_REG }
|
|
|
+};
|
|
|
+
|
|
|
+typedef struct {
|
|
|
+ modbus_mapping_t *map;
|
|
|
+}slave_handle_t;
|
|
|
+
|
|
|
+static slave_handle_t slHandle;
|
|
|
+
|
|
|
+
|
|
|
+modbus_mapping_t *cascade_slave_map()
|
|
|
+{
|
|
|
+ return slHandle.map;
|
|
|
+}
|
|
|
+
|
|
|
+int cascade_slave_init(void)
|
|
|
+{
|
|
|
+ slave_handle_t *sh=&slHandle;
|
|
|
+ GlobalDeviceManager* mgr=get_dm();
|
|
|
+
|
|
|
+ if(mgr->_globalDevInfo.product_pwr_type == SmartPDU_AC ||
|
|
|
+ mgr->_globalDevInfo.product_pwr_type == SmartPDU_DC) // single AC
|
|
|
+ {
|
|
|
+ if(sh->map)
|
|
|
+ {
|
|
|
+ free(sh->map);
|
|
|
+ sh->map = NULL;
|
|
|
+ }
|
|
|
+ sh->map = modbus_mapping_new_start_address(0,0,0,0,DEV_CHN_REG,5000,0,0); //3000 ge
|
|
|
+ modbus_single[DS_R_DEV_CHN ].addr = &mgr->single_mmap->dev_chn;
|
|
|
+ modbus_single[DS_R_OUT_INFO ].addr = &mgr->single_mmap->all_ch;
|
|
|
+ modbus_single[DS_R_IN_TOTAL ].addr = &mgr->single_mmap->total_valtage;
|
|
|
+ modbus_single[DS_R_TEMP_HUM ].addr = &mgr->single_mmap->total_temp;
|
|
|
+ modbus_single[DS_R_SWITCH_STA ].addr = &mgr->single_mmap->chn_status;
|
|
|
+ modbus_single[DS_R_OPEN_DELAY ].addr = &mgr->single_mmap->open_delay;
|
|
|
+ modbus_single[DS_R_CLOSE_DELAY ].addr = &mgr->single_mmap->close_delay;
|
|
|
+ modbus_single[DS_W_OPEN_DELAY ].addr = &mgr->single_mmap->set_chn_open_delay;
|
|
|
+ modbus_single[DS_W_CLOSE_DELAY ].addr = &mgr->single_mmap->set_chn_close_delay;
|
|
|
+ modbus_single[DS_W_CHN_SWITCH_STA ].addr = &mgr->single_mmap->set_chn_switch_status;
|
|
|
+ modbus_single[DS_W_ALL_CHN_STA ].addr = &mgr->single_mmap->set_chn_all_switch_status;
|
|
|
+ printf("single dc address init 4000\n");
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ if(sh->map)
|
|
|
+ {
|
|
|
+ free(sh->map);
|
|
|
+ sh->map = NULL;
|
|
|
+ }
|
|
|
+ sh->map = modbus_mapping_new_start_address(0,0,0,0,TREE_DEV_CHN_REG,7000,0,0);
|
|
|
+ modbus_three[TREE_R_DEV_CHN ].addr = &mgr->triphasic_mmap->dev_chn;
|
|
|
+ modbus_three[TREE_R_INPUT_ALL_A ].addr = &mgr->triphasic_mmap->i_total.pw_i_total[0];
|
|
|
+ modbus_three[TREE_R_INPUT_ALL_B ].addr = &mgr->triphasic_mmap->i_total.pw_i_total[1];
|
|
|
+ modbus_three[TREE_R_INPUT_ALL_C ].addr = &mgr->triphasic_mmap->i_total.pw_i_total[2];
|
|
|
+ modbus_three[TREE_R_CHN_TOTAL ].addr = &mgr->triphasic_mmap->chn_info;
|
|
|
+ modbus_three[TREE_R_CHN_PH_INFO ].addr = &mgr->triphasic_mmap->pw_o_chn;
|
|
|
+ modbus_three[TREE_R_TEMP_HUM ].addr = &mgr->triphasic_mmap->temperature;
|
|
|
+ modbus_three[TREE_R_SWITCH_STA ].addr = &mgr->triphasic_mmap->chn_status;
|
|
|
+ modbus_three[TREE_R_OPEN_DELAY ].addr = &mgr->triphasic_mmap->open_delay;
|
|
|
+ modbus_three[TREE_R_CLOSE_DELAY ].addr = &mgr->triphasic_mmap->close_delay;
|
|
|
+ modbus_three[TREE_W_OPEN_DELAY ].addr = &mgr->triphasic_mmap->set_chn_open_delay;
|
|
|
+ modbus_three[TREE_W_CLOSE_DELAY ].addr = &mgr->triphasic_mmap->set_chn_close_delay;
|
|
|
+ modbus_three[TREE_W_CHN_SWITCH_STA ].addr = &mgr->triphasic_mmap->set_chn_switch_status;
|
|
|
+ modbus_three[TREE_W_ALL_CHN_STA ].addr = &mgr->triphasic_mmap->set_chn_all_switch_status;
|
|
|
+ printf("triphasic address init 6000\n");
|
|
|
+ //return -1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+static void slave_read(slave_handle_t *sh, uint32_t addr,int num,uint32_t reg_type,uint32_t type)
|
|
|
+{
|
|
|
+ GlobalDeviceManager* mgr=get_dm();
|
|
|
+
|
|
|
+ if(mgr->_globalDevInfo.product_pwr_type == SmartPDU_AC ||
|
|
|
+ mgr->_globalDevInfo.product_pwr_type == SmartPDU_DC){
|
|
|
+ if(addr >= DEV_CHN_REG && addr <= ALL_SET_SWITCH_REG)
|
|
|
+ {
|
|
|
+ if(type == TYPE_U16)
|
|
|
+ {
|
|
|
+ uint16_t *base_addr = (uint16_t *)modbus_single[reg_type].addr;
|
|
|
+ uint32_t step = addr - sh->map->start_registers;
|
|
|
+ base_addr = base_addr + (addr - modbus_single[reg_type].offset);
|
|
|
+ uint16_t *map_addr = (uint16_t *)&(sh->map->tab_registers[step]);
|
|
|
+ if(num < 126)
|
|
|
+ {
|
|
|
+ memcpy(map_addr, base_addr,2*num);
|
|
|
+ }
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ uint32_t *base_addr = (uint32_t *)modbus_single[reg_type].addr;
|
|
|
+ uint32_t step = addr - sh->map->start_registers;
|
|
|
+ base_addr = base_addr + (addr - modbus_single[reg_type].offset);
|
|
|
+ uint32_t *map_addr = (uint32_t *)&(sh->map->tab_registers[step]);
|
|
|
+ if(num < 126)
|
|
|
+ {
|
|
|
+ memcpy(map_addr, base_addr,2*num);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ if(addr >= TREE_DEV_CHN_REG && addr <= TREE_ALL_SET_SWITCH_REG) {
|
|
|
+ if(type == TYPE_U16)
|
|
|
+ {
|
|
|
+ uint16_t *base_addr = (uint16_t *)modbus_three[reg_type].addr;
|
|
|
+ uint32_t step = addr - sh->map->start_registers;
|
|
|
+ base_addr = base_addr + (addr - modbus_three[reg_type].offset);
|
|
|
+ uint16_t *map_addr = (uint16_t *)&(sh->map->tab_registers[step]);
|
|
|
+ if(num < 126)
|
|
|
+ {
|
|
|
+ memcpy(map_addr, base_addr,2*num);
|
|
|
+ }
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ uint32_t *base_addr = (uint32_t *)modbus_three[reg_type].addr;
|
|
|
+ uint32_t step = addr - sh->map->start_registers;
|
|
|
+ base_addr = base_addr + (addr - modbus_three[reg_type].offset) / 2;
|
|
|
+ uint32_t *map_addr = (uint32_t *)&(sh->map->tab_registers[step]);
|
|
|
+ if(num < 126)
|
|
|
+ {
|
|
|
+ memcpy(map_addr, base_addr,2*num);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+void cascade_slave_read(uint32_t addr,uint32_t lenth)
|
|
|
+{
|
|
|
+ slave_handle_t *sh=&slHandle;
|
|
|
+
|
|
|
+ switch (addr)
|
|
|
+ {
|
|
|
+ case 4000:
|
|
|
+ slave_read(sh,addr,lenth,DS_R_DEV_CHN,TYPE_U16);
|
|
|
+ break;
|
|
|
+ case 4001 ... 4384:
|
|
|
+ slave_read(sh,addr,lenth,DS_R_OUT_INFO,TYPE_U32);
|
|
|
+ break;
|
|
|
+ case 4385 ... 4388:
|
|
|
+ slave_read(sh,addr,lenth,DS_R_IN_TOTAL,TYPE_U32);
|
|
|
+ break;
|
|
|
+ case 4389:
|
|
|
+ slave_read(sh,addr,lenth,DS_R_TEMP_HUM,TYPE_U16);
|
|
|
+ case 4390 ... 4453:
|
|
|
+ slave_read(sh,addr,lenth,DS_R_SWITCH_STA,TYPE_U16);
|
|
|
+ break;
|
|
|
+ case 4454 ... 4517:
|
|
|
+ slave_read(sh,addr,lenth,DS_R_OPEN_DELAY,TYPE_U16);
|
|
|
+ break;
|
|
|
+ case 4518 ... 4581:
|
|
|
+ slave_read(sh,addr,lenth,DS_R_CLOSE_DELAY,TYPE_U16);
|
|
|
+ break;
|
|
|
+ case 5000 ... 5063:
|
|
|
+ slave_read(sh,addr,lenth,DS_W_OPEN_DELAY,TYPE_U16);
|
|
|
+ break;
|
|
|
+ case 5064 ... 5127:
|
|
|
+ slave_read(sh,addr,lenth,DS_W_OPEN_DELAY,TYPE_U16);
|
|
|
+ break;
|
|
|
+ case 5128 ... 5191:
|
|
|
+ slave_read(sh,addr,lenth,DS_W_CHN_SWITCH_STA,TYPE_U16);
|
|
|
+ break;
|
|
|
+ case 5192 :
|
|
|
+ slave_read(sh,addr,lenth,DS_W_ALL_CHN_STA,TYPE_U16);
|
|
|
+ break;
|
|
|
+
|
|
|
+ // triple
|
|
|
+ case 6000:
|
|
|
+ slave_read(sh,addr,lenth,TREE_R_DEV_CHN,TYPE_U16);
|
|
|
+ break;
|
|
|
+ case 6001 ... 6008:
|
|
|
+ slave_read(sh,addr,lenth,TREE_R_INPUT_ALL_A,TYPE_U32);
|
|
|
+ break;
|
|
|
+ case 6009 ... 6016:
|
|
|
+ slave_read(sh,addr,lenth,TREE_R_INPUT_ALL_B,TYPE_U32);
|
|
|
+ break;
|
|
|
+ case 6017 ... 6024:
|
|
|
+ slave_read(sh,addr,lenth,TREE_R_INPUT_ALL_C,TYPE_U32);
|
|
|
+ break;
|
|
|
+ case 6025 ... 6664:
|
|
|
+ slave_read(sh,addr,lenth,TREE_R_CHN_TOTAL,TYPE_U32);
|
|
|
+ break;
|
|
|
+ case 6665 ... 8584:
|
|
|
+ slave_read(sh,addr,lenth,TREE_R_CHN_PH_INFO,TYPE_U32);
|
|
|
+ break;
|
|
|
+ case 8585 ... 8586:
|
|
|
+ slave_read(sh,addr,lenth,TREE_R_TEMP_HUM,TYPE_U16);
|
|
|
+ break;
|
|
|
+ case 8587 ... 8650:
|
|
|
+ slave_read(sh,addr,lenth,TREE_R_SWITCH_STA,TYPE_U16);
|
|
|
+ break;
|
|
|
+ case 8651 ... 8714:
|
|
|
+ slave_read(sh,addr,lenth,TREE_R_OPEN_DELAY,TYPE_U16);
|
|
|
+ break;
|
|
|
+ case 8715 ... 8778:
|
|
|
+ slave_read(sh,addr,lenth,TREE_R_CLOSE_DELAY,TYPE_U16);
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+void cascade_slave_write(uint32_t addr, uint16_t val)
|
|
|
+{
|
|
|
+ slave_handle_t *sh=&slHandle;
|
|
|
+ GlobalDeviceManager* mgr=get_dm();
|
|
|
+ uint16_t buff[128] = {0};
|
|
|
+
|
|
|
+ if(mgr->_globalDevInfo.product_pwr_type == SmartPDU_AC
|
|
|
+ || mgr->_globalDevInfo.product_pwr_type == SmartPDU_DC)
|
|
|
+ {
|
|
|
+ switch(addr)
|
|
|
+ {
|
|
|
+ case 5000 ... 5063:
|
|
|
+ {
|
|
|
+ int start_chn = addr - modbus_single[DS_W_OPEN_DELAY].offset;
|
|
|
+ GlobalPowerManger* _globalPowerMangerTemp = NULL ;
|
|
|
+ list_for_each_entry(_globalPowerMangerTemp, &__globalDeviceManage._globalPowerManger.list, list)
|
|
|
+ {
|
|
|
+ if(_globalPowerMangerTemp==NULL)
|
|
|
+ break;
|
|
|
+ if((start_chn+1) == _globalPowerMangerTemp->product_ch_id)
|
|
|
+ {
|
|
|
+ if(mgr->_globalDevInfo.product_pwr_type == SmartPDU_AC){
|
|
|
+ _globalPowerMangerTemp->product_ch_start_delay=val;
|
|
|
+ g_switch_set_ac_single_s_start_time_delay(&__globalDeviceManage._globalRelaySampManger,_globalPowerMangerTemp->product_saddr,
|
|
|
+ _globalPowerMangerTemp->product_ch_addr,val);
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ _globalPowerMangerTemp->product_ch_start_delay=val;
|
|
|
+ g_switch_set_dcpdu_start_time_delay(&__globalDeviceManage._globalRelaySampManger,_globalPowerMangerTemp->product_saddr,
|
|
|
+ _globalPowerMangerTemp->product_ch_addr,val/1000);
|
|
|
+ }
|
|
|
+ if (dev_update_power_manage_genera_info(__globalDeviceManage.db, _globalPowerMangerTemp->product_id, _globalPowerMangerTemp->product_ch_id, _globalPowerMangerTemp) != 0)
|
|
|
+ {
|
|
|
+ log_e("update pwr general data err.");
|
|
|
+ }
|
|
|
+ printf("val = %d start_chn = %d\n",val,start_chn);
|
|
|
+ // *(uint16_t *)((uint16_t*)(modbus_single[6].addr) + start_chn) = val;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 5064 ... 5127:
|
|
|
+ {
|
|
|
+ int start_chn = addr - modbus_single[DS_W_CLOSE_DELAY].offset;
|
|
|
+ GlobalPowerManger* _globalPowerMangerTemp = NULL ;
|
|
|
+ list_for_each_entry(_globalPowerMangerTemp, &__globalDeviceManage._globalPowerManger.list, list)
|
|
|
+ {
|
|
|
+ if(_globalPowerMangerTemp==NULL)
|
|
|
+ break;
|
|
|
+ if((start_chn+1) == _globalPowerMangerTemp->product_ch_id)
|
|
|
+ {
|
|
|
+ if(mgr->_globalDevInfo.product_pwr_type == SmartPDU_AC){
|
|
|
+ _globalPowerMangerTemp->product_ch_stop_delay=val;
|
|
|
+ g_switch_set_ac_single_s_stop_time_delay(&__globalDeviceManage._globalRelaySampManger,_globalPowerMangerTemp->product_saddr,
|
|
|
+ _globalPowerMangerTemp->product_ch_addr,val);
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ _globalPowerMangerTemp->product_ch_stop_delay=val;
|
|
|
+ g_switch_set_dcpdu_stop_time_delay(&__globalDeviceManage._globalRelaySampManger,_globalPowerMangerTemp->product_saddr,
|
|
|
+ _globalPowerMangerTemp->product_ch_addr,val/1000);
|
|
|
+ }
|
|
|
+ if (dev_update_power_manage_genera_info(__globalDeviceManage.db, _globalPowerMangerTemp->product_id, _globalPowerMangerTemp->product_ch_id, _globalPowerMangerTemp) != 0)
|
|
|
+ {
|
|
|
+ log_e("update pwr general data err.");
|
|
|
+ }
|
|
|
+ printf("val = %d",val);
|
|
|
+ //*(uint16_t *)((uint16_t*)(modbus_single[7].addr) + start_chn) = val;
|
|
|
+ //printf("modbus_single[7].addr = %d ",modbus_single[7].addr);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 5128 ... 5191:
|
|
|
+ {
|
|
|
+ int start_chn = addr - modbus_single[DS_W_CHN_SWITCH_STA].offset;
|
|
|
+ GlobalPowerManger* _globalPowerMangerTemp = NULL ;
|
|
|
+ if (val == 0 || val == 1)
|
|
|
+ {
|
|
|
+ list_for_each_entry(_globalPowerMangerTemp, &__globalDeviceManage._globalPowerManger.list, list)
|
|
|
+ {
|
|
|
+ if (_globalPowerMangerTemp == NULL)
|
|
|
+ break;
|
|
|
+ if ((start_chn + 1) == _globalPowerMangerTemp->product_ch_id)
|
|
|
+ {
|
|
|
+ int ret = g_switch_set_all_chn_ctrl(&__globalDeviceManage._globalRelaySampManger, _globalPowerMangerTemp,
|
|
|
+ _globalPowerMangerTemp->product_saddr,
|
|
|
+ _globalPowerMangerTemp->product_ch_addr,
|
|
|
+ val, false);
|
|
|
+ // printf("ret = %d 0x%x\n",ret,val);
|
|
|
+ *(uint16_t *)((uint16_t *)(modbus_single[DS_W_CHN_SWITCH_STA].addr) + start_chn) = val;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 5192:
|
|
|
+ {
|
|
|
+ if (val == 0 || val == 1)
|
|
|
+ {
|
|
|
+ GlobalPowerManger *_globalPowerMangerTemp = NULL;
|
|
|
+ list_for_each_entry(_globalPowerMangerTemp, &__globalDeviceManage._globalPowerManger.list, list)
|
|
|
+ {
|
|
|
+ if (_globalPowerMangerTemp == NULL)
|
|
|
+ break;
|
|
|
+ int rec = g_switch_set_all_ctrl(&__globalDeviceManage._globalRelaySampManger, _globalPowerMangerTemp->product_ch_type, _globalPowerMangerTemp->product_saddr, val);
|
|
|
+ // printf("rec = %d 0x%x\n",rec,val);
|
|
|
+ }
|
|
|
+ *(uint16_t *)(modbus_single[DS_W_ALL_CHN_STA].addr) = val;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ switch(addr)
|
|
|
+ {
|
|
|
+ case 9000 ... 9063:
|
|
|
+ {
|
|
|
+ int start_chn = addr - modbus_three[TREE_W_OPEN_DELAY].offset;
|
|
|
+ GlobalPowerManger* _globalPowerMangerTemp = NULL ;
|
|
|
+ list_for_each_entry(_globalPowerMangerTemp, &__globalDeviceManage._globalPowerManger.list, list){
|
|
|
+ if(_globalPowerMangerTemp==NULL)
|
|
|
+ break;
|
|
|
+ if((start_chn+1) == _globalPowerMangerTemp->product_ch_id)
|
|
|
+ {
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ _globalPowerMangerTemp->product_ch_start_delay = val;
|
|
|
+ if (__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_Tree
|
|
|
+ ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One
|
|
|
+ ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One_B
|
|
|
+ )
|
|
|
+ {
|
|
|
+ printf("hwllo every one stop time !!!!\n");
|
|
|
+ ret = g_switch_set_t_ac_start_time_delay(&__globalDeviceManage._globalRelaySampManger,
|
|
|
+ _globalPowerMangerTemp->product_saddr, (_globalPowerMangerTemp->product_ch_addr - 1) * 3, val / 1000);
|
|
|
+ ret = g_switch_set_t_ac_start_time_delay(&__globalDeviceManage._globalRelaySampManger,
|
|
|
+ _globalPowerMangerTemp->product_saddr, (_globalPowerMangerTemp->product_ch_addr - 1) * 3 + 1, val / 1000);
|
|
|
+ ret = g_switch_set_t_ac_start_time_delay(&__globalDeviceManage._globalRelaySampManger,
|
|
|
+ _globalPowerMangerTemp->product_saddr, (_globalPowerMangerTemp->product_ch_addr - 1) * 3 + 2, val / 1000);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ret = g_switch_set_t_ac_start_time_delay(&__globalDeviceManage._globalRelaySampManger,
|
|
|
+ _globalPowerMangerTemp->product_saddr, (_globalPowerMangerTemp->product_ch_addr - 1) * 3, val / 1000);
|
|
|
+ }
|
|
|
+ if (dev_update_power_manage_genera_info(__globalDeviceManage.db, _globalPowerMangerTemp->product_id, _globalPowerMangerTemp->product_ch_id, _globalPowerMangerTemp) != 0)
|
|
|
+ {
|
|
|
+ log_e("update pwr general data err.");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 9064 ... 9127:
|
|
|
+ {
|
|
|
+ int start_chn = addr - modbus_three[TREE_W_CLOSE_DELAY].offset;
|
|
|
+ GlobalPowerManger* _globalPowerMangerTemp = NULL ;
|
|
|
+ list_for_each_entry(_globalPowerMangerTemp, &__globalDeviceManage._globalPowerManger.list, list)
|
|
|
+ {
|
|
|
+ if(_globalPowerMangerTemp==NULL)
|
|
|
+ break;
|
|
|
+ if((start_chn+1) == _globalPowerMangerTemp->product_ch_id)
|
|
|
+ {
|
|
|
+ int ret = 0;
|
|
|
+
|
|
|
+ _globalPowerMangerTemp->product_ch_stop_delay = val;
|
|
|
+ if (__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_Tree
|
|
|
+ ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One
|
|
|
+ ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One_B)
|
|
|
+ {
|
|
|
+ ret = g_switch_set_t_ac_stop_time_delay(&__globalDeviceManage._globalRelaySampManger,
|
|
|
+ _globalPowerMangerTemp->product_saddr, (_globalPowerMangerTemp->product_ch_addr - 1) * 3, val / 1000);
|
|
|
+ ret = g_switch_set_t_ac_stop_time_delay(&__globalDeviceManage._globalRelaySampManger,
|
|
|
+ _globalPowerMangerTemp->product_saddr, (_globalPowerMangerTemp->product_ch_addr - 1) * 3 + 1, val / 1000);
|
|
|
+ ret = g_switch_set_t_ac_stop_time_delay(&__globalDeviceManage._globalRelaySampManger,
|
|
|
+ _globalPowerMangerTemp->product_saddr, (_globalPowerMangerTemp->product_ch_addr - 1) * 3 + 2, val / 1000);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ret = g_switch_set_t_ac_stop_time_delay(&__globalDeviceManage._globalRelaySampManger,
|
|
|
+ _globalPowerMangerTemp->product_saddr, (_globalPowerMangerTemp->product_ch_addr - 1) * 3, val / 1000);
|
|
|
+ }
|
|
|
+ if (dev_update_power_manage_genera_info(__globalDeviceManage.db, _globalPowerMangerTemp->product_id, _globalPowerMangerTemp->product_ch_id, _globalPowerMangerTemp) != 0)
|
|
|
+ {
|
|
|
+ log_e("update pwr general data err.");
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 9128 ... 9191:
|
|
|
+ {
|
|
|
+ int start_chn = addr - modbus_three[TREE_W_CHN_SWITCH_STA].offset;
|
|
|
+ GlobalPowerManger* _globalPowerMangerTemp = NULL ;
|
|
|
+ list_for_each_entry(_globalPowerMangerTemp, &__globalDeviceManage._globalPowerManger.list, list){
|
|
|
+ if(_globalPowerMangerTemp==NULL)
|
|
|
+ break;
|
|
|
+ if((start_chn+1) == _globalPowerMangerTemp->product_ch_id)
|
|
|
+ {
|
|
|
+ int t_ac_CtrlType=0;
|
|
|
+ int nRet = 0;
|
|
|
+
|
|
|
+ _globalPowerMangerTemp->product_ch_status = val;
|
|
|
+
|
|
|
+ GlobalTreeACManager *_globalTACManager = NULL;
|
|
|
+ list_for_each_entry(_globalTACManager, &_globalPowerMangerTemp->list_Tree_AC, list_Tree_AC)
|
|
|
+ {
|
|
|
+ t_ac_CtrlType=_globalTACManager->product_ph_outputType;
|
|
|
+ }
|
|
|
+ if (t_ac_CtrlType == 2&&(__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_Tree
|
|
|
+ ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One
|
|
|
+ ||__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One_B))
|
|
|
+ {
|
|
|
+ if(_globalPowerMangerTemp->product_ch_type == AC_SINGLE_S_TYPE || _globalPowerMangerTemp->product_ch_type == AC_SINGLE_B_TYPE)
|
|
|
+ {
|
|
|
+ if (val == 1)
|
|
|
+ {
|
|
|
+ if (_globalPowerMangerTemp->global_over_manager->product_vol_upper_enable == 1)
|
|
|
+ val |= ENABLE_TAC_V_UP;
|
|
|
+ if (_globalPowerMangerTemp->global_over_manager->product_vol_lower_enable == 1)
|
|
|
+ val |= ENABLE_TAC_V_DOWN;
|
|
|
+ if (_globalPowerMangerTemp->global_over_manager->product_cur_upper_enable == 1)
|
|
|
+ val |= ENABLE_TAC_A_UP;
|
|
|
+ if (_globalPowerMangerTemp->global_over_manager->product_pwr_upper_enable == 1)
|
|
|
+ val |= ENABLE_TAC_W_UP;
|
|
|
+ if (_globalPowerMangerTemp->global_over_manager->product_pwrcon_upper_enable == 1)
|
|
|
+ val |= ENABLE_TAC_P_UP;
|
|
|
+ }
|
|
|
+ g_switch_set_ac_single_s_chn_ctrl(&__globalDeviceManage._globalRelaySampManger, _globalPowerMangerTemp->product_saddr,
|
|
|
+ (_globalPowerMangerTemp->product_ch_addr- 1), val);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ unsigned short phsts=0;
|
|
|
+ list_for_each_entry(_globalTACManager, &_globalPowerMangerTemp->list_Tree_AC, list_Tree_AC)
|
|
|
+ {
|
|
|
+ if (val == 1 && _globalTACManager->product_ph_outputStatus==1)
|
|
|
+ {
|
|
|
+ phsts=1;
|
|
|
+ if (_globalTACManager->global_over_manager->product_vol_upper_enable == 1)
|
|
|
+ phsts |= ENABLE_TAC_V_UP;
|
|
|
+ if (_globalTACManager->global_over_manager->product_vol_lower_enable == 1)
|
|
|
+ phsts |= ENABLE_TAC_V_DOWN;
|
|
|
+ if (_globalTACManager->global_over_manager->product_cur_upper_enable == 1)
|
|
|
+ phsts |= ENABLE_TAC_A_UP;
|
|
|
+ if (_globalTACManager->global_over_manager->product_pwr_upper_enable == 1)
|
|
|
+ phsts |= ENABLE_TAC_W_UP;
|
|
|
+ if (_globalTACManager->global_over_manager->product_pwrcon_upper_enable == 1)
|
|
|
+ phsts |= ENABLE_TAC_P_UP;
|
|
|
+ }else{
|
|
|
+ phsts=0;
|
|
|
+ }
|
|
|
+ nRet= g_switch_set_t_ac_phchn_ctrl(&__globalDeviceManage._globalRelaySampManger,
|
|
|
+ _globalTACManager->product_saddr,
|
|
|
+ _globalTACManager->product_ch_addr - 1,
|
|
|
+ phsts);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }else
|
|
|
+ {
|
|
|
+ if (val == 1)
|
|
|
+ {
|
|
|
+ if (_globalPowerMangerTemp->global_over_manager->product_vol_upper_enable == 1)
|
|
|
+ val |= ENABLE_TAC_V_UP;
|
|
|
+ if (_globalPowerMangerTemp->global_over_manager->product_vol_lower_enable == 1)
|
|
|
+ val |= ENABLE_TAC_V_DOWN;
|
|
|
+ if (_globalPowerMangerTemp->global_over_manager->product_cur_upper_enable == 1)
|
|
|
+ val |= ENABLE_TAC_A_UP;
|
|
|
+ if (_globalPowerMangerTemp->global_over_manager->product_pwr_upper_enable == 1)
|
|
|
+ val |= ENABLE_TAC_W_UP;
|
|
|
+ if (_globalPowerMangerTemp->global_over_manager->product_pwrcon_upper_enable == 1)
|
|
|
+ val |= ENABLE_TAC_P_UP;
|
|
|
+ }
|
|
|
+ /*
|
|
|
+ if (isgroup)
|
|
|
+ {
|
|
|
+ sts |= ENABLE_TAC_STIME;
|
|
|
+ sts |= ENABLE_TAC_ETIME;
|
|
|
+ }*/
|
|
|
+ if (__globalDeviceManage._globalDevInfo.product_pwr_type == SmartPDU_Tree_AC_One)
|
|
|
+ {
|
|
|
+ g_switch_set_t_ac_phchn_ctrl(&__globalDeviceManage._globalRelaySampManger,
|
|
|
+ _globalPowerMangerTemp->product_saddr,
|
|
|
+ _globalPowerMangerTemp->product_ch_addr - 1,
|
|
|
+ val);
|
|
|
+ }else{
|
|
|
+ g_switch_set_t_ac_chn_ctrl(&__globalDeviceManage._globalRelaySampManger,
|
|
|
+ _globalPowerMangerTemp->product_saddr,
|
|
|
+ _globalPowerMangerTemp->product_ch_addr - 1,
|
|
|
+ val);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 9192:
|
|
|
+ {
|
|
|
+ if (val == 0 || val == 1)
|
|
|
+ {
|
|
|
+ GlobalPowerManger *_globalPowerMangerTemp = NULL;
|
|
|
+ list_for_each_entry(_globalPowerMangerTemp, &__globalDeviceManage._globalPowerManger.list, list)
|
|
|
+ {
|
|
|
+ if (_globalPowerMangerTemp == NULL)
|
|
|
+ break;
|
|
|
+
|
|
|
+ _globalPowerMangerTemp->product_ch_status = val;
|
|
|
+ int rec = g_switch_set_all_ctrl(&__globalDeviceManage._globalRelaySampManger, _globalPowerMangerTemp->product_ch_type, _globalPowerMangerTemp->product_saddr, val);
|
|
|
+ // printf("rec = %d 0x%x\n",rec,val);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+>>>>>>> 1a6c6a9ecc73b46498b40e3ded858f5abe7996e9
|