CIS441 Proj MS 2b

Dependencies:   TextLCD MQTT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Road.h Source File

Road.h

00001 #ifndef _ROAD_H_
00002 #define _ROAD_H_
00003 
00004 #include "mbed.h"
00005 #include "AccCar.h"
00006 
00007 #define MAX_CARS 5
00008 
00009 class AccCar;
00010 class Road;
00011 
00012 class Road {
00013 public:
00014     EventFlags go_flags;
00015     EventFlags done_flags;
00016     int active_cars;
00017     int intersection_car;
00018     int wait_counter; 
00019     static Road* road_in_use(Road* new_road);
00020     static int ready(int new_ready);
00021     
00022     Road();
00023     int try_enter_car(int time);
00024     void let_cars_update();
00025     void wait_for_car_update();
00026     int check_exit_cars(int cars[]);
00027     void update_car_speed(int id, int speed);
00028     void update_wait_counter(); 
00029     
00030     void print_status();
00031     void publish_car_info();
00032     void wait_for_sync();
00033     
00034     
00035 private:
00036     AccCar* last_car;
00037     AccCar* cars[MAX_CARS];
00038     
00039     AccCar* pending_car;
00040     int next_release;
00041     int num_cars;
00042 };
00043 #endif