CustusX  2023.01.05-dev+develop.0da12
An IGT application
igtl_sonix_status.c
Go to the documentation of this file.
1 /*
2  * igtl_sonix_status.c
3  *
4  * Created on: Nov 23, 2011
5  * Author: olevs
6  */
7 
8 #include "igtl_sonix_status.h"
9 #include "igtl_util.h"
10 
12 {
13  igtl_int64* tmp64 = (igtl_int64*)message;
14  igtl_int32* tmp32 = (igtl_int32*)message;
15  igtl_uint16* tmp16 = (igtl_uint16*)message;
16 
17  if (igtl_is_little_endian())
18  {
19  int i;
20  for (i = 0; i < 3; i++)//Update number when adding more variables to message
21  tmp64[i] = BYTE_SWAP_INT64(tmp64[i]);
22 
23  for (i = 0; i < 11; i ++)
24  tmp32[6 + i] = BYTE_SWAP_INT32(tmp32[6 + i]);//3*64 bit adressed as 32 bit = 6
25 
26  tmp16[34] = BYTE_SWAP_INT16(tmp16[34]);//3*64 bit + 8*32 bit (adressed as 16 bit = 28)
27  }
28 
29 }
30 
31 igtl_uint64 igtl_export igtl_sonix_status_get_crc(igtl_sonix_status_message * message)
32 {
33  igtl_uint64 crc = crc64(0, 0, 0);
34 
35  crc = crc64((unsigned char*)message, IGTL_SONIX_STATUS_HEADER_SIZE, crc);
36  return crc;
37 }
igtl_uint64 igtl_export igtl_sonix_status_get_crc(igtl_sonix_status_message *message)
void igtl_export igtl_sonix_status_convert_byte_order(igtl_sonix_status_message *message)
#define IGTL_SONIX_STATUS_HEADER_SIZE