22#ifndef __PL_WXWIDGETS_COMMS__
23#define __PL_WXWIDGETS_COMMS__
50#ifdef PL_WXWIDGETS_IPC3
51const unsigned char transmissionFlush = 10;
54#define TEXTSIZEINFO_MAX_LENGTH 500
76#ifdef PL_WXWIDGETS_IPC3
77 size_t plbufAmountToTransmit;
78 unsigned char transmissionType;
87#ifdef PL_WXWIDGETS_IPC3
95#define PL_SHARED_ARRAY_SIZE 10 * 1024
108 char data[PL_SHARED_ARRAY_SIZE];
111class PLThreeSemaphores
123 void initializeToValid(
const char * baseName );
125 ~PLThreeSemaphores();
130 void initializeToInvalid();
131 bool isWriteSemaphoreValid();
132 bool isReadSemaphoreValid();
133 bool isTransmitSemaphoreValid();
137 bool areSemaphoresValid();
139 bool areWriteReadSemaphoresBlocked();
142 int getValueWriteSemaphore();
144 int getValueReadSemaphore();
146 void postWriteSemaphore();
147 void postReadSemaphore();
148 void postTransmitSemaphore();
149 void waitWriteSemaphore();
150 void waitReadSemaphore();
151 void waitTransmitSemaphore();
161#define PL_SEMAPHORE_NAME_LENGTH 250
162 char m_wsemName[PL_SEMAPHORE_NAME_LENGTH + 1];
163 char m_rsemName[PL_SEMAPHORE_NAME_LENGTH + 1];
164 char m_tsemName[PL_SEMAPHORE_NAME_LENGTH + 1];
187 void create(
const char *
name,
PLINT size,
bool mustExist,
bool mustNotExist );
191#ifdef PL_WXWIDGETS_IPC3
193 MemoryMapHeader *getHeader() {
return &( ( (shmbuf *)
m_buffer )->
header ); }
194 void initializeSemaphoresToValid(
const char *baseName ) { m_threeSemaphores.initializeToValid( baseName ); }
195 size_t *getTotalDataBytes() {
return &( ( (shmbuf *)
m_buffer )->nbytes ); }
196 size_t getSize() {
return PL_SHARED_ARRAY_SIZE; }
197 void transmitBytes(
bool ifHeader,
const void *src,
size_t n );
198 void receiveBytes(
bool ifHeader,
void *dest,
size_t n );
210#ifdef PL_WXWIDGETS_IPC3
213 PLThreeSemaphores m_threeSemaphores;
220#ifndef PL_WXWIDGETS_IPC3
228 void create(
const char *
name,
bool aquireOnCreate =
false );
231 bool aquire(
unsigned long millisecs );
void create(const char *name, PLINT size, bool mustExist, bool mustNotExist)
PLNamedMutexLocker(const PLNamedMutexLocker &)
PLNamedMutexLocker & operator=(const PLNamedMutex &)
PLNamedMutexLocker(PLNamedMutex *mutex)
void create(const char *name, bool aquireOnCreate=false)
wchar_t text[TEXTSIZEINFO_MAX_LENGTH+1]