Refrigerator data monitoring system and method based on data conversion and application
By using a data conversion layer and protocol self-learning module generated through a hybrid programming language, the problems of parsing efficiency and compatibility in the refrigerator data monitoring system were solved, achieving efficient and reliable data processing and compatibility, and improving the system's stability and maintenance efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-14
AI Technical Summary
Existing refrigerator data monitoring systems cannot balance parsing efficiency and compatibility, resulting in low data processing efficiency, complex development, and difficult maintenance.
A data conversion layer generated using a hybrid programming language serves as an intermediate bridge. It processes binary data through protocol judgment, parsing, and mapping modules, and combines protocol self-learning and cross-platform adaptation to reduce the adaptation costs for different refrigerator models and operating systems.
It improves data parsing efficiency, reduces the frequency of modifications to upper-layer applications, enhances system stability and maintainability, and ensures the accuracy and compatibility of data processing.
Smart Images

Figure CN121855170A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of refrigerator technology, and in particular to a refrigerator data monitoring system and method based on data conversion and application. Background Technology
[0002] As a key device in smart homes, the need for real-time monitoring and fault early warning of refrigerators' operational status (such as temperature, compressor speed, and door open / closed status) is increasingly prominent. To achieve intelligent management of refrigerators, it is typically necessary to collect their operational data through hardware modules and transmit it in binary format via serial port to a host computer (such as a PC or app gateway) for further processing and display. In this application scenario, how to efficiently and reliably parse binary data and convert it into structured information that can be easily used by upper-level software becomes a fundamental requirement for realizing intelligent refrigerator monitoring.
[0003] To monitor refrigerator data, related technologies often employ development solutions based on a single programming language. For example, some systems use pure C# to write serial communication and data parsing logic, directly handling binary data unpacking and parameter extraction on the host computer; other systems are developed using pure C++, leveraging its efficient memory manipulation capabilities for data parsing and using frameworks such as MFC to implement upper-level status display and interactive functions. Additionally, some solutions attempt to use scripting languages like Python as an intermediate layer for data conversion, or implement cross-platform monitoring systems based on Java.
[0004] However, the above solutions still have significant limitations: while pure C# facilitates object-oriented programming and interface development, its binary data parsing efficiency is low, making it difficult to meet the needs of real-time monitoring of multiple devices; pure C++ offers high parsing efficiency, but its upper-layer interactive functions are complex to develop, have long development cycles, and suffer from poor compatibility with common smart home ecosystems; other cross-language solutions often introduce high latency or stability risks. More importantly, these solutions generally tightly couple the data parsing logic with the upper-layer application, requiring significant code modifications when protocols change or device models differ, resulting in poor compatibility and maintainability. Therefore, there is an urgent need for a refrigerator data monitoring solution that can balance parsing efficiency, ease of development, protocol compatibility, and system maintainability. Summary of the Invention
[0005] This application provides a refrigerator data monitoring system and method based on data conversion and application to solve the problem that refrigerator data monitoring systems cannot simultaneously achieve parsing efficiency and compatibility.
[0006] The first aspect of this application provides a refrigerator data monitoring system based on data conversion and application, comprising:
[0007] The data receiving layer is used to establish a serial communication connection with the refrigerator's hardware module and receive the raw binary data stream sent by the hardware module.
[0008] A data transformation layer, generated by a language that supports mixed managed and unmanaged code programming, is used to process the raw binary data stream; the data transformation layer includes:
[0009] The protocol determination module is used to identify data packets conforming to a predefined format from the raw binary data stream;
[0010] The binary parsing module is used to deconstruct the identified data packet and separate out multiple data fields that constitute the refrigerator's operating parameters;
[0011] The data mapping module is used to assign the values of the separated multiple data fields to multiple properties declared in a managed class, thereby generating an object instance containing structured refrigerator operation data;
[0012] The upper application layer, developed based on an object-oriented high-level programming language, obtains the object instance by calling the application programming interface provided by the data conversion layer, and performs visualization display of the refrigerator's operating status and diagnosis and alarm of operating faults based on the attribute values in the object instance.
[0013] By employing a data conversion layer that supports hybrid programming languages as an intermediate bridge, the system efficiently deconstructs and transforms raw binary data into a structured form, alleviating the conflict between low-level data processing efficiency and high-level programming ease of use. Through modular protocol judgment and data mapping design, the system reduces the compatibility adaptation costs caused by differences in data protocols across different refrigerator models. Simultaneously, this architecture decouples data parsing logic from high-level application functions, reducing the scope of modifications to high-level software when hardware communication protocols are updated, thereby improving system maintainability and stability. This addresses the problem of refrigerator data monitoring systems being unable to balance parsing efficiency and compatibility.
[0014] Optionally, the data conversion layer further includes a protocol self-learning module; the protocol self-learning module is used to continuously collect multiple sets of data packets when the original binary data stream with an unknown data protocol is detected; analyze the byte sequence characteristics of the multiple sets of data packets to infer the data packet structure; and generate a preliminary data protocol description file based on the inference results.
[0015] The protocol self-learning module added to the data conversion layer can automatically infer the data packet structure and generate a preliminary protocol description file when the system connects to a refrigerator with an unknown data protocol. This is achieved by continuously collecting and analyzing the byte sequence characteristics of multiple data packets. This mechanism reduces the reliance on manual protocol adaptation for new refrigerator models, alleviates the difficulties in initial system configuration caused by ambiguous protocols, and improves the system's ability to quickly adapt to unknown protocols.
[0016] Optionally, the data conversion layer further includes a cross-platform adaptation module; the cross-platform adaptation module is used to compile corresponding code for different operating system environments through pre-compilation instructions, and to uniformly encapsulate the operating system-related serial port operation functions and memory operation functions.
[0017] The cross-platform adaptation module added to the data conversion layer distinguishes different operating system environments through pre-compilation instructions to generate corresponding code, and uniformly encapsulates the low-level operation functions related to the operating system. This design reduces the system's dependence on different operating systems and underlying runtime environments, alleviates compatibility issues during cross-platform deployment, and thus improves the system's applicability and portability in diverse environments.
[0018] Optionally, the protocol judgment module is further configured to calculate the cyclic redundancy check code of the data packet when performing data packet identification, and compare the calculation result with the check code contained in the data packet; only when the comparison is consistent, the data packet is passed to the binary parsing module.
[0019] The protocol judgment module adds a step of calculating and comparing cyclic redundancy check codes when performing data packet identification. The data packet is only passed to the subsequent parsing module if the check matches. This mechanism reduces the possibility of invalid or erroneous raw data entering the subsequent processing flow, alleviates the problem of unreliable data parsing results due to data transmission or acquisition errors, and thus improves the overall accuracy of data processing in the system.
[0020] Optionally, the data conversion layer defines a protocol configuration file; the protocol configuration file is stored in text format and is used to define the data protocol rules corresponding to various refrigerator models. The data protocol rules include the frame header byte sequence, the length of each data field, and the starting position in each data packet; the data conversion layer reads the protocol configuration file at runtime to adapt to different refrigerator models.
[0021] The data conversion layer stores the data protocol rules corresponding to different refrigerator models through a predefined text-formatted protocol configuration file, enabling the system to adapt to multiple models during runtime by reading this configuration file. This approach reduces the frequency of modifying or recompiling the core code when parsing data for different refrigerator models, alleviating the development and maintenance burden caused by protocol diversity, thereby improving the system's versatility and long-term maintenance efficiency.
[0022] Optionally, the upper application layer includes: a status display module, used to read the attributes of the object instance and display the refrigerator's operating status information in real time through interface controls; and a fault alarm module, used to preset a fault judgment threshold, compare the attributes of the object instance with the fault judgment threshold through a timed detection function, and output fault information when a fault condition is triggered.
[0023] The upper application layer uses separate status display and fault alarm modules to respectively visualize real-time operating status information and perform fault diagnosis and alarm based on preset thresholds. This modular design reduces the coupling of application logic, alleviates mutual interference between status monitoring and fault handling functions, and thus improves the response speed of the user interface and the timeliness of fault alarms.
[0024] Optionally, the upper application layer further includes a multi-module data sharing module; the multi-module data sharing module is used to establish a shared memory area between the data conversion layer and the upper application layer through memory-mapped file technology, and write the data of the object instance into the shared memory area.
[0025] The multi-module data sharing module added to the upper application layer establishes a shared memory area between the data conversion layer and the upper application layer using memory-mapped file technology, and writes the parsed structured object instance data into this area. This mechanism reduces the system overhead and latency caused by repeated interface calls or data object copying when upper-layer functional modules access data, alleviates the performance bottleneck when multiple modules access data concurrently, and thus improves the system's data access efficiency and overall responsiveness in multi-task collaboration scenarios.
[0026] The second aspect of this application provides a refrigerator data monitoring method based on data conversion and application. The method is applied to the refrigerator data monitoring system based on data conversion and application described in the first aspect, and the method includes:
[0027] The raw binary data stream from the refrigerator hardware module is received through the data receiving layer;
[0028] The protocol judgment module in the data conversion layer identifies data packets conforming to a predefined format from the raw binary data stream; the data conversion layer is generated by a language that supports mixed programming of managed and unmanaged code.
[0029] The binary parsing module in the data conversion layer deconstructs the identified data packet and separates multiple data fields that constitute the refrigerator's operating parameters.
[0030] The data mapping module in the data transformation layer assigns the values of the separated data fields to multiple properties declared in a managed class, thereby generating an object instance containing structured refrigerator operation data.
[0031] The object instance is obtained by calling the application programming interface provided by the data transformation layer through the upper application layer; the upper application layer is developed based on an object-oriented high-level programming language.
[0032] The refrigerator's operating status is visualized based on the attribute values in the object instance.
[0033] Perform diagnostics and alarms for operational faults based on the attribute values in the object instance.
[0034] By employing a data conversion layer implemented with a hybrid programming language to structure the received binary data, the conflict between efficient low-level data processing and convenient development of upper-level applications is alleviated. Modular identification, destructuring, and mapping steps reduce the parsing difficulty caused by complex data protocols or model differences. This method separates data conversion from upper-level application logic, reducing modifications to upper-level functions during protocol updates, thereby improving system compatibility and maintenance efficiency. Simultaneously, by allowing upper-level applications to directly obtain and use structured object instances, the direct dependence of status display and fault alarm functions on the underlying data format is reduced, enhancing the responsiveness and ease of development of monitoring functions.
[0035] Optionally, after the step of identifying data packets conforming to a predefined format from the raw binary data stream, the method further includes:
[0036] Calculate the cyclic redundancy check (CRC) code of the data packet and compare the calculation result with the check code contained in the data packet;
[0037] The data packet is passed to the binary parsing module only if the comparison is successful.
[0038] After identifying data packets conforming to a predefined format, a step of calculating and comparing cyclic redundancy check (CRC) codes is added. Subsequent parsing is only performed if the check matches. This method reduces the likelihood of erroneous data generated during data transmission or acquisition being further processed, mitigates errors in analysis results caused by compromised data integrity, and thus improves the reliability of the entire monitoring system's data processing workflow.
[0039] Optionally, after generating an object instance containing structured refrigerator operation data, the method further includes: establishing a shared memory region between the data conversion layer and the upper application layer using memory-mapped file technology, and writing the data of the object instance into the shared memory region.
[0040] By using memory-mapped file technology, a shared memory area is established between the data conversion layer and the upper application layer, and data is written there. This method reduces the overhead of repeated calls and data copying when multiple application modules access the parsed data, alleviates access latency and resource contention when multiple modules concurrently read the same data source, and thus improves the data sharing efficiency and overall performance of the system in real-time monitoring scenarios.
[0041] As can be seen from the above technical solutions, this application provides a refrigerator data monitoring system and method based on data conversion and application. The system receives raw binary data streams from refrigerator hardware modules through a data receiving layer; a protocol judgment module in the data conversion layer identifies data packets conforming to a predefined format from the raw binary data stream; the data conversion layer is generated by a language that supports mixed programming of managed and unmanaged code; a binary parsing module in the data conversion layer deconstructs the identified data packets, separating multiple data fields that constitute refrigerator operating parameters; a data mapping module in the data conversion layer assigns the values of the separated multiple data fields to multiple attributes declared in a managed class, thereby generating an object instance containing structured refrigerator operating data; the upper application layer calls the application programming interface provided by the data conversion layer to obtain the object instance; the upper application layer is developed based on an object-oriented high-level programming language; the system performs a visual display of the refrigerator's operating status based on the attribute values in the object instance; and performs fault diagnosis and alarm based on the attribute values in the object instance, thus solving the problem that refrigerator data monitoring systems cannot simultaneously achieve parsing efficiency and compatibility. Attached Figure Description
[0042] To more clearly illustrate the technical solution of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a flowchart illustrating the refrigerator data monitoring method based on data conversion and application provided in an embodiment of this application. Detailed Implementation
[0044] The embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described below do not represent all embodiments consistent with this application. They are merely examples of systems and methods consistent with some aspects of this application.
[0045] To address the issue of refrigerator data monitoring systems failing to balance parsing efficiency and compatibility, some embodiments of this application provide a refrigerator data monitoring system based on data conversion and application, comprising:
[0046] The data receiving layer is used to establish a serial communication connection with the refrigerator's hardware module and to receive the raw binary data stream sent by the hardware module.
[0047] It should be understood that the data receiving layer is specifically implemented by the serial communication module integrated in the host computer (which can be a PC or an APP gateway). When the host computer communicates with the refrigerator's hardware module, the RS232 or RS485 serial port standard is used. To ensure accurate and stable communication, the serial port parameters need to be configured in advance, including setting the baud rate to 9600bps or 115200bps, the data bits to 8 bits, the stop bits to 1 bit, and no parity check. With this configuration, the host computer can receive raw binary data packets sent from the refrigerator's hardware module in real time. These data packets are typically between 16 and 64 bytes in length, and their data structure includes a frame header, data field, parity bit, and frame trailer to ensure the integrity and identifiability of the data during transmission.
[0048] The data transformation layer, generated by a language that supports mixed managed and unmanaged code programming, is used to process raw binary data streams.
[0049] It should be understood that the data conversion layer, as the core bridge module, is developed using C++ / CLI language to generate DLL files that can be referenced by C#.
[0050] The data conversion layer includes a protocol determination module, which is used to identify data packets conforming to a predefined format from the raw binary data stream.
[0051] It should be understood that when performing the identification operation, the protocol judgment module does not perform an isolated byte-by-byte check on the original binary data stream. Instead, it scans the data stream in blocks or a sliding window, referencing a preset data packet length range (16 to 64 bytes). During the scan, the frame header detection function CheckFrameHeader(byte[]data) is continuously called, which examines the byte sequence within the current scan window. When consecutive 0x55 and 0xAA bytes are detected, it is considered that the start identifier of a potential data packet—the frame header—has been captured. At this point, the protocol judgment module uses this frame header as a starting point, combined with predefined data packet structure information (such as the length of subsequent data fields, the position and length of the check bit, and the identifier byte at the end of the frame), to extract a complete data packet fragment from the data stream. After extraction, the module further verifies whether the length of the fragment is within the specified range of 16 to 64 bytes, and whether the frame tail conforms to the preset format, thereby ensuring that the identified data packet strictly conforms to the predefined format, rather than merely containing invalid or incomplete data with a frame header identifier. Only after key elements such as the frame header, length range, and frame tail have been verified will the data packet be confirmed as a valid target data packet and passed to the subsequent parsing process. Conversely, if no matching frame header sequence is detected during the scanning process, or if the segment captured after detecting the frame header does not meet the length or frame tail requirements, this part of the data stream will be judged as invalid data and discarded. At the same time, the abnormal log recording mechanism will be triggered to record the time of the identification failure and some key characteristics of the data stream (such as length, abnormal start position, etc.) in the system log for subsequent troubleshooting and system optimization.
[0052] The binary parsing module is used to deconstruct the identified data packets and separate out multiple data fields that constitute the refrigerator's operating parameters.
[0053] It should be understood that deconstruction is not simply data segmentation, but rather a deep understanding and strict adherence to the refrigerator data packet protocol. The binary parsing module first clearly knows the precise location, number of bytes occupied, and data type of each data field defined in the protocol within the data packet. For example, if the protocol specifies that bytes 2-3 represent the refrigerator compartment temperature, then the binary parsing module will accurately locate these two bytes in the data packet's memory. Then, it uses C++ / CLI memory manipulation functions, such as pin_ptr... <byte>pData = &data[0], which fixes the memory address of the data packet and obtains a pointer, thus enabling efficient and direct access to the original binary data at these specific locations. After extracting the original binary data, the module will convert it according to the data format specified by the protocol. For example, for the refrigerator temperature, if the original data is a 2-byte binary number 0x012C, the module will convert it into a 16-bit signed integer, and then combine it with the precision specified by the protocol (such as 0.1℃) to calculate the actual temperature value of 30.0℃. In this way, the binary parsing module can accurately separate and extract multiple specific data fields that constitute the refrigerator operating parameters, such as refrigerator temperature, freezer temperature, and compressor status, from the binary data stream, providing clear and usable parameter values for subsequent data processing and monitoring.
[0054] The data mapping module is used to assign the values of multiple separated data fields to multiple properties declared in a managed class, thereby generating an object instance containing structured refrigerator operation data.
[0055] It should be understood that a managed class specifically refers to a reference type (such as `refclass RefrigeratorData`) defined in a managed code environment such as C#. The "multiple properties" declared within this class correspond one-to-one with the refrigerator's operating parameters. These properties have explicit data types; for example, the refrigerator and freezer temperatures use the `double` type to precisely represent temperature values, the compressor operating status uses an enumeration type (`enum CompressorStatus`) to limit its value to either "Stop" (0) or "Run" (1), and the door opening / closing status uses the `bool` type to represent "open" (usually `true`) or "closed" (usually `false`). The assignment process is not a simple type conversion but is implemented through a specially designed field mapping function (such as `void MapToManagedClass(byte[] parsedData, RefrigeratorData^%managedData)`). This function receives the raw binary data (`parsedData`) of the separated data fields as input and, according to a preset protocol or data dictionary, accurately parses the values of each field in the binary data and assigns them to the corresponding name and type properties in the managed class instance (`managedData`). For example, if a byte in the parsed binary data represents the compressor status with a value of 0x01, the function will convert this value into the Run member of the CompressorStatus enumeration and assign it to the compressor_status property of the managed class. Through this series of operations, the final generated object instance containing structured refrigerator operating data is a managed class object with all attribute values correctly populated. This object instance can be directly recognized, accessed, and manipulated by managed code such as C#, allowing subsequent business logic processing (such as data display, analysis, and storage) to be based on a clear and standardized object model, rather than directly processing fragmented, untyped binary data or strings.
[0056] In some embodiments, the data conversion layer further includes a protocol self-learning module; the protocol self-learning module is used to continuously collect multiple sets of data packets when a raw binary data stream with an unknown data protocol is detected.
[0057] It should be understood that continuously collecting multiple sets of data packets is not a simple aggregation of quantities, but specifically refers to the process by which the system, through an unmanaged C++ thread in the background, collects the raw binary data streams sent by an unknown model of refrigerator. Furthermore, the number of data packets collected must reach at least 100 sets to ensure the statistical significance and accuracy of subsequent analysis. This collection process fully utilizes the advantages of C++ / CLI in multithreading and memory operations, enabling efficient and stable acquisition of raw data, laying a solid foundation for subsequent protocol parsing.
[0058] Analyze the byte sequence characteristics of multiple data packets to infer the data packet structure.
[0059] It should be understood that analyzing the byte sequence characteristics of multiple data packets to infer the data packet structure specifically refers to using statistical analysis algorithms to deeply analyze the byte sequences of a large number of collected data packets. These algorithms focus on examining key features such as the distribution of field lengths and the patterns of numerical changes. By identifying and summarizing these features, they can accurately infer the core structural information of the data packets, such as the frame header, checksum, and various data fields.
[0060] A preliminary data protocol description file is generated based on the inference results.
[0061] It should be understood that the preliminary data protocol description file generated based on the inference results is not a file of arbitrary format, but rather an XML-formatted protocol configuration template. This template is automatically generated by the system based on the aforementioned inference results regarding the data packet structure and is pushed to the C# upper-level interface via a managed interface. This allows users to confirm or make necessary fine-tuning of key parameters, such as the accuracy of the temperature field, thereby ultimately achieving zero-code adaptation to the unknown refrigerator data protocol.
[0062] In some embodiments, the data conversion layer further includes a cross-platform adaptation module; the cross-platform adaptation module is used to compile corresponding code for different operating system environments through pre-compilation instructions, and to uniformly encapsulate the operating system-related serial port operation functions and memory operation functions.
[0063] It should be understood that pre-compilation directives refer to a mechanism where the system automatically triggers the compilation of different code blocks based on the target operating system type during the compilation phase (e.g., by detecting compilation environment variables or compilation parameters specified by the developer). Specifically, when the compilation target is a Windows operating system, the system will recognize the #ifdef_WIN32 directive and then compile the serial port operation functions (such as calling Windows API functions like CreateFile, ReadFile, and WriteFile to open, read, and write serial ports) and memory operation functions (such as using Windows-specific memory management functions like LocalAlloc and LocalFree) optimized for the Windows platform under this directive. When the compilation target is switched to a Linux operating system, the system will recognize the #ifdefLINUX directive and instead compile the corresponding functions based on Linux system calls (such as using system calls like open, read, and write to implement serial port communication, and using standard C library functions like malloc and free for memory management). Separate compilation ensures that the generated DLL file is deeply compatible with the target operating system at the binary level. Unified encapsulation is reflected in the fact that, regardless of the specific functions called at the underlying level, the cross-platform adaptation module will expose a set of standardized, operating system-independent interface names and parameter lists to the upper layer. For example, for serial port opening operations, the upper layer uniformly calls the encapsulated OpenSerialPort() function, without needing to know whether it internally calls CreateFile under Windows or open under Linux. This encapsulation not only shields the interface differences between different operating systems, allowing other modules in the data conversion layer and the C# upper-layer interface to call these core functions in a consistent manner, avoiding the problem of needing to modify a large amount of upper-layer code due to different operating systems, but also reserves a unified interface extension point for future expansion to support other operating systems (such as embedded real-time operating systems). This only requires adding conditional compilation code blocks for the corresponding operating system to the DLL, greatly improving the maintainability and scalability of the system.
[0064] In some embodiments, the protocol determination module is further configured to calculate the cyclic redundancy check code of the data packet when performing data packet identification, and compare the calculation result with the check code contained in the data packet.
[0065] It should be understood that calculating the Cyclic Redundancy Check (CRC) code for a data packet specifically refers to the protocol judgment module, upon receiving the original binary data stream or a single data packet to be processed, recalculating the CRC value of the valid data portion of the data packet, excluding the checksum field it carries, according to the Cyclic Redundancy Check (CRC) algorithm and initial parameters (such as polynomials, initial values, XOR values, etc.) specified in the communication protocol that the data packet should follow. For example, if a protocol specifies a data packet format of "frame header + data length + data content + CRC checksum + frame trailer," the protocol judgment module will extract the "frame header + data length + data content" portion for CRC calculation. Comparing the calculation result with the checksum contained in the data packet means that after completing the above CRC value calculation, the protocol judgment module will perform a precise bit-by-bit or byte-by-byte comparison with the value of the CRC checksum field carried in the data packet's own structure.
[0066] The data packet is passed to the binary parsing module only if the comparison matches.
[0067] It should be understood that the condition for data flow is clearly defined when the comparison is consistent, only passing the data packet to the binary parsing module: only when the CRC value calculated by the protocol judgment module is exactly the same as the checksum contained in the data packet is the data packet considered to have not experienced bit flipping, loss, or incorrect insertion during transmission, and the integrity and accuracy of the data have been initially verified. At this point, the protocol judgment module will allow the data packet to continue to be passed down to the subsequent binary parsing module for deeper protocol field parsing and data extraction. Conversely, if the comparison results are inconsistent, i.e., the calculated CRC value is different from the checksum contained in the data packet, the protocol judgment module will determine that the data packet is invalid and will usually discard it instead of passing it to the binary parsing module. This is to prevent erroneous data from entering the subsequent processing flow, thereby ensuring the reliability of subsequent data parsing and application, and reducing the risk of system anomalies caused by invalid data.
[0068] In some embodiments, the data conversion layer defines a protocol configuration file; the protocol configuration file is stored in text format and is used to define the data protocol rules corresponding to various refrigerator models. The data protocol rules include the frame header byte sequence, the length of each data field and the starting position in each data packet; the data conversion layer reads the protocol configuration file at runtime to adapt to different refrigerator models.
[0069] Specifically, the protocol configuration file (such as ProtocolConfig.xml) is stored in a common text format such as XML. This text format has good readability and editability, making it easy for developers and maintenance personnel to configure parameters according to the communication protocol characteristics of different refrigerator models. In the protocol configuration file, for each refrigerator model, its corresponding data protocol rules are fully defined in the form of independent configuration items or configuration nodes. Among them, the frame header byte sequence clearly specifies the starting identifier of the data packet sent by the refrigerator model. For example, the frame header of a certain refrigerator model may be defined as hexadecimal "AA 55". When the data conversion layer receives the data packet, it first uses this frame header byte sequence to identify and locate the valid start position of the data packet, ensuring that subsequent field parsing starts from the correct position. The length of each data field precisely describes the number of bytes occupied by each specific data item (such as refrigerator internal temperature, operating mode, fault code, etc.) in the data packet. For example, the temperature field may be configured as 2 bytes, and the operating mode field as 1 byte, etc. The starting position of each data field in the data packet, i.e., the field offset, refers to the number of bytes between the starting byte of the data packet (usually the first valid data byte after the frame header) and the first byte of the data field. By combining the field length and the offset, the data conversion layer can accurately calculate the specific byte range of each data field in the entire data packet, thereby achieving accurate extraction of each data field.
[0070] The upper application layer, developed based on an object-oriented high-level programming language, obtains object instances by calling the application programming interface provided by the data transformation layer, and performs visualization of the refrigerator's operating status and diagnosis and alarm of operating faults based on the attribute values in the object instances.
[0071] It should be understood that when the upper application layer is developed using high-level object-oriented programming languages such as C# and Java, its core function is to obtain refrigerator operating data through interaction with the data conversion layer. Calling the application programming interface (API) provided by the data conversion layer to obtain an object instance specifically means that the upper application layer loads the dynamic link library (DLL) file generated by the data conversion layer. After loading, the upper application creates an instance of the RefrigeratorData class defined within the DLL in its code. Subsequently, it calls the specific serial port data receiving and parsing interface function encapsulated in the DLL, such as RefrigeratorData^GetRefrigeratorData(SerialPort^serialPort) given in the example, passing the currently used serial port object (SerialPort^serialPort) as a parameter to the interface function. Internally, this interface function utilizes the data protocol rules in the protocol configuration file read by the data conversion layer to perform a complete parsing process on the received serial port data packets. This includes a series of operations such as checksum verification, frame header recognition, and extraction and conversion of various data fields. Finally, the parsed structured refrigerator operation data is filled into a previously instantiated RefrigeratorData object, and this data-filled object instance is returned as the upper application layer. In this way, the upper application layer successfully obtains a RefrigeratorData object instance containing specific refrigerator operation attribute values, enabling subsequent business logic processing based on this object.
[0072] In some embodiments, the upper application layer includes a status display module for reading the properties of an object instance and displaying the refrigerator's operating status information in real time through interface controls.
[0073] Specifically, the status display module first obtains key operating parameters such as coldroom_sensor_temperature (refrigerator compartment sensor temperature), freezer_sensor_temperature (freezer compartment sensor temperature), and compressor_status (compressor status) precisely by calling the public property accessor of the RefrigeratorData object instance. Regarding the interface presentation, the system uses a WinForm or WPF framework to build the user interface, selecting appropriate interface controls for different types of attribute values. For example, for numerical data like temperature, the system binds it to a label control and sets the display format to retain one decimal place, ensuring that users can intuitively read accurate temperature values. For Boolean or enumerated status data such as compressor operating status, status indicator lights (such as PictureBox simulations or custom indicator light controls) are used for visualization, and a color-coding mechanism is used for differentiation. For example, when the compressor_status attribute value is "Running," the indicator light is green, and when the attribute value is "Stopped," the indicator light is gray, allowing users to quickly and clearly identify the current operating status of the compressor. In addition, to achieve "real-time display", the module will periodically reread the latest property values of the RefrigeratorData object instance or re-read them when a data update event is triggered, and immediately update the corresponding interface controls through a timer control or an event-driven approach, so as to ensure that the information displayed on the interface is highly synchronized with the actual operating status of the refrigerator.
[0074] The fault alarm module is used to preset fault judgment thresholds. It compares the attributes of an object instance with the fault judgment thresholds through a timed detection function, and outputs fault information when a fault condition is triggered.
[0075] It should be understood that the preset fault judgment thresholds specifically cover scenarios such as refrigerator temperature > 8℃, freezer temperature > -10℃, and door continuously open for more than 5 minutes. Taking the specific void CheckFault(RefrigeratorData^data) function as an example, the timed detection function detects faults by comparing the real-time attribute data of the refrigerator object instance with the preset fault judgment thresholds. When a fault condition is triggered, the fault information is output in the following ways: pop-up window prompts the user, calling the System.Media.SoundPlayer class to trigger an audible alarm to attract attention, and writing the fault details to the local FaultLog.txt file for logging. The log will also include the specific time of the fault occurrence and related parameters, such as "2025-10-20 14:30:00, refrigerator temperature 9.2℃, high temperature fault triggered" and other detailed log content.
[0076] In some embodiments, the upper application layer further includes a multi-module data sharing module; the multi-module data sharing module is used to establish a shared memory area between the data conversion layer and the upper application layer through memory-mapped file technology, and write the data of object instances into the shared memory area.
[0077] Specifically, after parsing the raw refrigerator data and generating structured object instance data, the data conversion layer uses the memory-mapped file interface functions provided by the DLL (Dynamic Link Library) to create a shared memory area of a specific size in the system memory. This shared memory area serves as an efficient data exchange medium between the data conversion layer and the upper application layer. The data conversion layer writes the parsed complete object instance data, including all valid field information such as the real-time temperature, operating status, and device ID of each compartment of the refrigerator, into this shared memory area according to a preset data structure and format. Various functional modules in the upper application layer, such as the real-time monitoring module responsible for displaying the refrigerator's operating parameters, the historical data storage module for storing historical operating records, and the remote push module that needs to send critical data to a remote server, no longer need to send requests to the data conversion layer and wait for a response through conventional inter-process communication methods (such as message queues and pipes), nor do they need to independently call the data parsing interface to repeatedly parse the raw data or copy data objects. Instead, they can directly access this pre-established shared memory area to quickly read the required structured data. This direct access method significantly reduces latency and additional system overhead during data transfer between modules. Simultaneously, to ensure data accuracy and integrity when multiple modules concurrently access shared memory, the system employs thread-safe mechanisms built into the C# programming language. For example, it uses the `lock` statement to control access to shared resources, combined with locking logic such as mutexes or semaphores implemented internally within the DLL, to strictly manage synchronization and mutual exclusion for shared memory read and write operations. This means that when one module is writing or reading data from the shared memory area, other modules are restricted from accessing it until the current operation is completed and the lock resource is released. This effectively avoids data races that can occur when multiple modules simultaneously read and write to shared memory, ensuring that all modules in the upper application layer can obtain consistent and up-to-date refrigerator object instance data at any given time.
[0078] See Figure 1 This application also provides a refrigerator data monitoring method based on data conversion and application in some embodiments. The method is applied to the refrigerator data monitoring system based on data conversion and application provided in the above embodiments, and includes:
[0079] S100: Receives raw binary data streams from the refrigerator hardware module via the data receiving layer.
[0080] S200: Through the protocol judgment module in the data conversion layer, data packets conforming to a predefined format are identified from the raw binary data stream.
[0081] It should be understood that the data transformation layer is generated by a language that supports mixed programming of managed and unmanaged code.
[0082] S300: The binary parsing module in the data conversion layer deconstructs the identified data packets and separates multiple data fields that constitute the refrigerator's operating parameters.
[0083] S400: Through the data mapping module in the data transformation layer, the values of multiple separated data fields are assigned to multiple properties declared in a managed class, thereby generating an object instance containing structured refrigerator operation data.
[0084] S500: Obtain object instances by calling the application programming interface provided by the data transformation layer through the upper application layer.
[0085] It should be understood that the upper application layer is developed based on a high-level object-oriented programming language.
[0086] S600: Performs a visual display of the refrigerator's operating status based on the attribute values in the object instance.
[0087] S700: Performs diagnostics and alarms for runtime faults based on attribute values in object instances.
[0088] By employing a data conversion layer implemented with a hybrid programming language to structure the received binary data, the conflict between efficient low-level data processing and convenient development of upper-level applications is alleviated. Modular identification, destructuring, and mapping steps reduce the parsing difficulty caused by complex data protocols or model differences. This method separates data conversion from upper-level application logic, reducing modifications to upper-level functions during protocol updates, thereby improving system compatibility and maintenance efficiency. Simultaneously, by allowing upper-level applications to directly obtain and use structured object instances, the direct dependence of status display and fault alarm functions on the underlying data format is reduced, enhancing the responsiveness and ease of development of monitoring functions.
[0089] In some embodiments, after identifying data packets conforming to a predefined format from the raw binary data stream, the method further includes: calculating a cyclic redundancy check (CRC) code for the data packet and comparing the calculation result with a check code contained in the data packet; and only when the comparison matches, passing the data packet to the binary parsing module.
[0090] After identifying data packets conforming to a predefined format, a step of calculating and comparing cyclic redundancy check (CRC) codes is added. Subsequent parsing is only performed if the check matches. This method reduces the likelihood of erroneous data generated during data transmission or acquisition being further processed, mitigates errors in analysis results caused by compromised data integrity, and thus improves the reliability of the entire monitoring system's data processing workflow.
[0091] In some embodiments, after generating an object instance containing structured refrigerator operation data, the method further includes: establishing a shared memory region between the data transformation layer and the upper application layer using memory-mapped file technology, and writing the data of the object instance into the shared memory region.
[0092] By using memory-mapped file technology, a shared memory area is established between the data conversion layer and the upper application layer, and data is written there. This method reduces the overhead of repeated calls and data copying when multiple application modules access the parsed data, alleviates access latency and resource contention when multiple modules concurrently read the same data source, and thus improves the data sharing efficiency and overall performance of the system in real-time monitoring scenarios.
[0093] As can be seen from the above technical solutions, this application provides a refrigerator data monitoring system and method based on data conversion and application. The system receives raw binary data streams from the refrigerator hardware module through a data receiving layer; identifies data packets conforming to a predefined format from the raw binary data stream through a protocol judgment module in the data conversion layer; the data conversion layer is generated by a language that supports mixed programming of managed and unmanaged code; the binary parsing module in the data conversion layer deconstructs the identified data packets, separating multiple data fields that constitute the refrigerator's operating parameters; the data mapping module in the data conversion layer assigns the values of the separated data fields to multiple attributes declared in a managed class, thereby generating an object instance containing structured refrigerator operating data; the upper application layer calls the application programming interface provided by the data conversion layer to obtain the object instance; the upper application layer is developed based on an object-oriented high-level programming language; the system performs visual display of the refrigerator's operating status based on the attribute values in the object instance; and performs fault diagnosis and alarm based on the attribute values in the object instance, thus solving the problem that refrigerator data monitoring systems cannot simultaneously achieve parsing efficiency and compatibility.
[0094] Similar parts between the embodiments provided in this application can be referred to mutually. The specific implementation methods provided above are only a few examples under the overall concept of this application and do not constitute a limitation on the scope of protection of this application. For those skilled in the art, any other implementation methods extended from the solution of this application without creative effort shall fall within the scope of protection of this application.< / byte>
Claims
1. A refrigerator data monitoring system based on data conversion and application, characterized in that, include: The data receiving layer is used to establish a serial communication connection with the refrigerator's hardware module and receive the raw binary data stream sent by the hardware module. A data transformation layer, generated by a language that supports mixed programming of managed and unmanaged code, is used to process the raw binary data stream; The data transformation layer includes: The protocol determination module is used to identify data packets conforming to a predefined format from the raw binary data stream; The binary parsing module is used to deconstruct the identified data packet and separate out multiple data fields that constitute the refrigerator's operating parameters; The data mapping module is used to assign the values of the separated multiple data fields to multiple properties declared in a managed class, thereby generating an object instance containing structured refrigerator operation data; The upper application layer, developed based on an object-oriented high-level programming language, obtains the object instance by calling the application programming interface provided by the data conversion layer, and performs visualization display of the refrigerator's operating status and diagnosis and alarm of operating faults based on the attribute values in the object instance.
2. The refrigerator data monitoring system based on data conversion and application according to claim 1, characterized in that, The data conversion layer also includes a protocol self-learning module; The protocol self-learning module is used to continuously collect multiple sets of data packets when the original binary data stream with an unknown data protocol is detected; The byte sequence characteristics of the multiple data packets are analyzed to infer the data packet structure; a preliminary data protocol description file is generated based on the inference results.
3. The refrigerator data monitoring system based on data conversion and application according to claim 1, characterized in that, The data conversion layer also includes a cross-platform adaptation module; The cross-platform adaptation module is used to compile corresponding code for different operating system environments through pre-compilation instructions, and to uniformly encapsulate the operating system-related serial port operation functions and memory operation functions.
4. The refrigerator data monitoring system based on data conversion and application according to claim 1, characterized in that, The protocol judgment module is also used to calculate the cyclic redundancy check code of the data packet when performing data packet identification, and compare the calculation result with the check code contained in the data packet; only when the comparison is consistent, the data packet is passed to the binary parsing module.
5. The refrigerator data monitoring system based on data conversion and application according to claim 1, characterized in that, The data conversion layer is defined with a protocol configuration file; The protocol configuration file is stored in text format and is used to define the data protocol rules corresponding to various refrigerator models. The data protocol rules include the frame header byte sequence, the length of each data field and the starting position in each data packet. The data conversion layer reads the protocol configuration file at runtime to adapt to different refrigerator models.
6. The refrigerator data monitoring system based on data conversion and application according to claim 1, characterized in that, The upper application layer includes: The status display module is used to read the attributes of the object instance and display the refrigerator's operating status information in real time through interface controls; The fault alarm module is used to preset fault judgment thresholds. It compares the attributes of the object instance with the fault judgment thresholds through a timed detection function, and outputs fault information when a fault condition is triggered.
7. The refrigerator data monitoring system based on data conversion and application according to claim 1, characterized in that, The upper application layer also includes a multi-module data sharing module; The multi-module data sharing module is used to establish a shared memory area between the data conversion layer and the upper application layer through memory-mapped file technology, and to write the data of the object instance into the shared memory area.
8. A refrigerator data monitoring method based on data conversion and application, characterized in that, The method is applied to the refrigerator data monitoring system based on data conversion and application as described in any one of claims 1-7, and the method includes: The raw binary data stream from the refrigerator hardware module is received through the data receiving layer; The protocol judgment module in the data conversion layer identifies data packets conforming to a predefined format from the raw binary data stream; the data conversion layer is generated by a language that supports mixed programming of managed and unmanaged code. The binary parsing module in the data conversion layer deconstructs the identified data packet and separates multiple data fields that constitute the refrigerator's operating parameters. The data mapping module in the data transformation layer assigns the values of the separated data fields to multiple properties declared in a managed class, thereby generating an object instance containing structured refrigerator operation data. The object instance is obtained by calling the application programming interface provided by the data transformation layer through the upper application layer; the upper application layer is developed based on an object-oriented high-level programming language. The refrigerator's operating status is visualized based on the attribute values in the object instance. Perform diagnostics and alarms for operational faults based on the attribute values in the object instance.
9. The refrigerator data monitoring method based on data conversion and application according to claim 8, characterized in that, After the step of identifying data packets conforming to a predefined format from the raw binary data stream, the method further includes: Calculate the cyclic redundancy check (CRC) code of the data packet and compare the calculation result with the check code contained in the data packet; The data packet is passed to the binary parsing module only if the comparison is successful.
10. The refrigerator data monitoring method based on data conversion and application according to claim 8, characterized in that, After the step of generating an object instance containing structured refrigerator operation data, the method further includes: A shared memory area is established between the data transformation layer and the upper application layer using memory-mapped file technology, and the data of the object instance is written into the shared memory area.