PUD: put the gateway flag in the NMEA output
authorFerry Huberts <f.huberts@mindef.nl>
Fri, 21 Oct 2011 15:05:39 +0000 (17:05 +0200)
committerFerry Huberts <f.huberts@mindef.nl>
Fri, 21 Oct 2011 15:55:41 +0000 (17:55 +0200)
Signed-off-by: Ferry Huberts <f.huberts@mindef.nl>
lib/pud/src/gpsConversion.c
lib/pud/src/gpsConversion.h

index 733a732..94d59b1 100644 (file)
@@ -50,6 +50,8 @@ unsigned int gpsFromOlsr(union olsr_message *olsrMessage,
        char trackString[PUD_TX_TRACK_DIGITS + 1];
        char hdopString[PUD_TX_HDOP_DIGITS + 1];
        uint8_t smask;
+       uint8_t flags;
+       char gateway[2] = { '0', '\0' };
 
        char nodeIdTypeString[PUD_TX_NODEIDTYPE_DIGITS + 1];
        char nodeIdString[PUD_TX_NODEID_BUFFERSIZE + 1];
@@ -72,6 +74,12 @@ unsigned int gpsFromOlsr(union olsr_message *olsrMessage,
 
        smask = getPositionUpdateSmask(olsrGpsMessage);
 
+       flags = getPositionUpdateSmask(olsrGpsMessage);
+
+       if (flags & PUD_FLAGS_GATEWAY) {
+               gateway[0] = '1';
+       }
+
        /* time is ALWAYS present so we can just use it */
        getPositionUpdateTime(olsrGpsMessage, time(NULL), &timeStruct);
 
@@ -180,6 +188,7 @@ unsigned int gpsFromOlsr(union olsr_message *olsrMessage,
        transmitStringLength = nmea_printf((char *) txGpsBuffer, txGpsBufferSize
                        - 1, "$P%s," /* prefix (always) */
                "%u," /* sentence version (always) */
+               "%s," /* gateway flag (always) */
                "%s,%s," /* nodeIdType/nodeId (always) */
                "%02u%02u%02u," /* date (always) */
                "%02u%02u%02u," /* time (always) */
@@ -190,7 +199,7 @@ unsigned int gpsFromOlsr(union olsr_message *olsrMessage,
                "%s," /* speed (optional) */
                "%s," /* track (optional) */
                "%s" /* hdop (optional) */
-       , getTxNmeaMessagePrefix(), PUD_TX_SENTENCE_VERSION, &nodeIdTypeString[0],
+       , getTxNmeaMessagePrefix(), PUD_TX_SENTENCE_VERSION, &gateway[0], &nodeIdTypeString[0],
                        nodeId, timeStruct.tm_mday, timeStruct.tm_mon + 1, (timeStruct.tm_year
                                        % 100), timeStruct.tm_hour, timeStruct.tm_min,
                        timeStruct.tm_sec, validityTime, &latitudeString[0],
index fd8046d..fafbdab 100644 (file)
@@ -14,7 +14,7 @@
  */
 
 /** The version of the transmit sentence */
-#define PUD_TX_SENTENCE_VERSION                0
+#define PUD_TX_SENTENCE_VERSION                1
 
 /** The OLSRD message type FIXME get an assigned one */
 #define PUD_OLSR_MSG_TYPE                      171