2022-05-06 11:55:30 +08:00
|
|
|
|
//
|
|
|
|
|
// Created by ricardo on 2022/5/6.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#ifndef AUTO_PILOT_BUS_QUERY_H
|
|
|
|
|
#define AUTO_PILOT_BUS_QUERY_H
|
2022-05-13 11:41:00 +08:00
|
|
|
|
#include "stdlib.h"
|
2022-05-06 11:55:30 +08:00
|
|
|
|
#include "rail.h"
|
|
|
|
|
|
2022-05-13 11:41:00 +08:00
|
|
|
|
struct up_bus {
|
2022-05-06 11:55:30 +08:00
|
|
|
|
/**
|
|
|
|
|
* 请求的序号
|
|
|
|
|
*/
|
|
|
|
|
int id;
|
|
|
|
|
/**
|
|
|
|
|
* 请求前往的方向
|
|
|
|
|
*/
|
|
|
|
|
int direction;
|
|
|
|
|
/**
|
|
|
|
|
* 请求上车的地点
|
|
|
|
|
*/
|
|
|
|
|
rail_node_t* target;
|
|
|
|
|
struct up_bus* next;
|
2022-05-13 11:41:00 +08:00
|
|
|
|
};
|
2022-05-06 11:55:30 +08:00
|
|
|
|
|
2022-05-13 11:41:00 +08:00
|
|
|
|
struct down_bus {
|
2022-05-06 11:55:30 +08:00
|
|
|
|
/**
|
|
|
|
|
* 请求的序号
|
|
|
|
|
*/
|
|
|
|
|
int id;
|
|
|
|
|
/**
|
|
|
|
|
* 请求下车的地点
|
|
|
|
|
*/
|
|
|
|
|
rail_node_t* target;
|
|
|
|
|
struct down_bus* next;
|
2022-05-13 11:41:00 +08:00
|
|
|
|
};
|
2022-05-06 11:55:30 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 表示上车请求的结构体
|
|
|
|
|
*/
|
|
|
|
|
typedef struct up_bus up_bus_t;
|
|
|
|
|
/**
|
|
|
|
|
* 表示下车请求的结构体
|
|
|
|
|
*/
|
|
|
|
|
typedef struct down_bus down_bus_t;
|
|
|
|
|
|
2022-05-12 15:32:45 +08:00
|
|
|
|
/**
|
|
|
|
|
* 全局的上车请求链表头节点地址,也就是当前未处理的首个请求
|
|
|
|
|
*/
|
2022-05-06 11:55:30 +08:00
|
|
|
|
extern up_bus_t *up_queries;
|
2022-05-12 15:32:45 +08:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 全局的下车请求链表头节点地址,也就是当前未处理的首个请求
|
|
|
|
|
*/
|
2022-05-06 11:55:30 +08:00
|
|
|
|
extern down_bus_t *down_queries;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建一个上车请求
|
|
|
|
|
* @param target 上车的地点
|
|
|
|
|
* @param direction 需要前往的方向
|
|
|
|
|
*/
|
|
|
|
|
void CreateUpBusQuery(rail_node_t* target, int direction);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除一个上车请求
|
|
|
|
|
* @param id 需要删除的请求编号
|
|
|
|
|
*/
|
|
|
|
|
void DeleteUpBusQuery(int id);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 创建一个下车请求
|
|
|
|
|
* @param target 需要下车的地点
|
|
|
|
|
*/
|
|
|
|
|
void CreateDownBusQuery(rail_node_t *target);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 删除一个下车请求
|
|
|
|
|
* @param id 需要删除的请求编号
|
|
|
|
|
*/
|
|
|
|
|
void DeleteDownBusQuery(int id);
|
|
|
|
|
|
|
|
|
|
#endif //AUTO_PILOT_BUS_QUERY_H
|