A method for uploading detection data by an alcohol detector
By using a timer mechanism to periodically detect and upload unuploaded data when the alcohol detector is powered off, the problems of untimely data upload and excessive power consumption are solved, achieving timely data upload and power saving.
Patent Information
- Application Number
- CN202310389802.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-03
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2043-04-03
AI Technical Summary
Existing alcohol detectors are prone to data upload failures due to poor communication signals or human intervention. Furthermore, prolonged operation while waiting for data upload increases power consumption, making it difficult to avoid battery depletion and data upload failures.
The control module starts a timer mechanism to periodically check whether there is any unuploaded data in the storage module when the alcohol detector is off, and upload the data within a preset time. If communication fails, it will pause and retry until all data is uploaded and then enter sleep mode.
Ensure that test data is uploaded in a timely manner to avoid data failure, while also saving power consumption of the alcohol detector and preventing battery depletion due to prolonged operation.
Smart Images

Figure CN116233785B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of alcohol testing equipment technology, and in particular to a method for uploading test data from an alcohol testing equipment. Background Technology
[0002] A breathalyzer (or breathalyzer for short, see GB / T 21254-2017 for details) is an instrument used to detect whether a person has ingested alcohol and how much alcohol they have ingested. It can be used as a tool for traffic enforcement to detect whether drivers have been drinking and how much they have drunk, so as to promptly investigate drunk driving and reduce the occurrence of major traffic accidents.
[0003] Driving under the influence of alcohol is a serious violation that endangers road traffic safety. To prevent favoritism in law enforcement, traffic management departments now require breathalyzers to transmit the data in real time to the department's server via wireless communication methods such as 4G while detecting the alcohol content in exhaled breath.
[0004] Currently, the general process of breath alcohol testing using a breathalyzer is as follows: After the breathalyzer is turned on, the person being tested blows air into the breathalyzer through the mouthpiece. The breathalyzer detects the amount of exhaled air and samples it when a certain volume is reached. The air pump draws a certain amount of exhaled air into the alcohol sensor for analysis to obtain test data. The test data is then displayed and stored by the breathalyzer and simultaneously uploaded to a remote server. Once the upload is complete, the test ends and the device is turned off.
[0005] "Powering off" refers to the control module (e.g., microcontroller) of the alcohol detector shutting down all other modules, while the control module itself enters sleep mode or low-power mode. Once in sleep or low-power mode, its internal functional modules are typically inactive, resulting in very low power consumption. It can only resume operation by being woken up via a button interrupt.
[0006] However, if the communication signal is poor when the alcohol detector is uploading data, it must be shut down after the measurement to save power, even if the data cannot be uploaded. Another scenario is that the data upload process is manually interrupted, such as by being manually shut down or having the battery removed; in this case, the data upload will also fail. Currently, alcohol detectors upload data while powered on, so the data will only be uploaded again upon the next power-on. Therefore, the national standard 4.6.3 for alcohol detectors requires that "the measurement results of the alcohol detector should be able to be synchronously transmitted to the computer through the corresponding interface and have a resume function," indicating that the national standard has considered the possibility of interruptions in data upload due to various reasons.
[0007] Therefore, due to various reasons, existing breathalyzers cannot guarantee timely data upload. Some traffic management departments require staff to periodically check for backlogged data, which increases workload and is ineffective. Alternatively, some departments require breathalyzers to have a non-forced shutdown function; if backlogged data is not uploaded, the device cannot be shut down until it is fully uploaded. This results in several issues: firstly, the device is constantly powered on with the screen on, leading to high power consumption during data upload; secondly, the continuous wait for data upload reminds operators that data is still pending, making it difficult to avoid removing the battery or placing the device in areas with poor signal, thus preventing data upload; and thirdly, if the communication signal is weak and data cannot be uploaded, the device may automatically shut down due to battery depletion, but the data will still not be uploaded.
[0008] Therefore, how to ensure the timely uploading of test data from alcohol detectors, avoid the phenomenon of data failure to be uploaded, and at the same time save the power consumption of alcohol detectors during the data uploading process is an urgent problem to be solved. Summary of the Invention
[0009] The purpose of this invention is to provide a method for uploading test data from an alcohol detector, which can ensure that all test data in the alcohol detector can be uploaded in a timely manner, avoid the phenomenon of test data not being uploaded, and save the power consumption of the alcohol detector during the data upload process.
[0010] To achieve the above objectives, the present invention provides a method for uploading test data using an alcohol detection device. The alcohol detection device includes a control module, a power supply module, a detection module, a storage module, and a communication module. The power supply module supplies power to the alcohol detection device. The detection module performs breath alcohol testing to obtain test data. The storage module stores the test data. The communication module communicates with a remote server. The control module controls the power supply module, the detection module, the storage module, and the communication module. The method includes:
[0011] S11. When the alcohol detector enters the power-off state, the control module starts the first timer of the control module to start timing;
[0012] S12. Whenever the first timer reaches a preset first timing duration, the control module starts the second timer of the control module. During the second timing duration of the second timer, it checks whether there is any detection data in the storage module that has not been uploaded to the remote server. If there is any detection data in the storage module that has not been uploaded to the remote server, it controls the communication module to upload the detection data that has not been uploaded to the remote server to the remote server.
[0013] After the communication module uploads all the detection data in the storage module that has not been uploaded to the remote server to the remote server, the process proceeds to step S13.
[0014] S13. The control module shuts down the first timer, ensures that the second timer and the communication module are turned off, and enters sleep mode or low-power mode.
[0015] Further, step S12 specifically includes:
[0016] S121. When the first timer reaches the first timing duration, the control module starts the second timer to keep track of the time and checks whether there is any detection data in the storage module that has not been uploaded to the remote server.
[0017] S122. If the control module detects that there is detection data in the storage module that has not been uploaded to the remote server, the control module starts the communication module to upload the detection data that has not been uploaded to the remote server to the remote server. If the communication module has uploaded all the detection data that has not been uploaded to the remote server to the remote server within the second time interval of the second timer, then proceed to step S13. If the second timer reaches the second time interval, the control module shuts down the second timer and the communication module, and proceeds to step S123.
[0018] S123. The control module waits for the first timer to reach the first timing duration, and then returns to step S121.
[0019] Furthermore, step S12 also includes:
[0020] If the control module detects that there is no detection data in the storage module that has not been uploaded to the remote server, the control module shuts down the second timer and proceeds to step S13.
[0021] Furthermore, the duration of the first timing is greater than the duration of the second timing.
[0022] Furthermore, in step S11, the alcohol detector enters a power-off state, specifically including:
[0023] After completing the breath alcohol test, the breathalyzer automatically shuts down under the control of the control module; or...
[0024] When the control module receives a shutdown command, it controls the alcohol detector to enter a shutdown state; or...
[0025] The alcohol detector was forcibly shut down and entered the shutdown state.
[0026] This invention also provides a method for uploading test data using an alcohol detector. The alcohol detector includes a control module, a power supply module, a detection module, a storage module, and a communication module. The power supply module supplies power to the alcohol detector. The detection module performs breath alcohol testing to obtain test data. The storage module stores the test data. The communication module communicates with a remote server. The control module controls the power supply module, the detection module, the storage module, and the communication module. The method includes:
[0027] S21. When the alcohol detector enters the power-off state, the control module starts the first timer of the control module to start timing;
[0028] S22. When the first timer reaches the preset first timing duration, the control module detects whether there is any detection data in the storage module that has not been uploaded to the remote server, and when there is detection data in the storage module that has not been uploaded to the remote server, controls the communication module to upload the detection data that has not been uploaded to the remote server to the remote server.
[0029] S23. During the process of the communication module uploading the detection data that has not been uploaded to the remote server to the remote server, if the communication module fails to upload the detection data and reaches the preset interruption condition, the control module shuts down the communication module, waits for the first timer to reach the first timeout duration, and returns to step S22; otherwise, the communication module continues to upload the detection data that has not been uploaded to the remote server in the storage module to the remote server until all the detection data that has not been uploaded to the remote server in the storage module has been uploaded to the remote server, and then proceeds to step S24;
[0030] S24. The control module shuts down the first timer, ensures that the communication module is turned off, and enters sleep mode or low-power mode.
[0031] Furthermore, the interruption upload condition is that the communication module fails to upload detection data for a preset second time interval.
[0032] Furthermore, the time during which the communication module fails to upload detection data is either the consecutive time of the communication module failing to upload detection data, or the cumulative time of the communication module failing to upload detection data.
[0033] Furthermore, step S23 specifically includes:
[0034] S231. During the process of the communication module uploading the detection data that has not been uploaded to the remote server to the remote server, if the communication module fails to upload the detection data, then proceed to step S232; otherwise, the communication module continues to upload the detection data that has not been uploaded to the remote server in the storage module to the remote server until all the detection data that has not been uploaded to the remote server in the storage module has been uploaded to the remote server, then proceed to step S24.
[0035] S232. The control module starts the second timer of the control module to count the time when the communication module fails to upload detection data, and the communication module continuously attempts to upload the detection data that has not been uploaded to the remote server to the remote server;
[0036] If the second timer reaches the second timeout duration, the control module shuts down the communication module and the second timer, and waits for the first timer to reach the first timeout duration before returning to step S22; otherwise, the communication module continues the process of uploading the detection data that has not been uploaded to the remote server to the remote server.
[0037] Furthermore, the interruption upload condition is when the number of times the communication module fails to upload detection data reaches a preset number.
[0038] Furthermore, the number of times the communication module fails to upload detection data is the number of consecutive failures of the communication module to upload detection data, or the cumulative number of failures of the communication module to upload detection data.
[0039] Furthermore, step S22 also includes:
[0040] When the first timer reaches the preset first timing duration, the control module detects whether there is any detection data in the storage module that has not been uploaded to the remote server. If there is no detection data in the storage module that has not been uploaded to the remote server, the process proceeds to step S24.
[0041] The beneficial effects of this invention are as follows: The method for uploading detection data in the alcohol detector of this invention enables the detection and uploading of all detection data stored in the storage module of the alcohol detector even when the device is powered off. This ensures that all detection data in the alcohol detector is uploaded in a timely manner, eliminating the need for staff to periodically turn on the device to check for backlogged data or to stand by the detector while uploading data. Furthermore, the method prevents operators from noticing the data upload process and thus prevents accidental battery removal, preventing data from failing to upload. Simultaneously, the method allows for the activation of only a portion of the modules to detect whether all data has been uploaded and to upload any data that has not yet been uploaded, effectively saving power consumption during the data upload process. Moreover, during the process of the control module controlling the communication module to upload detection data from the storage module that has not yet been uploaded to the remote server to the remote server, the method can pause and restart the upload process of unuploaded detection data in segments to avoid various situations that could cause data transmission disruptions and improve transmission efficiency. This ensures smooth data upload and further saves power consumption during the data upload process. Attached Figure Description
[0042] To further understand the features and technical content of this invention, please refer to the following detailed description and accompanying drawings. However, the drawings are provided for reference and illustration only and are not intended to limit the invention.
[0043] In the attached diagram,
[0044] Figure 1 This is a circuit block diagram of an alcohol detector according to an embodiment of the present invention.
[0045] Figure 2 This is a flowchart of a first embodiment of the method for uploading test data by the alcohol detector of the present invention.
[0046] Figure 3 This is a flowchart illustrating the first embodiment of the method for uploading test data using the alcohol detector of the present invention.
[0047] Figure 4 This is a flowchart of a second embodiment of the method for uploading detection data using the alcohol detector of the present invention.
[0048] Figure 5 This is a flowchart illustrating a second embodiment of the method for uploading test data using the alcohol detector of the present invention. Detailed Implementation
[0049] To further illustrate the technical means and effects of the present invention, the following detailed description is provided in conjunction with the preferred embodiments of the present invention and their accompanying drawings.
[0050] The method for uploading detection data by an alcohol detector provided by this invention ensures that all detection data in the alcohol detector can be uploaded in a timely manner, thereby avoiding the phenomenon of data not being uploaded and saving power consumption of the alcohol detector during the data upload process.
[0051] The alcohol detector described in this invention, such as Figure 1 As shown, the device may include a control module 10, a power supply module 20, a detection module 30, a storage module 40, and a communication module 50. The control module 10 controls the operation of the alcohol detector, including the power supply module 20, the detection module 30, the storage module 40, and the communication module 50. The control module 10 may include a first timer 11 and a second timer 12. The power supply module 20 supplies power to the alcohol detector. The detection module 30 performs breath alcohol detection to obtain data and may include an alcohol sensor. The storage module 40 stores the detection data obtained by the detection module 30. The communication module 50 communicates with a remote server. The alcohol detector may further include a peripheral module 60, which may include a display module, an alarm module, a button module, etc., and can be configured according to the specific functions of the alcohol detector.
[0052] The specific process of breath alcohol testing by the alcohol detector is well known to those skilled in the art and will not be described in detail here.
[0053] like Figure 2 As shown, a first embodiment of the method for uploading test data by the alcohol detector of the present invention may include the following steps:
[0054] S11. When the alcohol detector enters the power-off state, the control module 10 starts the first timer 11 of the control module 10 to start timing;
[0055] S12. Whenever the first timer 11 reaches a preset first timing duration, the control module 10 starts the second timer 12 of the control module 10. During the second timing duration of the second timer 12, it checks whether there is any detection data in the storage module 40 that has not been uploaded to the remote server. If there is any detection data in the storage module 40 that has not been uploaded to the remote server, it controls the communication module 50 to upload the detection data that has not been uploaded to the remote server to the remote server.
[0056] After the communication module 50 uploads all the detection data in the storage module 40 that has not been uploaded to the remote server to the remote server, the process proceeds to step S13.
[0057] S13. The control module 10 shuts down the first timer 11, ensures that the second timer 12 and the communication module 50 are turned off, and enters sleep mode or low power mode.
[0058] Thus, the method for uploading test data by the alcohol detector of the present invention can detect and complete the uploading of all test data stored in the storage module of the alcohol detector when the device is powered off, ensuring that all test data in the alcohol detector can be uploaded in a timely manner, thereby avoiding the phenomenon of test data not being uploaded, and saving the power consumption of the alcohol detector during the data uploading process.
[0059] Specifically, in step S11, the alcohol detector may enter the shutdown state in the following ways: after completing the detection, the alcohol detector automatically enters the shutdown state under the control of the control module 10; or the control module 10 may control the alcohol detector to enter the shutdown state when it receives a shutdown command, which can be generated by the button module; or the alcohol detector may be forced to shut down when it detects low battery voltage or be forced to shut down in other ways to enter the shutdown state.
[0060] In the power-off state, the control module 10 shuts down all running programs of the alcohol detector and all other modules except the control module 10, including the detection module 30, storage module 40, communication module 50, and peripheral module 60. It can also enter a sleep mode or a low-power mode. Furthermore, the control module 10 can be implemented using a microcontroller or an embedded system controller. When the control module 10 enters sleep mode or low-power mode, its internal functional modules are all inactive, resulting in very low power consumption. Of course, the implementation of the control module 10 is not limited to this.
[0061] When the alcohol detector enters the power-off state, the control module 10 starts its first timer 11 to keep track of time.
[0062] In some embodiments, the control module 10 can be implemented using a microcontroller or an embedded system controller. In this case, the first timer 11 and the second timer 12 are internal timers of the control module 10 to achieve the timing function. Of course, the specific implementation is not limited to this. The timers can also be set according to the actual control module 10 used. For example, the first timer 11 and the second timer 12 can be set for the control module 10.
[0063] Specifically, step S12 may include:
[0064] S121. When the first timer 11 reaches the first timing duration, the control module 10 starts the second timer 12 to start timing and detects whether there is any detection data in the storage module 40 that has not been uploaded to the remote server.
[0065] S122. If the control module 10 detects that there is detection data in the storage module 40 that has not been uploaded to the remote server, the control module 10 starts the communication module 50 to upload the detection data that has not been uploaded to the remote server to the remote server. If the communication module 50 has uploaded all the detection data that has not been uploaded to the remote server to the remote server within the second timing duration of the second timer 12, then proceed to step S13. If the second timer 12 reaches the second timing duration, the control module 10 shuts down the second timer 12 and the communication module 50, and proceeds to step S123.
[0066] S123. The control module 10 waits for the first timer 11 to reach the first timing duration, and then returns to step S121.
[0067] Both the first timing duration and the second timing duration are preset, wherein the first timing duration is longer than the second timing duration. The first timing duration and the second timing duration will be explained in further detail below.
[0068] Furthermore, step S12 also includes: if the control module 10 detects that there is no detection data in the storage module 40 that has not been uploaded to the remote server, then the control module 10 shuts down the second timer 12 and proceeds to step S13.
[0069] Figure 3 This is a flowchart illustrating a specific implementation of the first embodiment of the method for uploading test data using an alcohol detector according to the present invention. Figure 3 As shown, in the first embodiment of the method for uploading detection data by the alcohol detector of the present invention, in step S11', when the alcohol detector enters the power-off state, the control module 10 starts the first timer 11 of the control module 10 to start timing; in step S12', when the first timer 11 reaches the first timing duration, the control module 10 starts the second timer 12 to start timing, and proceeds to step S13'. Between steps S11' and S12', the system is in a state of waiting for the first timer 11 to reach the first timing duration.
[0070] Specifically, the first timer 11 has a preset first timing duration, which can be set to a value greater than or equal to zero. For example, setting the first timing duration to 30 minutes is equivalent to the first timer 11 waking up once every 30 minutes. It is also equivalent to the control module 10 waking up once every 30 minutes in the first embodiment to check whether there is any unuploaded detection data in the storage module 40 and upload it.
[0071] The second timer 12 is used to limit the duration for which the control module 10 controls the communication module 50 to upload data each time it wakes up, and a second timer duration is preset. The reason for setting the second timer 12 and its duration is to save power under specific conditions. Specifically, during the process of the control module 10 controlling the communication module 50 to upload detection data from the storage module 40 that has not yet been uploaded to the remote server to the remote server, various situations may occur that prevent timely data transmission, such as slow or intermittent transmission due to poor communication signals. In this case, to improve transmission efficiency and save power, the control module 10 can pause the uploading of unuploaded detection data after the communication module 50 has been uploading data for a period of time, ending the timed data upload process. After a period of time, it can attempt to restart the uploading process of unuploaded detection data, and this process can be repeated until all detection data from the storage module 40 that has not yet been uploaded to the remote server has been uploaded to the remote server. This segmented pausing and restarting of the uploading process of unuploaded detection data ensures smooth data upload while reducing overall power consumption. Taking a preset second timer duration of 5 minutes as an example, if the communication module 50 cannot upload data after a certain startup due to poor signal, a maximum of 5 minutes will be wasted. After 5 minutes, the communication module 50 will stop uploading data and wait for the first timer 11 to count to 30 minutes (i.e., wait 25 minutes) before the control module 10 controls the communication module 50 to try uploading again. It is possible that the communication module 50 will be able to upload data this time.
[0072] Generally, the second timing duration of the second timer 12 is shorter than the first timing duration of the first timer 11. For example, when the first timing duration of the first timer 11 is set to 30 minutes, the second timing duration of the second timer 12 can be set to 5 minutes. Under this setting, if the communication module 50 is unable to upload detection data to the remote server for any reason, the control module 10 will attempt to upload data for a maximum of 5 minutes. After that, the control module 10 will stop the communication module 50 from uploading data and wait for the first timer 11 to reach 30 minutes before resuming the upload. This avoids the phenomenon of the communication module 50 continuously attempting to upload detection data or inefficiently uploading data, thus wasting power.
[0073] In step S13', the control module 10 detects whether there is any detection data in the storage module 40 that has not been uploaded to the remote server. If the control module 10 detects that there is any detection data in the storage module 40 that has not been uploaded to the remote server, it proceeds to step S14'; otherwise, if the control module 10 detects that there is no detection data in the storage module 40 that has not been uploaded to the remote server, it proceeds to step S17'.
[0074] In step S14', the control module 10 starts the communication module 50, and the control communication module 50 uploads the detection data that was not uploaded to the remote server in the storage module 40 to the remote server.
[0075] Further, in step S14', while controlling the communication module 50 to upload the detection data in the storage module 40 that has not been uploaded to the remote server, the control module 10 marks the detection data in the storage module 40 that has already been uploaded to the remote server by the communication module 50 as uploaded data. In one embodiment, the control module 10 can mark the detection data in the storage module 40 that has not been uploaded to the remote server as unuploaded data. Optionally, the detection data in the storage module 40 that has not been uploaded to the remote server may not be marked separately.
[0076] In one embodiment, the communication module 50 is a 4G wireless communication module, but it is not limited to this. Various remote wireless communication modules that can realize remote wireless communication can be used, such as a 5G wireless communication module.
[0077] Next, in step S15', it is determined whether the second timer 12 has reached the preset second timing duration. If not, step S13' is executed to continue detecting whether there is any detection data in the storage module 40 that has not been uploaded to the remote server. If there is detection data that has not been uploaded to the remote server, the communication module 50 is controlled to upload the detection data in the storage module 40 that has not been uploaded to the remote server to the remote server (step S14'). Alternatively, after the communication module 50 has uploaded all the detection data that has not been uploaded to the remote server to the remote server, that is, when there is no more detection data that has not been uploaded to the remote server in the storage module 40, step S17' is executed.
[0078] In step S15', if it is determined that the second timer 12 has reached the preset second timing duration, then proceed to step S16'. At this time, the storage module 40 may still contain detection data that has not been uploaded to the remote server.
[0079] In step S16', the control module 10 shuts down the second timer 12 and the communication module 50, and enters the state of waiting for the first timer 11 to reach the first timing duration, that is, returning to the state between step S11' and step S12'. After the first timer 11 reaches the first timing duration again, step S12' is executed again.
[0080] In step S17', the control module 10 shuts down the first timer 11, ensures that the second timer 12 and the communication module 50 are turned off, and enters sleep mode or low-power mode. Thereafter, the control module 10 will not wake up at a set time before the next power-on.
[0081] Specifically, there are two situations for entering step S17': First, when control module 1 starts the second timer 12 for the first time and detects that there is no detection data in storage module 40 that has not been uploaded to the remote server, meaning that when the alcohol detector is powered off, all detection data in storage module 40 has been uploaded to the remote server. Second, when the alcohol detector enters the power-off state, there is still detection data in storage module 40 that has not been uploaded to the remote server, but after steps S11'-S16', all of it has been uploaded to the remote server, and there is no longer any detection data in storage module 40 that has not been uploaded to the remote server. In short, step S17' is only entered when there is no detection data in storage module 40 that has not been uploaded to the remote server. Control module 10 shuts down any internal or external components that were running during this period and enters sleep mode or low-power mode itself, and will not wake up again before the next power-on.
[0082] In other words, in the first embodiment of the present invention, if there is detection data in the storage module 40 that has not been uploaded to the remote server, or if the communication module 50 fails to upload all the detection data in the storage module 40 that has not been uploaded to the remote server to the remote server, the first timer 11 remains on. The first timer 11 will continuously count for a duration of a first time interval. Whenever the first timer 11 reaches the first time interval, the control module 10 starts the second timer 12. Within the second time interval, the detection and uploading of the detection data in the storage module 40 that has not been uploaded to the remote server are performed until all the detection data in the storage module 40 that has not been uploaded to the remote server is uploaded to the remote server.
[0083] It should be briefly explained here that... Figure 3 Step S11' corresponds to the implementation of the aforementioned step S11, steps S12'-S16' correspond to the implementation of the aforementioned steps S12 (S121-S123), and step S17' corresponds to the implementation of the aforementioned step S13.
[0084] Therefore, the first embodiment of the alcohol detector's data uploading method of the present invention can detect and upload all detection data stored in the alcohol detector's storage module even when the device is powered off, ensuring that all detection data in the alcohol detector is uploaded in a timely manner, thus avoiding the phenomenon of data not being uploaded, and saving power consumption of the alcohol detector during the data upload process. Moreover, the advantage of the first embodiment of the present invention is that when the first timer reaches the preset first time interval, only the data detection and upload for the second time interval is performed. After the second time interval is reached, even if the communication module has not yet uploaded all the detection data in the storage module that has not been uploaded to the remote server, the upload of detection data to the remote server will stop, and the attempt to upload detection data will be resumed after the next first time interval is reached. This can avoid the phenomenon of wasting power due to poor communication signal but continuous attempts to upload data or inefficient data upload. Even if the communication signal is poor and the upload fails, the power consumption is at most the power consumption for the second time interval, thereby further saving power consumption of the alcohol detector during the data upload process.
[0085] like Figure 4 As shown, a second embodiment of the method for uploading test data by the alcohol detector of the present invention may include the following steps:
[0086] S21. When the alcohol detector enters the power-off state, the control module 10 starts the first timer 11 of the control module 10 to start timing;
[0087] S22. When the first timer 11 reaches the preset first timing duration, the control module 10 detects whether there is any detection data in the storage module 40 that has not been uploaded to the remote server, and when there is detection data in the storage module 40 that has not been uploaded to the remote server, controls the communication module 50 to upload the detection data that has not been uploaded to the remote server to the remote server.
[0088] S23. During the process of the communication module 50 uploading the detection data that has not been uploaded to the remote server to the remote server, if the communication module 50 fails to upload the detection data and reaches the preset interruption upload condition, the control module 10 shuts down the communication module 50, waits for the first timer 11 to count to the first timer duration, and returns to step S22; otherwise, the communication module 50 continues to upload the detection data that has not been uploaded to the remote server in the storage module 40 to the remote server until all the detection data that has not been uploaded to the remote server in the storage module 40 has been uploaded to the remote server, and then proceeds to step S24;
[0089] S24. The control module 10 shuts down the first timer 11, ensuring that the communication module 50 is turned off, and enters sleep mode or low power mode.
[0090] Thus, the method for uploading test data by the alcohol detector of the present invention can detect and complete the uploading of all test data stored in the storage module of the alcohol detector when the device is powered off, ensuring that all test data in the alcohol detector can be uploaded in a timely manner, thereby avoiding the phenomenon of test data not being uploaded, and saving the power consumption of the alcohol detector during the data uploading process.
[0091] Specifically, for the explanation of the alcohol detector entering the power-off state in step S21 and the explanation of the control module 10 that can be used, please refer to the first embodiment, which will not be repeated here.
[0092] The preset interruption upload condition mentioned in step S23 can be either the time during which the communication module 50 fails to upload detection data reaches a preset second time interval, or the number of times the communication module 50 fails to upload detection data reaches a preset number.
[0093] When the preset interruption upload condition is that the communication module 50 fails to upload detection data for a preset second time interval, step 23 is as follows: During the process of the communication module 50 uploading the detection data that has not been uploaded to the remote server to the remote server, if the communication module 50 fails to upload detection data and the time of failure reaches the preset second time interval, the control module 10 shuts down the communication module 50, waits for the first timer to reach the first time interval, and returns to step S22; otherwise, the communication module continues to upload the detection data that has not been uploaded to the remote server in the storage module to the remote server until all the detection data that has not been uploaded to the remote server in the storage module has been uploaded to the remote server, and then proceeds to step S24.
[0094] The time during which the communication module 50 fails to upload detection data can be either consecutive times or cumulative times.
[0095] Specifically, step 23 may further include:
[0096] S231. During the process of the communication module 50 uploading the detection data that has not been uploaded to the remote server to the remote server, if the communication module 50 fails to upload the detection data, then proceed to step S232; otherwise, the communication module 50 continues to upload the detection data that has not been uploaded to the remote server in the storage module 40 to the remote server until all the detection data that has not been uploaded to the remote server in the storage module 40 has been uploaded to the remote server, then proceed to step S24;
[0097] S232. The control module 10 starts the second timer 12 of the control module 10 to count the time when the communication module fails to upload detection data, and the communication module 50 continuously attempts to upload the detection data that has not been uploaded to the remote server to the remote server;
[0098] If the second timer reaches the second timeout duration, the control module shuts down the communication module and the second timer, and waits for the first timer to reach the first timeout duration before returning to step S22; otherwise, the communication module continues the process of uploading the detection data that has not been uploaded to the remote server to the remote server.
[0099] Both the first timing duration and the second timing duration are preset. Preferably, the first timing duration can be set to a relatively long time period and the second timing duration can be set to a relatively short time period.
[0100] Furthermore, step S22 further includes: when the first timer 11 reaches a preset first timing duration, the control module 10 detects whether there is any detection data in the storage module 40 that has not been uploaded to the remote server, and if there is no detection data in the storage module 40 that has not been uploaded to the remote server, proceed to step S24.
[0101] Figure 5 This is a flowchart illustrating a specific implementation of the second embodiment of the method for uploading detection data using an alcohol detector according to the present invention. Figure 5 As shown, in the second embodiment of the method for uploading detection data by the alcohol detector of the present invention, in step S21', when the alcohol detector enters the power-off state, the control module 10 starts the first timer 11 of the control module 10 to start timing; in step S22', it is determined whether the timing of the first timer 11 has reached the first timing duration, and when the timing of the first timer 11 reaches the first timing duration, the process proceeds to step S23'.
[0102] Specifically, the first timer 11 has a preset first timer duration, which can be set to a value greater than or equal to zero. For example, setting the first timer duration to 30 minutes means that the first timer 11 wakes up once every 30 minutes.
[0103] In step S23', the control module 10 detects whether there is any detection data in the storage module 40 that has not been uploaded to the remote server. If the control module 10 detects that there is any detection data in the storage module 40 that has not been uploaded to the remote server, it proceeds to step S24'; otherwise, if the control module 10 detects that there is no detection data in the storage module 40 that has not been uploaded to the remote server, it proceeds to step S28'.
[0104] In step S24', the control module 10 starts the communication module 50, and controls the communication module 50 to upload the detection data in the storage module 40 that has not been uploaded to the remote server to the remote server.
[0105] Further, in step S24', while controlling the communication module 50 to upload the detection data in the storage module 40 that has not been uploaded to the remote server, the control module 10 marks the detection data in the storage module 40 that has been uploaded to the remote server by the communication module 50 as uploaded data. In one embodiment, the control module 10 can mark the detection data in the storage module 40 that has not been uploaded to the remote server as unuploaded data. Optionally, the detection data in the storage module 40 that has not been uploaded to the remote server may not be marked separately.
[0106] In one embodiment, the communication module 50 is a 4G wireless communication module, but it is not limited to this. Various remote wireless communication modules that can realize remote wireless communication can be used, such as a 5G wireless communication module.
[0107] In step S25', during the process of communication module 50 uploading the detection data that has not been uploaded to the remote server to the remote server, it is determined whether communication module 50 has failed to upload the detection data. If communication module 50 fails to upload the detection data, proceed to step S26'; otherwise, communication module 50 continues to upload the detection data that has not been uploaded to the remote server from storage module 40 to the remote server (i.e., execute steps S23'-S24') until all the detection data that has not been uploaded to the remote server from storage module 40 has been uploaded to the remote server, and then proceed to step S28'. It should be noted that those skilled in the art should know how to determine if communication module 50 has failed to upload the detection data. For example, after a successful upload, the server will return a response indicating successful upload. If no such response is received or a response indicating upload failure is received, then it can be known that the upload has failed.
[0108] In step S26', the control module 10 starts the second timer 12 to count the time when the communication module fails to upload the detection data. During the second timer 12, the communication module 50 continuously attempts to upload the detection data that has not been uploaded to the remote server to the remote server, and then returns to steps S23'-S25'.
[0109] If the communication module 50 successfully uploads the detection data that was not uploaded to the remote server to the remote server before the second timer 12 reaches the second time interval, then the communication module 50 continues the process of uploading the detection data that was not uploaded to the remote server to the remote server. If the second timer 12 reaches the second time interval, that is, the time during which the communication module 50 failed to upload the detection data reaches the second time interval, then proceed to step S27'.
[0110] In step S27', the control module 10 shuts down the communication module 50 and the second timer 12, and waits for the first timer 11 to reach the first timing duration, then returns to step S22'. Once the first timer 11 reaches the first timing duration again, step S23' is executed again.
[0111] In step S28', the control module 10 shuts down the first timer 11, ensuring that the communication module 50 and the second timer 12 are off, and enters sleep mode or low-power mode. Thereafter, the control module 10 will not wake up at a set time before the next power-on.
[0112] Specifically, there are two scenarios for entering step S28': First, the control module 1 detects for the first time that there is no detection data in the storage module 40 that has not been uploaded to the remote server. This means that when the alcohol detector is powered off, all detection data in the storage module 40 has already been uploaded to the remote server. Second, when the alcohol detector enters the power-off state, there is still detection data in the storage module 40 that has not been uploaded to the remote server. After steps S23'-S27', all of this data has been uploaded to the remote server, and there is no longer any unuploaded detection data in the storage module 40. In short, step S28' is only entered when there is no unuploaded detection data in the storage module 40. During this time, the control module 10 shuts down any internal or external components that were running and enters sleep or low-power mode, and will not wake up again before the next power-on.
[0113] In other words, in the second embodiment of the present invention, if there is detection data in the storage module 40 that has not been uploaded to the remote server, or if the communication module 50 fails to upload all the detection data in the storage module 40 that has not been uploaded to the remote server, the first timer 11 remains on. The first timer 11 will continuously count down for a first time interval, while the communication module 50 continuously uploads the detection data in the storage module 40 that has not been uploaded to the remote server to the remote server, without time constraints. Only when the communication module 50 fails to upload detection data and reaches the preset interruption upload condition will the control module 10 shut down the communication module 50. After the first timer 11 counts down to the next first time interval, the process of detecting and uploading the detection data in the storage module 40 that has not been uploaded to the remote server will be restarted until all the detection data in the storage module 40 that has not been uploaded to the remote server is uploaded to the remote server.
[0114] It should be noted that in actual implementation, it is possible that the first timer reaches its first set duration during the data upload process of the communication module. However, since the timer usually notifies the timeout via an interrupt, and the interrupt processing time is very short, it generally does not affect the data upload of the communication module. Therefore, no special handling is required for this. Even if the interrupt processing after the first timer expires affects the data upload of the communication module, it can be resolved by restarting the first timer before the timeout expires, which is easily implemented by those skilled in the art.
[0115] It should be briefly explained here that... Figure 5 Step S21' corresponds to the implementation of the aforementioned step S21, steps S22'-S24' correspond to the implementation of the aforementioned step S22, steps S25'-S27' correspond to the implementation of the aforementioned steps S23 (S231-S232), and step S28' corresponds to the implementation of the aforementioned step S24.
[0116] Figure 5 This illustration demonstrates the specific implementation process of the second embodiment where the preset interruption upload condition is that the communication module 50 fails to upload detection data for a preset second time interval. When the preset interruption upload condition is that the number of times the communication module 50 fails to upload detection data reaches a preset number, the specific implementation process of the second embodiment is similar, except that the second timer is replaced by a counter (typically, a timer also has a counter function, so a second timer can also implement the counting function), and the preset second time interval is replaced by a preset number of times; therefore, this will not be elaborated further here. (For reference only) Figure 4 The following explanation is provided:
[0117] When the preset interruption upload condition is that the number of times the communication module 50 fails to upload detection data reaches a preset number, Figure 4 Step 23 is as follows: During the process of the communication module 50 uploading the detection data that has not been uploaded to the remote server to the remote server, if the communication module 50 fails to upload the detection data and the number of times the communication module 50 fails to upload the detection data reaches a preset number, then the control module 10 shuts down the communication module 50, waits for the first timer to reach the first timeout duration, and returns to step S22; otherwise, the communication module continues to upload the detection data that has not been uploaded to the remote server in the storage module to the remote server until all the detection data that has not been uploaded to the remote server in the storage module has been uploaded to the remote server, and then proceeds to step S24.
[0118] It should be noted that the number of failed uploads can be either consecutive or cumulative, without limitation. Correspondingly, the second timer 12 mentioned in step S26' can also be either the duration of consecutive upload failures or the duration of cumulative upload failures, without limitation.
[0119] Therefore, the second embodiment of the method for uploading detection data in the alcohol detector of the present invention can also detect and complete the uploading of all detection data stored in the storage module of the alcohol detector when the device is powered off, ensuring that all detection data in the alcohol detector can be uploaded in a timely manner, avoiding the phenomenon of data not being uploaded, and saving power consumption of the alcohol detector during the data uploading process. Moreover, the second embodiment of the method for uploading detection data in the alcohol detector of the present invention has the advantage that the second embodiment determines whether to stop data uploading based on whether the communication module 50 can successfully upload detection data. Since the quality of the communication signal can be quickly determined, the second timing duration can be set to a very short time (e.g., 2 minutes), and the preset number of failed data uploads can also be set to a small value. In this way, even if the communication signal is poor and the data cannot be uploaded, the power consumption of attempting to upload will be very small. Moreover, if the communication signal is always good, the communication module 50 can maintain uninterrupted uploading of detection data without interruption and waiting, which can further improve the data uploading efficiency of the alcohol detector.
[0120] As described above, the method for uploading test data by the alcohol detector of the present invention can detect and upload all test data stored in the storage module of the alcohol detector even when the device is powered off. This ensures that all test data in the alcohol detector can be uploaded in a timely manner, eliminating the need for staff to periodically turn on the device to check for any backlogged data. It also eliminates the need for staff to stand by the detector while uploading data and prevents operators from noticing that data is being uploaded. This also prevents actions such as manually removing the battery from the device and avoids the phenomenon of test data not being uploaded.
[0121] Furthermore, those skilled in the art will understand through the above-described method of the present invention that, during the implementation of the method for uploading detection data in the alcohol detector of the present invention, when the control module starts its timer, but the time has not yet reached the preset first timeout duration, apart from the first timer working, other internal functional modules and external modules of the control module do not work to save power consumption; when the preset first timeout duration is reached and detection data needs to be uploaded, all functional modules in the control module except for the timer, the storage module, and the communication module do not work, and among the external modules, apart from the storage module and the communication module related to data upload working, other modules do not work to save power consumption. Therefore, the present invention can not only detect and complete the upload of all detection data stored in the storage module of the alcohol detector when the device is powered off, but also effectively save power consumption of the alcohol detector during the data upload process.
[0122] Furthermore, in the method for uploading test data by the alcohol detector of the present invention, during the process of the control module controlling the communication module to upload test data that has not been uploaded to the remote server in the storage module to the remote server, in order to avoid various situations that may cause data transmission problems, improve transmission efficiency, and save power consumption, the uploading process of the unuploaded test data can be paused and restarted in stages to ensure smooth uploading of test data and further save the power consumption of the alcohol detector during the data uploading process.
[0123] The control module of the alcohol detector in this invention can be implemented using various embedded system controllers or microcontrollers. Those skilled in the art can configure and control it according to the above description of the technical solution of this invention to achieve the purpose of this invention.
[0124] As described above, those skilled in the art can make various other corresponding changes and modifications based on the technical solutions and concepts of this invention, and all such changes and modifications should fall within the protection scope of the claims of this invention.
Claims
1. A method for uploading detection data using a breathalyzer, the breathalyzer comprising a control module, a power supply module, a detection module, a storage module, and a communication module, wherein, The power supply module supplies power to the breathalyzer, the detection module performs breath alcohol testing to obtain test data, the storage module stores the test data, the communication module communicates with a remote server, and the control module controls the power supply module, the detection module, the storage module, and the communication module. The method is characterized by comprising: S11. When the alcohol detector enters the power-off state, the control module starts the first timer of the control module to start timing; S12. Whenever the first timer reaches a preset first timing duration, the control module starts the second timer of the control module. During the second timing duration of the second timer, it checks whether there is any detection data in the storage module that has not been uploaded to the remote server. If there is any detection data in the storage module that has not been uploaded to the remote server, it controls the communication module to upload the detection data that has not been uploaded to the remote server to the remote server. After the communication module uploads all the detection data that has not been uploaded to the remote server in the storage module to the remote server, it proceeds to step S13. S13. The control module shuts down the first timer, ensures that the second timer and the communication module are turned off, and enters sleep mode or low-power mode; Specifically, step S12 includes: S121. When the first timer reaches the first timing duration, the control module starts the second timer to keep track of the time and checks whether there is any detection data in the storage module that has not been uploaded to the remote server. S122. If the control module detects that there is detection data in the storage module that has not been uploaded to the remote server, the control module starts the communication module to upload the detection data that has not been uploaded to the remote server to the remote server. If the communication module has uploaded all the detection data that has not been uploaded to the remote server to the remote server within the second time interval of the second timer, then proceed to step S13. If the second timer reaches the second time interval, the control module shuts down the second timer and the communication module, and proceeds to step S123. S123. The control module waits for the first timer to reach the first timing duration, and then returns to step S121; Step S12 further includes: If the control module detects that there is no detection data in the storage module that has not been uploaded to the remote server, the control module shuts down the second timer and proceeds to step S13.
2. The method for uploading detection data using an alcohol detector according to claim 1, characterized in that, The duration of the first timing period is greater than the duration of the second timing period.
3. The method for uploading detection data using an alcohol detector according to claim 1, characterized in that, In step S11, the alcohol detector enters a power-off state, specifically including: After completing the breath alcohol test, the breathalyzer automatically shuts down under the control of the control module; or... When the control module receives a shutdown command, it controls the alcohol detector to enter a shutdown state; or... The alcohol detector was forcibly shut down and entered the shutdown state.
4. A method for uploading detection data using a breathalyzer, the breathalyzer comprising a control module, a power supply module, a detection module, a storage module, and a communication module, wherein, The power supply module supplies power to the breathalyzer, the detection module performs breath alcohol testing to obtain test data, the storage module stores the test data, the communication module communicates with a remote server, and the control module controls the power supply module, the detection module, the storage module, and the communication module. The method is characterized by comprising: S21. When the alcohol detector enters the power-off state, the control module starts the first timer of the control module to start timing; S22. When the first timer reaches the preset first timing duration, the control module detects whether there is any detection data in the storage module that has not been uploaded to the remote server. If there is detection data in the storage module that has not been uploaded to the remote server, the control module controls the communication module to upload the detection data that has not been uploaded to the remote server to the remote server. When the first timer reaches the preset first timing duration, the control module detects whether there is any detection data in the storage module that has not been uploaded to the remote server. If there is no detection data in the storage module that has not been uploaded to the remote server, the process proceeds to step S24. S23. During the process of the communication module uploading the detection data that has not been uploaded to the remote server to the remote server, if the communication module fails to upload the detection data and reaches the preset interruption condition, the control module shuts down the communication module, waits for the first timer to reach the first timeout duration, and returns to step S22; otherwise, the communication module continues to upload the detection data that has not been uploaded to the remote server in the storage module to the remote server until all the detection data that has not been uploaded to the remote server in the storage module has been uploaded to the remote server, and then proceeds to step S24; S24. The control module shuts down the first timer, ensures that the communication module is turned off, and enters sleep mode or low-power mode.
5. The method for uploading detection data using an alcohol detector according to claim 4, characterized in that, The interruption upload condition is when the communication module fails to upload detection data for a preset second time interval.
6. The method for uploading detection data using an alcohol detector according to claim 5, characterized in that, The time when the communication module fails to upload detection data is either the consecutive time of the communication module failing to upload detection data, or the cumulative time of the communication module failing to upload detection data.
7. The method for uploading detection data using an alcohol detector according to claim 5 or 6, characterized in that, Step S23 specifically includes: S231. During the process of the communication module uploading the detection data that has not been uploaded to the remote server to the remote server, if the communication module fails to upload the detection data, then proceed to step S232; otherwise, the communication module continues to upload the detection data that has not been uploaded to the remote server in the storage module to the remote server until all the detection data that has not been uploaded to the remote server in the storage module has been uploaded to the remote server, then proceed to step S24. S232. The control module starts the second timer of the control module to count the time when the communication module fails to upload detection data, and the communication module continuously attempts to upload the detection data that has not been uploaded to the remote server to the remote server; If the second timer reaches the second timeout duration, the control module shuts down the communication module and the second timer, and waits for the first timer to reach the first timeout duration before returning to step S22. Otherwise, the communication module continues the process of uploading the detection data that was not uploaded to the remote server to the remote server.
8. The method for uploading detection data using an alcohol detector according to claim 4, characterized in that, The interruption upload condition is when the number of times the communication module fails to upload detection data reaches a preset number.
9. The method for uploading detection data using an alcohol detector according to claim 8, characterized in that, The number of times the communication module fails to upload detection data is the number of consecutive failures of the communication module to upload detection data, or the cumulative number of failures of the communication module to upload detection data.
Citation Information
Patent Citations
Communication method and equipment for network terminal equipment
CN104125077A
Data processing method for drunk driving investigation
CN111654655A