Robert Sochuliak
/
Vytah
test
ElevatorThreads.h@1:a7bdc6b05f96, 2019-01-24 (annotated)
- Committer:
- hodgins
- Date:
- Thu Jan 24 06:52:36 2019 +0000
- Revision:
- 1:a7bdc6b05f96
- Parent:
- 0:e541909ea6b0
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hodgins | 0:e541909ea6b0 | 1 | #include "Protothread.h" |
hodgins | 0:e541909ea6b0 | 2 | #include "SwTimer.h" |
hodgins | 0:e541909ea6b0 | 3 | |
hodgins | 0:e541909ea6b0 | 4 | /** |
hodgins | 0:e541909ea6b0 | 5 | * Trieda na spracovanie prijatých správ z buffra. |
hodgins | 0:e541909ea6b0 | 6 | * Potomok triedy ProtoThread, beží v samostatnom proto-vlákne |
hodgins | 0:e541909ea6b0 | 7 | * Definíca a dokumentácia proto-vlákna sa nachádza v "Protothread.h" hlavičkovom súbore |
hodgins | 0:e541909ea6b0 | 8 | */ |
hodgins | 0:e541909ea6b0 | 9 | class MessExecute : public Protothread |
hodgins | 0:e541909ea6b0 | 10 | { |
hodgins | 0:e541909ea6b0 | 11 | public: |
hodgins | 0:e541909ea6b0 | 12 | |
hodgins | 0:e541909ea6b0 | 13 | /** @brief Vytvorenie MessExecute inštancie |
hodgins | 0:e541909ea6b0 | 14 | * @param id - identifikátor vlákna |
hodgins | 0:e541909ea6b0 | 15 | */ |
hodgins | 0:e541909ea6b0 | 16 | MessExecute(int id) { |
hodgins | 0:e541909ea6b0 | 17 | identificator = id; |
hodgins | 0:e541909ea6b0 | 18 | }; |
hodgins | 0:e541909ea6b0 | 19 | |
hodgins | 0:e541909ea6b0 | 20 | virtual bool Run(); |
hodgins | 0:e541909ea6b0 | 21 | |
hodgins | 0:e541909ea6b0 | 22 | private: |
hodgins | 0:e541909ea6b0 | 23 | int identificator; |
hodgins | 0:e541909ea6b0 | 24 | }; |
hodgins | 0:e541909ea6b0 | 25 | |
hodgins | 0:e541909ea6b0 | 26 | /** Trieda, ktorá sa stará o funkcionalitu samotného výťahu |
hodgins | 0:e541909ea6b0 | 27 | * Potomok triedy ProtoThread, beží v samostatnom proto-vlákne |
hodgins | 0:e541909ea6b0 | 28 | * Definíca a dokumentácia proto-vlákne sa nachádza v "Protothread.h" hlavičkovom súbore |
hodgins | 0:e541909ea6b0 | 29 | * Definíca a dokumentácia časovača sa nachádza v "SwTimer.h" hlavičkovom súbore |
hodgins | 0:e541909ea6b0 | 30 | */ |
hodgins | 0:e541909ea6b0 | 31 | class Elevator : public Protothread |
hodgins | 0:e541909ea6b0 | 32 | { |
hodgins | 0:e541909ea6b0 | 33 | public: |
hodgins | 0:e541909ea6b0 | 34 | /** @brief Vytvorenie MessExecute inštancie, následná inicializícia časovca |
hodgins | 0:e541909ea6b0 | 35 | * @param id - identifikátor vlákna |
hodgins | 0:e541909ea6b0 | 36 | * @param GetGLTime - parameter s globálnym časom |
hodgins | 0:e541909ea6b0 | 37 | * @param delay - čas, ktorý bude timer odpočítavať |
hodgins | 0:e541909ea6b0 | 38 | */ |
hodgins | 0:e541909ea6b0 | 39 | Elevator(int id, f_int_t GetGLTime,int delay):swTimer1(GetGLTime) { |
hodgins | 0:e541909ea6b0 | 40 | _timer = delay; |
hodgins | 0:e541909ea6b0 | 41 | identificator = id; |
hodgins | 0:e541909ea6b0 | 42 | }; |
hodgins | 0:e541909ea6b0 | 43 | virtual bool Run(); |
hodgins | 0:e541909ea6b0 | 44 | |
hodgins | 0:e541909ea6b0 | 45 | private: |
hodgins | 0:e541909ea6b0 | 46 | int identificator ; |
hodgins | 0:e541909ea6b0 | 47 | int _timer; |
hodgins | 0:e541909ea6b0 | 48 | SwTimer swTimer1; |
hodgins | 0:e541909ea6b0 | 49 | }; |