Skip to content
Permalink
Browse files

update

  • Loading branch information...
lowlevel86 committed Jul 22, 2019
1 parent 374a5cc commit d343be2482bd8c42e1bc8e0b7604a7e7ed6cb4ea
@@ -187,7 +187,18 @@ void receiveCallback(char *bytes, int byteCnt)
return;

while (TRUE)
{
{
// get the operation
if (opType == UNKNOWN)
{
opType = bytes[byteInc] & 0xFF;
byteInc++;
}

if (byteInc >= byteCnt)
return;


// get the operation data size
if (opDataSzBytesAcquired < sizeof(uint32_t))
{
@@ -227,17 +238,7 @@ void receiveCallback(char *bytes, int byteCnt)
opDataSzBytesAcquired++;
byteInc++;
}

if (byteInc >= byteCnt)
return;
}


if (opType == UNKNOWN)
{
opType = bytes[byteInc] & 0xFF;
byteInc++;


opDataBuff = malloc(opDataSz);
}

@@ -105,7 +105,18 @@ void receiveCallback(char *bytes, int byteCnt)
return;

while (TRUE)
{
{
// get the operation
if (opType == UNKNOWN)
{
opType = bytes[byteInc] & 0xFF;
byteInc++;
}

if (byteInc >= byteCnt)
return;


// get the operation data size
if (opDataSzBytesAcquired < sizeof(uint32_t))
{
@@ -145,17 +156,7 @@ void receiveCallback(char *bytes, int byteCnt)
opDataSzBytesAcquired++;
byteInc++;
}

if (byteInc >= byteCnt)
return;
}


if (opType == UNKNOWN)
{
opType = bytes[byteInc] & 0xFF;
byteInc++;


opDataBuff = malloc(opDataSz);
}

@@ -316,9 +316,9 @@ void viewStart(float value)
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[0] = 4;
opDataHead[4] = SET_VIEW_START;
// place the type and size into the data head array
opDataHead[0] = SET_VIEW_START;
opDataHead[1] = 4;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -335,9 +335,9 @@ void viewEnd(float value)
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[0] = 4;
opDataHead[4] = SET_VIEW_END;
// place the type and size into the data head array
opDataHead[0] = SET_VIEW_END;
opDataHead[1] = 4;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -354,9 +354,9 @@ void setPerspective(float value)
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[0] = 4;
opDataHead[4] = SET_PERSPECTIVE;
// place the type and size into the data head array
opDataHead[0] = SET_PERSPECTIVE;
opDataHead[1] = 4;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -373,9 +373,9 @@ void orthographicMode(int value)
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[0] = 1;
opDataHead[4] = SET_ORTHOGRAPHIC_MODE;
// place the type and size into the data head array
opDataHead[0] = SET_ORTHOGRAPHIC_MODE;
opDataHead[1] = 1;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -392,9 +392,9 @@ void fogMode(int value)
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[0] = 1;
opDataHead[4] = SET_FOG_MODE;
// place the type and size into the data head array
opDataHead[0] = SET_FOG_MODE;
opDataHead[1] = 1;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -411,8 +411,8 @@ void fogColor()
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[4] = SET_FOG_COLOR;
// place the type and size into the data head array
opDataHead[0] = SET_FOG_COLOR;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -426,9 +426,9 @@ void fogStart(float value)
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[0] = 4;
opDataHead[4] = SET_FOG_START;
// place the type and size into the data head array
opDataHead[0] = SET_FOG_START;
opDataHead[1] = 4;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -445,9 +445,9 @@ void fogEnd(float value)
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[0] = 4;
opDataHead[4] = SET_FOG_END;
// place the type and size into the data head array
opDataHead[0] = SET_FOG_END;
opDataHead[1] = 4;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -464,9 +464,9 @@ void antialiasingMode(int value)
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[0] = 1;
opDataHead[4] = SET_ANTIALIASING_MODE;
// place the type and size into the data head array
opDataHead[0] = SET_ANTIALIASING_MODE;
opDataHead[1] = 1;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -487,12 +487,12 @@ void setColor(char *colorData, int byteDataCnt)
// size in bytes
size = byteDataCnt;

// place the size and type into the data head array
opDataHead[0] = size & 0xFF;
opDataHead[1] = (size >> 8) & 0xFF;
opDataHead[2] = (size >> 16) & 0xFF;
opDataHead[3] = (size >> 24) & 0xFF;
opDataHead[4] = SET_COLOR;
// place the type and size into the data head array
opDataHead[0] = SET_COLOR;
opDataHead[1] = size & 0xFF;
opDataHead[2] = (size >> 8) & 0xFF;
opDataHead[3] = (size >> 16) & 0xFF;
opDataHead[4] = (size >> 24) & 0xFF;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -509,8 +509,8 @@ void clearScreen()
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[4] = CLEAR_SCREEN;
// place the type and size into the data head array
opDataHead[0] = CLEAR_SCREEN;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -528,12 +528,12 @@ void drawLine(float *coordData, int floatDataCnt)
// size in bytes
size = floatDataCnt * sizeof(float);

// place the size and type into the data head array
opDataHead[0] = size & 0xFF;
opDataHead[1] = (size >> 8) & 0xFF;
opDataHead[2] = (size >> 16) & 0xFF;
opDataHead[3] = (size >> 24) & 0xFF;
opDataHead[4] = DRAW_LINE;
// place the type and size into the data head array
opDataHead[0] = DRAW_LINE;
opDataHead[1] = size & 0xFF;
opDataHead[2] = (size >> 8) & 0xFF;
opDataHead[3] = (size >> 16) & 0xFF;
opDataHead[4] = (size >> 24) & 0xFF;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -554,12 +554,12 @@ void drawPath(float *coordData, int floatDataCnt)
// size in bytes
size = floatDataCnt * sizeof(float);

// place the size and type into the data head array
opDataHead[0] = size & 0xFF;
opDataHead[1] = (size >> 8) & 0xFF;
opDataHead[2] = (size >> 16) & 0xFF;
opDataHead[3] = (size >> 24) & 0xFF;
opDataHead[4] = DRAW_PATH;
// place the type and size into the data head array
opDataHead[0] = DRAW_PATH;
opDataHead[1] = size & 0xFF;
opDataHead[2] = (size >> 8) & 0xFF;
opDataHead[3] = (size >> 16) & 0xFF;
opDataHead[4] = (size >> 24) & 0xFF;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -576,8 +576,8 @@ void showContent()
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[4] = SHOW_CONTENT;
// place the type and size into the data head array
opDataHead[0] = SHOW_CONTENT;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -602,12 +602,12 @@ void printSB(char *fmtStr, ...)

va_end(arg);

// place the size and type into the data head array
opDataHead[0] = size & 0xFF;
opDataHead[1] = (size >> 8) & 0xFF;
opDataHead[2] = (size >> 16) & 0xFF;
opDataHead[3] = (size >> 24) & 0xFF;
opDataHead[4] = PRINT_STATUS;
// place the type and size into the data head array
opDataHead[0] = PRINT_STATUS;
opDataHead[1] = size & 0xFF;
opDataHead[2] = (size >> 8) & 0xFF;
opDataHead[3] = (size >> 16) & 0xFF;
opDataHead[4] = (size >> 24) & 0xFF;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -630,12 +630,12 @@ void playSound(float *leftSnd, float *rightSnd, int sampleCnt)
// size in bytes
size = sampleCnt * sizeof(float) * 2;

// place the size and type into the data head array
opDataHead[0] = size & 0xFF;
opDataHead[1] = (size >> 8) & 0xFF;
opDataHead[2] = (size >> 16) & 0xFF;
opDataHead[3] = (size >> 24) & 0xFF;
opDataHead[4] = PLAY_SOUND;
// place the type and size into the data head array
opDataHead[0] = PLAY_SOUND;
opDataHead[1] = size & 0xFF;
opDataHead[2] = (size >> 8) & 0xFF;
opDataHead[3] = (size >> 16) & 0xFF;
opDataHead[4] = (size >> 24) & 0xFF;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -653,8 +653,8 @@ void stopSound()
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[4] = STOP_SOUND;
// place the type and size into the data head array
opDataHead[0] = STOP_SOUND;

pthread_mutex_lock(&avecis_sendData_lock);

@@ -668,8 +668,8 @@ void endTransmission()
{
char opDataHead[5] = {0};

// place the size and type into the data head array
opDataHead[4] = END_TRANSMISSION;
// place the type and size into the data head array
opDataHead[0] = END_TRANSMISSION;

pthread_mutex_lock(&avecis_sendData_lock);

0 comments on commit d343be2

Please sign in to comment.
You can’t perform that action at this time.