Skip to content

Commit

Permalink
add components for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Shanginre committed Dec 21, 2021
1 parent 242d67d commit b2d4da2
Show file tree
Hide file tree
Showing 19 changed files with 1,191 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .vs/VSWorkspaceState.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ExpandedNodes": [
""
],
"PreviewInSolutionExplorer": false
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
17 changes: 17 additions & 0 deletions AddInNative_SynchClientServerWindows/NativeAPI/src/SynchServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ std::string SynchClientServer::listen()
}
threads.create_thread(boost::bind(&SynchClientServer::handle_connections_thread, this));
threads.create_thread(boost::bind(&SynchClientServer::clean_thread, this));
threads.create_thread(boost::bind(&SynchClientServer::reconnectToRemoteServers_thread, this));
terminate_thread.create_thread(boost::bind(&SynchClientServer::checkForTerminate_thread, this));

state = RUNNING;
Expand Down Expand Up @@ -497,6 +498,22 @@ void SynchClientServer::checkForTerminate_thread()
}
}

void SynchClientServer::reconnectToRemoteServers_thread()
{
while (true) {
boost::this_thread::sleep(boost::posix_time::millisec(10000));
if (isThreadInterrupted())
break;

for (auto const& portSettingPair : portsSettings) {
portSettings_ptr setting_ptr = portSettingPair.second;
if (setting_ptr->isLinkToRemoteServer) {
clientConnection_ptr connectionToRemoteServer = getCreateClientConnectionToRemoteServer(setting_ptr);
}
}
}
}

bool SynchClientServer::allIncomingMessagesTakenInProcessing()
{
return std::find_if(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class SynchClientServer : public std::enable_shared_from_this<SynchClientServer>
void handle_connections_thread();
void clean_thread();
void checkForTerminate_thread();
void reconnectToRemoteServers_thread();
bool allIncomingMessagesTakenInProcessing();
void readMessageFromConnection(const clientConnection_ptr &clientConnection);
void sendMessagesToConnection(const clientConnection_ptr &clientConnection);
Expand Down
165 changes: 165 additions & 0 deletions addInclude/AddInDefBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/*
* Warning!!!
* DO NOT ALTER THIS FILE!
*/

#ifndef __ADAPTER_DEF_H__
#define __ADAPTER_DEF_H__
#include "types.h"

struct IInterface
{
};


enum Interfaces
{
eIMsgBox = 0,
eIPlatformInfo,
#if defined(__ANDROID__)
eIAndroidComponentHelper,
#endif
eIConnectInfo,
};

////////////////////////////////////////////////////////////////////////////////
/**
* This class serves as representation of a platform for external
* components External components use it to communicate with a platform.
*
*/
/// Base interface for object components.
class IAddInDefBase
{
public:
virtual ~IAddInDefBase() {}
/// Adds the error message
/**
* @param wcode - error code
* @param source - source of error
* @param descr - description of error
* @param scode - error code (HRESULT)
* @return the result of
*/
virtual bool ADDIN_API AddError(unsigned short wcode, const WCHAR_T* source,
const WCHAR_T* descr, long scode) = 0;

/// Reads a property value
/**
* @param wszPropName -property name
* @param pVal - value being returned
* @param pErrCode - error code (if any error occured)
* @param errDescriptor - error description (if any error occured)
* @return the result of read.
*/
virtual bool ADDIN_API Read(WCHAR_T* wszPropName,
tVariant* pVal,
long *pErrCode,
WCHAR_T** errDescriptor) = 0;
/// Writes a property value
/**
* @param wszPropName - property name
* @param pVar - new property value
* @return the result of write.
*/
virtual bool ADDIN_API Write(WCHAR_T* wszPropName,
tVariant *pVar) = 0;

///Registers profile components
/**
* @param wszProfileName - profile name
* @return the result of
*/
virtual bool ADDIN_API RegisterProfileAs(WCHAR_T* wszProfileName) = 0;

/// Changes the depth of event buffer
/**
* @param lDepth - new depth of event buffer
* @return the result of
*/
virtual bool ADDIN_API SetEventBufferDepth(long lDepth) = 0;
/// Returns the depth of event buffer
/**
* @return the depth of event buffer
*/
virtual long ADDIN_API GetEventBufferDepth() = 0;
/// Registers external event
/**
* @param wszSource - source of event
* @param wszMessage - event message
* @param wszData - message parameters
* @return the result of
*/
virtual bool ADDIN_API ExternalEvent(WCHAR_T* wszSource,
WCHAR_T* wszMessage,
WCHAR_T* wszData) = 0;
/// Clears event buffer
/**
*/
virtual void ADDIN_API CleanEventBuffer() = 0;

/// Sets status line contents
/**
* @param wszStatusLine - new status line contents
* @return the result of
*/
virtual bool ADDIN_API SetStatusLine(WCHAR_T* wszStatusLine) = 0;
/// Resets the status line contents
/**
* @return the result of
*/
virtual void ADDIN_API ResetStatusLine() = 0;
};

class IAddInDefBaseEx :
public IAddInDefBase
{
public:
virtual ~IAddInDefBaseEx() {}

virtual IInterface* ADDIN_API GetInterface(Interfaces iface) = 0;
};

struct IMsgBox :
public IInterface
{
virtual bool ADDIN_API Confirm(const WCHAR_T* queryText, tVariant* retVal) = 0;

virtual bool ADDIN_API Alert(const WCHAR_T* text) = 0;
};

struct IPlatformInfo :
public IInterface
{
enum AppType
{
eAppUnknown = -1,
eAppThinClient = 0,
eAppThickClient,
eAppWebClient,
eAppServer,
eAppExtConn,
eAppMobileClient,
eAppMobileServer,
};

struct AppInfo
{
const WCHAR_T* AppVersion;
const WCHAR_T* UserAgentInformation;
AppType Application;
};

virtual const AppInfo* ADDIN_API GetPlatformInfo() = 0;
};
struct IConnectInfo :
public IInterface
{
enum ConnectType
{
eConnectedIsolated = 0,
eConnectedNotIsolated,
};
virtual const ConnectType ADDIN_API GetConnectInfo() = 0;
};
#endif //__ADAPTER_DEF_H__
Loading

0 comments on commit b2d4da2

Please sign in to comment.