|  |  | @ -32,19 +32,41 @@ int32_t _csgiron_config_port_get(uint8_t slot, char* pkt, uint16_t len) | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |     csg_pkt_head_t *head = (csg_pkt_head_t*)pkt; |  |  |  |     csg_pkt_head_t *head = (csg_pkt_head_t*)pkt; | 
			
		
	
		
		
			
				
					
					|  |  |  |     iron_config_t *pdata = (iron_config_t*)(pkt + sizeof(csg_pkt_head_t)); |  |  |  |     iron_config_t *pdata = (iron_config_t*)(pkt + sizeof(csg_pkt_head_t)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     pdata->vport = slot + 1; | 
			
		
	
		
		
			
				
					
					|  |  |  |     pdata->report_period = pd_config.config_slot[slot].report_period; |  |  |  |     pdata->report_period = pd_config.config_slot[slot].report_period; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     _csg_send_data(CSG_REPLY, head->cmd, pkt, sizeof(iron_config_t), slot + 1); |  |  |  |     _csg_send_data(CSG_PRV_REPLY, head->cmd, pkt, sizeof(iron_config_t), slot + 1); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     return E_NONE; |  |  |  |     return E_NONE; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | int32_t _csgiron_config_port_set(uint8_t slot, char* pkt, uint16_t len) |  |  |  | int32_t _csgiron_config_port_set(uint8_t slot, char* pkt, uint16_t len) | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     csg_pkt_head_t *head = (csg_pkt_head_t*)pkt; | 
			
		
	
		
		
			
				
					
					|  |  |  |     iron_config_t *pdata = (iron_config_t*)(pkt + sizeof(csg_pkt_head_t)); |  |  |  |     iron_config_t *pdata = (iron_config_t*)(pkt + sizeof(csg_pkt_head_t)); | 
			
		
	
		
		
			
				
					
					|  |  |  |     pd_config.config_slot[slot].report_period = pdata->report_period; |  |  |  |     pd_config.config_slot[slot].report_period = pdata->report_period; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     vtysh_config_save(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     iron_ack_t ack = {0}; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     ack.vport = slot + 1; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     ack.result = TRUE; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     memcpy(pkt + sizeof(csg_pkt_head_t), (char *)&ack, sizeof(iron_ack_t)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     _csg_send_data(CSG_PRV_REPLY, head->cmd, pkt, sizeof(iron_ack_t), slot + 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |     return E_NONE; |  |  |  |     return E_NONE; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | int32_t _csgiron_modbus_reply(uint8_t slot, char* pkt, uint16_t len) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     //csg_pkt_head_t *head = (csg_pkt_head_t*)pkt;
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     //csg_ack_t ack = {0};
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     //ack.result = TRUE;
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     //memcpy(pkt + sizeof(csg_pkt_head_t), (char *)&ack, sizeof(csg_ack_t));
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     //_csg_send_data(CSG_REPLY, head->cmd, pkt, sizeof(csg_ack_t), slot + 1);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     return E_NONE; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | /* 命令映射表 */ |  |  |  | /* 命令映射表 */ | 
			
		
	
		
		
			
				
					
					|  |  |  | static csgiron_recv_fun_cb _csgiron_command[] =  |  |  |  | static csgiron_recv_fun_cb _csgiron_command[] =  | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
	
		
		
			
				
					|  |  | @ -59,19 +81,35 @@ static csgiron_recv_fun_cb _csgiron_prv_command[] = | 
			
		
	
		
		
			
				
					
					|  |  |  |     NULL,                       // CSG_PRV_CONFIG_GLOBAL_GET
 |  |  |  |     NULL,                       // CSG_PRV_CONFIG_GLOBAL_GET
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     _csgiron_config_port_set,   // CSG_PRV_CONFIG_PORT_SET
 |  |  |  |     _csgiron_config_port_set,   // CSG_PRV_CONFIG_PORT_SET
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     _csgiron_config_port_get,   // CSG_PRV_CONFIG_PORT_GET
 |  |  |  |     _csgiron_config_port_get,   // CSG_PRV_CONFIG_PORT_GET
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     NULL, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     NULL, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     NULL, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     NULL, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     NULL, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     NULL, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     NULL, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     NULL, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     NULL,      // CSG_PRV_MODBUS
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     NULL | 
			
		
	
		
		
			
				
					
					|  |  |  | }; |  |  |  | }; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | int32_t _csgiron_recv_process(uint8_t slot, char *pkt, uint16_t len) |  |  |  | int32_t _csgiron_recv_process(uint8_t slot, char *pkt, uint16_t len) | 
			
		
	
		
		
			
				
					
					|  |  |  | { |  |  |  | { | 
			
		
	
		
		
			
				
					
					|  |  |  |     dau_pkt_head_t *head = (dau_pkt_head_t*)pkt; |  |  |  |     dau_pkt_head_t *head = (dau_pkt_head_t*)pkt; | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (CSG_REQUEST == head->cmd) |  |  |  |     if (CSG_REQUEST == head->cmd_type) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (_csgiron_command[head->cmd]) | 
			
		
	
		
		
			
				
					
					|  |  |  |         { |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |             _csgiron_command[head->cmd](slot, pkt, len); |  |  |  |             _csgiron_command[head->cmd](slot, pkt, len); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     else if (CSG_PRV_REQUEST == head->cmd) |  |  |  |     } | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     else if (CSG_PRV_REQUEST == head->cmd_type) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (_csgiron_prv_command[head->cmd]) | 
			
		
	
		
		
			
				
					
					|  |  |  |         { |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |             _csgiron_prv_command[head->cmd](slot, pkt, len); |  |  |  |             _csgiron_prv_command[head->cmd](slot, pkt, len); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |     return E_NONE; |  |  |  |     return E_NONE; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | #endif |  |  |  | #endif | 
			
		
	
	
		
		
			
				
					|  |  | 
 |