ccNOos  v0.0.0
Build Portable Microcontroller Applications!
Application_Solution.h
Go to the documentation of this file.
1 /** \file Application_Solution.h
2 * \brief <a href="https://www.inmechasol.org/" target="_blank">IMS</a>:
3  <a href="https://github.com/InMechaSol/ccNOos" target="_blank">ccNOos</a>,
4  Declarations for straight C and C++
5 
6  Copyright 2021 <a href="https://www.inmechasol.org/" target="_blank">InMechaSol, Inc</a>
7 
8  Licensed under the Apache License, Version 2.0(the "License");
9  you may not use this file except in compliance with the License.
10  You may obtain a copy of the License at
11 
12  http://www.apache.org/licenses/LICENSE-2.0
13 
14  Unless required by applicable law or agreed to in writing, software
15  distributed under the License is distributed on an "AS IS" BASIS,
16  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  See the License for the specific language governing permissions and
18  limitations under the License.
19 
20 Notes:
21  (.c includes .h) - for straight C or
22  (.cpp includes .c which includes .h) - for C++ wrapped straight C
23  *Always compiled to a single compilation unit, either C or CPP, not both
24 
25 */
26 
27 #ifndef __CCNOOS_SATCOMACS__
28 #define __CCNOOS_SATCOMACS__
29 
30 // Base ccNOos includes
31 #include "execution_system.h"
32 #include "console_menu.h"
33 
34 // SatComACS and Device includes
35 #include "satComControl.h"
36 #include "APTmodule.h"
37 #include "TPMmodule.h"
38 #include "TxRxmodule.h"
39 
40 // The main SatComACS module
41 #define Mn SatComACS
42 
43 
44 
45 // Main SatComACS Data Structure
47 {
49  // satComACS Terminal Module
50  struct antennaStruct Terminal;
51  // satComACS Device Modules
52  struct aptStruct APT;
53  struct wmmStruct WMM;
54  struct tpmStruct TPM;
55  struct txRxStruct TxRx;
56  // satComACS API Device Modules
57  struct uiStruct LCDKeyPad;
58  struct uiStruct ConsoleMenu;
59 };
60 
61 #define MODdeclareCREATEINS
62 #define MODcallCREATEINS
63 
65 
66 // Re-usable, portable, cross-platform (ccNOosTests setup() function)
68 // Re-usable, portable, cross-platform (ccNOosTests loop() function)
70 // Re-usable, portable, cross-platform (ccNOosTests systick() function)
72 
73 #ifdef __USINGCONSOLEMENU
74 
75 enum currentViewFormat
76 {
77  cV_Console=0,
78  cv_LCD4_40,
79  cv_LCD2_40
80 };
81 
82 enum currentMenuAction
83 {
84  cA_NoAction=0,
85  cA_Enter,
86  cA_Up,
87  cA_Down,
88  cA_Forward,
89  cA_Back,
90  cA_Status,
91  cA_Acquire
92 };
93 
94 enum currentMenuNode
95 {
96  cM_MainMenu=0,
97  cM_RootNode,
98  cM_Devices,
99  cM_Terminal,
100  cM_ExecutionSystem,
101  cM_devTXRX,
102  cM_devAPT,
103  cM_devTPM
104 };
105 
106 enum uiAccessLevel
107 {
108  uiLevel_Observer = 0,
109  uiLevel_Operator,
110  uiLevel_Administrator,
111  uiLevel_Developer
112 };
113 
114 //// Module Console Menu Print and Parse
117 
118 void linkAPIioDevices(struct SatComACSStruct* satcomacsStructPtrIn);
119 
120 void parseConsoleKeyPadAPI(struct SatComACSStruct* satcomacsStructPtrIn, struct uiStruct* uiStructPtrIn);
121 void parseLCDKeyPadAPI(struct SatComACSStruct* satcomacsStructPtrIn, struct uiStruct* uiStructPtrIn);
122 
123 
124 void parseSatComACSDevicesMenuAPI(struct SatComACSStruct* satcomacsStructPtrIn, struct uiStruct* uiStructPtrIn);
125 void writeSatComACSDevicesMenuScreen(struct SatComACSStruct* satcomacsStructPtrIn, struct uiStruct* uiStructPtrIn);
126 
127 void parseSatComACSMenuAPI(struct SatComACSStruct* satcomacsStructPtrIn, struct uiStruct* uiStructPtrIn);
128 void writeSatComACSMenuScreen(struct SatComACSStruct* satcomacsStructPtrIn, struct uiStruct* uiStructPtrIn);
129 
130 
131 void writeSatComACSLogLine(struct SatComACSStruct* satcomacsStructPtrIn, struct logStruct* logStructPtrIn);
132 void parseSatComACSConfigLine(struct SatComACSStruct* satcomacsStructPtrIn, struct configStruct* configStructPtrIn);
133 
134 
135 //// Module "JSON" serialization/deserialization for satComControl.h and motionControl.h data structures
136 //struct satelliteStruct createSatelliteStructJSON(char* JSONptrIn);
137 //void createJSONSatelliteStruct(struct satelliteStruct* satelliteStructPtrIn);
138 //struct commsParameters createcommsParametersJSON(char* JSONptrIn);
139 //void createJSONcommsParameters(struct commsParameters* commsParametersPtrIn);
140 //struct geoLocationStruct creategeoLocationStructJSON(char* JSONptrIn);
141 //void createJSONgeoLocationStruct(struct geoLocationStruct* geoLocationStructPtrIn);
142 //struct antennaAttitudeStruct createantennaAttitudeStructJSON(char* JSONptrIn);
143 //void createJSONantennaAttitudeStruct(struct antennaAttitudeStruct* antennaAttitudeStructPtrIn);
144 //struct antennaAxis createantennaAxisJSON(char* JSONptrIn);
145 //void createJSONantennaAxis(struct antennaAxis* antennaAxisPtrIn);
146 //struct antennaStruct createantennaStructJSON(char* JSONptrIn);
147 //void createJSONantennaStruct(struct antennaStruct* antennaStructPtrIn);
148 //struct axisStruct createaxisStructJSON(char* JSONptrIn);
149 //void createJSONaxisStruct(struct axisStruct* axisStructPtrIn);
150 
151 #else
152 #error Console Required for SatComACS Module
153 #endif
154 
155 
156 ////////////////////////////////////////////////////////////////////////////////
157 // C ccNOosTests Example Application - built from computeModuleClass and Execution System
158 #define __PLATFORM_APP_CTEMPLATE(MODNAME) \
159  struct linkedEntryPointStruct setupListHead = {\
160  nullptr,\
161  (struct computeModuleStruct*)&MODdataINST(Mn),\
162  MODsetup(Mn)\
163  };\
164  struct linkedEntryPointStruct loopListHead = {\
165  nullptr,\
166  (struct computeModuleStruct*)&MODdataINST(Mn),\
167  MODloop(Mn)\
168  };\
169  struct executionEntryStruct exeEntryPoints = {\
170  &setupListHead,\
171  &loopListHead,\
172  nullptr,\
173  &setupListHead\
174  };\
175  void applicationConfig()\
176  {\
177  exeSystem = CreateExecutionSystemStruct(uSEC_PER_CLOCK);\
178  MODdataINST(Mn) = MODstructCREATE(Mn)();\
179  }
180 #define PLATFORM_APP_CTEMPLATE(MODNAME) __PLATFORM_APP_CTEMPLATE(MODNAME)
181 
182 #ifdef __cplusplus
183 ////////////////////////////////////////////////////////////////////////////////
184 // C++ ccNOosTests Example Class - built from computeModuleClass
185 class MODCLASS_NAME(Mn) : public computeModuleClass {
186 protected:
188 public:
190  MODCLASS_SETUP_INLINE(Mn);
191  MODCLASS_LOOP_INLINE(Mn);
192  MODCLASS_SYSTICK_INLINE(Mn);
193  MODCLASS_ExcpHndlr_INLINE(Mn);
194 };
195 
196 ////////////////////////////////////////////////////////////////////////////////
197 // C++ ccNOosTests Example Application - built from computeModuleClass and Execution System
198 #define __PLATFORM_APP_CLASS(MODNAME) class theApplicationClass{\
199  public:\
200  linkedEntryPointClass setupListHead;\
201  linkedEntryPointClass loopListHead;\
202  linkedEntryPointClass systickListHead;\
203  linkedEntryPointClass exceptionListHead;\
204  MODCLASS_NAME(MODNAME) MODNAME##CompMod;\
205  executionSystemClass* theExecutionSystemPtr;\
206  theApplicationClass() :\
207  MODNAME##CompMod(),\
208  setupListHead(& MODNAME##CompMod, nullptr),\
209  loopListHead(& MODNAME##CompMod, nullptr),\
210  systickListHead(nullptr, nullptr),\
211  exceptionListHead(&MODNAME##CompMod, nullptr)\
212  {\
213  theExecutionSystemPtr = &exeSystem;\
214  theExecutionSystemPtr->LinkTheListsHead(\
215  &setupListHead,\
216  &loopListHead,\
217  &systickListHead,\
218  &exceptionListHead\
219  );\
220  }\
221 }
222 #define PLATFORM_APP_CLASS(MODNAME) __PLATFORM_APP_CLASS(MODNAME)
223 
224 
225 #endif // !__cplusplus
226 #endif // !__CCNOOS_SATCOMACS__
parseSatComACSConfigLine
void parseSatComACSConfigLine(struct SatComACSStruct *satcomacsStructPtrIn, struct configStruct *configStructPtrIn)
Definition: PlatformApp_Serialization.c:31
console_menu.h
IMS: ccNOos, Declarations for straight C and C++
parseSatComACSMenuAPI
void parseSatComACSMenuAPI(struct SatComACSStruct *satcomacsStructPtrIn, struct uiStruct *uiStructPtrIn)
Definition: MenuAPI.c:141
satComControl.h
IMS: ccNOos, Declarations for straight C and C++
TPMmodule.h
IMS: ccNOos, Declarations for straight C and C++
MODdeclareLOOP
MODdeclareLOOP(Mn)
Definition: Application_Solution.c:116
parseSatComACSDevicesMenuAPI
void parseSatComACSDevicesMenuAPI(struct SatComACSStruct *satcomacsStructPtrIn, struct uiStruct *uiStructPtrIn)
Definition: MenuAPI.c:202
Mn
#define Mn
Definition: Application_Solution.h:41
COMPMODFIRST
#define COMPMODFIRST
Definition: version_config.h:280
writeSatComACSDevicesMenuScreen
void writeSatComACSDevicesMenuScreen(struct SatComACSStruct *satcomacsStructPtrIn, struct uiStruct *uiStructPtrIn)
Definition: MenuAPI.c:244
execution_system.h
IMS: ccNOos, Declarations for straight C and C++
MODdeclarePRINTm
MODdeclarePRINTm(Mn)
Definition: Application_Solution.c:109
wmmStruct
Definition: APTmodule.h:66
MODdeclarePARSEi
MODdeclarePARSEi(Mn)
Definition: Application_Solution.c:161
antennaStruct
Definition: satComControl.h:94
parseConsoleKeyPadAPI
void parseConsoleKeyPadAPI(struct SatComACSStruct *satcomacsStructPtrIn, struct uiStruct *uiStructPtrIn)
Definition: MenuAPI.c:103
writeSatComACSMenuScreen
void writeSatComACSMenuScreen(struct SatComACSStruct *satcomacsStructPtrIn, struct uiStruct *uiStructPtrIn)
Definition: MenuAPI.c:191
TxRxmodule.h
IMS: ccNOos, Declarations for straight C and C++
MODdeclareCREATEINS
#define MODdeclareCREATEINS
Definition: Application_Solution.h:61
txRxStruct
Definition: TxRxmodule.h:38
MODdeclareSETUP
MODdeclareSETUP(Mn)
Definition: Application_Solution.c:79
MODCLASS_NAME
MODCLASS_NAME(Mn)
Definition: Application_Solution.cpp:34
aptStruct
Definition: APTmodule.h:57
MODdeclareCREATE
#define MODdeclareCREATE(mNAME)
Definition: version_config.h:292
MODdeclareSYSTICK
MODdeclareSYSTICK(Mn)
Definition: Application_Solution.c:157
tpmStruct
Definition: TPMmodule.h:56
writeSatComACSLogLine
void writeSatComACSLogLine(struct SatComACSStruct *satcomacsStructPtrIn, struct logStruct *logStructPtrIn)
Definition: PlatformApp_Serialization.c:30
APTmodule.h
IMS: ccNOos, Declarations for straight C and C++
linkAPIioDevices
void linkAPIioDevices(struct SatComACSStruct *satcomacsStructPtrIn)
Definition: Application_Platform_Main.c:73
MODdeclareDATA
#define MODdeclareDATA(mNAME)
Definition: version_config.h:288
MODdeclareSTRUCT
MODdeclareSTRUCT(Mn)
Definition: Application_Solution.h:36
parseLCDKeyPadAPI
void parseLCDKeyPadAPI(struct SatComACSStruct *satcomacsStructPtrIn, struct uiStruct *uiStructPtrIn)
Definition: LCDapi.c:29