Program the control the fischertechnik robo interface or intelligent interface via tcp socket or via a java gui.

Dependencies:   mbed ConfigFile

Committer:
networker
Date:
Wed May 04 15:42:13 2011 +0000
Revision:
1:2c9d412ad471
Parent:
0:7f26f0680202
first publication (mbed challenge submission)

Who changed what in which revision?

UserRevisionLine numberNew contents of line
networker 0:7f26f0680202 1 #ifndef MYCONFIG_H
networker 0:7f26f0680202 2 #define MYCONFIG_H
networker 0:7f26f0680202 3 #include "ConfigFile.h"
networker 0:7f26f0680202 4 #include <string.h>
networker 0:7f26f0680202 5
networker 0:7f26f0680202 6 class myConfig: public ConfigFile {
networker 0:7f26f0680202 7 public:
networker 0:7f26f0680202 8 static const int MAXLEN_VALUE = 128;//redeclared because inaccessible
networker 0:7f26f0680202 9 int getInt(char *key, int dflt=0) {
networker 0:7f26f0680202 10 char value[MAXLEN_VALUE];
networker 0:7f26f0680202 11 if (getValue(key, value, sizeof(value))) {
networker 0:7f26f0680202 12 int val=dflt;
networker 0:7f26f0680202 13 sscanf(value,"%d", &val);
networker 0:7f26f0680202 14 return val;
networker 0:7f26f0680202 15 }
networker 0:7f26f0680202 16 return dflt;
networker 0:7f26f0680202 17 }
networker 0:7f26f0680202 18 int getLookup(char *key, char*names[], int n) {
networker 0:7f26f0680202 19 char value[MAXLEN_VALUE];
networker 0:7f26f0680202 20 if (getValue(key, value, sizeof(value))) {
networker 0:7f26f0680202 21 for (int i = 0; i < n; i++)
networker 0:7f26f0680202 22 if (strcmp(value, names[i])==0)
networker 0:7f26f0680202 23 return i;
networker 0:7f26f0680202 24 }
networker 0:7f26f0680202 25 return n;
networker 0:7f26f0680202 26 }
networker 0:7f26f0680202 27 };
networker 0:7f26f0680202 28
networker 0:7f26f0680202 29 #endif