Subversion Repositories tpanel

Rev

Rev 93 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 93 Rev 169
Line 28... Line 28...
28
#include <cstdio>
28
#include <cstdio>
29
#include <atomic>
29
#include <atomic>
30
#include <thread>
30
#include <thread>
31
 
31
 
32
#include "tsocket.h"
32
#include "tsocket.h"
33
 
-
 
34
//#ifdef __APPLE__
-
 
35
//using namespace boost;
33
#include "tvector.h"
36
//#endif
-
 
37
 
34
 
38
#ifdef __ANDROID__
35
#ifdef __ANDROID__
39
typedef unsigned long int ulong;
36
typedef unsigned long int ulong;
40
#endif
37
#endif
41
 
38
 
Line 411... Line 408...
411
                RT_DATA
408
                RT_DATA
412
            };
409
            };
413
 
410
 
414
            void init();
411
            void init();
415
            void handle_connect();
412
            void handle_connect();
-
 
413
            void runWrite();
416
            void start_read();
414
            void start_read();
417
            void handle_read(size_t n, R_TOKEN tk);
415
            void handle_read(size_t n, R_TOKEN tk);
418
            void start_write();
416
            void start_write();
419
            void handleFTransfer(ANET_SEND& s, ANET_FILETRANSFER& ft);
417
            void handleFTransfer(ANET_SEND& s, ANET_FILETRANSFER& ft);
420
            uint16_t swapWord(uint16_t w);
418
            uint16_t swapWord(uint16_t w);
Line 439... Line 437...
439
            size_t posRcv{0};
437
            size_t posRcv{0};
440
            size_t lenRcv{0};
438
            size_t lenRcv{0};
441
            size_t posSnd{0};
439
            size_t posSnd{0};
442
            size_t lenSnd{0};
440
            size_t lenSnd{0};
443
            std::thread mThread;
441
            std::thread mThread;
-
 
442
            std::thread mWriteThread;   // Thread used to write to the Netlinx.
444
            std::string input_buffer_;
443
            std::string input_buffer_;
445
            std::string panName;        // The technical name of the panel
444
            std::string panName;        // The technical name of the panel
446
            std::vector<ANET_COMMAND> comStack; // commands to answer
445
            TVector<ANET_COMMAND> comStack; // commands to answer
447
            std::vector<DEVICE_INFO> devInfo;
446
            std::vector<DEVICE_INFO> devInfo;
448
            std::string oldCmd;
447
            std::string oldCmd;
449
            std::string serNum;
448
            std::string serNum;
450
            std::string sndFileName;
449
            std::string sndFileName;
451
            std::string rcvFileName;
450
            std::string rcvFileName;
Line 460... Line 459...
460
            std::atomic<bool> stopped_{false};
459
            std::atomic<bool> stopped_{false};
461
            std::atomic<bool> mSendReady{false};
460
            std::atomic<bool> mSendReady{false};
462
            bool protError{false};      // true = error on receive --> disconnect
461
            bool protError{false};      // true = error on receive --> disconnect
463
            bool initSend{false};       // TRUE = all init messages are send.
462
            bool initSend{false};       // TRUE = all init messages are send.
464
            bool ready{false};          // TRUE = ready for communication
463
            bool ready{false};          // TRUE = ready for communication
465
            bool write_busy{false};
464
            std::atomic<bool> write_busy{false};
466
            std::atomic<bool> receiveSetup{false};
465
            std::atomic<bool> receiveSetup{false};
467
            bool isOpenSnd{false};
466
            bool isOpenSnd{false};
468
            bool isOpenRcv{false};
467
            bool isOpenRcv{false};
469
            bool _retry{false};
468
            bool _retry{false};
470
            char buff_[BUF_SIZE];       // Internal used buffer for network communication
469
            char buff_[BUF_SIZE];       // Internal used buffer for network communication