Host software for the MAX30001 ECG, PACE, biopotential, bioimpedance, R-to-R peak sensor. Hosted on the MAX32630FTHR.

Dependencies:   SDFileSystem USBDevice max32630fthr

Fork of MAX30001 SYS EvKit by Emre Eken

MAX30001-MAX32630FTHR ECG Evaluation System

The MAX30001 EVKIT SYS-MBED Evaluation System (EV System) is used to evaluates the MAX30001 sensor, which is an ECG (electrocardiogram), biopotential and bioimpedance analog front end solution for wearable applications. The full evaluation system consists of the MAX32630FTHR board, MAX30001 EVKIT sensor board and the evaluation software. The evaluation kit features ECG, PACE, R-to-R (R-peak timing) detection; bioimpedance (BioZ) AFE; and raw data logging.

The MAX30001 EVKIT evaluation system is assembled, tested and contains the necessary circuitry and connections to evaluate the MAX30001 ECG sensor.

When evaluated as an evaluation system, the MAX32630FTHR board provides the necessary logic rails, master clock, SPI, USB-to-Serial interfaces that are needed to evaluate the MAX30001 sensor board. MAX32630FTHR can be used as an independent development platform.

Communication between the PC and the MAX32630FTHR board is facilitated by a Windows 7, Windows 8 and Windows 10 compatible software that provides a simple and intuitive graphical user interface (GUI).

For more information, visit the wiki pages by clicking the wiki tab above and MAX30001EVSYS product page.

C++ source code, library for the MAX30001 ECG drivers are in the links at the bottom of this page. The sample code includes the ability to log data to the SD card of the MAX32630FTHR.

MAX30001 EVKIT Pinout Connections

/media/uploads/EmreE/max30001_sensor_board_connector_pinout.png

Where to Buy

MAX30001EVSYS-Buy

