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: WncControllerK64F
Fork of WNCInterface by
IOTSMS.h
00001 /* ===================================================================== 00002 Copyright © 2016, Avnet (R) 00003 00004 Contributors: 00005 * James M Flynn, www.em.avnet.com 00006 00007 Licensed under the Apache License, Version 2.0 (the "License"); 00008 you may not use this file except in compliance with the License. 00009 You may obtain a copy of the License at 00010 00011 http://www.apache.org/licenses/LICENSE-2.0 00012 00013 Unless required by applicable law or agreed to in writing, 00014 software distributed under the License is distributed on an 00015 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 00016 either express or implied. See the License for the specific 00017 language governing permissions and limitations under the License. 00018 00019 @file IOTSMS.h 00020 @version 1.0 00021 @date Oct 2016 00022 00023 ======================================================================== */ 00024 00025 #ifndef WNCSms_H_ 00026 #define WNCSms_H_ 00027 00028 #include "mbed.h" 00029 #include "rtos.h" 00030 00031 #include "WNCInterface.h" 00032 #include "RtosTimer.h" 00033 #include "Callback.h" 00034 00035 typedef struct SmsMsg { 00036 string number; 00037 string date; 00038 string time; 00039 string msg; 00040 } WNCSmsMsg; 00041 00042 /** Component to use the Short Messages Service (SMS) **/ 00043 class WNCSms 00044 { 00045 private: 00046 unsigned int m_smsinit; 00047 void m_smscheck(void); 00048 uint32_t m_timer; 00049 00050 protected: 00051 WNCSmsMsg m_MsgText; 00052 RtosTimer *m_SMStimer; 00053 struct WncController_fk::WncController::WncSmsList m_smsmsgs; //use the WncSmsList structure to hold messages 00054 mbed::Callback<void (WNCSmsMsg&)> m_callback; //pointer to the call-back function the user specified 00055 00056 public: 00057 WNCSms(); /** Create SMSInterface instance */ 00058 00059 /** Initialize interface **/ 00060 int init(uint32_t poll=0, void ((*cb)(WNCSmsMsg& s))=NULL); 00061 00062 /** Send a SM 00063 @param string& receiver's contact number 00064 @param string& the message to send 00065 @return 0 on success, error code on failure 00066 */ 00067 int send(const string& number, const string& message); 00068 00069 00070 /** Receive a SM 00071 @param string Pointer to the sender's phone number 00072 @param string Pointer to store the the incoming message into 00073 @return 0 on success, error code on failure 00074 */ 00075 int get(string& number, string& message); 00076 00077 /** Get the users number to use for SMS messaging 00078 @param none 00079 @return character pointer on success, NULL on failure 00080 */ 00081 char * getSMSNbr( void ); 00082 00083 /** Attached a callback function for a Receive SMS 00084 @param fp(string&) a function that takes a string as an input argument 00085 */ 00086 void attach(void (*fp)(WNCSmsMsg& s)) {m_callback.attach(fp);} 00087 00088 }; 00089 00090 #endif /* WNCSms_H_ */
Generated on Tue Jul 12 2022 18:50:29 by
