Add files via upload
authorFrançois Grondin <Francois.Grondin2@USherbrooke.ca>
Mon, 3 Jul 2017 19:18:05 +0000 (15:18 -0400)
committerGitHub <noreply@github.com>
Mon, 3 Jul 2017 19:18:05 +0000 (15:18 -0400)
src/message/msg_hops.c [new file with mode: 0644]
src/message/msg_hops.h [new file with mode: 0644]
src/message/msg_pots.c [new file with mode: 0644]
src/message/msg_pots.h [new file with mode: 0644]
src/message/msg_spectra.c [new file with mode: 0644]
src/message/msg_spectra.h [new file with mode: 0644]
src/message/msg_tracks.c [new file with mode: 0644]
src/message/msg_tracks.h [new file with mode: 0644]

diff --git a/src/message/msg_hops.c b/src/message/msg_hops.c
new file mode 100644 (file)
index 0000000..109c2a7
--- /dev/null
@@ -0,0 +1,82 @@
+
+    #include "msg_hops.h"
+
+    msg_hops_obj * msg_hops_construct(const msg_hops_cfg * msg_hops_config) {
+
+        msg_hops_obj * obj;
+
+        obj = (msg_hops_obj *) malloc(sizeof(msg_hops_obj));
+
+        obj->timeStamp = 0;
+        obj->fS = msg_hops_config->fS;
+        obj->hops = hops_construct_zero(msg_hops_config->nChannels, msg_hops_config->hopSize);
+
+        return obj;
+
+    }
+
+    void msg_hops_destroy(msg_hops_obj * obj) {
+
+        hops_destroy(obj->hops);
+        free((void *) obj);
+
+    }
+
+    void msg_hops_copy(msg_hops_obj * dest, const msg_hops_obj * src) {
+
+        dest->timeStamp = src->timeStamp;
+        dest->fS = src->fS;
+        hops_copy(dest->hops, src->hops);
+
+    }
+
+    void msg_hops_zero(msg_hops_obj * obj) {
+
+        obj->timeStamp = 0;
+        obj->fS = 0;
+        hops_zero(obj->hops);
+
+    }
+
+    unsigned int msg_hops_isZero(const msg_hops_obj * obj) {
+
+        unsigned int rtnValue;
+
+        if (obj->timeStamp == 0) {
+            rtnValue = 1;
+        }
+        else {
+            rtnValue = 0;
+        }
+
+        return rtnValue;
+
+    }
+
+    msg_hops_cfg * msg_hops_cfg_construct(void) {
+
+        msg_hops_cfg * cfg;
+
+        cfg = (msg_hops_cfg *) malloc(sizeof(msg_hops_cfg));
+
+        cfg->hopSize = 0;
+        cfg->nChannels = 0;
+        cfg->fS;
+
+        return cfg;
+
+    }
+
+    void msg_hops_cfg_destroy(msg_hops_cfg * msg_hops_config) {
+
+        free((void *) msg_hops_config);
+
+    }
+
+    void msg_hops_cfg_printf(const msg_hops_cfg * msg_hops_config) {
+       
+        printf("hopSize = %u\n", msg_hops_config->hopSize);
+        printf("nChannels = %u\n", msg_hops_config->nChannels);        
+        printf("fS = %u\n", msg_hops_config->fS);
+
+    }
diff --git a/src/message/msg_hops.h b/src/message/msg_hops.h
new file mode 100644 (file)
index 0000000..1345dd1
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef __ODAS_MESSAGE_HOPS
+#define __ODAS_MESSAGE_HOPS
+
+    #include <stdlib.h>
+    #include "../signal/hop.h"
+    #include "../utils/fifo.h"
+
+    typedef struct msg_hops_obj {
+
+        unsigned long long timeStamp;
+        unsigned int fS;
+        hops_obj * hops;
+
+    } msg_hops_obj;
+
+    typedef struct msg_hops_cfg {
+
+        unsigned int hopSize;
+        unsigned int nChannels;
+        unsigned int fS;
+
+    } msg_hops_cfg;
+
+    msg_hops_obj * msg_hops_construct(const msg_hops_cfg * msg_hops_config);
+
+    void msg_hops_destroy(msg_hops_obj * obj);
+
+    void msg_hops_copy(msg_hops_obj * dest, const msg_hops_obj * src);
+
+    void msg_hops_zero(msg_hops_obj * obj);
+
+    unsigned int msg_hops_isZero(const msg_hops_obj * obj);
+
+    msg_hops_cfg * msg_hops_cfg_construct(void);
+
+    void msg_hops_cfg_destroy(msg_hops_cfg * msg_hops_config);
+
+    void msg_hops_cfg_printf(const msg_hops_cfg * msg_hops_config);
+
+#endif
\ No newline at end of file
diff --git a/src/message/msg_pots.c b/src/message/msg_pots.c
new file mode 100644 (file)
index 0000000..6852e51
--- /dev/null
@@ -0,0 +1,80 @@
+    
+    #include "msg_pots.h"
+
+    msg_pots_obj * msg_pots_construct(const msg_pots_cfg * cfg) {
+
+        msg_pots_obj * obj;
+
+        obj = (msg_pots_obj *) malloc(sizeof(msg_pots_obj));
+
+        obj->timeStamp = 0;
+        obj->fS = cfg->fS;
+        obj->pots = pots_construct_zero(cfg->nPots);
+
+        return obj;
+
+    }
+
+    void msg_pots_destroy(msg_pots_obj * obj) {
+
+        pots_destroy(obj->pots);
+        free((void *) obj);
+
+    }
+
+    void msg_pots_copy(msg_pots_obj * dest, const msg_pots_obj * src) {
+
+        dest->timeStamp = src->timeStamp;
+        dest->fS = src->fS;
+        pots_copy(dest->pots, src->pots);
+
+    }
+
+    void msg_pots_zero(msg_pots_obj * obj) {
+
+        obj->timeStamp = 0;
+        obj->fS = 0;
+        pots_zero(obj->pots);
+
+    }
+
+    unsigned int msg_pots_isZero(const msg_pots_obj * obj) {
+
+        unsigned int rtnValue;
+
+        if (obj->timeStamp == 0) {
+            rtnValue = 1;
+        }
+        else {
+            rtnValue = 0;
+        }
+
+        return rtnValue;
+
+    }
+
+    msg_pots_cfg * msg_pots_cfg_construct(void) {
+
+        msg_pots_cfg * cfg;
+
+        cfg = (msg_pots_cfg *) malloc(sizeof(msg_pots_cfg));
+
+        cfg->nPots = 0;
+        cfg->fS = 0;
+
+        return cfg;
+
+    }
+
+    void msg_pots_cfg_destroy(msg_pots_cfg * cfg) {
+
+        free((void *) cfg);
+
+    }
+
+    void msg_pots_cfg_printf(const msg_pots_cfg * msg_pots_config) {
+
+        printf("nPots = %u\n", msg_pots_config->nPots);        
+        printf("fS = %u\n", msg_pots_config->fS);        
+
+    }
\ No newline at end of file
diff --git a/src/message/msg_pots.h b/src/message/msg_pots.h
new file mode 100644 (file)
index 0000000..a016b67
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef __ODAS_MESSAGE_POTS
+#define __ODAS_MESSAGE_POTS
+
+    #include <stdlib.h>
+    #include "../signal/pot.h"
+
+    typedef struct msg_pots_obj {
+
+        unsigned long long timeStamp;
+        unsigned int fS;
+        pots_obj * pots;
+
+    } msg_pots_obj;
+
+    typedef struct msg_pots_cfg {
+
+        unsigned int nPots;
+        unsigned int fS;
+
+    } msg_pots_cfg;
+
+    msg_pots_obj * msg_pots_construct(const msg_pots_cfg * cfg);
+
+    void msg_pots_destroy(msg_pots_obj * obj);
+
+    void msg_pots_copy(msg_pots_obj * dest, const msg_pots_obj * src);
+
+    void msg_pots_zero(msg_pots_obj * obj);
+
+    unsigned int msg_pots_isZero(const msg_pots_obj * obj);
+
+    msg_pots_cfg * msg_pots_cfg_construct(void);
+
+    void msg_pots_cfg_destroy(msg_pots_cfg * cfg);
+
+    void msg_pots_cfg_printf(const msg_pots_cfg * msg_pots_config);
+
+#endif
\ No newline at end of file
diff --git a/src/message/msg_spectra.c b/src/message/msg_spectra.c
new file mode 100644 (file)
index 0000000..184cca9
--- /dev/null
@@ -0,0 +1,107 @@
+    
+    #include "msg_spectra.h"
+
+    msg_spectra_obj * msg_spectra_construct(const msg_spectra_cfg * msg_spectra_config) {
+
+        msg_spectra_obj * obj;
+
+        obj = (msg_spectra_obj *) malloc(sizeof(msg_spectra_obj));
+
+        obj->timeStamp = 0;
+        obj->fS = 0;
+        obj->freqs = freqs_construct_zero(msg_spectra_config->nChannels, msg_spectra_config->halfFrameSize);
+
+        return obj;
+
+    }
+
+    void msg_spectra_destroy(msg_spectra_obj * obj) {
+
+        freqs_destroy(obj->freqs);
+        free((void *) obj);
+
+    }
+
+    void msg_spectra_copy(msg_spectra_obj * dest, const msg_spectra_obj * src) {
+
+        dest->timeStamp = src->timeStamp;
+        dest->fS = src->fS;
+        freqs_copy(dest->freqs, src->freqs);
+
+    }
+
+    void msg_spectra_zero(msg_spectra_obj * obj) {
+
+        obj->timeStamp = 0;
+        obj->fS = 0;
+        freqs_zero(obj->freqs);
+
+    }
+
+    unsigned int msg_spectra_isZero(const msg_spectra_obj * obj) {
+
+        unsigned int rtnValue;
+
+        if (obj->timeStamp == 0) {
+            rtnValue = 1;
+        }
+        else {
+            rtnValue = 0;
+        }
+
+        return rtnValue;
+
+    }
+
+    void msg_spectra_printf(const msg_spectra_obj * obj) {
+
+        if (obj != NULL) {
+
+            printf("timeStamp = %llu\n", obj->timeStamp);
+            printf("freqs = %p\n", obj->freqs);
+
+        }
+        else {
+
+            printf("(null)\n");
+
+        }
+
+    }
+
+    msg_spectra_cfg * msg_spectra_cfg_construct(void) {
+
+        msg_spectra_cfg * cfg;
+
+        cfg = (msg_spectra_cfg *) malloc(sizeof(msg_spectra_cfg));
+
+        cfg->halfFrameSize = 0;
+        cfg->nChannels = 0;
+        cfg->fS = 0;
+
+        return cfg;
+
+    }
+
+    void msg_spectra_cfg_destroy(msg_spectra_cfg * msg_spectra_config) {
+
+        free((void *) msg_spectra_config);
+
+    }
+
+    void msg_spectra_cfg_printf(const msg_spectra_cfg * msg_spectra_config) {
+
+        if (msg_spectra_config != NULL) {
+
+            printf("halfFrameSize = %u\n", msg_spectra_config->halfFrameSize);
+            printf("nChannels = %u\n", msg_spectra_config->nChannels);
+            printf("fS = %u\n", msg_spectra_config->fS);
+
+        }
+        else {
+
+            printf("(null)\n");
+
+        }        
+
+    }
\ No newline at end of file
diff --git a/src/message/msg_spectra.h b/src/message/msg_spectra.h
new file mode 100644 (file)
index 0000000..36e3d6b
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef __ODAS_MESSAGE_SPECTRA
+#define __ODAS_MESSAGE_SPECTRA
+
+    #include <stdlib.h>
+
+    #include "../signal/freq.h"
+
+    typedef struct msg_spectra_obj {
+
+        unsigned long long timeStamp;
+        unsigned int fS;
+        freqs_obj * freqs;
+
+    } msg_spectra_obj;
+
+    typedef struct msg_spectra_cfg {
+
+        unsigned int halfFrameSize;
+        unsigned int nChannels;
+        unsigned int fS;
+
+    } msg_spectra_cfg;
+
+    msg_spectra_obj * msg_spectra_construct(const msg_spectra_cfg * msg_spectra_config);
+
+    void msg_spectra_destroy(msg_spectra_obj * obj);
+
+    void msg_spectra_copy(msg_spectra_obj * dest, const msg_spectra_obj * src);
+
+    void msg_spectra_zero(msg_spectra_obj * obj);
+
+    unsigned int msg_spectra_isZero(const msg_spectra_obj * obj);
+
+    msg_spectra_cfg * msg_spectra_cfg_construct(void);
+
+    void msg_spectra_cfg_destroy(msg_spectra_cfg * msg_spectra_config);
+
+    void msg_spectra_cfg_printf(const msg_spectra_cfg * msg_spectra_config);
+
+#endif
\ No newline at end of file
diff --git a/src/message/msg_tracks.c b/src/message/msg_tracks.c
new file mode 100644 (file)
index 0000000..aa15a5b
--- /dev/null
@@ -0,0 +1,79 @@
+
+    #include "msg_tracks.h"
+
+    msg_tracks_obj * msg_tracks_construct(const msg_tracks_cfg * cfg) {
+
+        msg_tracks_obj * obj;
+
+        obj = (msg_tracks_obj *) malloc(sizeof(msg_tracks_obj));
+
+        obj->timeStamp = 0;
+        obj->fS = cfg->fS;
+        obj->tracks = tracks_construct_zero(cfg->nTracks);
+
+        return obj;
+
+    }
+
+    void msg_tracks_destroy(msg_tracks_obj * obj) {
+
+        tracks_destroy(obj->tracks);
+        free((void *) obj);
+
+    }
+
+    void msg_tracks_copy(msg_tracks_obj * dest, const msg_tracks_obj * src) {
+
+        dest->timeStamp = src->timeStamp;
+        dest->fS = src->fS;
+        tracks_copy(dest->tracks, src->tracks);
+
+    }
+
+    void msg_tracks_zero(msg_tracks_obj * obj) {
+
+        obj->timeStamp = 0;
+        obj->fS = 0;
+        tracks_zero(obj->tracks);
+
+    }
+
+    unsigned int msg_tracks_isZero(const msg_tracks_obj * obj) {
+
+        unsigned int rtnValue;
+
+        if (obj->timeStamp == 0) {
+            rtnValue = 1;
+        }
+        else {
+            rtnValue = 0;
+        }
+
+        return rtnValue;
+
+    }
+
+    msg_tracks_cfg * msg_tracks_cfg_construct(void) {
+
+        msg_tracks_cfg * cfg;
+
+        cfg = (msg_tracks_cfg *) malloc(sizeof(msg_tracks_cfg));
+
+        cfg->nTracks = 0;
+
+        return cfg;
+
+    }
+
+    void msg_tracks_cfg_destroy(msg_tracks_cfg * cfg) {
+
+        free((void *) cfg);
+
+    }
+
+    void msg_tracks_cfg_printf(const msg_tracks_cfg * msg_tracks_config) {
+
+        printf("nTracks = %u\n", msg_tracks_config->nTracks);
+        printf("fS = %u\n", msg_tracks_config->fS);        
+
+    }    
\ No newline at end of file
diff --git a/src/message/msg_tracks.h b/src/message/msg_tracks.h
new file mode 100644 (file)
index 0000000..8258136
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef __ODAS_MESSAGE_TRACKS
+#define __ODAS_MESSAGE_TRACKS
+
+    #include <stdlib.h>
+    #include "../signal/track.h"
+
+    typedef struct msg_tracks_obj {
+
+        unsigned long long timeStamp;
+        unsigned int fS;
+        tracks_obj * tracks;
+
+    } msg_tracks_obj;
+
+    typedef struct msg_tracks_cfg {
+
+        unsigned int nTracks;
+        unsigned int fS;
+
+    } msg_tracks_cfg;
+
+    msg_tracks_obj * msg_tracks_construct(const msg_tracks_cfg * cfg);
+
+    void msg_tracks_destroy(msg_tracks_obj * obj);
+
+    void msg_tracks_copy(msg_tracks_obj * dest, const msg_tracks_obj * src);
+
+    void msg_tracks_zero(msg_tracks_obj * obj);
+
+    unsigned int msg_tracks_isZero(const msg_tracks_obj * obj);
+
+    msg_tracks_cfg * msg_tracks_cfg_construct(void);
+
+    void msg_tracks_cfg_destroy(msg_tracks_cfg * cfg);
+
+    void msg_tracks_cfg_printf(const msg_tracks_cfg * msg_tracks_config);
+
+#endif
\ No newline at end of file