\doxysection{Base\+Communication.\+h}
\hypertarget{a00290_source}{}\label{a00290_source}\index{BaseCommunication.h@{BaseCommunication.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00002\ \textcolor{preprocessor}{\#include\ <string>}}
\DoxyCodeLine{00003\ \textcolor{preprocessor}{\#include\ <thread>}}
\DoxyCodeLine{00004\ \textcolor{preprocessor}{\#include\ <iostream>}}
\DoxyCodeLine{00005\ \textcolor{preprocessor}{\#include\ <future>}}
\DoxyCodeLine{00006\ \textcolor{preprocessor}{\#include\ "{}BaseSettings.h"{}}}
\DoxyCodeLine{00007\ \textcolor{preprocessor}{\#include\ "{}RawData.h"{}}}
\DoxyCodeLine{00008\ \textcolor{preprocessor}{\#include\ "{}BaseDataExtractor.h"{}}}
\DoxyCodeLine{00009\ \textcolor{preprocessor}{\#include\ "{}CommunicationStructures.h"{}}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00011\ \textcolor{comment}{//\#define\ MONITORING\_ENABLED}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00013\ \textcolor{keyword}{using\ namespace\ }std;}
\DoxyCodeLine{00014\ }
\DoxyCodeLine{00015\ \textcolor{preprocessor}{\#ifdef\ STARFLEETTOOLBOX\_EXPORTS}}
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#define\ BASECOMM\ \_\_declspec(dllexport)}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#define\ BASECOMM\ \_\_declspec(dllimport)}}
\DoxyCodeLine{00019\ \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#define\ MONITORING\_TIMESLEEP\ 250\ \ \ \ \ \ \ \ }\textcolor{comment}{//\ Sets\ the\ loop\ period\ of\ the\ monitoring\ system}}
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#define\ RECONNECT\_TIMESLEEP\ 250\ \ \ \ \ \ \ \ \ }\textcolor{comment}{//\ Sets\ the\ reconnect\ timeout\ period\ in\ the\ monitoring\ system}}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#define\ MONITORING\_MODE\ unsigned\ int}}
\DoxyCodeLine{00026\ \textcolor{preprocessor}{\#define\ MONITORING\_OFF\ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\textcolor{comment}{//\ Indicates\ that\ monitoring\ is\ OFF}}
\DoxyCodeLine{00027\ \textcolor{preprocessor}{\#define\ MONITORING\_ON\ 1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\textcolor{comment}{//\ Indicates\ that\ monitoring\ is\ ON}}
\DoxyCodeLine{00028\ \textcolor{preprocessor}{\#define\ AUTO\_RECONNECT\ 2\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }\textcolor{comment}{//\ Indicates\ that\ monitoring\ is\ ON\ and\ auto\ reconnect\ mode\ is\ on}}
\DoxyCodeLine{00029\ }
\DoxyCodeLine{00030\ \textcolor{keyword}{typedef}\ void\ \ (*MarshallingConnectionCheckerCallback)(\mbox{\hyperlink{a00816}{CommunicationStatus}}*);}
\DoxyCodeLine{00031\ \textcolor{keyword}{typedef}\ std::function<void(\mbox{\hyperlink{a00816}{CommunicationStatus}}*)>\ ConnectionCheckerCallback;}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00036\ \textcolor{keyword}{class\ }BASECOMM\ BaseCommunication\ \textcolor{keyword}{abstract}}
\DoxyCodeLine{00037\ \{}
\DoxyCodeLine{00038\ \textcolor{keyword}{public}:\ }
\DoxyCodeLine{00042\ \ \ \ \ \mbox{\hyperlink{a00796_a07f5ac904bd6f3354aadec16d55243f7}{BaseCommunication}}();}
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00047\ \ \ \ \ \mbox{\hyperlink{a00796_aef19a00c52069f410a0f8916d5b2c236}{BaseCommunication}}(MONITORING\_MODE\ monitor);}
\DoxyCodeLine{00048\ }
\DoxyCodeLine{00052\ \ \ \ \ \mbox{\hyperlink{a00796_ae02c3d34c0bb14f8348455aba656216d}{\string~BaseCommunication}}();}
\DoxyCodeLine{00053\ }
\DoxyCodeLine{00058\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00796_afd346eecd704ce15a1be7a4af2fa2ec2}{SetSettings}}(BaseSettings*\ settings);}
\DoxyCodeLine{00059\ }
\DoxyCodeLine{00064\ \ \ \ \ BaseSettings*\ \mbox{\hyperlink{a00796_a4f810efa6eb6e0476612b5bf3b336fb2}{GetSettings}}();}
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00066\ }
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00796_a1f7d7847fe8775bac2b8e1be30548f3a}{SetDataExtractor}}(BaseDataExtractor*\ pDataExtractor);}
\DoxyCodeLine{00072\ }
\DoxyCodeLine{00077\ \ \ \ \ BaseDataExtractor*\ \mbox{\hyperlink{a00796_a28146f1285657c087407c2431b8d0c60}{GetDataExtractor}}();}
\DoxyCodeLine{00078\ }
\DoxyCodeLine{00083\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{a00816}{CommunicationStatus}}\ \mbox{\hyperlink{a00796_ab3946b9007a5532974c29ff66531e6e0}{Connect}}()\ =\ 0;}
\DoxyCodeLine{00084\ }
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00796_a0851786556bc3f2d48a482d46d811772}{Disconnect}}()\ =\ 0;}
\DoxyCodeLine{00089\ }
\DoxyCodeLine{00094\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{a00816}{CommunicationStatus}}\ \mbox{\hyperlink{a00796_aa5d2f9d3491830e2f20b15885a68db42}{GetConnectionStatus}}()\ =\ 0;}
\DoxyCodeLine{00095\ }
\DoxyCodeLine{00100\ \ \ \ \ \textcolor{keywordtype}{bool}\ \mbox{\hyperlink{a00796_a3f41a0cc57c9f1290a117d605f41a51d}{IsConnected}}();}
\DoxyCodeLine{00101\ }
\DoxyCodeLine{00102\ }
\DoxyCodeLine{00109\ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{string}\ \mbox{\hyperlink{a00796_ab5819dd22ed975cb2fb0ed11e704d5dd}{SendCommand}}(\textcolor{keywordtype}{string}\ commandToSend)\ =\ 0;}
\DoxyCodeLine{00110\ }
\DoxyCodeLine{00118\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{a00888}{RawData}}\ \mbox{\hyperlink{a00796_a35004113eae585ed10bb3694d7f0eab6}{WaitForRawData}}(\textcolor{keywordtype}{int}\ waitTimeout,\ \textcolor{keywordtype}{unsigned}\ \textcolor{keywordtype}{long}*\ semStatus)\ =\ 0;\ }
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00123\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00796_a005c3939de711e08d09bb30371df3bd2}{StartMonitoring}}();}
\DoxyCodeLine{00124\ \ \ \ \ }
\DoxyCodeLine{00128\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00796_aa22491626e2b50a98b7aa8e9f2d5b4ff}{StopMonitoring}}();}
\DoxyCodeLine{00129\ }
\DoxyCodeLine{00130\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00796_a3ba6fd416e32aa116ea82655defeb205}{SetCommunicationCallback}}(ConnectionCheckerCallback);}
\DoxyCodeLine{00131\ \ \ \ \ \textcolor{keywordtype}{void}\ \mbox{\hyperlink{a00796_a73f7ab05a5ed41818c5a0f79cfe0b5e0}{SetCommunicationCallback}}(\textcolor{keywordtype}{void}(*\ ConnectionCheckerCallbackMethod)(\mbox{\hyperlink{a00816}{CommunicationStatus}}*));}
\DoxyCodeLine{00132\ }
\DoxyCodeLine{00133\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00134\ \ \ \ \ std::atomic<bool>\ \mbox{\hyperlink{a00796_a2959180701d69a8061bd6e59edca42c8}{\_connected}};}
\DoxyCodeLine{00135\ \ \ \ \ std::atomic<bool>\ \mbox{\hyperlink{a00796_a57a3cfeacbfabfb17ba6e41caf737fa2}{\_reconnecting}};}
\DoxyCodeLine{00136\ \ \ \ \ \textcolor{keywordtype}{bool}\ \_connectHasBeenCalled\ =\ \textcolor{keyword}{false};}
\DoxyCodeLine{00137\ }
\DoxyCodeLine{00142\ \ \ \ \ MONITORING\_MODE\ \mbox{\hyperlink{a00796_ab53ea74bb34e96b762909cd6ffa07f9e}{GetMonitoringMode}}();}
\DoxyCodeLine{00143\ \ \ \ \ }
\DoxyCodeLine{00144\ \ \ \ \ \textcolor{keyword}{virtual}\ \mbox{\hyperlink{a00816}{CommunicationStatus}}\ \mbox{\hyperlink{a00796_a5ccb13b9db4d02848440204df46d7286}{Reconnect}}()\ =\ 0;}
\DoxyCodeLine{00145\ }
\DoxyCodeLine{00146\ \ \ \ \ \textcolor{keywordtype}{void}\ *\mbox{\hyperlink{a00796_ab506370bda5af9ad4410fa8ce0b8e208}{\_mutexMonitoring}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00147\ \ \ \ \ \textcolor{keywordtype}{void}*\ \mbox{\hyperlink{a00796_af346187b19db87c2f15550c1af786ab8}{\_mutexConnectState}};\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00148\ \ \ \ \ \textcolor{keyword}{volatile}\ \textcolor{keywordtype}{int}\ \_connStatus\ =\ 0;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00149\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00150\ \ \ \ \ std::atomic<bool>\ \_monitoringExit;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00151\ \ \ \ \ thread\ \_monitoringWorker;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00152\ \ \ \ \ MONITORING\_MODE\ \_monitoringMode\ =\ MONITORING\_OFF;\ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00153\ \ \ \ \ ConnectionCheckerCallback\ \_monitorinCallBack\ =\ NULL;\ \ \ \ \ \ \ \ }
\DoxyCodeLine{00154\ \ \ \ \ \textcolor{keywordtype}{void}\ AsyncWrapper(ConnectionCheckerCallback,\ \mbox{\hyperlink{a00816}{CommunicationStatus}}*);\ \textcolor{comment}{//\ async\ wrapper\ for\ callback}}
\DoxyCodeLine{00155\ \ \ \ \ \textcolor{keywordtype}{void}\ MonitoringBusiness();\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00156\ \ \ \ \ }
\DoxyCodeLine{00157\ \ \ \ \ BaseSettings*\ \_settings;}
\DoxyCodeLine{00158\ \ \ \ \ BaseDataExtractor*\ \_dataExtractor;}
\DoxyCodeLine{00159\ \};}
\DoxyCodeLine{00160\ }

\end{DoxyCode}
