<reponame>ConnorCrwf/ECE382V_Embedded_IoT<filename>documentation/latex/group___fona.tex
\hypertarget{group___fona}{}\doxysection{Fona}
\label{group___fona}\index{Fona@{Fona}}


Configure Adafruit FONA Cellular Module.  


\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{group___fona_gaf88b3d8851f26733dfeb48c41e68abad}{FONA\+\_\+\+DEBUG}}~1
\begin{DoxyCompactList}\small\item\em Define for enabling FONA debug output to UART0. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{group___fona_gae0449dd90e20194f9f4ba79d8eb029d1}\label{group___fona_gae0449dd90e20194f9f4ba79d8eb029d1}} 
\#define \mbox{\hyperlink{group___fona_gae0449dd90e20194f9f4ba79d8eb029d1}{SMS\+\_\+\+SIM}}~1
\begin{DoxyCompactList}\small\item\em Save SMS on SIM, Fona\+\_\+\+Set\+SMSStorage. \end{DoxyCompactList}\item 
\mbox{\Hypertarget{group___fona_ga2f4da7f4d977b8001c4c3fc53bda41e8}\label{group___fona_ga2f4da7f4d977b8001c4c3fc53bda41e8}} 
\#define \mbox{\hyperlink{group___fona_ga2f4da7f4d977b8001c4c3fc53bda41e8}{SMS\+\_\+\+FONA}}~0
\begin{DoxyCompactList}\small\item\em Save SMS on Fona, Fona\+\_\+\+Set\+SMSStorage. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{group___fona_gab8decec0a3ee48eca32a70b3f2f98cce}{Fona\+\_\+\+Reset}} (void)
\begin{DoxyCompactList}\small\item\em reset Fona \end{DoxyCompactList}\item 
void \mbox{\hyperlink{group___fona_ga33244a2d030d5660d51e870c7d5f498b}{Fona\+\_\+\+Init}} (uint32\+\_\+t baud)
\begin{DoxyCompactList}\small\item\em Initialize Fona. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{group___fona_gad2172ab89c74fabccc7f0a8631e349b9}{Fona\+\_\+\+Send\+SMS}} (uint8\+\_\+t phone\mbox{[}$\,$\mbox{]}, uint8\+\_\+t message\mbox{[}$\,$\mbox{]})
\begin{DoxyCompactList}\small\item\em Send an SMS Message from a buffer provided. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{group___fona_ga9cecc6ca366f2c73474a1f56e81059ce}{Fona\+\_\+\+Set\+SMSStorage}} (int place)
\begin{DoxyCompactList}\small\item\em Set the preferred SMS storage SMS\+\_\+\+SIM = 1 for storage on the SIM.~\newline
 SMS\+\_\+\+FONA= 0 for storage on the FONA chip. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{group___fona_ga84fae501706eb779c989cf5a70466e5f}{Fona\+\_\+\+Set\+SMSInterrupt}} (int n)
\begin{DoxyCompactList}\small\item\em configure RI pin n=0 off~\newline
 n=1 On(\+TCPIP,\+FTP and URC control RI PIN)~\newline
 n=2 On(only TCPIP control RI PIN) \end{DoxyCompactList}\item 
int32\+\_\+t \mbox{\hyperlink{group___fona_ga0044b57181638a6a0418c87799e5fa35}{Fona\+\_\+\+Get\+Num\+SMS}} (void)
\begin{DoxyCompactList}\small\item\em Get the number of SMS messages. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{group___fona_gaa664f621556d29950e3f9e6b9b66de74}{Fona\+\_\+\+Read\+SMS}} (uint32\+\_\+t message\+\_\+index, char $\ast$smsbuff, uint32\+\_\+t maxlen, uint32\+\_\+t $\ast$readlen)
\begin{DoxyCompactList}\small\item\em Read an SMS message into a provided buffer. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{group___fona_ga054d300d6c000c4e0789806b17500039}{Fona\+\_\+\+Delete\+SMS}} (uint8\+\_\+t message\+\_\+index)
\begin{DoxyCompactList}\small\item\em Delete an SMS Message. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{group___fona_gaea33317caa98bf1c133c3f7a6d263ab0}{Fona\+\_\+\+Get\+SMSSender}} (uint32\+\_\+t message\+\_\+index, char $\ast$sender, int senderlen)
\begin{DoxyCompactList}\small\item\em Retrieve the sender of the specified SMS message and copy it as a string to the sender buffer. Up to senderlen characters of the sender will be copied and a null terminator will be added if less than senderlen characters are copied to the result. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Configure Adafruit FONA Cellular Module. 



