KbHitTask.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00029
00030
00034
00035
00036 #ifndef __KB_HIT_TASK_H_
00037 #define __KB_HIT_TASK_H_
00038
00039 #include <Task.h>
00040 #include <TaskFactory.h>
00041 #include <MobileRob.h>
00042 #include <Keyboard.h>
00043 #include <termios.h>
00044
00045 using namespace MipResources;
00046
00047 namespace MipTasks{
00048
00050
00051
00052 class KbHitTask : public Task{
00053 private:
00054 static const TaskPlate _plate = KBH_TASK;
00055 #ifndef MIP_PLATFORM_ARM
00056 static const long int _maxDurSec = 0, _maxDurUsec = 50000;
00057 static const long int _maxSamplPeriodSec = 1, _maxSamplPeriodUsec = 0;
00058 static const long int _minSamplPeriodSec = 0, _minSamplPeriodUsec = 50000;
00059 #else
00060 static const long int _maxDurSec = 0, _maxDurUsec = 20000;
00061 static const long int _maxSamplPeriodSec = 1, _maxSamplPeriodUsec = 0;
00062 static const long int _minSamplPeriodSec = 0, _minSamplPeriodUsec = 5000;
00063 #endif
00064 Keyboard* _keyboard;
00065
00066 unsigned int _kbhit(Time timeout);
00067
00068 public:
00070 KbHitTask(ResourcePointers resources,int argc, const char* argv[]);
00071
00073 ~KbHitTask();
00074
00076 TaskPlate getPlate() const {
00077 return _plate;
00078 }
00080 Time getMaxDuration(){
00081 return Time(_maxDurSec,_maxDurUsec);
00082 }
00084 Time getMaxSamplPeriod(){
00085 return Time(_maxSamplPeriodSec,_maxSamplPeriodUsec);
00086 }
00088 Time getMinSamplPeriod(){
00089 return Time(_minSamplPeriodSec,_minSamplPeriodUsec);
00090 }
00091
00093 TaskOutputs run();
00094 };
00095
00096 MIP_REGISTER_STATIC_TASK(KbHitTask)
00097
00098
00099
00100
00101 };
00102
00103 #endif
00104
00105
00106
00107
00108