Gas detector data sending method, gas detector data receiving method and remote data transmission system
The BMP bitmap file format enables cross-manufacturer compatibility and reduces maintenance by allowing clients to adapt display images based on their screen sizes, addressing communication protocol incompatibilities in gas detectors.
Patent Information
- Application Number
- CN202411185076.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-08-27
AI Technical Summary
Existing gas detectors face incompatibility issues due to different communication protocols among manufacturers, requiring separate program development and maintenance when memory content or data formats change.
A unified data transmission method using BMP bitmap files, where gas detectors generate data based on detection results, import it into a preset image template, and send BMP bitmap file data to clients, allowing clients to calculate scaling ratios for display adaptation.
Achieves compatibility across different product series by using a unified data format, reducing maintenance work and ensuring high-definition display on various devices.
Smart Images

Figure CN119147691A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a data transmission method, and in particular to a gas detector data sending method, receiving method and remote data transmission system. Background Art
[0002] A gas detector is an instrument for detecting gas concentration. It is suitable for dangerous places where flammable or toxic gases exist. It can continuously detect the content of the gas in the air for a long time. It is widely used in various industries where flammable or toxic gases exist, such as gas, petrochemical, metallurgy, steel, coking, and electricity.
[0003] In actual use, gas detectors generally use LEDs, segment code screens or LCD screens to indicate gas concentration data or alarm status, and use specific communication protocols to transmit data through wired or wireless communication methods. Client devices use the same communication protocol to receive, analyze and display data. This communication transmission method has the following problems: 1. Due to the need to use a specific communication protocol for data transmission, different manufacturers or different series of products from the same manufacturer often develop their own communication protocol formats due to differences in video memory content or data formats. This results in the incompatibility of communication protocols between products, and it is often necessary to develop corresponding client device programs separately; 2. Since the gas detector and the client device need to use the same communication protocol for communication, if the memory content or data format of the gas detector changes, the programs of the gas detector and the client device need to be adjusted synchronously, increasing product development and maintenance work.
[0004] In order to solve the above problems, people have been seeking an ideal technical solution. Summary of the invention
[0005] The object of the present invention is to address the deficiencies of the prior art and thus provide a gas detector data sending method, receiving method and remote data transmission system.
[0006] In order to achieve the above object, the technical solution adopted by the present invention is: A first aspect provides a gas detector data transmission method, which is applied to a gas detector, wherein a CPU RAM of the gas detector is provided with a video memory space, and the gas detector generates data to be transmitted based on the detection result, and the data to be transmitted includes at least an alarm state, a gas type, and a concentration information; The method comprises: Import the data to be transmitted into a preset image template to generate an image to be transmitted; After acquiring the image to be transmitted, the image to be transmitted is output to the video memory space through the display function to generate video memory content; The video memory content generates corresponding BMP bitmap file data according to the BMP bitmap file format and sends it to the client, so that after the client obtains the BMP bitmap file data, it generates a BMP file according to the BMP bitmap file data and displays it.
[0007] Preferably, the data to be transmitted is imported into a preset image template to generate an image to be transmitted, including: Writing the data to be transmitted into the corresponding position in the preset image template in the first color and the specified element type to obtain an initial image; the element type includes at least character elements and digital elements, wherein the non-specified position of the preset image template is set to the second color, the alarm state and the gas type correspond to the character elements, and the concentration information corresponds to the digital elements; Extract inner and outer edge pixels of the first color region in the initial image; The pixel colors of the inner and outer edge pixels of the first color area are changed to a specified color to form an image to be transmitted.
[0008] Preferably, the preset image template is further provided with at least one dynamic chart element, the edge pixel points of each dynamic chart element are defined as the second color, different dynamic chart elements are of different types and correspond to unique standard thresholds; In the process of writing the data to be transmitted in the first color and the specified element type into the corresponding position in the preset image template to generate the initial image, for each dynamic chart element, calculating the chart display ratio based on the data to be transmitted and the standard threshold value corresponding to the dynamic chart element, filling the dynamic chart element with a third color according to the chart display ratio, and modifying the edge pixels of the dynamic chart element to the third color; The steps for obtaining the third color are: encoding the chart display ratio value using error correction coding, mapping the encoded data to a color index, and converting the color index to an RGB color by looking up a color index table, and the RGB color is the third color.
[0009] Preferably, when drawing the outer contour according to the preset pixel width and the specified color, different element types correspond to different specified colors, and the specified color is a color different from the first color, the second color and the third color.
[0010] A second aspect provides a gas detector data receiving method, which is applied to a client connected to a gas detector, wherein the client receives BMP bitmap file data sent by the gas detector based on the aforementioned gas detector data sending method, and the method comprises: After receiving the BMP bitmap file data sent by the gas detector based on a gas detector data sending method provided in the first aspect, the scaling ratio is calculated according to the image size in the BMP bitmap file data and its own screen size, and a target BMP bitmap of the screen size is generated for display based on the received BMP bitmap file data and the scaling ratio.
[0011] A third aspect provides a gas detector, the gas detector comprising a CPU, a collection unit, a storage unit and a data sending device; The acquisition unit is used to acquire the gas signal to be tested; The CPU generates data to be transmitted according to the collected original electrical signal; The storage unit is used to store data to be transmitted; After acquiring the data to be transmitted, the data sending device executes the data sending method proposed in the first aspect, generates BMP bitmap file data and sends it to the client.
[0012] The fourth aspect provides a client, including a display module and a data receiving device, wherein the data receiving device is used to execute the data receiving method provided in the second aspect to generate a target BMP bitmap; the display module is used to display the target BMP bitmap sent by the data receiving device.
[0013] In one embodiment, the client is also provided with a command button for obtaining a clear BMP bitmap and an element graphic library, wherein the element graphic library is provided with character element graphics and digital element graphics of different resolutions and sizes; When a command to obtain a clear BMP bitmap is received, an intermediate BMP bitmap of the screen size is generated, wherein the pixel color of all pixels in the intermediate BMP bitmap is white; In the obtained target BMP bitmap, a color matching algorithm is used to search for an area composed of colors whose color difference with the specified color is within a preset threshold range, and a target element graphic is obtained; Traverse each target element image, obtain the position of the target element image in the target BMP bitmap, and use the same position in the intermediate BMP bitmap as the position to be pasted; Searching for an element graphic having the same outline and size as the target element graphic in the specified element graphic library as a candidate graphic; Select a graphic with the same screen resolution from the candidate graphics as the target graphic, and paste the target graphic at the position to be pasted in the middle BMP bitmap; After the traversal is completed, the original target BMP bitmap is deleted, and the intermediate BMP bitmap after pasting the graphics is displayed as the target BMP bitmap.
[0014] Furthermore, the element graphic library is also provided with dynamic chart graphics, each of which is associated with a chart display ratio value; In the target BMP bitmap, a color matching algorithm is used to search for an area composed of colors whose color difference with the third color is within a preset threshold range to obtain a dynamic chart graphic; the position of the dynamic chart graphic in the target BMP bitmap is obtained, and the same position in the intermediate BMP bitmap is used as the position to be pasted; in the specified element graphic library, a graphic with the same outline, size and percentage value as the dynamic chart graphic is searched as a candidate graphic, and a graphic with the same screen resolution is selected from the candidate graphics as the target graphic, and the target graphic is pasted at the position to be pasted in the intermediate BMP bitmap; The steps for obtaining the numerical value of the chart display ratio are as follows: while calculating the scaling ratio according to the image size in the BMP bitmap file data and the screen size itself, the BMP bitmap file data is traversed to find the third color that is different from the first color, the second color and the specified color, the RGB color is converted into a color index by looking up the color index table, and the color index is decoded to obtain the numerical value of the chart display ratio.
[0015] The fifth aspect provides a gas detector remote data transmission system, comprising the aforementioned gas detector, and also comprising at least one client, wherein the client is the aforementioned client, and the gas detector is communicatively connected to the client.
[0016] The present invention has outstanding substantive features and significant progress compared to the prior art. Specifically, the present invention uses a unified data format for transmission to achieve compatibility between different series of products from different manufacturers. The client does not do any parsing, but directly calculates the scaling ratio based on the image size in the BMP bitmap file data and its own screen size, and generates a target BMP bitmap of the screen size for display based on the received BMP bitmap file data and the scaling ratio, thereby reducing the subsequent product maintenance work. Moreover, since the BMP bitmap has a simple structure and does not involve image compression, it can be used on any device.
[0017] Specifically, before generating a BMP bitmap file, the gas detector uses different colors as the outline of the element, so that when the client wants to obtain a high-definition image, it can find the element graphic of the corresponding size and resolution in the specified element graphic library based on the element graphic corresponding to the outline, and paste the element graphic at the corresponding position in the middle BMP bitmap, thereby obtaining a BMP bitmap file that adapts to the screen resolution and screen size, and obtaining a high-definition display effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a flowchart of the data sending method described in Example 1 of the present invention.
[0019] Figure 2 It is a schematic diagram of an image to be transmitted in Embodiment 1 of the present invention.
[0020] Figure 3 It is a schematic diagram of the structure of the gas detector described in Example 4 of the present invention.
[0021] Figure 4 It is a schematic diagram of the process of obtaining a clear BMP bitmap described in Example 6 of the present invention.
[0022] Figure 5 It is a schematic diagram of the structure of the gas detector remote data transmission system described in Example 8 of the present invention.
[0023] Figure 6 It is a flow chart of the gas detector remote data transmission system described in Example 8 of the present invention. DETAILED DESCRIPTION
[0024] BMP is a widely used image file format that is independent of hardware devices. It uses a bitmap storage format and does not use any other compression except for the optional image depth. Therefore, BMP files occupy a large amount of space.
[0025] Specifically, a BMP file consists of four parts: a file header, a bitmap information header, color information, and graphic data. The file header provides information such as the file format and size; specifically, it includes a 2-byte data flag BM, which indicates the BMP format supported by Windows; a 4-byte file data length; a bitmap information header used to provide the image data size, number of bit planes, compression method, color index, etc.; color information, an index to a mapping table of corresponding colors; and image data array bytes, which are image data.
[0026] The technical solution of the present invention is further described in detail below through specific implementation methods.
[0027] Example 1 This embodiment provides a method for sending gas detector data, which is applied to a gas detector. A bitmap memory space is set in the CPU RAM of the gas detector. The gas detector generates data to be transmitted based on the detection result. The data to be transmitted includes at least alarm status, gas type, and concentration information. The CPU FLASH also stores a display function. The memory function includes the memory layout of the LCD display screen, such as selecting a one-dimensional memory layout or a two-dimensional memory layout. The method is as Figure 1 As shown, including: After obtaining the data to be transmitted, the data to be transmitted is imported into a preset image template to generate an image to be transmitted; the preset image template includes a resolution parameter, an image size parameter, a content type and a corresponding content placement position; Figure 2 As shown, it is a schematic diagram of the image to be transmitted. It can be seen that the image to be transmitted includes concentration information, alarm information and the type of gas detected. In addition, in some embodiments, the image to be transmitted also includes dynamic charts, such as a graphical display of the lower explosion limit percentage and the flow rate of the gas.
[0028] The video memory content generates corresponding BMP bitmap file data according to the BMP bitmap file format and sends it to the client, so that after the client obtains the BMP bitmap file data, it generates a BMP file according to the BMP bitmap file data and displays it.
[0029] Example 2 This embodiment provides a specific embodiment of generating an image to be transmitted.
[0030] In this embodiment, the data to be transmitted is imported into a preset image template to generate an image to be transmitted, including: The data to be transmitted is written into the corresponding position in the preset image template in a first color and a specified element type to obtain an initial image; the element type includes at least character elements and digital elements, wherein the non-specified position of the preset image template is set to a second color, the alarm status and gas type correspond to the character elements, and the concentration information corresponds to the digital elements.
[0031] Extract inner and outer edge pixels of the first color region in the initial image; The pixel colors of the inner and outer edge pixels of the first color area are changed to a specified color to form an image to be transmitted.
[0032] It can be understood that the first color and the second color are different colors. For example, if the first color is pure black, the second color can be pure white.
[0033] The function of this technical solution is to allow different subsequent clients to regenerate a high-definition BMP bitmap that meets the client's requirements according to the screen resolution and screen size of their displays and the outline formed by the specified color for display.
[0034] Specifically, in the process of specific implementation, different designated colors can also be assigned to the inner and outer edge pixels of the first color area corresponding to different element types, and the designated colors are different from the first color, the second color and the third color, so that the contour lines of different elements can be obtained according to different colors and searched separately.
[0035] Furthermore, the preset image template is further provided with at least one dynamic chart element, the edge pixel points of each dynamic chart element are defined as the second color, different dynamic chart elements are of different types and correspond to unique standard thresholds; In the process of writing the data to be transmitted in the first color and the specified element type into the corresponding position in the preset image template to generate the initial image, for each dynamic chart element, calculating the chart display ratio based on the data to be transmitted and the standard threshold value corresponding to the dynamic chart element, filling the dynamic chart element with a third color according to the chart display ratio, and modifying the edge pixels of the dynamic chart element to the third color; The steps for obtaining the third color are: encoding the chart display ratio value using error correction coding, mapping the encoded data to a color index, and converting the color index to an RGB color by looking up a color index table, and the RGB color is the third color.
[0036] In practice, in order to distinguish the third color from the second color and the first color, the third color may be obtained first, and then the first color and the second color may be set respectively.
[0037] The purpose of designing the third color is that when a high-definition BMP bitmap that meets the client's requirements is regenerated later on different clients, the chart display ratio can be deduced based on the third color, and the chart of the corresponding ratio can be queried based on the chart display ratio for display. I will not go into details here, and please refer to the subsequent description for details.
[0038] Example 3 This embodiment provides a gas detector data receiving method, which is applied to a client connected to a gas detector. The client receives BMP bitmap file data sent by the gas detector based on a gas detector data sending method described in any one of Embodiments 1-2. Preferably, the client is a cloud platform, a controller or a PC, a handheld device, etc. It can be seen that different types of clients have different screen sizes and resolution requirements, so the size and resolution of the BMP bitmap need to be adjusted according to actual needs.
[0039] Specifically, the data receiving method includes: after obtaining BMP bitmap file data, calculating the scaling ratio according to the image size in the BMP bitmap file data and its own screen size, and generating a target BMP bitmap of the screen size for display according to the received BMP bitmap file data and the scaling ratio.
[0040] Example 4 This embodiment provides a gas detector such as Figure 3 As shown, the gas detector includes a CPU, a collection unit, a storage unit and a data sending device; The acquisition unit is used to acquire the gas signal to be tested; The CPU generates data to be transmitted according to the collected original electrical signal; The storage unit is used to store data to be transmitted; After acquiring the data to be transmitted, the data sending device executes the data sending method described in Embodiment 1 or Embodiment 2 to generate BMP bitmap file data and send it to the client.
[0041] In one embodiment, the data sending device may be a device or module having the data sending method described in Embodiment 1 or Embodiment 2 built-in.
[0042] In one embodiment, the data sending device includes: The bitmap memory space is located in the CPU's RAM and is used to store the video memory content; the display function is located in the CPU's FLASH; A generation module, used for importing the data to be transmitted into a preset image template to generate an image to be transmitted; A mode conversion module, used for calling the display function to output the data to be transmitted to the bitmap display memory space to obtain the display memory content; The format conversion unit generates corresponding BMP bitmap file data according to the BMP bitmap file format from the video memory content; The communication unit communicates with the client and sends out the BMP bitmap file data.
[0043] Example 5 This embodiment provides a client, including a display module, an element graphic library and a data receiving device, wherein the data receiving device is used to execute the data receiving method described in Example 3 to generate a target BMP bitmap; the display module is used to display the target BMP bitmap sent by the data receiving device.
[0044] Specifically, the client may be at least one of a cloud platform, a controller or a PC, and a handheld device. The handheld device may include a mobile phone and a specially customized monitoring terminal.
[0045] In one embodiment, the data receiving device is a device or module having the data receiving method described in Embodiment 3 built-in.
[0046] In another embodiment, the data receiving device is located on the client and includes: The ratio calculation module calculates the scaling ratio based on the bitmap size in the BMP bitmap file data and the screen size itself The restoration module generates a target BMP bitmap of the screen size according to the received BMP bitmap file data and the scaling ratio.
[0047] Example 6 The difference between this embodiment and embodiment 5 is that: The client is also provided with a command button for obtaining a clear BMP bitmap and an element graphic library, wherein the element graphic library is provided with character element graphics and digital element graphics of different resolutions and sizes.
[0048] like Figure 6 As shown, when a command to obtain a clear BMP bitmap is received, an intermediate BMP bitmap of the screen size is generated, wherein the pixel color of all pixels in the intermediate BMP bitmap is white; In the obtained target BMP bitmap, a color matching algorithm is used to search for an area composed of colors whose color difference with the specified color is within a preset threshold range, and a target element graphic is obtained; Traverse each target element image, obtain the position of the target element image in the target BMP bitmap, and use the same position in the intermediate BMP bitmap as the position to be pasted; Searching for an element graphic having the same outline and size as the target element graphic in the specified element graphic library as a candidate graphic; Select a graphic with the same screen resolution from the candidate graphics as the target graphic, and paste the target graphic at the position to be pasted in the middle BMP bitmap; After the traversal is completed, the original target BMP bitmap is deleted, and the intermediate BMP bitmap after pasting the graphics is displayed as the target BMP bitmap.
[0049] As is known to all, there is a direct connection between bitmap and resolution. A bitmap with a large resolution has a high definition and its magnification is also increased accordingly. Therefore, the gas detector uses a higher resolution to generate the image to be transmitted. A higher resolution means that more pixels are contained in each unit length. In this way, when scaling, the size of each pixel changes less, thereby maintaining the details and clarity of the image. However, when the magnification of the bitmap exceeds its optimal resolution, details will be lost and jagged edges will be generated. In order to solve this problem, when the present embodiment wants to obtain a high-definition image, the command button for obtaining a clear BMP bitmap can be used to start the above technical solution, and the element graphic of the corresponding size and resolution is searched in the specified element graphic library based on the element graphic corresponding to the contour line, and the element graphic is pasted in the corresponding position in the intermediate BMP bitmap, thereby obtaining a BMP bitmap file that adapts to the screen resolution and screen size, and obtaining a high-definition display effect.
[0050] However, there is a prerequisite, that is, the gas detector must generate the image to be transmitted in the manner described in Example 2, so that the contour of the element graphic can be found based on the preset color in this embodiment.
[0051] It should be noted that, under normal circumstances, it is only necessary to use the data receiving method described in Example 5 to generate a target BMP bitmap for display. Only when the monitoring personnel cannot see the displayed BMP bitmap clearly or find that the data in the BMP is abnormal, it is necessary to obtain the command button for obtaining a clear BMP bitmap to activate the above technical solution to obtain a high-definition image for verification or storage.
[0052] Specifically, when the gas detector changes the pixel color of the inner and outer edge pixels of the first color area to a specified color, different specified colors are assigned to the inner and outer edge pixels of the first color area corresponding to different element types. For example, the inner and outer edge pixels of the first color area corresponding to the character elements are assigned to the fourth color, and the inner and outer edge pixels of the first color area corresponding to the digital elements are assigned to the fifth color, and the fourth color and the fifth color are different, and are respectively different from the first color, the second color, and the third color.
[0053] Then, the client searches for a region composed of colors whose color difference with the specified color is within a preset threshold range in the obtained target BMP bitmap through a color matching algorithm, and when the target element graphic is obtained, executes: Traverse the element types, and for each element type, obtain its corresponding specified color, such as the fourth color or the fifth color, according to the element type and color mapping relationship table, and search the target BMP bitmap through a color matching algorithm to find the area composed of colors whose color difference with the specified color is within a preset threshold range, so as to obtain several contour areas and obtain the target element graphic.
[0054] The client searches for an element graphic having the same outline and size as the target element graphic in the specified element graphic library as a candidate graphic, including: Searching for an element graphic having the same outline and size as the target element graphic in the element graphic group of the corresponding type in the specified element graphic library as a candidate graphic; The element graphic library is arranged in the client, and character element graphics and digital element graphics of different resolutions and sizes are arranged in the element graphic library, and element graphics of the same type belong to the same element graphic group.
[0055] For ease of understanding, the data 30.2 is taken as an example to illustrate how to obtain the graph corresponding to 30.2.
[0056] According to the element type and color mapping relationship table, the fifth color corresponding to the data 30.2 is obtained, and the area composed of colors whose color difference with the fifth color is within the preset threshold range is searched in the target BMP bitmap through the color matching algorithm, thereby obtaining three contour areas, namely the three target element graphics "3", "0" and "2".
[0057] Search for the target element graphic "3", and search for an element graphic with the same outline and size as the target element graphic "3" in the digital element graphic group of the specified element graphic library as a candidate graphic, select a graphic consistent with the screen resolution as the target graphic from the candidate graphics, and paste the target graphic at the position to be pasted in the intermediate BMP bitmap; Continue to search for the target element graphic "0", and search for an element graphic with the same outline and size as the target element graphic "3" in the digital element graphic group of the specified element graphic library as a candidate graphic, and select a graphic consistent with the screen resolution as the target graphic from the candidate graphics, and paste the target graphic at the position to be pasted in the intermediate BMP bitmap; Find the target element graphic "2", and search for an element graphic with the same outline and size as the target element graphic "3" in the digital element graphic grouping of the specified element graphic library as a candidate graphic, select a graphic consistent with the screen resolution from the candidate graphics as the target graphic, and paste the target graphic at the to-be-pasted position in the intermediate BMP bitmap.
[0058] The search method for character elements is the same as the search method for digital elements, which will not be repeated here. It should be noted that character elements include both alphabetic characters and symbol characters, such as "." and "%".
[0059] Example 7 The difference between this embodiment and embodiment 6 is that: the element graphic library is further provided with dynamic chart graphics, each of which is associated with a chart display ratio value; In the target BMP bitmap, a color matching algorithm is used to search for an area composed of colors whose color difference with the third color is within a preset threshold range to obtain a dynamic chart graphic; the position of the dynamic chart graphic in the target BMP bitmap is obtained, and the same position in the intermediate BMP bitmap is used as the position to be pasted; in the specified element graphic library, a graphic with the same outline, size and percentage value as the dynamic chart graphic is searched as a candidate graphic, and a graphic with the same screen resolution is selected from the candidate graphics as the target graphic, and the target graphic is pasted at the position to be pasted in the intermediate BMP bitmap; The steps for obtaining the numerical value of the chart display ratio are as follows: while calculating the scaling ratio according to the image size in the BMP bitmap file data and the screen size itself, the BMP bitmap file data is traversed to find the third color that is different from the first color, the second color and the specified color, the RGB color is converted into a color index by looking up the color index table, and the color index is decoded to obtain the numerical value of the chart display ratio.
[0060] The purpose of this embodiment is to illustrate that when a high-definition BMP bitmap that meets the client requirements is regenerated later on different clients, the chart display ratio can be inferred based on the third color, and a chart of the corresponding ratio can be queried based on the chart display ratio for display, thereby obtaining a high-definition dynamic icon with the correct chart display ratio.
[0061] Example 8 This embodiment provides a gas detector remote data transmission system, such as Figure 5 and 6 As shown, it includes a gas detector as described in Example 4, and also includes at least one client, the client is the client as described in Example 5 or 6 or 7, and the gas detector is communicatively connected with the client.
[0062] Specifically, the client can be at least one of a cloud platform, a controller or PC, and a handheld device, wherein the cloud platform and the gas detector communicate using 4G / NB, the controller or PC and the gas detector communicate using RS485 / CAN / ETH, and the controller or PC and the gas detector communicate using BLE / WIFI.
[0063] Since BMP bitmap data can be transmitted through different communication protocols, this embodiment makes use of this feature. Instead of transmitting specific data, the data is converted into an image, and finally the BMP bitmap file data is generated for transmission. Since the BMP bitmap data format is used for transmission, compatibility of different series of products from different manufacturers is achieved. The client does not do any parsing, but directly calculates the scaling ratio based on the image size in the BMP bitmap file data and its own screen size, and generates a target BMP bitmap of the screen size for display based on the received BMP bitmap file data and the scaling ratio, reducing the later product maintenance work; and since the BMP bitmap structure is simple and does not involve image compression, it can be used on any device.
[0064] The gas detector collects the gas signal to be tested, generates data to be transmitted according to the collected original electrical signal, imports the data to be transmitted into a preset image template, and generates an image to be transmitted; after obtaining the image to be transmitted, outputs the image to be transmitted to the video memory space through a display function to generate video memory content; generates corresponding BMP bitmap file data according to the video memory content in BMP bitmap file format and sends it to the client; After the client obtains the BMP bitmap file data, it generates a BMP file according to the BMP bitmap file data and displays it.
[0065] Specifically, when the client is the client described in Embodiment 6, When the gas detector changes the pixel colors of the inner and outer edge pixels of the first color area to the specified color, different specified colors can be assigned to the inner and outer edge pixels of the first color area corresponding to different element types, and the specified colors are colors different from the first color, the second color, and the third color; The client searches for an area composed of colors whose color difference with the specified color is within a preset threshold range in the obtained target BMP bitmap through a color matching algorithm, and when the target element graphic is obtained, executes: Traverse the element types, for each element type, obtain the corresponding specified color according to the element type and color mapping relationship table, search the target BMP bitmap for the area composed of colors whose color difference with the specified color is within the preset threshold range through the color matching algorithm, thereby obtaining several contour areas and obtaining the target element graphics; The client searches for an element graphic having the same outline and size as the target element graphic in the specified element graphic library as a candidate graphic, including: Searching for an element graphic having the same outline and size as the target element graphic in the element graphic group of the corresponding type in the specified element graphic library as a candidate graphic; The element graphic library is arranged in the client, and character element graphics and digital element graphics of different resolutions and sizes are arranged in the element graphic library, and element graphics of the same type belong to the same element graphic group.
[0066] The above technical solution enables the client to obtain a BMP bitmap file adapted to the screen resolution and screen size, thereby obtaining a high-definition display effect.
[0067] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, ordinary technicians in the field should understand that the specific implementation methods of the present invention can still be modified or some technical features can be replaced by equivalents without departing from the spirit of the technical solution of the present invention, which should be included in the scope of the technical solution for protection of the present invention.
Claims
1. A gas detector data transmission method, applied to a gas detector, It is characterized in that The CPU RAM of the gas detector is provided with a video memory space, and the gas detector generates data to be transmitted based on the detection result, and the data to be transmitted includes at least alarm status, gas type, and concentration information; The method comprises: Import the data to be transmitted into a preset image template to generate an image to be transmitted; After acquiring the image to be transmitted, the image to be transmitted is output to the video memory space through the display function to generate video memory content; The video memory content generates corresponding BMP bitmap file data according to the BMP bitmap file format and sends it to the client, so that after the client obtains the BMP bitmap file data, it generates a BMP file according to the BMP bitmap file data and displays it.
2. A gas detector data sending method according to claim 1, It is characterized in that Import the data to be transmitted into the preset image template to generate the image to be transmitted, including: Writing the data to be transmitted into the corresponding position in the preset image template in the first color and the specified element type to obtain an initial image; the element type includes at least character elements and digital elements, wherein the non-specified position of the preset image template is set to the second color, the alarm state and the gas type correspond to the character elements, and the concentration information corresponds to the digital elements; Extract inner and outer edge pixels of the first color region in the initial image; The pixel colors of the inner and outer edge pixels of the first color area are changed to a specified color to form an image to be transmitted.
3. A gas detector data sending method according to claim 2, It is characterized in that The preset image template is further provided with at least one dynamic chart element, the edge pixel points of each dynamic chart element are defined as the second color, different dynamic chart elements are of different types and correspond to unique standard thresholds; In the process of writing the data to be transmitted in the first color and the specified element type into the corresponding position in the preset image template to generate the initial image, for each dynamic chart element, calculating the chart display ratio based on the data to be transmitted and the standard threshold value corresponding to the dynamic chart element, filling the dynamic chart element with a third color according to the chart display ratio, and modifying the edge pixels of the dynamic chart element to the third color; The steps for obtaining the third color are: encoding the chart display ratio value using error correction coding, mapping the encoded data to a color index, and converting the color index to an RGB color by looking up a color index table, and the RGB color is the third color.
4. A method for receiving gas detector data, applied to a client connected to a gas detector, It is characterized in that The method comprises: After receiving the BMP bitmap file data sent by the gas detector based on the gas detector data sending method described in any one of claims 1-3, the scaling ratio is calculated according to the image size in the BMP bitmap file data and its own screen size, and a target BMP bitmap of the screen size is generated for display based on the received BMP bitmap file data and the scaling ratio.
5. A gas detector, It is characterized in that The gas detector includes a CPU, a collection unit, a storage unit and a data sending device; The acquisition unit is used to acquire the gas signal to be tested; The CPU generates data to be transmitted according to the collected original electrical signal; The storage unit is used to store data to be transmitted; After acquiring the data to be transmitted, the data sending device executes the data sending method according to any one of claims 1 to 3, generates BMP bitmap file data and sends it to the client.
6. A client, It is characterized in that It includes a display module, an element graphic library and a data receiving device, wherein the data receiving device is used to execute the data receiving method according to claim 4 to generate a target BMP bitmap; The display module is used to display the target BMP bitmap sent by the data receiving device.
7. A client according to claim 6, Features: The client is also provided with a command button for obtaining a clear BMP bitmap and an element graphic library, wherein the element graphic library is provided with character element graphics and digital element graphics of different resolutions and sizes; When a command to obtain a clear BMP bitmap is received, an intermediate BMP bitmap of the screen size is generated, wherein the pixel color of all pixels in the intermediate BMP bitmap is white; In the obtained target BMP bitmap, a color matching algorithm is used to search for an area composed of colors whose color difference with the specified color is within a preset threshold range, and a target element graphic is obtained; Traverse each target element image, traverse each target element image, obtain the position of the target element image in the target BMP bitmap, and use the same position in the intermediate BMP bitmap as the position to be pasted; Searching for an element graphic having the same outline and size as the target element graphic in the specified element graphic library as a candidate graphic; Select a graphic with the same screen resolution from the candidate graphics as the target graphic, and paste the target graphic at the position to be pasted in the middle BMP bitmap; After the traversal is completed, the original target BMP bitmap is deleted, and the intermediate BMP bitmap after pasting the graphics is displayed as the target BMP bitmap.
8. A client according to claim 6 or 7, Features: The element graphic library is also provided with dynamic chart graphics, each of which is associated with a chart display ratio value; In the target BMP bitmap, a color matching algorithm is used to search for an area composed of colors whose color difference with the third color is within a preset threshold range to obtain a dynamic chart graphic; the position of the dynamic chart graphic in the target BMP bitmap is obtained, and the same position in the intermediate BMP bitmap is used as the position to be pasted; in the specified element graphic library, a graphic with the same outline, size and percentage value as the dynamic chart graphic is searched as a candidate graphic, and a graphic with the same screen resolution is selected from the candidate graphics as the target graphic, and the target graphic is pasted at the position to be pasted in the intermediate BMP bitmap; The steps for obtaining the numerical value of the chart display ratio are as follows: while calculating the scaling ratio according to the image size in the BMP bitmap file data and the screen size itself, the BMP bitmap file data is traversed to find the third color that is different from the first color, the second color and the specified color, the RGB color is converted into a color index by looking up the color index table, and the color index is decoded to obtain the numerical value of the chart display ratio.
9. A gas detector remote data transmission system, Features: It comprises a gas detector as described in claim 5, and also comprises at least one client, wherein the client is the client as described in any one of claims 6-8, and the gas detector is communicatively connected with the client.
10. A gas detector remote data transmission system according to claim 9, Features: When the gas detector changes the pixel colors of the inner and outer edge pixels of the first color area to the specified color, different specified colors can be assigned to the inner and outer edge pixels of the first color area corresponding to different element types, and the specified colors are colors different from the first color, the second color, and the third color; The client searches for an area composed of colors whose color difference with the specified color is within a preset threshold range in the obtained target BMP bitmap through a color matching algorithm, and when the target element graphic is obtained, executes: Traverse the element types, for each element type, obtain the corresponding specified color according to the element type and color mapping relationship table, search the target BMP bitmap for the area composed of colors whose color difference with the specified color is within the preset threshold range through the color matching algorithm, thereby obtaining several contour areas and obtaining the target element graphics; The client searches for an element graphic having the same outline and size as the target element graphic in the specified element graphic library as a candidate graphic, including: Searching for an element graphic having the same outline and size as the target element graphic in the element graphic group of the corresponding type in the specified element graphic library as a candidate graphic; The element graphic library is arranged in the client, and character element graphics and digital element graphics of different resolutions and sizes are arranged in the element graphic library, and element graphics of the same type belong to the same element graphic group.
Citation Information
Patent Citations
Android kernel based information display method for dynamically generating bitmap image
CN104965709A
File conversion method and device and file transmission system
CN106776677A
Columnar diagram recognition method and device, equipment and computer readable storage medium
CN110363092A
Printing data sending method, device, equipment and storage medium
CN111813350A
Image processing method and device based on desktop cloud
CN114564261A
