This library provides data update method to Fastsensing.
Dependents: SCP1000_Fastsensing
Fastsensing.h
00001 /* 00002 MIT License 00003 00004 Copyright (c) 2017 Fast Sensing Inc. 00005 00006 Permission is hereby granted, free of charge, to any person obtaining a copy 00007 of this software and associated documentation files (the "Software"), to deal 00008 in the Software without restriction, including without limitation the rights 00009 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00010 copies of the Software, and to permit persons to whom the Software is 00011 furnished to do so, subject to the following conditions: 00012 00013 The above copyright notice and this permission notice shall be included in all 00014 copies or substantial portions of the Software. 00015 00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00019 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00020 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00021 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00022 SOFTWARE. 00023 */ 00024 00025 #ifndef FASTSENSING_H 00026 #define FASTSENSING_H 00027 00028 #include "mbed.h" 00029 #include "EthernetInterface.h" 00030 00031 /** Fastsensing Data Update class. 00032 * You can update data to your Fastsensing account used this class. This Liberary is tested on mbedOS 5.3. 00033 * 00034 * Example: 00035 * @code 00036 * #include "mbed.h" 00037 * #include "Fastsensing.h" 00038 * 00039 * Fastsensing fast; 00040 * AnalogIn illu(p20); 00041 * DigitalOut myled(LED1); 00042 * 00043 * int main() 00044 * { 00045 * float lx = illu * 3.3 / 3 * 1000; 00046 * printf("lx : %f\n", lx); 00047 * for(int i = 0; i < 5; i++) { 00048 * fast.updateData("UIYCOQAATQAO5AF7", channel[0], lx,1 ); 00049 * wait(5.0); 00050 * } 00051 * while(1) { 00052 * myled = 1; 00053 * wait(0.5); 00054 * myled = 0; 00055 * wait(0.5); 00056 * } 00057 * } 00058 * @endcode 00059 */ 00060 class Fastsensing { 00061 private: 00062 EthernetInterface eth; //create eth instance from Ethernet 00063 00064 public: 00065 /** 00066 * Only one data update. 00067 * @param *deviceId It is issued your dashboard on fastsening. Device ID length is 16 characters. 00068 * @param *channelId It is issued your dashboard on fastsensing. Channel ID length is 8characters. 00069 * @param data It is the data you want to update. 00070 * @param display 1 is display your sent data and recieve data. 0 is not. 00071 * @return 00072 * 0 on success, -1 on deviceId length error, -2 on channelId length error 00073 */ 00074 int updateData(char *deviceId, char *channelId, double data, int display); 00075 /** 00076 * Only one data update. 00077 * @param *deviceId It is issued your dashboard on fastsening. Device ID length is 16 characters. 00078 * @param *channelId[3] These are issued your dashboard on fastsensing. Channel ID length is 8characters. 00079 * @param data[3] These are the data you want to update. 00080 * @param display 1 is display your sent data and recieve data. 0 is not. 00081 * @return 00082 * 0 on success, -1 on deviceId length error, -2 on channelId length error 00083 */ 00084 int updateDataAll(char *deviceId, char *channelId[3], float data[3], int display); 00085 00086 }; 00087 00088 #endif
Generated on Tue Jul 26 2022 07:29:23 by 1.7.2