▼Click the image below to search for【Internet of Things】 to access a variety of practical IoT projects we have prepared for you.
In the 1990s, the rapid development of the Internet greatly advanced communication testing equipment. During that time, hardware capable of performing certain measurements was the core of competition, while software’s purpose was merely to drive the hardware and provide a simple interface. Thus, the initial software structure of the products was very simple, similar to the earlier urban rail access control system.
Advantages: The program simply and clearly met the user’s needs, and one programmer could handle everything.
Disadvantages: There was no module division, and the coupling between the lower and upper layers was severe.
Users required the ability to save measurement results and reopen them. The data storage module and interface were separated.
The main logic remained the same, but the interface could not only display real-time data but also read data from ResultManager to display.
Advantages: The initial separation of data and interface began to take shape.
Disadvantages: ResultManager served merely as a tool responsible for saving and loading historical data. The interface and data sources were still tightly coupled. Different interfaces required different data, which were determined through hard coding.
As the functionality grew more complex, the original method of using one class to draw various interfaces could no longer handle the load. Thus, the concept of windows was introduced. Each interface was treated as a window, and the elements within the window were controls. Opening, closing, and hiding windows were managed by the window manager.
Advantages: Interface functionality was separated by window units, no longer a massive collection.
Disadvantages: Although a window manager was introduced, the interface was still directly coupled with the lower layers, maintaining a large loop structure.
As the scale further expanded, the original large loop structure could no longer meet the increasingly complex demands. The standard MVC pattern was introduced, resulting in a major restructuring.
The data center was separated as the Model, storing the latest data. The View was placed in an independent task to periodically poll data from the DataCenter. User operations were sent from the View to the Controller, which further called hardware drivers for execution. The results of hardware execution were updated from the driver to the Controller and then to the DataCenter. The interface, data, and commands were essentially decoupled. ResultManager became a component of the DataCenter, and the View no longer communicated directly with it.
The introduction of the MVC pattern clarified responsibilities and function independence in the product.
4. Numerous Similar Modules, Inefficient Reuse
By the previous step, as a standalone embedded device, the architecture could basically meet the needs. However, as the market expanded, more and more devices were designed. Although these devices performed different specific measurement tasks, they shared the same operational methods, similar interfaces, and faced the same problem domains. For a long time, copy-pasting was the only means of reuse, often without time to rename class or variable names. An error corrected on one device was not promptly fixed on others with the same code. As team sizes grew, even the basic MVC architecture was not adhered to in some new devices.
Eventually, a framework was introduced for this series of products. The framework established the following:
Basic architecture of the MVC pattern
Window manager and component layout algorithms
Multilingual solutions (string manager)
Memory allocator and memory leak detection
Customers wanted to place the device fixedly at a certain location on the network and use it as a “probe” for remote access from the office. This posed a challenge for a system originally designed as a purely handheld device. Fortunately, the MVC architecture proved to be quite flexible, and early investments paid off.
TL1 Server provided a Telnet-based remote control interface. Internally, it functioned like the View, communicating only with the original Controller and DataCenter.
6. Automated TL1 Interpreter
Due to the numerous TL1 commands, and TL1 not often being the primary demand of customers, many devices had incomplete TL1 commands. The reason was that manually writing TL1 command interpreters was too tedious. Later, by introducing Bison and Flex, this issue improved, but it was still insufficient. Automated code generation was introduced at this stage. By defining TL1 in the following format, tools could automatically generate TL1 encoding and decoding code.
CMD_NAME{ cmd = "SET-TIME-CONFIG::<ctag>::<year>,<month>,<day>,<hour>,<minute>,[<second>]" year = 1970..2100 month = 1..12 day = 1..31 hour = 0..23 minute = 0..59 second = 0..59}</second></minute></hour></day></month></year></ctag>
After decades of accumulation, the product has become a series with dozens of devices. Most devices have entered the maintenance phase, and customers frequently request small improvements or fixes for defects. The heavy manual regression testing has become a nightmare.
Automated testing based on TL1 has greatly liberated testers. Running test scripts on PCs has made regression testing simple and reliable. The only downside is that the interface part cannot be verified.
Automated tools based on Test Quest require developing software similar to a remote desktop on the device running the pSOS system, which is not easy on pSOS. However, the good news is that the framework established the style and layout algorithms of the interface, ensuring high recognition efficiency for the automated tools based on Test Quest.
The reconstruction process of this practical embedded product indicates that the introduction of the MVC pattern and the frameworkization are crucial steps. A mature MVC pattern ensures a series of extensibility, while the framework guarantees the accurate reuse of this architecture across all products.
C Language Programming | Comprehensive C++ for Beginners | QT Development | AI Image Processing | Advanced Linux Programming | Advanced Linux Networking | Database + BS Development | 5G IoT Engineering Development
