You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.3 KiB
C

/* Includes ------------------------------------------------------------------*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef CFG_DEV_TYPE_LAND_PD
/* 标准C库头文件. */
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <math.h>
/* 用户代码头文件. */
#include "pd_csgiron.h"
#include "pd_csg.h"
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private typedef -----------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Internal functions --------------------------------------------------------*/
int32_t _csgiron_config_port_get(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));
pdata->report_period = pd_config.config_slot[slot].report_period;
_csg_send_data(CSG_REPLY, head->cmd, pkt, sizeof(iron_config_t), slot + 1);
return E_NONE;
}
int32_t _csgiron_config_port_set(uint8_t slot, char* pkt, uint16_t len)
{
iron_config_t *pdata = (iron_config_t*)(pkt + sizeof(csg_pkt_head_t));
pd_config.config_slot[slot].report_period = pdata->report_period;
return E_NONE;
}
/* 命令映射表 */
static csgiron_recv_fun_cb _csgiron_command[] =
{
NULL, // 0
};
/* 命令映射表 */
static csgiron_recv_fun_cb _csgiron_prv_command[] =
{
NULL, // 0
NULL, // CSG_PRV_CONFIG_GLOBAL_SET
NULL, // CSG_PRV_CONFIG_GLOBAL_GET
_csgiron_config_port_set, // CSG_PRV_CONFIG_PORT_SET
_csgiron_config_port_get, // CSG_PRV_CONFIG_PORT_GET
};
int32_t _csgiron_recv_process(uint8_t slot, char *pkt, uint16_t len)
{
dau_pkt_head_t *head = (dau_pkt_head_t*)pkt;
if (CSG_REQUEST == head->cmd)
{
_csgiron_command[head->cmd](slot, pkt, len);
}
else if (CSG_PRV_REQUEST == head->cmd)
{
_csgiron_prv_command[head->cmd](slot, pkt, len);
}
return E_NONE;
}
#endif