Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Homepage
Information
Dependencies not included with library:
Example¶
#include "mbed.h"
#include "CommHandler.h"
DigitalOut myled(LED1);
CommHandler msgs;
char *one(char* msg)
{
// you can parse msg here
LOG("\n");
return msg;
}
class Wrap
{
public:
Wrap(){}
char *two(char *msg)
{
// you can parse msg here
LOG("\n");
return msg;
}
}obj;
char *three(char* msg)
{
// you can parse msg here
LOG("\n");
return msg;
}
int main()
{
char *tmp = 0;
msgs.attachMsg("One", &one);
msgs.attachMsg("Two", &obj, &Wrap::two);
msgs.attachMsg("Three", &three);
tmp = msgs.messageLookup(0);
printf("0:%s\n", tmp);
tmp = msgs.messageLookup(1);
printf("1:%s\n", tmp);
tmp = msgs.messageLookup(2);
printf("2:%s\n", tmp);
tmp = msgs.messageLookup(3);
printf("3:%s\n", tmp);
tmp = msgs.messageLookup(4);
printf("4:%s\n", tmp);
tmp = msgs.serviceMessage("Two-00-66-99-20133");
printf("1: Found: %s\n", tmp);
tmp = msgs.serviceMessage("One-99-60-1-339788354");
printf("2: Found: %s\n", tmp);
tmp = msgs.serviceMessage("Three-xx-xx-XX-XXXXXXX");
printf("3: Found: %s\n", tmp);
error("End of Test\n");
}