char queue for WiFi communication

Committer:
williampeers
Date:
Wed Aug 23 02:10:23 2017 +0000
Revision:
2:8f54ba4d961f
Parent:
1:f9e6627f1f59

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
williampeers 0:043b1271ed1b 1 #ifndef __STRQUEUE_INCLUDED__
williampeers 0:043b1271ed1b 2 #define __STRQUEUE_INCLUDED__
williampeers 0:043b1271ed1b 3
williampeers 0:043b1271ed1b 4 #include "mbed.h"
williampeers 1:f9e6627f1f59 5 #include "commands.h"
williampeers 0:043b1271ed1b 6
williampeers 0:043b1271ed1b 7 class StrQueue {
williampeers 0:043b1271ed1b 8 public:
williampeers 0:043b1271ed1b 9 StrQueue();
williampeers 0:043b1271ed1b 10 StrQueue(int size);
williampeers 0:043b1271ed1b 11 ~StrQueue();
williampeers 0:043b1271ed1b 12 int put(const char* message, int length = 0);
williampeers 0:043b1271ed1b 13 int get(char* str, int size);
williampeers 0:043b1271ed1b 14 int getChars(char* chars, int size);
williampeers 0:043b1271ed1b 15 bool isfull();
williampeers 1:f9e6627f1f59 16 bool isEmpty();
williampeers 0:043b1271ed1b 17
williampeers 0:043b1271ed1b 18 private:
williampeers 2:8f54ba4d961f 19 Mutex* lock;
williampeers 0:043b1271ed1b 20 bool empty, full;
williampeers 0:043b1271ed1b 21 int front, back;
williampeers 0:043b1271ed1b 22 int size;
williampeers 0:043b1271ed1b 23 char* chars;
williampeers 0:043b1271ed1b 24 };
williampeers 0:043b1271ed1b 25
williampeers 0:043b1271ed1b 26 #endif