aboutsummaryrefslogtreecommitdiff
path: root/libraries/SpacebrewYun/SpacebrewYun.h
diff options
context:
space:
mode:
authorFederico Fissore <f.fissore@arduino.cc>2013-08-07 17:16:13 +0200
committerFederico Fissore <f.fissore@arduino.cc>2013-08-28 10:12:33 +0200
commitaa7d03ba9c6d61597b10d06804bfee7d53b45ce2 (patch)
tree34e58aeb2d5183c44d8988cb6aef369bfeffa3cf /libraries/SpacebrewYun/SpacebrewYun.h
parent39d8b74f58ec5b1cb59ad7879ffed9f6bb66795c (diff)
spacebrew update
Diffstat (limited to 'libraries/SpacebrewYun/SpacebrewYun.h')
-rw-r--r--libraries/SpacebrewYun/SpacebrewYun.h29
1 files changed, 22 insertions, 7 deletions
diff --git a/libraries/SpacebrewYun/SpacebrewYun.h b/libraries/SpacebrewYun/SpacebrewYun.h
index 8fd7bd2..df608c1 100644
--- a/libraries/SpacebrewYun/SpacebrewYun.h
+++ b/libraries/SpacebrewYun/SpacebrewYun.h
@@ -11,6 +11,7 @@ enum SBmsg {
CONNECTION_START = char(28),
CONNECTION_END = char(27),
CONNECTION_ERROR = char(26),
+ MSG_CONFIRM = char(7),
MSG_START = char(29),
MSG_DIV = char(30),
MSG_END = char(31)
@@ -19,14 +20,16 @@ enum SBmsg {
struct Publisher {
char *name;
char *type;
- char *defaultValue;
- Publisher * next;
+ char *lastMsg;
+ Publisher *next;
+ int confirmed;
+ long time;
};
struct Subscriber{
char *name;
char *type;
- Subscriber * next;
+ Subscriber *next;
};
int const pidLength = 6;
@@ -46,12 +49,13 @@ class SpacebrewYun {
void monitor();
void onMessage();
+ void onConfirm();
boolean connected();
void send(const String&, const String&);
void send(const String& name, char * value) { send(name, String(value)); }
- void send(const String& name, bool value){ send(name, (value ? "true" : "false")); };
+ void send(const String& name, bool value){ send(name, (value ? String("true") : String("false"))); };
void send(const String& name, int value) { send(name, String(value)); };
void send(const String& name, long value) { send(name, String(value)); };
void send(const String& name, float value) { send(name, String(value)); };
@@ -102,8 +106,13 @@ class SpacebrewYun {
boolean read_name;
boolean read_msg;
- int sub_name_max;
- int sub_msg_max;
+ boolean read_confirm;
+ static int sub_name_max;
+ static int sub_msg_str_max;
+ static int sub_msg_int_max;
+ static int sub_msg_bool_max;
+ // int sub_name_max;
+ // int sub_msg_str_max;
Process pids;
char pid [6];
@@ -113,10 +122,16 @@ class SpacebrewYun {
void getPids();
static char * createString(int len){
- char * out = ( char * )malloc( len + 1 );
+ char * out = ( char * ) malloc ( len + 1 );
return out;
}
+ static void emptyString(char * str, int len){
+ for (int i = 0; i < len; i++) {
+ str[i] = '\0';
+ }
+ }
+
};
#endif