Committer:
Emre.Eken
Date:
Tue Jul 24 15:22:35 2018 +0300
Revision:
13:6031b0bd9773
Parent:
0:8e4630a71eb1
.hgtags is added.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 1 /*******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 3 *
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 4 * Permission is hereby granted, free of charge, to any person obtaining a
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 5 * copy of this software and associated documentation files (the "Software"),
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 6 * to deal in the Software without restriction, including without limitation
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 8 * and/or sell copies of the Software, and to permit persons to whom the
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 9 * Software is furnished to do so, subject to the following conditions:
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 10 *
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 11 * The above copyright notice and this permission notice shall be included
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 12 * in all copies or substantial portions of the Software.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 13 *
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 20 * OTHER DEALINGS IN THE SOFTWARE.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 21 *
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 22 * Except as contained in this notice, the name of Maxim Integrated
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 24 * Products, Inc. Branding Policy.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 25 *
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 26 * The mere transfer of this software does not imply any licenses
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 27 * of trade secrets, proprietary technology, copyrights, patents,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 28 * trademarks, maskwork rights, or any other form of intellectual
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 30 * ownership rights.
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 31 *******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 32 */
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 33 #include "RpcServer.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 34 #include "StringInOut.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 35 #include "StringHelper.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 36 #include "MAX30001_RPC.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 37 #include "Logging_RPC.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 38 #include "Peripherals.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 39 #include "HspLed_RPC.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 40 #include "S25FS512_RPC.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 41 #include "Testing_RPC.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 42 #include "RpcDeclarations.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 43 #include "Device_Logging.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 44 #include "../version.h"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 45
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 46 /// define the version string that is reported with a RPC "ReadVer" command
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 47 #define FW_VERSION_STRING "MAX30001 FW Ver"
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 48
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 49 char args[32][32];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 50 char results[32][32];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 51
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 52 /// define a fifo for incoming USB data
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 53 static fifo_t fifo;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 54 /// define a buffer for incoming USB data
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 55 static uint8_t fifoBuffer[128];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 56 /// define stream out fifo
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 57 static fifo_t fifoStreamOut;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 58 /// allocate a large fifo buffer for streaming out
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 59 static uint32_t streamOutBuffer[0xC000 / 4];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 60
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 61 /// define a device log for the BMP280, keeps track of mission and loggin status
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 62 Device_Logging *bmp280_Logging;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 63 /// define a device log for the MAX30205 (instance 0), keeps track of mission
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 64 /// and loggin status
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 65 Device_Logging *MAX30205_0_Logging;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 66 /// define a device log for the MAX30205 (instance 1), keeps track of mission
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 67 /// and loggin status
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 68 Device_Logging *MAX30205_1_Logging;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 69
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 70 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 71 fifo_t *GetUSBIncomingFifo(void) { return &fifo; }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 72
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 73 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 74 fifo_t *GetStreamOutFifo(void) { return &fifoStreamOut; }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 75
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 76 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 77 int System_ReadVer(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 78 char version[32];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 79 snprintf(version, sizeof(version)/sizeof(char), "%s %d.%d.%d %02d/%02d/%02d",
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 80 FW_VERSION_STRING, VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 81 VERSION_MONTH, VERSION_DAY, VERSION_SHORT_YEAR);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 82 strcpy(replyStrs[0], version);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 83 strcpy(replyStrs[1], "\0");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 84 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 85 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 86
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 87 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 88 int System_ReadBuildTime(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 89 // strcpy(replyStrs[0],buildTime);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 90 // strcpy(replyStrs[1],"\0");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 91 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 92 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 93
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 94 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 95 int System_SystemCoreClock(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 96 sprintf(replyStrs[0], "SystemCoreClock = %d", SystemCoreClock);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 97 strcpy(replyStrs[1], "\0");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 98 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 99 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 100
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 101 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 102 int System_GetTimestamp(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 103 sprintf(replyStrs[0], "GetTimestamp = %d", 0);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 104 strcpy(replyStrs[1], "\0");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 105 return 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 106 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 107
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 108 static struct RPC_Object RPC_Procedures = {NULL, NULL};
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 109
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 110 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 111 void RPC_addProcedure(struct RPC_registeredProcedure *procedure) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 112 struct RPC_Object *obj = &RPC_Procedures;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 113 if (obj->last != NULL) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 114 obj->last->next = procedure;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 115 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 116 if (obj->head == NULL) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 117 obj->head = procedure;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 118 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 119 procedure->next = NULL;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 120 obj->last = procedure;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 121 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 122
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 123 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 124 void RPC_init(void) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 125
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 126 fifo_init(&fifo, fifoBuffer, sizeof(fifoBuffer));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 127 fifo_init(&fifoStreamOut, streamOutBuffer,
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 128 sizeof(streamOutBuffer) / sizeof(uint32_t));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 129
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 130 // MAX30001
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 131 RPC_addProcedure(&Define_MAX30001_WriteReg);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 132 RPC_addProcedure(&Define_MAX30001_ReadReg);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 133 RPC_addProcedure(&Define_MAX30001_Start);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 134 RPC_addProcedure(&Define_MAX30001_Stop);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 135 RPC_addProcedure(&Define_MAX30001_Enable_ECG_LeadON);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 136 RPC_addProcedure(&Define_MAX30001_Enable_BIOZ_LeadON);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 137 RPC_addProcedure(&Define_MAX30001_Read_LeadON);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 138 RPC_addProcedure(&Define_MAX30001_StartTest);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 139 RPC_addProcedure(&Define_MAX30001_INT_assignment);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 140 RPC_addProcedure(&Define_MAX30001_Rbias_FMSTR_Init);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 141 RPC_addProcedure(&Define_MAX30001_CAL_InitStart);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 142 RPC_addProcedure(&Define_MAX30001_ECG_InitStart);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 143 RPC_addProcedure(&Define_MAX30001_ECGFast_Init);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 144 RPC_addProcedure(&Define_MAX30001_PACE_InitStart);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 145 RPC_addProcedure(&Define_MAX30001_BIOZ_InitStart);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 146 RPC_addProcedure(&Define_MAX30001_RtoR_InitStart);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 147 RPC_addProcedure(&Define_MAX30001_Stop_ECG);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 148 RPC_addProcedure(&Define_MAX30001_Stop_PACE);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 149 RPC_addProcedure(&Define_MAX30001_Stop_BIOZ);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 150 RPC_addProcedure(&Define_MAX30001_Stop_RtoR);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 151 RPC_addProcedure(&Define_MAX30001_Stop_Cal);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 152
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 153 // Logging
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 154 RPC_addProcedure(&Define_Logging_StartMissionDefine);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 155 RPC_addProcedure(&Define_Logging_AppendMissionCmd);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 156 RPC_addProcedure(&Define_Logging_EndMissionDefine);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 157 RPC_addProcedure(&Define_Logging_WriteMission);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 158 RPC_addProcedure(&Define_Logging_ReadMission);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 159 RPC_addProcedure(&Define_Logging_EraseMission);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 160 RPC_addProcedure(&Define_Logging_EraseWrittenSectors);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 161 RPC_addProcedure(&Define_Logging_StartLoggingUsb);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 162 RPC_addProcedure(&Define_Logging_StartLoggingFlash);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 163 RPC_addProcedure(&Define_Logging_GetLastWrittenPage);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 164 RPC_addProcedure(&Define_Logging_Start);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 165
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 166 // led
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 167 RPC_addProcedure(&Define_Led_On);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 168 RPC_addProcedure(&Define_Led_Off);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 169 RPC_addProcedure(&Define_Led_BlinkHz);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 170 RPC_addProcedure(&Define_Led_BlinkPattern);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 171
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 172 // S25FS512
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 173 RPC_addProcedure(&Define_S25FS512_ReadId);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 174 RPC_addProcedure(&Define_S25FS512_ReadPagesBinary);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 175 RPC_addProcedure(&Define_S25FS512_Reset);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 176 RPC_addProcedure(&Define_S25FS512_EnableHWReset);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 177 RPC_addProcedure(&Define_S25FS512_SpiWriteRead);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 178 RPC_addProcedure(&Define_S25FS512_SpiWriteRead4Wire);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 179
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 180 RPC_addProcedure(&Define_Testing_Test_MAX30001);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 181
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 182 // SDCard
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 183 RPC_addProcedure(&Define_SDCard_IsReady);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 184
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 185 // System
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 186 RPC_addProcedure(&Define_System_ReadVer);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 187 RPC_addProcedure(&Define_System_ReadBuildTime);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 188 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 189
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 190 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 191 struct RPC_registeredProcedure *RPC_lookup(char *objectName, char *methodName) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 192 struct RPC_registeredProcedure *ptr;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 193 // lookup all registered methods
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 194 ptr = RPC_Procedures.head;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 195 while (ptr != NULL) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 196 if (strcmp(ptr->objectName, objectName) == 0 &&
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 197 strcmp(ptr->methodName, methodName) == 0) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 198 // we found a match... return with it
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 199 return ptr;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 200 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 201 ptr = ptr->next;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 202 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 203 return NULL;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 204 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 205
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 206 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 207 char *GetToken(char *inStr, char *outStr, int start, char ch) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 208 int i;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 209 int index = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 210 int length = strlen(inStr);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 211 for (i = start; i < length; i++) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 212 if (inStr[i] != ch) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 213 outStr[index++] = inStr[i];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 214 } else {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 215 break;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 216 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 217 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 218 outStr[index++] = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 219 return outStr;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 220 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 221
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 222 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 223 void SendCommandList(char *reply) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 224 struct RPC_registeredProcedure *ptr;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 225 reply[0] = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 226 ptr = RPC_Procedures.head;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 227 while (ptr != NULL) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 228 strcat(reply, "/");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 229 strcat(reply, ptr->objectName);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 230 strcat(reply, "/");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 231 strcat(reply, ptr->methodName);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 232 strcat(reply, ",");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 233 ptr = ptr->next;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 234 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 235 strcat(reply, "\r\n");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 236 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 237
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 238 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 239 int CheckForDoubleQuote(char *str) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 240 int doubleQuoteFound;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 241 // scan through arguments, see if there is a double quote for a string
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 242 // argument
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 243 doubleQuoteFound = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 244 while (*str != 0) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 245 if (*str == '\"') {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 246 doubleQuoteFound = 1;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 247 break;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 248 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 249 str++;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 250 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 251 return doubleQuoteFound;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 252 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 253
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 254 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 255 void ExtractDoubleQuoteStr(char *src, char *dst) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 256 int start;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 257
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 258 dst[0] = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 259 start = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 260 while (*src != 0) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 261 // look for start
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 262 if ((*src == '\"') && (start == 0)) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 263 start = 1;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 264 src++;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 265 continue;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 266 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 267 // look for end
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 268 if ((*src == '\"') && (start == 1)) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 269 *dst = 0; // terminate the string
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 270 break;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 271 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 272 if (start == 1) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 273 *dst = *src;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 274 dst++;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 275 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 276 src++;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 277 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 278 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 279
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 280 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 281 void RPC_call_test(void) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 282 int doubleQuoteFound;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 283 char doubleQuoteStr[64];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 284 char *request = "/Logging/AppendMissionCmd \"BMP280 InitStart 1\"";
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 285
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 286 // scan through arguments, see if there is a double quote for a string
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 287 // argument
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 288 doubleQuoteFound = CheckForDoubleQuote(request);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 289 if (doubleQuoteFound) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 290 ExtractDoubleQuoteStr(request, doubleQuoteStr);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 291 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 292 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 293
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 294 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 295 void RPC_call(char *request, char *reply) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 296 const char slash[2] = "/";
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 297 const char space[2] = " ";
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 298 char *objectName;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 299 char *methodName;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 300 char doubleQuoteStr[128];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 301 char requestCpy[256];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 302 char *token;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 303 int argIndex;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 304 int resultIndex;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 305 int doubleQuoteFound;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 306 struct RPC_registeredProcedure *procedurePtr;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 307
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 308 // clear out the reply
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 309 reply[0] = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 310 // copy the request for scanning and extraction later
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 311 strcpy(requestCpy, request);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 312 // check for beginning forward slash
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 313 if (request[0] != '/') {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 314 return;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 315 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 316 // check for only a forward slash
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 317 if (request[0] == '/' && request[1] == 0) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 318 SendCommandList(reply);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 319 return;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 320 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 321 strcat(request, " ");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 322 // get the object name
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 323 token = strtok(request, slash);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 324 // token = GetToken(request, tokenBuffer, 1, '/');
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 325 objectName = token;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 326 if (objectName == NULL)
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 327 return; // must have an object name
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 328 // get the method name
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 329 token = strtok(NULL, space);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 330 methodName = token;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 331 if (methodName == NULL)
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 332 return; // must have a method name
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 333
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 334 // scan through arguments, see if there is a double quote for a string
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 335 // argument
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 336 doubleQuoteFound = CheckForDoubleQuote(requestCpy);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 337
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 338 if (doubleQuoteFound == 0) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 339 // walk through arguments
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 340 argIndex = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 341 token = strtok(NULL, space);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 342 while (token != NULL) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 343 // save this arg in array
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 344 strcpy(args[argIndex++], token);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 345 // read next token arg if any
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 346 token = strtok(NULL, space);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 347 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 348 // terminate the end of the string array with an empty string
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 349 strcpy(args[argIndex], "\0");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 350 strcpy(results[0], "\0");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 351 } else {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 352 // grab out the double quote string
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 353 ExtractDoubleQuoteStr(requestCpy, doubleQuoteStr);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 354 argIndex = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 355 // token = strtok(NULL, quote);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 356 strcpy(args[argIndex++], doubleQuoteStr);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 357 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 358
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 359 //
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 360 // alias the MAX30001 and MAX30003 names
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 361 //
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 362 if (strcmp(objectName, MAX30003_NAME) == 0) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 363 strcpy(objectName, MAX30001_NAME);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 364 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 365
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 366 procedurePtr = RPC_lookup(objectName, methodName);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 367 if (procedurePtr != NULL) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 368 // printf("RPC_call: %s processing\n",requestCpy);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 369 procedurePtr->func(args, results);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 370 } else {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 371 printf("RPC_call: %s not found\n", requestCpy);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 372 // printf("Unable to lookup %s %s", objectName, methodName);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 373 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 374
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 375 // loop while (if) there are results to return
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 376 resultIndex = 0;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 377 strcpy(reply, "\0");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 378 while (results[resultIndex][0] != '\0') {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 379 strcat(reply, results[resultIndex++]);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 380 strcat(reply, " ");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 381 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 382 strcat(reply, "\r\n");
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 383 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 384
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 385 //******************************************************************************
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 386 void RPC_ProcessCmds(char *cmds) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 387 char cmd[32 * 32];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 388 char *ptrCmds;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 389 char reply[512];
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 390 ptrCmds = cmds;
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 391
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 392 while (*ptrCmds != 0) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 393 ptrCmds = ParseUntilCRLF(ptrCmds, cmd, sizeof(cmd));
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 394 if (*cmd != 0) {
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 395 RPC_call(cmd, reply);
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 396 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 397 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 398 }
Emre.Eken@IST-LT-35101.maxim-ic.internal 0:8e4630a71eb1 399