Dependents:   OBROT_ALL

OBROT.h

Committer:
inst
Date:
2015-10-15
Revision:
1:a46109178200
Parent:
0:4877273ec8cc
Child:
2:cefcd4cb1777

File content as of revision 1:a46109178200:

#ifndef INCLUDED_OBROT_H
#define INCLUDED_OBROT_H

#include "mbed.h"
#include "Robot.h"

class XBee;
class Steering;
class ShootingSystem;
class I2CServo;
class I2CMotor;
class Shooter;
class AmmoSupplier;
class AmmoPusher;
    
namespace I2CDeviceID{
    enum ID{
        STEERING_MOTOR_0    = 0,
        STEERING_MOTOR_1    = 1,
        STEERING_MOTOR_2    = 2,
        STEERING_SERVO_0    = 3,
        STEERING_SERVO_1    = 4,
        STEERING_SERVO_2    = 5,
        XBEE                = 6,
        ANGLE_MANAGER       = 7,
        SHOOTER             = 8,
        AMMO_PUSHER         = 9,
        AMMO_SUPPLIER       = 10,
        POSITION_MANAGER    = 11
    };
}

class OBROT : public Robot{
public:
    static void create(){
        if ( mInstance == NULL ){
            mInstance = new OBROT;
        }
    }
    static OBROT* getInstance(){
        return mInstance;
    }
    
    static const char mI2CDeviceAddress[];
    
private:
    OBROT();
    ~OBROT();
    
    virtual void updateAction();
    
    I2CServo** initSteeringServo();
    I2CMotor** initSteeringTire();
    XBee** iniXBee();
    I2CServo* initAngleManager();
    AmmoPusher* initAmmoPusher();
    AmmoSupplier* initAmmoSupplier();
    Shooter* initShooter();
    I2CServo* initPositionManager();
    
    mShootingSystem = new ShootingSystem( angleManagerServo, ammoPusher,
                                          ammoSupplier, shooter, positionManager );
    
    static OBROT* mInstance;
    
    Steering* mSteering;
    ShootingSystem* mShootingSystem;
    XBee* mXBee;
};

#endif