gusimplewhiteboard
wb_location.h File Reference
#include <gu_util.h>
#include <stdint.h>
#include <guunits/guunits.h>
#include <gucoordinates/gucoordinates.h>
Include dependency graph for wb_location.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  wb_location
 WHITEBOARD_POSTER_STRING_CONVERSION. More...
 

Macros

#define _XOPEN_SOURCE   700
 
#define LOCATION_GENERATED
 
#define LOCATION_C_STRUCT   wb_location
 
#define LOCATION_NUMBER_OF_VARIABLES   5
 
#define LOCATION_DESC_BUFFER_SIZE   108
 
#define LOCATION_TO_STRING_BUFFER_SIZE   43
 

Functions

const char * wb_location_description (const struct wb_location *self, char *descString, size_t bufferSize)
 Convert to a description string. More...
 
const char * wb_location_to_string (const struct wb_location *self, char *toString, size_t bufferSize)
 Convert to a string. More...
 
struct wb_locationwb_location_from_string (struct wb_location *self, const char *str)
 Convert from a string. More...
 
struct wb_location rr_coord_to_wb_location (const gu_relative_coordinate coord, const uint8_t confidence, const uint32_t distanceVariance, const uint32_t directionVariance)
 WHITEBOARD_POSTER_STRING_CONVERSION. More...
 
struct gu_relative_coordinate wb_location_to_rr_coord (const struct wb_location location)
 Converts a wb_location to a gu_relative_coordinate. More...
 
struct gu_optional_relative_coordinate wb_location_to_opt_rr_coord (const struct wb_location location, const uint8_t confidence)
 Converts a wb_location to a gu_optional_relative_coordinate. More...
 
size_t wb_location_to_network_serialised (const struct wb_location *self, char *dst)
 Network stream serialisation. More...
 
size_t wb_location_from_network_serialised (const char *src, struct wb_location *dst)
 Network stream deserialisation. More...
 

Macro Definition Documentation

◆ _XOPEN_SOURCE

#define _XOPEN_SOURCE   700

Definition at line 72 of file wb_location.h.

◆ LOCATION_C_STRUCT

#define LOCATION_C_STRUCT   wb_location

Definition at line 93 of file wb_location.h.

◆ LOCATION_DESC_BUFFER_SIZE

#define LOCATION_DESC_BUFFER_SIZE   108

Definition at line 97 of file wb_location.h.

◆ LOCATION_GENERATED

#define LOCATION_GENERATED

Definition at line 92 of file wb_location.h.

◆ LOCATION_NUMBER_OF_VARIABLES

#define LOCATION_NUMBER_OF_VARIABLES   5

Definition at line 94 of file wb_location.h.

◆ LOCATION_TO_STRING_BUFFER_SIZE

#define LOCATION_TO_STRING_BUFFER_SIZE   43

Definition at line 98 of file wb_location.h.

Function Documentation

◆ rr_coord_to_wb_location()

struct wb_location rr_coord_to_wb_location ( const gu_relative_coordinate  coord,
const uint8_t  confidence,
const uint32_t  distanceVariance,
const uint32_t  directionVariance 
)

WHITEBOARD_POSTER_STRING_CONVERSION.

Converts a gu_relative_coordinate to a wb_location.

Parameters
[in]coordThe gu_relative_coordinate which is being converted.
[in]confidenceThe confidence value for the new location.
[in]distanceVarianceThe distanceVariance value for the new location.
[in]directionVarianceThe directionVariance value for the new location.
Returns
A wb_location containing the values of coord having performed the necessary conversions.

Definition at line 511 of file wb_location.c.

References wb_location::confidence, wb_location::directionVariance, and wb_location::distanceVariance.

◆ wb_location_description()

const char * wb_location_description ( const struct wb_location self,
char *  descString,
size_t  bufferSize 
)

Convert to a description string.

Definition at line 125 of file wb_location.c.

Referenced by guWhiteboard::Location::description().

◆ wb_location_from_network_serialised()

size_t wb_location_from_network_serialised ( const char *  src,
struct wb_location dst 
)

Network stream deserialisation.

Network stream deserialisation.

Definition at line 426 of file wb_location.c.

References wb_location::confidence, wb_location::direction, wb_location::directionVariance, wb_location::distance, wb_location::distanceVariance, ntohl, and ntohs.

◆ wb_location_from_string()

struct wb_location * wb_location_from_string ( struct wb_location self,
const char *  str 
)

Convert from a string.

Definition at line 221 of file wb_location.c.

References LOCATION_DESC_BUFFER_SIZE.

◆ wb_location_to_network_serialised()

size_t wb_location_to_network_serialised ( const struct wb_location self,
char *  dst 
)

Network stream serialisation.

Network stream serialisation.

Definition at line 345 of file wb_location.c.

References htonl, and htons.

◆ wb_location_to_opt_rr_coord()

struct gu_optional_relative_coordinate wb_location_to_opt_rr_coord ( const struct wb_location  location,
const uint8_t  confidence 
)

Converts a wb_location to a gu_optional_relative_coordinate.

Parameters
[in]locationThe wb_location which is being converted.
[in]confidenceThe minimum confidence value that location needs to be in order for the returning gu_optional_relative_coordinate to contain a value. If the locations confidence is less than this value then this function returns a gu_optional_realtive_coordinate where gu_optional_relative_coordinate::has_value is false.
Returns
A gu_optional_relative_coordinate containing the values of coord having performed the necessary conversions. If locations confidence value is less than confidence then the gu_optional_realtive_coordinate::has_value is false;

Definition at line 532 of file wb_location.c.

References wb_location_to_rr_coord().

Referenced by guWhiteboard::Location::optionalRelativeCoordinate().

◆ wb_location_to_rr_coord()

struct gu_relative_coordinate wb_location_to_rr_coord ( const struct wb_location  location)

Converts a wb_location to a gu_relative_coordinate.

Parameters
[in]locationThe wb_location which is being converted.
Returns
A gu_relative_coordinate containing the values of coord having performed the necessary conversions.
Attention
The confidence of the location is discarded since gu_relative_coordinate has no notion of a confidence.

Definition at line 523 of file wb_location.c.

Referenced by guWhiteboard::Location::relativeCoordinate(), and wb_location_to_opt_rr_coord().

◆ wb_location_to_string()

const char * wb_location_to_string ( const struct wb_location self,
char *  toString,
size_t  bufferSize 
)

Convert to a string.

Definition at line 173 of file wb_location.c.

Referenced by guWhiteboard::Location::to_string().