aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <swo-dev@marcschink.de>2016-09-18 11:11:15 +0200
committerMarc Schink <swo-dev@marcschink.de>2016-09-18 22:14:15 +0200
commit9d350336190aeb1758e7c0e0339644ac0a84956e (patch)
treecfaf3ec48ec0f063e6f3724fd73a9a02204ef89a
parent1cde7260e97cf1f5843022ffeec45c727c599d47 (diff)
Rearrange packet types
-rw-r--r--bindings/cxx/libswocxx.h22
-rw-r--r--bindings/python/swopy.i6
-rw-r--r--libswo/libswo.h52
3 files changed, 40 insertions, 40 deletions
diff --git a/bindings/cxx/libswocxx.h b/bindings/cxx/libswocxx.h
index f835cc4..906fd81 100644
--- a/bindings/cxx/libswocxx.h
+++ b/bindings/cxx/libswocxx.h
@@ -41,6 +41,7 @@ enum LogLevel {
};
enum PacketType {
+ PACKET_TYPE_UNKNOWN = LIBSWO_PACKET_TYPE_UNKNOWN,
PACKET_TYPE_SYNC = LIBSWO_PACKET_TYPE_SYNC,
PACKET_TYPE_OVERFLOW = LIBSWO_PACKET_TYPE_OVERFLOW,
PACKET_TYPE_LTS = LIBSWO_PACKET_TYPE_LTS,
@@ -48,8 +49,7 @@ enum PacketType {
PACKET_TYPE_GTS2 = LIBSWO_PACKET_TYPE_GTS2,
PACKET_TYPE_EXT = LIBSWO_PACKET_TYPE_EXT,
PACKET_TYPE_INST = LIBSWO_PACKET_TYPE_INST,
- PACKET_TYPE_HW = LIBSWO_PACKET_TYPE_HW,
- PACKET_TYPE_UNKNOWN = LIBSWO_PACKET_TYPE_UNKNOWN
+ PACKET_TYPE_HW = LIBSWO_PACKET_TYPE_HW
};
enum LocalTimestampRelation {
@@ -102,6 +102,15 @@ typedef int (*DecoderCallback)(const Packet &packet, void *user_data);
typedef int (*LogCallback)(enum LogLevel level, const std::string &message,
void *user_data);
+class LIBSWO_API Unknown : public PayloadPacket
+{
+public:
+ Unknown(const struct libswo_packet_unknown *packet);
+ Unknown(const union libswo_packet *packet);
+
+ const string to_string(void) const;
+};
+
class LIBSWO_API Synchronization : public Packet
{
public:
@@ -194,15 +203,6 @@ public:
const string to_string(void) const;
};
-class LIBSWO_API Unknown : public PayloadPacket
-{
-public:
- Unknown(const struct libswo_packet_unknown *packet);
- Unknown(const union libswo_packet *packet);
-
- const string to_string(void) const;
-};
-
class LIBSWO_PRIV DecoderCallbackHelper
{
public:
diff --git a/bindings/python/swopy.i b/bindings/python/swopy.i
index 1507a23..f42a5d2 100644
--- a/bindings/python/swopy.i
+++ b/bindings/python/swopy.i
@@ -163,6 +163,9 @@ static PyObject *packet_object(const libswo::Packet &packet)
tmp = (void *)&packet;
switch (packet.get_type()) {
+ case libswo::PACKET_TYPE_UNKNOWN:
+ ret = SWIG_NewPointerObj(tmp, SWIGTYPE_p_libswo__Unknown, 0);
+ break;
case libswo::PACKET_TYPE_SYNC:
ret = SWIG_NewPointerObj(tmp,
SWIGTYPE_p_libswo__Synchronization, 0);
@@ -192,9 +195,6 @@ static PyObject *packet_object(const libswo::Packet &packet)
case libswo::PACKET_TYPE_HW:
ret = SWIG_NewPointerObj(tmp, SWIGTYPE_p_libswo__Hardware, 0);
break;
- case libswo::PACKET_TYPE_UNKNOWN:
- ret = SWIG_NewPointerObj(tmp, SWIGTYPE_p_libswo__Unknown, 0);
- break;
default:
ret = NULL;
}
diff --git a/libswo/libswo.h b/libswo/libswo.h
index 2c76fe1..c610b3a 100644
--- a/libswo/libswo.h
+++ b/libswo/libswo.h
@@ -70,24 +70,24 @@ enum libswo_log_level {
/** Packet types. */
enum libswo_packet_type {
+ /** Unknown data packet. */
+ LIBSWO_PACKET_TYPE_UNKNOWN = 0,
/** Synchronization packet. */
- LIBSWO_PACKET_TYPE_SYNC = 0,
+ LIBSWO_PACKET_TYPE_SYNC = 1,
/** Overflow packet. */
- LIBSWO_PACKET_TYPE_OVERFLOW = 1,
+ LIBSWO_PACKET_TYPE_OVERFLOW = 2,
/** Local timestamp packet. */
- LIBSWO_PACKET_TYPE_LTS = 2,
+ LIBSWO_PACKET_TYPE_LTS = 3,
/** Global timestamp (GTS1) packet. */
- LIBSWO_PACKET_TYPE_GTS1 = 3,
+ LIBSWO_PACKET_TYPE_GTS1 = 4,
/** Global timestamp (GTS2) packet. */
- LIBSWO_PACKET_TYPE_GTS2 = 4,
+ LIBSWO_PACKET_TYPE_GTS2 = 5,
/** Extension packet. */
- LIBSWO_PACKET_TYPE_EXT = 5,
+ LIBSWO_PACKET_TYPE_EXT = 6,
/** Instrumentation packet. */
- LIBSWO_PACKET_TYPE_INST = 6,
+ LIBSWO_PACKET_TYPE_INST = 7,
/** Hardware source packet. */
- LIBSWO_PACKET_TYPE_HW = 7,
- /** Unknown data packet. */
- LIBSWO_PACKET_TYPE_UNKNOWN = 8
+ LIBSWO_PACKET_TYPE_HW = 8
};
/** Local timestamp relation information. */
@@ -146,6 +146,20 @@ struct libswo_packet_any {
uint8_t data[1 + LIBSWO_MAX_PAYLOAD_SIZE];
};
+/**
+ * Unknown data packet.
+ *
+ * This packet represents data which could not be decoded.
+ */
+struct libswo_packet_unknown {
+ /** Packet type. */
+ enum libswo_packet_type type;
+ /** Packet size in bytes. */
+ size_t size;
+ /** Packet data. */
+ uint8_t data[1 + LIBSWO_MAX_PAYLOAD_SIZE];
+};
+
/** Synchronization packet. */
struct libswo_packet_sync {
/** Packet type. */
@@ -267,26 +281,14 @@ struct libswo_packet_hw {
uint32_t value;
};
-/**
- * Unknown data packet.
- *
- * This packet represents data which could not be decoded.
- */
-struct libswo_packet_unknown {
- /** Packet type. */
- enum libswo_packet_type type;
- /** Packet size in bytes. */
- size_t size;
- /** Packet data. */
- uint8_t data[1 + LIBSWO_MAX_PAYLOAD_SIZE];
-};
-
/** Union of all packet types. */
union libswo_packet {
/** Packet type. */
enum libswo_packet_type type;
/** Common fields packet. */
struct libswo_packet_any any;
+ /** Unknown data packet. */
+ struct libswo_packet_unknown unknown;
/** Synchronization packet. */
struct libswo_packet_sync sync;
/** Overflow packet. */
@@ -303,8 +305,6 @@ union libswo_packet {
struct libswo_packet_inst inst;
/** Hardware source packet. */
struct libswo_packet_hw hw;
- /** Unknown data packet. */
- struct libswo_packet_unknown unknown;
};
/**