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.
afTransport.h
00001 /** 00002 * Copyright 2016 Afero, Inc. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef AFLIB_AFTRANSPORT_H 00017 #define AFLIB_AFTRANSPORT_H 00018 00019 #include "StatusCommand.h" 00020 00021 class afTransport { 00022 public: 00023 /* 00024 * checkForInterrupt 00025 * 00026 * For interfaces that don't use the interrupt pin to signal they want the state machine to run (like UART). 00027 */ 00028 virtual void checkForInterrupt(volatile int *interrupts_pending, bool idle) = 0; 00029 00030 /* 00031 * exchangeStatus 00032 * 00033 * Write a status message to the interface and read one back. 00034 */ 00035 virtual int exchangeStatus(StatusCommand *tx, StatusCommand *rx) = 0; 00036 00037 /* 00038 * writeStatus 00039 * 00040 * Write the specified status message to the interface. 00041 */ 00042 virtual int writeStatus(StatusCommand *c) = 0; 00043 00044 /* 00045 * sendBytes 00046 * 00047 * Write the specified bytes to the interface. 00048 */ 00049 virtual void sendBytes(char *bytes, int len) = 0; 00050 00051 /* 00052 * recvBytes 00053 * 00054 * Read the specified bytes from the interface. 00055 */ 00056 virtual void recvBytes(char *bytes, int len) = 0; 00057 00058 /* 00059 * sendBytesOffset 00060 * 00061 * Write bytes using an interface specific packet size. 00062 * It may take multiple calls to this method to write all of the bytes. 00063 * 00064 * @param bytes buffer of bytes to be written. 00065 * @param bytesToSend Pointer to count of total number of bytes to be written. 00066 * This value is decremented after each packet is written and will be 0 when all bytes have been sent. 00067 * @param offset Pointer to offset into bytes buffer. 00068 * This value is incremented after each packet is written and will equal bytesToSend when all bytes have been sent. 00069 */ 00070 virtual void sendBytesOffset(char *bytes, uint16_t *bytesToSend, uint16_t *offset) = 0; 00071 00072 /* 00073 * recvBytesOffset 00074 * 00075 * Read bytes using an interface specific packet size. 00076 * It may take multiple calls to this method to read all of the bytes. 00077 * 00078 * @param bytes Pointer to buffer of bytes to read into. 00079 * This buffer is allocated for all bytesToRecv before the first packet is read. 00080 * NOTE: IT IS THE CALLER'S RESPONSIBILITY TO FREE THIS BUFFER. 00081 * @param bytesToRecv Pointer to count of total number of bytes to be read. 00082 * This value is decremented after each packet is read and will be 0 when all bytes have been read. 00083 * @param offset Pointer to offset into bytes buffer. 00084 * This value is incremented after each packet is read and will equal bytesToRecv when all bytes have been read. 00085 */ 00086 virtual void recvBytesOffset(char **bytes, uint16_t *bytesLen, uint16_t *bytesToRecv, uint16_t *offset) = 0; 00087 }; 00088 00089 #endif 00090 00091
Generated on Wed Jul 13 2022 19:00:06 by
1.7.2