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.
Dependents: XPL-App4_cleanup XPL-App5
xPL_Message.h
00001 /* 00002 * xPL.Arduino v0.1, xPL Implementation for Arduino 00003 * 00004 * This code is parsing a xPL message stored in 'received' buffer 00005 * - isolate and store in 'line' buffer each part of the message -> detection of EOL character (DEC 10) 00006 * - analyse 'line', function of its number and store information in xpl_header memory 00007 * - check for each step if the message respect xPL protocol 00008 * - parse each command line 00009 * 00010 * Copyright (C) 2012 johan@pirlouit.ch, olivier.lebrun@gmail.com 00011 * Original version by Gromain59@gmail.com 00012 * 00013 * This program is free software; you can redistribute it and/or 00014 * modify it under the terms of the GNU General Public License 00015 * as published by the Free Software Foundation; either version 2 00016 * of the License, or (at your option) any later version. 00017 * 00018 * This program is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License 00024 * along with this program; if not, write to the Free Software 00025 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00026 */ 00027 00028 #ifndef xPLMessage_h 00029 #define xPLMessage_h 00030 00031 //#include "Arduino.h" 00032 #include "mbed.h" 00033 #include "xPL_utils.h" 00034 00035 #define XPL_CMND 1 00036 #define XPL_STAT 2 00037 #define XPL_TRIG 3 00038 00039 #define XPL_MESSAGE_BUFFER_MAX 256 // going over 256 would mean changing index from byte to int 00040 #define XPL_MESSAGE_COMMAND_MAX 10 00041 00042 class xPL_Message 00043 { 00044 public: 00045 short type; // 1=cmnd, 2=stat, 3=trig 00046 short hop; // Hop count 00047 00048 struct_id source; // source identification 00049 struct_id target; // target identification 00050 00051 struct_xpl_schema schema; 00052 struct_command *command; 00053 //byte command_count; 00054 short command_count; 00055 00056 bool AddCommand(const char *,const char *); 00057 bool AddCommand(char*, char*); 00058 00059 xPL_Message(); 00060 ~xPL_Message(); 00061 00062 char *toString(); 00063 00064 bool IsSchema(char*, char*); 00065 bool IsSchema(const char*, const char*); 00066 00067 void SetSource(char *, char *, char *); // define my source 00068 void SetTarget(const char *, const char * = NULL, const char * = NULL); 00069 void SetSchema(const char *, const char *); 00070 00071 00072 private: 00073 bool CreateCommand(); 00074 }; 00075 00076 #endif
Generated on Thu Jul 28 2022 00:39:57 by
1.7.2