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.
Dependencies: mbed
TransLayer.h
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 2 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * This program is distributed in the hope that it will be useful, 00008 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 * GNU General Public License for more details. 00011 * 00012 * You should have received a copy of the GNU General Public License 00013 * along with this program; if not, write to the Free Software 00014 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00015 * MA 02110-1301, USA. 00016 * 00017 */ 00018 00019 /** 00020 * \brief This file contains functions defines and definations 00021 * required by trans_layer.c 00022 * \author Navin Bhaskar 00023 */ 00024 00025 00026 #ifndef __TRANS_LAYER_H 00027 #define __TRANS_LAYER_H 00028 00029 #include <stdlib.h> 00030 #include "Console.h" 00031 #include "PerAccess.h" 00032 00033 00034 typedef void(* call_back_ptr)(Console * cons, PerAccess * per, char*, int ); /**< typedef for callback function pointer for protocol packets*/ 00035 00036 typedef struct service_list* service_ptr; /**< pointer to next service */ 00037 00038 struct service_list /**< Struct for holding service list */ 00039 { 00040 //char* service_name; /**< pointer to the name of the service */ 00041 call_back_ptr service_function; /**< call back function pointer */ 00042 char service_flag; /**< Packet service flag for which this service responds*/ 00043 service_ptr next_service; 00044 }; 00045 00046 00047 #define PACKET_START 'S' /**< Start of packet indicator */ 00048 #define QUERY_ADC_DATA 'A' /**< Control pcaket for quering ADC data */ 00049 #define SET_LCD_DATA 'L' /**< To transmit string to be displayed on LCD */ 00050 #define PACKET_ACK 'V' /**< Acknowledgement flag */ 00051 #define PACKET_NACK 'N' /**< Negative acknowledgement */ 00052 #define PACKET_DAT 'D' /**< Data follows after length field */ 00053 #define PACKET_CMD 'C' /**< Command follows this field */ 00054 00055 #define PIN_OP 'P' /**< Flag indicating pin operations */ 00056 00057 class TransLayer 00058 { 00059 private: 00060 service_ptr _head, _tail; 00061 public: 00062 TransLayer(); 00063 int AddService(call_back_ptr, char flag); 00064 void MainLoop(Console *, PerAccess *); 00065 service_ptr LookForService(char flag); 00066 }; 00067 00068 #define PRINT_OK Serial.println(" OK"); /**< A framing method */ 00069 00070 #endif 00071
Generated on Thu Aug 4 2022 08:49:39 by
1.7.2