\hypertarget{state_8c}{
\section{state.c File Reference}
\label{state_8c}\index{state.c@{state.c}}
}
Functions for retrieving and displaying the state information.  


{\tt \#include $<$state\_\-p.h$>$}\par
{\tt \#include $<$LEM/defs.h$>$}\par
{\tt \#include $<$PBS/WCT.h$>$}\par
{\tt \#include $<$string.h$>$}\par
{\tt \#include $<$stdlib.h$>$}\par
{\tt \#include $<$time.h$>$}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ \hyperlink{state_8c_adc3ecbd0ae617ceb242b88c24e8d6dd}{QPIG\_\-allocState} (void)
\begin{CompactList}\small\item\em Allocate memory for a QPIG\_\-state structure and construct it as such. \item\end{CompactList}\item 
\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$ \hyperlink{state_8c_6810c75cfa258237290c8d667e449307}{QPIG\_\-constructState} (void $\ast$buffer)
\begin{CompactList}\small\item\em Construct a QPIG\_\-state structure in the memory provided. \item\end{CompactList}\item 
void \hyperlink{state_8c_b710f08e6ee07684138002301dd0cdb2}{QPIG\_\-destructState} (\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$state)
\begin{CompactList}\small\item\em Release resources associated with the QPIG\_\-state structure. \item\end{CompactList}\item 
const unsigned int $\ast$ \hyperlink{state_8c_c54de82c8f4ce0d9fccbbaba8c6d9e9f}{QPIG\_\-recoverState} (\hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$state, int version, const unsigned int $\ast$buf)
\begin{CompactList}\small\item\em Copy the state information from the buffer. \item\end{CompactList}\item 
void \hyperlink{state_8c_8a27d1aeb9d9b9e8c5c9b9c83fe4d243}{QPIG\_\-reportState} (unsigned int secs, int version, const \hyperlink{struct__QPIG__state}{QPIG\_\-state} $\ast$state, FILE $\ast$fp)
\begin{CompactList}\small\item\em Write a formatted ASCII description of the state. \item\end{CompactList}\item 
size\_\-t \hyperlink{state_8c_c908f18c7d442ff12e718dd69814528b}{QPIG\_\-sizeofState} (void)
\begin{CompactList}\small\item\em Return the size of the QPIG state structure. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Functions for retrieving and displaying the state information. 

\begin{Desc}
\item[Author:]James Swain \& Owen Saxton\end{Desc}
\begin{Desc}
\item[Id]\hyperlink{state_8c}{state.c},v 1.5 2011/03/29 20:29:25 saxton Exp \end{Desc}


\subsection{Function Documentation}
\hypertarget{state_8c_adc3ecbd0ae617ceb242b88c24e8d6dd}{
\index{state.c@{state.c}!QPIG\_\-allocState@{QPIG\_\-allocState}}
\index{QPIG\_\-allocState@{QPIG\_\-allocState}!state.c@{state.c}}
\subsubsection[{QPIG\_\-allocState}]{\setlength{\rightskip}{0pt plus 5cm}{\bf QPIG\_\-state}$\ast$ QPIG\_\-allocState (void)}}
\label{state_8c_adc3ecbd0ae617ceb242b88c24e8d6dd}


Allocate memory for a QPIG\_\-state structure and construct it as such. 

\begin{Desc}
\item[Returns:]Allocated QPIG\_\-state structure \end{Desc}


References QPIG\_\-constructState(), and QPIG\_\-sizeofState().\hypertarget{state_8c_6810c75cfa258237290c8d667e449307}{
\index{state.c@{state.c}!QPIG\_\-constructState@{QPIG\_\-constructState}}
\index{QPIG\_\-constructState@{QPIG\_\-constructState}!state.c@{state.c}}
\subsubsection[{QPIG\_\-constructState}]{\setlength{\rightskip}{0pt plus 5cm}{\bf QPIG\_\-state}$\ast$ QPIG\_\-constructState (void $\ast$ {\em buffer})}}
\label{state_8c_6810c75cfa258237290c8d667e449307}


Construct a QPIG\_\-state structure in the memory provided. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em buffer}]block of memory to use for the QPIG\_\-state structure\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to an initialised QPIG\_\-state structure \end{Desc}


References QPIG\_\-sizeofState().

Referenced by QPIG\_\-allocState(), and QPIG\_\-construct().\hypertarget{state_8c_b710f08e6ee07684138002301dd0cdb2}{
\index{state.c@{state.c}!QPIG\_\-destructState@{QPIG\_\-destructState}}
\index{QPIG\_\-destructState@{QPIG\_\-destructState}!state.c@{state.c}}
\subsubsection[{QPIG\_\-destructState}]{\setlength{\rightskip}{0pt plus 5cm}void QPIG\_\-destructState ({\bf QPIG\_\-state} $\ast$ {\em state})}}
\label{state_8c_b710f08e6ee07684138002301dd0cdb2}


Release resources associated with the QPIG\_\-state structure. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a QPIG\_\-state structure created using \hyperlink{state_8h_adc3ecbd0ae617ceb242b88c24e8d6dd}{QPIG\_\-allocState()} \end{description}
\end{Desc}
\hypertarget{state_8c_c54de82c8f4ce0d9fccbbaba8c6d9e9f}{
\index{state.c@{state.c}!QPIG\_\-recoverState@{QPIG\_\-recoverState}}
\index{QPIG\_\-recoverState@{QPIG\_\-recoverState}!state.c@{state.c}}
\subsubsection[{QPIG\_\-recoverState}]{\setlength{\rightskip}{0pt plus 5cm}const unsigned int$\ast$ QPIG\_\-recoverState ({\bf QPIG\_\-state} $\ast$ {\em state}, \/  int {\em version}, \/  const unsigned int $\ast$ {\em buf})}}
\label{state_8c_c54de82c8f4ce0d9fccbbaba8c6d9e9f}


Copy the state information from the buffer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]Pointer to a state structure\item[{\em version}]The version of the state data.\item[{\em buf}]Pointer to the context data\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]Pointer to the next word in the buffer \end{Desc}


References \_\-QPIG\_\-pduState\_\-V0::acd, \_\-QPIG\_\-pduState::acd, \_\-QPIG\_\-pwrState::acd\_\-dac, \_\-QPIG\_\-pwrState\_\-V0::acd\_\-hv, \_\-QPIG\_\-pwrState::acd\_\-hv, \_\-QPIG\_\-pwrState\_\-V1::acd\_\-on, \_\-QPIG\_\-pwrState::acd\_\-on, \_\-QPIG\_\-pwrState\_\-V0::acd\_\-saa, \_\-QPIG\_\-pwrState::acd\_\-saa, \_\-QPIG\_\-pwrState\_\-V0::aem, \_\-QPIG\_\-pwrState::aem, QPIG\_\-dbState\_\-V0::aem\_\-event\_\-timeout, QPIG\_\-dbState::aem\_\-event\_\-timeout, QPIG\_\-dbState\_\-V0::aem\_\-response\_\-timeout, QPIG\_\-dbState::aem\_\-response\_\-timeout, \_\-QPIG\_\-pwrState\_\-V0::cal, \_\-QPIG\_\-pwrState::cal, \_\-QPIG\_\-pwrState\_\-V1::cal\_\-on, \_\-QPIG\_\-pwrState::cal\_\-on, QPIG\_\-dbState\_\-V0::ccc\_\-event\_\-timeouts, QPIG\_\-dbState::ccc\_\-event\_\-timeouts, \_\-QPIG\_\-cruState\_\-V0::command, \_\-QPIG\_\-cruState::command, \_\-QPIG\_\-ebmState\_\-V0::contributors, \_\-QPIG\_\-ebmState::contributors, \_\-QPIG\_\-pduState\_\-V0::crates, \_\-QPIG\_\-pduState::crates, \_\-QPIG\_\-state\_\-V0::cru, \_\-QPIG\_\-state::cru, \_\-QPIG\_\-ebmState\_\-V0::destinations, \_\-QPIG\_\-ebmState::destinations, \_\-QPIG\_\-state\_\-V0::ebm, \_\-QPIG\_\-state::ebm, QPIG\_\-dbState\_\-V0::ebm\_\-timeout, QPIG\_\-dbState::ebm\_\-timeout, \_\-QPIG\_\-ebmState\_\-V0::inputs, \_\-QPIG\_\-ebmState::inputs, \_\-QPIG\_\-state\_\-V0::pdb, \_\-QPIG\_\-state::pdb, \_\-QPIG\_\-state\_\-V0::pdu, \_\-QPIG\_\-state::pdu, \_\-QPIG\_\-state\_\-V0::pwr, \_\-QPIG\_\-state\_\-V1::pwr, \_\-QPIG\_\-state::pwr, \_\-QPIG\_\-cruState\_\-V0::response, \_\-QPIG\_\-cruState::response, \_\-QPIG\_\-pwrState\_\-V0::sib, \_\-QPIG\_\-pwrState::sib, QPIG\_\-dbState\_\-V0::tcc\_\-event\_\-timeouts, QPIG\_\-dbState::tcc\_\-event\_\-timeouts, \_\-QPIG\_\-pwrState\_\-V0::tem, \_\-QPIG\_\-pwrState::tem, QPIG\_\-dbState\_\-V0::tem\_\-configuration, QPIG\_\-dbState::tem\_\-configuration, \_\-QPIG\_\-pduState\_\-V0::tems, \_\-QPIG\_\-pduState::tems, \_\-QPIG\_\-pwrState\_\-V0::tkr, \_\-QPIG\_\-pwrState::tkr, \_\-QPIG\_\-pwrState\_\-V1::tkr\_\-on, and \_\-QPIG\_\-pwrState::tkr\_\-on.

Referenced by QPIG\_\-updateAtDatagram().\hypertarget{state_8c_8a27d1aeb9d9b9e8c5c9b9c83fe4d243}{
\index{state.c@{state.c}!QPIG\_\-reportState@{QPIG\_\-reportState}}
\index{QPIG\_\-reportState@{QPIG\_\-reportState}!state.c@{state.c}}
\subsubsection[{QPIG\_\-reportState}]{\setlength{\rightskip}{0pt plus 5cm}void QPIG\_\-reportState (unsigned int {\em secs}, \/  int {\em version}, \/  const {\bf QPIG\_\-state} $\ast$ {\em state}, \/  FILE $\ast$ {\em fp})}}
\label{state_8c_8a27d1aeb9d9b9e8c5c9b9c83fe4d243}


Write a formatted ASCII description of the state. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em secs}]The time the state was sent (spacecraft time)\item[{\em version}]The version of the state data.\item[{\em state}]Pointer to a state structure\item[{\em fp}]Pointer to the output file \end{description}
\end{Desc}


References \_\-QPIG\_\-state::cru, \_\-QPIG\_\-state::ebm, \_\-QPIG\_\-state::pdb, \_\-QPIG\_\-state::pdu, and \_\-QPIG\_\-state::pwr.\hypertarget{state_8c_c908f18c7d442ff12e718dd69814528b}{
\index{state.c@{state.c}!QPIG\_\-sizeofState@{QPIG\_\-sizeofState}}
\index{QPIG\_\-sizeofState@{QPIG\_\-sizeofState}!state.c@{state.c}}
\subsubsection[{QPIG\_\-sizeofState}]{\setlength{\rightskip}{0pt plus 5cm}size\_\-t QPIG\_\-sizeofState (void)}}
\label{state_8c_c908f18c7d442ff12e718dd69814528b}


Return the size of the QPIG state structure. 

\begin{Desc}
\item[Returns:]Size of memory block required to hold the structure \end{Desc}


Referenced by QPIG\_\-allocState(), and QPIG\_\-constructState().