\doxysubsection{Macro Definition Documentation}
\mbox{\Hypertarget{group___fona_gaf88b3d8851f26733dfeb48c41e68abad}\label{group___fona_gaf88b3d8851f26733dfeb48c41e68abad}} 
\index{Fona@{Fona}!FONA\_DEBUG@{FONA\_DEBUG}}
\index{FONA\_DEBUG@{FONA\_DEBUG}!Fona@{Fona}}
\doxysubsubsection{\texorpdfstring{FONA\_DEBUG}{FONA\_DEBUG}}
{\footnotesize\ttfamily \#define FONA\+\_\+\+DEBUG~1}



Define for enabling FONA debug output to UART0. 

\begin{DoxyNote}{Note}
Remove this line to save time/space 
\end{DoxyNote}


\doxysubsection{Function Documentation}
\mbox{\Hypertarget{group___fona_ga054d300d6c000c4e0789806b17500039}\label{group___fona_ga054d300d6c000c4e0789806b17500039}} 
\index{Fona@{Fona}!Fona\_DeleteSMS@{Fona\_DeleteSMS}}
\index{Fona\_DeleteSMS@{Fona\_DeleteSMS}!Fona@{Fona}}
\doxysubsubsection{\texorpdfstring{Fona\_DeleteSMS()}{Fona\_DeleteSMS()}}
{\footnotesize\ttfamily int Fona\+\_\+\+Delete\+SMS (\begin{DoxyParamCaption}\item[{uint8\+\_\+t}]{message\+\_\+index }\end{DoxyParamCaption})}



Delete an SMS Message. 


\begin{DoxyParams}{Parameters}
{\em message\+\_\+index} & The message to delete \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true\+: success, false\+: failure 
\end{DoxyReturn}
\mbox{\Hypertarget{group___fona_ga0044b57181638a6a0418c87799e5fa35}\label{group___fona_ga0044b57181638a6a0418c87799e5fa35}} 
\index{Fona@{Fona}!Fona\_GetNumSMS@{Fona\_GetNumSMS}}
\index{Fona\_GetNumSMS@{Fona\_GetNumSMS}!Fona@{Fona}}
\doxysubsubsection{\texorpdfstring{Fona\_GetNumSMS()}{Fona\_GetNumSMS()}}
{\footnotesize\ttfamily int32\+\_\+t Fona\+\_\+\+Get\+Num\+SMS (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



Get the number of SMS messages. 


\begin{DoxyParams}{Parameters}
{\em none} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
number of messages, -\/1\+: failure 
\end{DoxyReturn}
\mbox{\Hypertarget{group___fona_gaea33317caa98bf1c133c3f7a6d263ab0}\label{group___fona_gaea33317caa98bf1c133c3f7a6d263ab0}} 
\index{Fona@{Fona}!Fona\_GetSMSSender@{Fona\_GetSMSSender}}
\index{Fona\_GetSMSSender@{Fona\_GetSMSSender}!Fona@{Fona}}
\doxysubsubsection{\texorpdfstring{Fona\_GetSMSSender()}{Fona\_GetSMSSender()}}
{\footnotesize\ttfamily int Fona\+\_\+\+Get\+SMSSender (\begin{DoxyParamCaption}\item[{uint32\+\_\+t}]{message\+\_\+index,  }\item[{char $\ast$}]{sender,  }\item[{int}]{senderlen }\end{DoxyParamCaption})}



Retrieve the sender of the specified SMS message and copy it as a string to the sender buffer. Up to senderlen characters of the sender will be copied and a null terminator will be added if less than senderlen characters are copied to the result. 


\begin{DoxyParams}{Parameters}
{\em message\+\_\+index} & The SMS message index to retrieve the sender for \\
\hline
{\em sender} & Pointer to a buffer to fill with the sender \\
\hline
{\em senderlen} & The maximum length to read \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1\+: a result was successfully retrieved, 0\+: failure 
\end{DoxyReturn}
\mbox{\Hypertarget{group___fona_ga33244a2d030d5660d51e870c7d5f498b}\label{group___fona_ga33244a2d030d5660d51e870c7d5f498b}} 
\index{Fona@{Fona}!Fona\_Init@{Fona\_Init}}
\index{Fona\_Init@{Fona\_Init}!Fona@{Fona}}
\doxysubsubsection{\texorpdfstring{Fona\_Init()}{Fona\_Init()}}
{\footnotesize\ttfamily void Fona\+\_\+\+Init (\begin{DoxyParamCaption}\item[{uint32\+\_\+t}]{baud }\end{DoxyParamCaption})}



Initialize Fona. 


\begin{DoxyParams}{Parameters}
{\em n} & specifies baud rate, n = 12,000,000/baud rate \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
none 
\end{DoxyReturn}
\mbox{\Hypertarget{group___fona_gaa664f621556d29950e3f9e6b9b66de74}\label{group___fona_gaa664f621556d29950e3f9e6b9b66de74}} 
\index{Fona@{Fona}!Fona\_ReadSMS@{Fona\_ReadSMS}}
\index{Fona\_ReadSMS@{Fona\_ReadSMS}!Fona@{Fona}}
\doxysubsubsection{\texorpdfstring{Fona\_ReadSMS()}{Fona\_ReadSMS()}}
{\footnotesize\ttfamily int Fona\+\_\+\+Read\+SMS (\begin{DoxyParamCaption}\item[{uint32\+\_\+t}]{message\+\_\+index,  }\item[{char $\ast$}]{smsbuff,  }\item[{uint32\+\_\+t}]{maxlen,  }\item[{uint32\+\_\+t $\ast$}]{readlen }\end{DoxyParamCaption})}



Read an SMS message into a provided buffer. 


\begin{DoxyParams}{Parameters}
{\em message\+\_\+index} & The SMS message index to retrieve \\
\hline
{\em smsbuff} & SMS message buffer \\
\hline
{\em maxlen} & The maximum read length \\
\hline
{\em readlen} & The length read \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1\+: success, 0\+: failure 
\end{DoxyReturn}
\mbox{\Hypertarget{group___fona_gab8decec0a3ee48eca32a70b3f2f98cce}\label{group___fona_gab8decec0a3ee48eca32a70b3f2f98cce}} 
\index{Fona@{Fona}!Fona\_Reset@{Fona\_Reset}}
\index{Fona\_Reset@{Fona\_Reset}!Fona@{Fona}}
\doxysubsubsection{\texorpdfstring{Fona\_Reset()}{Fona\_Reset()}}
{\footnotesize\ttfamily void Fona\+\_\+\+Reset (\begin{DoxyParamCaption}\item[{void}]{ }\end{DoxyParamCaption})}



reset Fona 


\begin{DoxyParams}{Parameters}
{\em none} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
none 
\end{DoxyReturn}
\mbox{\Hypertarget{group___fona_gad2172ab89c74fabccc7f0a8631e349b9}\label{group___fona_gad2172ab89c74fabccc7f0a8631e349b9}} 
\index{Fona@{Fona}!Fona\_SendSMS@{Fona\_SendSMS}}
\index{Fona\_SendSMS@{Fona\_SendSMS}!Fona@{Fona}}
\doxysubsubsection{\texorpdfstring{Fona\_SendSMS()}{Fona\_SendSMS()}}
{\footnotesize\ttfamily int Fona\+\_\+\+Send\+SMS (\begin{DoxyParamCaption}\item[{uint8\+\_\+t}]{phone\mbox{[}$\,$\mbox{]},  }\item[{uint8\+\_\+t}]{message\mbox{[}$\,$\mbox{]} }\end{DoxyParamCaption})}



Send an SMS Message from a buffer provided. 


\begin{DoxyParams}{Parameters}
{\em phone} & The SMS address buffer \\
\hline
{\em message} & The SMS message buffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
1\+: success, 0\+: failure 
\end{DoxyReturn}
\mbox{\Hypertarget{group___fona_ga84fae501706eb779c989cf5a70466e5f}\label{group___fona_ga84fae501706eb779c989cf5a70466e5f}} 
\index{Fona@{Fona}!Fona\_SetSMSInterrupt@{Fona\_SetSMSInterrupt}}
\index{Fona\_SetSMSInterrupt@{Fona\_SetSMSInterrupt}!Fona@{Fona}}
\doxysubsubsection{\texorpdfstring{Fona\_SetSMSInterrupt()}{Fona\_SetSMSInterrupt()}}
{\footnotesize\ttfamily void Fona\+\_\+\+Set\+SMSInterrupt (\begin{DoxyParamCaption}\item[{int}]{n }\end{DoxyParamCaption})}



configure RI pin n=0 off~\newline
 n=1 On(\+TCPIP,\+FTP and URC control RI PIN)~\newline
 n=2 On(only TCPIP control RI PIN) 


\begin{DoxyParams}{Parameters}
{\em n} & 0 1 or 2 \\
\hline
\end{DoxyParams}
\mbox{\Hypertarget{group___fona_ga9cecc6ca366f2c73474a1f56e81059ce}\label{group___fona_ga9cecc6ca366f2c73474a1f56e81059ce}} 
\index{Fona@{Fona}!Fona\_SetSMSStorage@{Fona\_SetSMSStorage}}
\index{Fona\_SetSMSStorage@{Fona\_SetSMSStorage}!Fona@{Fona}}
\doxysubsubsection{\texorpdfstring{Fona\_SetSMSStorage()}{Fona\_SetSMSStorage()}}
{\footnotesize\ttfamily void Fona\+\_\+\+Set\+SMSStorage (\begin{DoxyParamCaption}\item[{int}]{place }\end{DoxyParamCaption})}



Set the preferred SMS storage SMS\+\_\+\+SIM = 1 for storage on the SIM.~\newline
 SMS\+\_\+\+FONA= 0 for storage on the FONA chip. 


\begin{DoxyParams}{Parameters}
{\em place} & 1 for SIM, 0 for FONA \\
\hline
\end{DoxyParams}
