2021-03-08 19:28:54 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# Internal design
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## Design decisions
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-30 08:36:04 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  Use C++ with additional C API
							 
						 
					
						
							
								
									
										
										
										
											2021-03-18 08:14:34 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-30 08:36:04 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  Use exceptions
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  Use macro wrapper over `try-catch`  blocks when exceptions off (use `abort()`  if `THROW()` ) 
							 
						 
					
						
							
								
									
										
										
										
											2021-03-18 08:14:34 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								*  Initializes and allocates in the constructor (might throw)
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  easier code with exceptions ON, with exceptions OFF alloc/init failures are not treated as runtime error (program aborts)
							 
						 
					
						
							
								
									
										
										
										
											2021-03-30 08:36:04 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  -  break down long initialization in constructor into more private methods
							 
						 
					
						
							
								
									
										
										
										
											2021-04-14 17:57:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-03-30 08:36:04 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								*  Implements different devices using inheritance from `GenericModule` , which is the most general implementation of a common modem
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  -  Internally uses templates with device specialization (modeled as `DCE<SpecificModule>` ) which could be used as well for some special cases, 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  such as implantation of a minimal device (ModuleIf), add new AT commands (oOnly in compile time), or using the Module with DTE only (no DCE, no Netif) for sending AT commands without network
							 
						 
					
						
							
								
									
										
										
										
											2021-03-18 08:14:34 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  
							 
						 
					
						
							
								
									
										
										
										
											2021-03-08 19:28:54 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								## DCE collaboration model
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								The diagram describes how the DCE class collaborates with DTE, PPP and the device abstraction
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## Terminal inheritance
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								Terminal is a class which can read or write data, and can handle callbacks when data are available. UART specialization
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								is provided implementing these method using the uart driver.
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								## CMUX terminal
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2021-04-14 17:57:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								The below diagram depicts the idea of using CMUX terminal mode using the CMuxInstance class which is a terminal
							 
						 
					
						
							
								
									
										
										
										
											2021-03-08 19:28:54 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								(it implements the basic read/write methods) interfacing arbitrary number of virtual terminals,
							 
						 
					
						
							
								
									
										
										
										
											2021-04-14 17:57:42 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								but at the same time it is also composed of CMux class, which consumes the original terminal and uses its read/write methods
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								to multiplex the terminal.
							 
						 
					
						
							
								
									
										
										
										
											2021-03-08 19:28:54 +01:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								