CN114020297A - Bluetooth-based intelligent water meter program upgrading method, device, equipment and medium - Google Patents

Bluetooth-based intelligent water meter program upgrading method, device, equipment and medium Download PDF

Info

Publication number
CN114020297A
CN114020297A CN202111307818.4A CN202111307818A CN114020297A CN 114020297 A CN114020297 A CN 114020297A CN 202111307818 A CN202111307818 A CN 202111307818A CN 114020297 A CN114020297 A CN 114020297A
Authority
CN
China
Prior art keywords
upgrading
instruction
upgrade
code returning
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111307818.4A
Other languages
Chinese (zh)
Inventor
段明高
陈坤
舒莉丹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Sanchuan Wisdom Technology Co Ltd
Original Assignee
Sanchuan Wisdom Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Sanchuan Wisdom Technology Co Ltd filed Critical Sanchuan Wisdom Technology Co Ltd
Priority to CN202111307818.4A priority Critical patent/CN114020297A/en
Publication of CN114020297A publication Critical patent/CN114020297A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04MTELEPHONIC COMMUNICATION
    • H04M1/00Substation equipment, e.g. for use by subscribers
    • H04M1/72Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
    • H04M1/724User interfaces specially adapted for cordless or mobile telephones
    • H04M1/72403User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The invention provides a program upgrading method, a device, equipment and a medium based on a Bluetooth intelligent water meter, wherein the method is applied to a mobile phone terminal and comprises the following steps: initializing a mobile phone APP Bluetooth to connect with an intelligent water meter; reading a local upgrade file, and writing upgrade data in the upgrade file into a cache; sending an upgrading request instruction to the intelligent water meter, and receiving a code receiving instruction; checking and analyzing the code returning instruction, and judging whether the code returning instruction is lost or correct: if the code returning instruction is lost or incorrect, a retransmission mechanism is triggered; if the code returning instruction is correct, judging the type of the code returning instruction; and sending the block upgrading instruction and receiving the next code instruction, and circulating the steps. The invention provides a Bluetooth-based intelligent water meter program upgrading method, device, equipment and medium, and aims to provide the Internet of things intelligent water meter equipment with more flexible and convenient maintenance and updating and cost reduction, and a wireless upgrading method is adopted for firmware updating.

Description

Bluetooth-based intelligent water meter program upgrading method, device, equipment and medium
Technical Field
The invention relates to the technical field of intelligent water meters, in particular to a Bluetooth BLE based method, a Bluetooth BLE based device, Bluetooth BLE based equipment and Bluetooth BLE based program upgrading media.
Background
The Bluetooth technology develops and matures rapidly, more and more industries use the Bluetooth module technology, and the intelligent water meter is no exception. The function of traditional water gauge is only flow acquisition and the demonstration of using water yield on mechanical pointer, just needs the manual work to check meter, along with the appearance of bluetooth intelligence water gauge, for traditional water gauge with regard to more convenient and swift, the bluetooth intelligence water gauge that we appear utilizes bluetooth low energy module technique to carry out the short distance communication transmission, can look over the water gauge water consumption condition on the network anytime and anywhere.
Along with the continuous increase of user experience, the upgrading of the intelligent water meter program becomes more and more frequent, and in the current intelligent water meter upgrading communication software, a one-time upgrading method is adopted, but the safety, reliability and continuity of data cannot be completely guaranteed, the time consumption is long, once a problem occurs in the middle of upgrading, the upgrading is restarted, the phenomenon of consuming time and labor is caused, so that the user is inconvenient to use the software to work, and the user use experience and the efficiency are also influenced.
Disclosure of Invention
The invention aims to solve the technical problem of providing a Bluetooth-based intelligent water meter program upgrading method, device, equipment and medium, aiming at ensuring that the Internet of things intelligent water meter equipment is more flexible and convenient to maintain and upgrade and reduces the cost, and a wireless upgrading method is adopted for firmware upgrading.
In a first aspect, the invention provides a method for upgrading a program based on a bluetooth intelligent water meter, which is applied to a mobile phone terminal and comprises the following steps:
s1, initializing a mobile phone APP, and connecting the mobile phone APP with the intelligent water meter through Bluetooth;
s2, reading a local upgrade file, acquiring a current version number and a target version number in the upgrade file, and writing the upgrade data in the upgrade file into a cache;
s3, sending a request upgrading instruction with a current version number and a target version number to the intelligent water meter, and receiving a code returning instruction of the intelligent water meter, wherein the code returning instruction comprises a code returning instruction type and code returning entity data;
s4, checking and analyzing the code returning instruction, specifically:
s41, judging whether the code returning instruction is lost or correct: if the code returning instruction is lost or incorrect, a retransmission mechanism is triggered, and the step S3 is returned; if the code return instruction is correct, go to step S42;
s42, judging the code returning instruction type, wherein the code returning instruction type comprises an upgrading request instruction type, a block upgrading packet instruction type and an upgrading ending instruction type;
when the code returning instruction type is the request upgrading instruction type, analyzing an upgrading mark through the code returning entity data, and judging whether the upgrading mark needs to be upgraded or not; if the upgrading mark is that upgrading is not needed, prompting a description of the condition that upgrading cannot be carried out; if the upgrade flag is in need of upgrading, analyzing the information of the upgrade package number, the upgrade package length and the target version number through the code returning entity data, calculating the total package number according to the total byte number of the local cache and the upgrade package length, and entering the step S5;
when the code returning instruction type is a block upgrading packet instruction type, analyzing information of an upgrading packet number, an upgrading packet length and a target version number through the code returning entity data, and entering a step S5;
when the code returning instruction type is an upgrading ending instruction type, analyzing an upgrading completion mark through a code returning entity number, and when the upgrading completion mark is upgrading success, prompting that the upgrading is successful by a mobile phone APP and updating a user interface; when the upgrade completion mark is upgrade failure, the mobile phone APP prompts the upgrade failure;
s5, sending a block upgrading instruction with an upgrading packet number, an upgrading packet length and upgrading packet data to the intelligent water meter, receiving a next code returning instruction, checking and analyzing the code returning instruction in the step S4, and repeating the steps until the upgrading packet number is the same as the total packet number and the code returning instruction type is the upgrading ending instruction type, and finishing program upgrading.
Further, in step S41, when the number of times of triggering the retransmission mechanism exceeds three times, the user is prompted to fail the upgrade, the retransmission mechanism sets a variable of the retransmission number mCount, the upgrade request instruction is retransmitted every time, the mCount retransmitted once is increased by 1, and when the next code return instruction is received, the information of the upgrade package number, the upgrade package length, and the upgrade target version number that failed the last time is analyzed, and the upgrade process is continuously completed, and if the number of times of triggering the retransmission mechanism exceeds three times, the user is prompted to fail the upgrade, and the retransmission number mCount is reset to 0.
Further, in step S4, the method for calculating the total number of packets is as follows: the number of the long bytes of the upgrade packet is modulo by the total number of the bytes of the local cache: if the result is 0, dividing the number of the upgrade packet length bytes by the number of the local cache total bytes to obtain the number of the upgrade packet length M; if the result is not 0, the total byte number of the local cache is used for dividing the total byte number of the upgrade package by the whole byte number of the upgrade package to obtain the total package length number of the upgrade package of M + 1.
In a second aspect, the present invention provides a bluetooth-based intelligent water meter program upgrading apparatus, where the apparatus is used at a mobile phone terminal, and includes:
the reading module is used for connecting the mobile phone APP with the intelligent water meter Bluetooth, reading a local upgrade file, acquiring a current version number and a target version number in the upgrade file, and writing upgrade data in the upgrade file into a cache;
the sending module is used for sending an upgrading request instruction and a block upgrading instruction to the intelligent water meter;
the receiving module is used for receiving a code returning instruction of the intelligent water meter;
the checking module is used for checking and analyzing the code returning instruction; and
and the retransmission module is used for retransmitting the upgrading request instruction when the code returning instruction is lost or incorrect.
Furthermore, the device also comprises a calculation module used for calculating the total packet number according to the total byte number of the local cache and the length of the upgrade packet.
Further, the specific method for checking and analyzing the code returning instruction is as follows: judging whether the code returning instruction is lost or correct: if the code returning instruction is lost or incorrect, triggering a retransmission mechanism, returning to resend the upgrading request instruction, and prompting the user that the upgrading fails when the number of times of triggering the retransmission mechanism exceeds three times; if the code returning instruction is correct, judging the code returning instruction type, wherein the code returning instruction type comprises an upgrading request instruction type, a block upgrading packet instruction type and an upgrading ending instruction type; when the code returning instruction type is the request upgrading instruction type, analyzing an upgrading mark through the code returning entity data, and judging whether the upgrading mark needs to be upgraded or not; if the upgrading mark is that upgrading is not needed, prompting a description of the condition that upgrading cannot be carried out; if the upgrading mark is in need of upgrading, analyzing information of an upgrading packet number, an upgrading packet length and a target version number through the code returning entity data, calculating the total packet number according to the total byte number and the upgrading packet length of a local cache, sending a block upgrading instruction with the upgrading packet number, the upgrading packet length and upgrading packet data to the intelligent water meter, receiving a next code returning instruction, and checking and analyzing the code returning instruction; when the code returning instruction type is a blocked upgrading packet instruction type, analyzing information of an upgrading packet number, an upgrading packet length and a target version number through the code returning entity data, sending a blocked upgrading instruction with the upgrading packet number, the upgrading packet length and upgrading packet data to the intelligent water meter, receiving a next code returning instruction, and verifying and analyzing the code returning instruction; when the code returning instruction type is an upgrading ending instruction type, analyzing an upgrading completion mark through a code returning entity number, and when the upgrading completion mark is upgrading success, prompting that the upgrading is successful by a mobile phone APP and updating a user interface; when the upgrade completion mark is upgrade failure, the mobile phone APP prompts the upgrade failure; and repeating the steps until the number of the upgrade package is the same as the total package number, and finishing the program upgrade when the code returning instruction type is the upgrade ending instruction type.
In a third aspect, the present invention provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of the first aspect when executing the program.
In a fourth aspect, the invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the method of the first aspect.
One or more technical solutions provided in the embodiments of the present invention have at least the following technical effects or advantages: the invention relates to a program upgrading method, a device, equipment and a medium based on a Bluetooth intelligent water meter, wherein the method adopts a mobile phone app to be directly connected with a Bluetooth BLE intelligent water meter, obtains a current version number and a target version number in an upgrading file through a reading module, writes upgrading data in the upgrading file into a cache, is used for verifying and analyzing a code-returning command through a verification module, resends the upgrading request command when the code-returning command is lost or incorrect through a retransmission module, analyzes the information of the upgrading packet number, the upgrading packet length and the upgrading target version number which have failed last time when the verification module receives the next code-returning command, and then continues to transmit upgrading packet data, and the problem that equipment is upgraded in the field of intelligent water meters can be well solved through the breakpoint resuming technology, and the breakpoint resuming technology is a technology combining local storage and transmission storage, the method is mainly used for solving the problem of data loss during transmission failure, and breakpoint continuous transmission supports data transmission from the last interrupted place of the file instead of from the beginning of the file. The invention also sets a third retransmission mechanism, when the intelligent water meter can not normally return the code instruction or the code instruction is incorrect, the retransmission mechanism can be triggered, the three times of failure can not be exceeded in the whole upgrading process, if the failure exceeds the condition of automatically quitting the upgrading process, the mechanism can well prevent the abnormal condition from happening in the upgrading process, and the program upgrading is stopped. The invention has the advantages of high upgrading efficiency, short time consumption, greatly reduced labor cost for upgrading maintenance, capability of automatically updating the equipment upgrade which is put into use by a user, low power consumption and flexible operation.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
The invention will be further described with reference to the following examples with reference to the accompanying drawings.
Fig. 1 is a schematic diagram of a system framework based on bluetooth intelligent water meter program upgrading according to the present invention;
fig. 2 is a flowchart of a bluetooth-based intelligent water meter program upgrading method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a bluetooth-based intelligent water meter program upgrading device according to a second embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to a third embodiment of the invention;
fig. 5 is a schematic structural diagram of a medium according to a fourth embodiment of the present invention.
Detailed Description
The embodiment of the application provides a Bluetooth-based intelligent water meter program upgrading method, device, equipment and medium, and aims to achieve the purposes that the maintenance and the updating of Internet of things intelligent water meter equipment are more flexible and convenient and the cost is reduced.
The technical scheme in the embodiment of the application has the following general idea: the Bluetooth BLE intelligent water meter is directly connected with a mobile phone app, a current version number and a target version number in an upgrade file are obtained through a reading module, upgrade data in the upgrade file are written into a cache, a check module is used for checking and analyzing a code returning command, a retransmission module is used for retransmitting the upgrade request command when the code returning command is lost or incorrect, the check module can analyze upgrade packet number, upgrade packet length and upgrade target version number information which fail last time when receiving the next code returning command, then upgrade packet data is continuously transmitted, the problem of equipment upgrade work in the field of the intelligent water meter is well solved through the breakpoint continuous transmission technology, the breakpoint continuous transmission technology is a technology combining local storage and transmission storage, is mainly used for solving the problem of data loss when transmission fails, and supports the transmission of data from a place where the file is interrupted last time, rather than from the beginning of the file. The invention also sets a third retransmission mechanism, when the intelligent water meter can not normally return the code instruction or the code instruction is incorrect, the retransmission mechanism can be triggered, the three times of failure can not be exceeded in the whole upgrading process, if the failure exceeds the condition of automatically quitting the upgrading process, the mechanism can well prevent the abnormal condition from happening in the upgrading process, and the program upgrading is stopped.
Before describing the specific embodiment, a system framework corresponding to the method of the embodiment of the present application is described, and as shown in fig. 1, the system is roughly divided into two parts: cell-phone end and intelligent water gauge.
Example one
The embodiment provides a program upgrading method based on a bluetooth intelligent water meter, as shown in fig. 2, the method is applied to a mobile phone terminal in fig. 1, and includes the following steps:
s1, initializing the mobile phone APP, and connecting the Bluetooth with the intelligent water meter.
S2, reading the local upgrade file, obtaining the current version number and the target version number in the upgrade file, and writing the upgrade data in the upgrade file into the cache.
S3, sending a request upgrading instruction with a current version number and a target version number to the intelligent water meter, and receiving a code returning instruction of the intelligent water meter, wherein the code returning instruction comprises a code returning instruction type and code returning entity data.
S4, checking and analyzing the code returning instruction, specifically:
s41, judging whether the code returning instruction is lost or correct: if the code returning instruction is lost or incorrect, a retransmission mechanism is triggered, and the step S3 is returned; if the code return instruction is correct, the process proceeds to step S42.
And S42, judging the code returning instruction type, wherein the code returning instruction type comprises a request upgrading instruction type, a block upgrading packet instruction type and an upgrading ending instruction type.
When the code returning instruction type is an upgrading request instruction type, analyzing an upgrading mark through code returning entity data, judging whether the upgrading mark needs to be upgraded or not, if the upgrading mark does not need to be upgraded, displaying the upgrading mark as 2 or 3, prompting the description of the condition that the upgrading cannot be carried out, when the upgrading mark is displayed as 2, indicating that the upgrading is not needed, and when the upgrading mark is displayed as 3, indicating that the current version is not matched with the target version number, indicating that the upgrading cannot be carried out; if the upgrade flag is upgrade-needed, the upgrade flag is display 1, which indicates that upgrade is needed, the information of the upgrade package number, the upgrade package length, and the target version number is analyzed through the code-returning entity data, and the total package number is calculated according to the local cache total byte number and the upgrade package length, and the process goes to step S5.
When the code returning instruction type is a block upgrading packet instruction type, the information of the number of the upgrading packet, the length of the upgrading packet and the target version number is analyzed through the code returning entity data, and the step S5 is carried out.
When the code returning instruction type is an upgrading ending instruction type, analyzing an upgrading completion mark through a code returning entity number, when the upgrading completion mark is 1, indicating that upgrading is successful, prompting that upgrading is successful by a mobile phone APP, and updating a user interface; and when the upgrade completion flag is 2, the mobile phone APP prompts that the upgrade is failed.
S5, sending a block upgrading instruction with an upgrading packet number, an upgrading packet length and upgrading packet data to the intelligent water meter, receiving a next code returning instruction, checking and analyzing the code returning instruction in the step S4, and repeating the steps until the upgrading packet number is the same as the total packet number and the code returning instruction type is the upgrading ending instruction type, and finishing program upgrading.
In step S41 of this embodiment, when the number of times of triggering the retransmission mechanism exceeds three times, the user is prompted to fail this time of upgrading, the retransmission mechanism sets the mCount variable for the number of times of retransmission, the request upgrade command is resent every time of retransmission, mCount is increased by 1 once of retransmission, the smart water meter can automatically record the correct data receiving condition of the last block upgrade command, and when receiving the next request upgrade command, the code return command can return the upgrade package number, the upgrade package length, and the target version number information of the last failure, the check module can resolve the upgrade package number, the upgrade package length, and the target version number information of the last failure when receiving the next code return command, and continue to complete the upgrade process, and if the number of times of triggering the retransmission mechanism exceeds three times, the user is prompted to fail this time of upgrading, and mCount is reset to 0.
In step S4 in the embodiment of the present application, a method for calculating the total number of packages is as follows: the number of the long bytes of the upgrade packet is modulo by the total number of the bytes of the local cache: if the result is 0, dividing the number of the upgrade packet length bytes by the number of the local cache total bytes to obtain the number of the upgrade packet length M; if the result is not 0, the total byte number of the local cache is used for dividing the total byte number of the upgrade package by the whole byte number of the upgrade package to obtain the total package length number of the upgrade package of M + 1.
As a more preferred or specific implementation manner of this embodiment, the method further includes:
based on the same inventive concept, the application also provides a device corresponding to the method in the first embodiment, which is detailed in the second embodiment.
Example two
In this embodiment, an intelligent water meter program upgrading device based on bluetooth is provided, as shown in fig. 3, including: the device is used for the cell-phone end, includes:
and the reading module is used for connecting the mobile phone APP with the intelligent water meter Bluetooth, reading the local upgrade file, acquiring the current version number and the target version number in the upgrade file, and writing the upgrade data in the upgrade file into the cache.
And the sending module is used for sending a request upgrading instruction and a block upgrading instruction to the intelligent water meter.
And the receiving module is used for receiving the code returning instruction of the intelligent water meter.
And the checking module is used for checking and analyzing the code returning instruction.
And the retransmission module is used for retransmitting the upgrading request instruction when the code returning instruction is lost or incorrect.
The device also comprises a calculation module used for calculating the total packet number according to the total byte number of the local cache and the length of the upgrade packet.
The specific method for checking and analyzing the code returning instruction is as follows: judging whether the code returning instruction is lost or correct: if the code returning instruction is lost or incorrect, triggering a retransmission mechanism, returning to resend the upgrading request instruction, and prompting the user that the upgrading fails when the number of times of triggering the retransmission mechanism exceeds three times; if the code returning instruction is correct, judging the code returning instruction type, wherein the code returning instruction type comprises an upgrading request instruction type, a block upgrading packet instruction type and an upgrading ending instruction type; when the code returning instruction type is the request upgrading instruction type, analyzing an upgrading mark through the code returning entity data, and judging whether the upgrading mark needs to be upgraded or not; if the upgrading mark is that upgrading is not needed, prompting a description of the condition that upgrading cannot be carried out; if the upgrading mark is in need of upgrading, analyzing information of an upgrading packet number, an upgrading packet length and a target version number through the code returning entity data, calculating the total packet number according to the total byte number and the upgrading packet length of a local cache, sending a block upgrading instruction with the upgrading packet number, the upgrading packet length and upgrading packet data to the intelligent water meter, receiving a next code returning instruction, and checking and analyzing the code returning instruction; when the code returning instruction type is a blocked upgrading packet instruction type, analyzing information of an upgrading packet number, an upgrading packet length and a target version number through the code returning entity data, sending a blocked upgrading instruction with the upgrading packet number, the upgrading packet length and upgrading packet data to the intelligent water meter, receiving a next code returning instruction, and verifying and analyzing the code returning instruction; when the code returning instruction type is an upgrading ending instruction type, analyzing an upgrading completion mark through a code returning entity number, and when the upgrading completion mark is upgrading success, prompting that the upgrading is successful by a mobile phone APP and updating a user interface; when the upgrade completion mark is upgrade failure, the mobile phone APP prompts the upgrade failure; and repeating the steps until the number of the upgrade package is the same as the total package number, and finishing the program upgrade when the code returning instruction type is the upgrade ending instruction type.
Since the apparatus described in the second embodiment of the present invention is an apparatus used for implementing the method of the first embodiment of the present invention, based on the method described in the first embodiment of the present invention, a person skilled in the art can understand the specific structure and the deformation of the apparatus, and thus the details are not described herein. All the devices adopted in the method of the first embodiment of the present invention belong to the protection scope of the present invention.
Based on the same inventive concept, the application provides an electronic device embodiment corresponding to the first embodiment, which is detailed in the third embodiment.
EXAMPLE III
The embodiment provides an electronic device, as shown in fig. 4, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, any one of the first embodiment modes may be implemented.
Since the electronic device described in this embodiment is a device used for implementing the method in the first embodiment of the present application, based on the method described in the first embodiment of the present application, a specific implementation of the electronic device in this embodiment and various variations thereof can be understood by those skilled in the art, and therefore, how to implement the method in the first embodiment of the present application by the electronic device is not described in detail herein. The equipment used by those skilled in the art to implement the methods in the embodiments of the present application is within the scope of the present application.
Based on the same inventive concept, the application provides a storage medium corresponding to the fourth embodiment, which is described in detail in the fourth embodiment.
Example four
The present embodiment provides a computer-readable storage medium, as shown in fig. 5, on which a computer program is stored, and when the computer program is executed by a processor, any one of the embodiments can be implemented.
The technical scheme provided in the embodiment of the application at least has the following technical effects or advantages: according to the Bluetooth-based intelligent water meter program upgrading method, device, system, equipment and medium, the portable intelligent water meter main program can be effectively updated through the breakpoint continuous transmission technology and the retransmission mechanism, a user can independently update the equipment which is already put into use, and the Bluetooth-based intelligent water meter program upgrading method has the advantages of being high in upgrading efficiency, short in time consumption, capable of greatly reducing labor cost of upgrading and maintaining and flexible in operation.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus or system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
Although specific embodiments of the invention have been described above, it will be understood by those skilled in the art that the specific embodiments described are illustrative only and are not limiting upon the scope of the invention, and that equivalent modifications and variations can be made by those skilled in the art without departing from the spirit of the invention, which is to be limited only by the appended claims.

Claims (8)

1. A method for upgrading programs of an intelligent water meter based on Bluetooth is characterized by comprising the following steps: the method is applied to a mobile phone end and comprises the following steps:
s1, initializing a mobile phone APP, and connecting the mobile phone APP with the intelligent water meter through Bluetooth;
s2, reading a local upgrade file, acquiring a current version number and a target version number in the upgrade file, and writing the upgrade data in the upgrade file into a cache;
s3, sending a request upgrading instruction with a current version number and a target version number to the intelligent water meter, and receiving a code returning instruction of the intelligent water meter, wherein the code returning instruction comprises a code returning instruction type and code returning entity data;
s4, checking and analyzing the code returning instruction, specifically:
s41, judging whether the code returning instruction is lost or correct: if the code returning instruction is lost or incorrect, a retransmission mechanism is triggered, and the step S3 is returned; if the code return instruction is correct, go to step S42;
s42, judging the type of the code returning instruction;
when the code returning instruction type is the request upgrading instruction type, analyzing an upgrading mark through the code returning entity data, and judging whether the upgrading mark needs to be upgraded or not; if the upgrading mark is that upgrading is not needed, prompting a description of the condition that upgrading cannot be carried out; if the upgrade flag is in need of upgrading, analyzing the information of the upgrade package number, the upgrade package length and the target version number through the code returning entity data, calculating the total package number according to the total byte number of the local cache and the upgrade package length, and entering the step S5;
when the code returning instruction type is a block upgrading packet instruction type, analyzing information of an upgrading packet number, an upgrading packet length and a target version number through the code returning entity data, and entering a step S5;
when the code returning instruction type is an upgrading ending instruction type, analyzing an upgrading completion mark through a code returning entity number, and when the upgrading completion mark is upgrading success, prompting that the upgrading is successful by a mobile phone APP and updating a user interface; when the upgrade completion mark is upgrade failure, the mobile phone APP prompts the upgrade failure;
s5, sending a block upgrading instruction with an upgrading packet number, an upgrading packet length and upgrading packet data to the intelligent water meter, receiving a next code returning instruction, checking and analyzing the code returning instruction in the step S4, and repeating the steps until the upgrading packet number is the same as the total packet number and the code returning instruction type is the upgrading ending instruction type, and finishing program upgrading.
2. The Bluetooth-based intelligent water meter program upgrading method according to claim 1, characterized in that: in step S41, when the number of times of triggering the retransmission mechanism exceeds three times, the user is prompted to fail the upgrade, the retransmission mechanism sets a variable of the number of retransmission mCount, the upgrade request instruction is retransmitted every time, the mCount retransmitted once is increased by 1, and when the next code return instruction is received, the information of the upgrade package number, the upgrade package length, and the upgrade target version number that failed the last time is analyzed, and the upgrade process is continuously completed, and if the number of times of triggering the retransmission mechanism exceeds three times, the user is prompted to fail the upgrade this time, and the number of retransmission mCount is reset to 0.
3. The Bluetooth-based intelligent water meter program upgrading method according to claim 1, characterized in that: in step S4, the method of calculating the total number of packets is as follows: the number of the long bytes of the upgrade packet is modulo by the total number of the bytes of the local cache: if the result is 0, dividing the number of the upgrade packet length bytes by the number of the local cache total bytes to obtain the number of the upgrade packet length M; if the result is not 0, the total byte number of the local cache is used for dividing the total byte number of the upgrade package by the whole byte number of the upgrade package to obtain the total package length number of the upgrade package of M + 1.
4. The utility model provides a based on bluetooth intelligence water gauge procedure upgrading device which characterized in that: the device is used for the cell-phone end, includes:
the reading module is used for connecting the mobile phone APP with the intelligent water meter Bluetooth, reading a local upgrade file, acquiring a current version number and a target version number in the upgrade file, and writing upgrade data in the upgrade file into a cache;
the sending module is used for sending an upgrading request instruction and a block upgrading instruction to the intelligent water meter;
the receiving module is used for receiving a code returning instruction of the intelligent water meter;
the checking module is used for checking and analyzing the code returning instruction; and
and the retransmission module is used for retransmitting the upgrading request instruction when the code returning instruction is lost or incorrect.
5. The Bluetooth-based intelligent water meter program upgrading device according to claim 4, characterized in that: the device also comprises a calculation module used for calculating the total packet number according to the total byte number of the local cache and the length of the upgrade packet.
6. The Bluetooth-based intelligent water meter program upgrading device according to claim 5, characterized in that: the specific method for checking and analyzing the code returning instruction is as follows: judging whether the code returning instruction is lost or correct: if the code returning instruction is lost or incorrect, triggering a retransmission mechanism, returning to resend the upgrading request instruction, and prompting the user that the upgrading fails when the number of times of triggering the retransmission mechanism exceeds three times; if the code returning instruction is correct, judging the code returning instruction type, wherein the code returning instruction type comprises an upgrading request instruction type, a block upgrading packet instruction type and an upgrading ending instruction type; when the code returning instruction type is the request upgrading instruction type, analyzing an upgrading mark through the code returning entity data, and judging whether the upgrading mark needs to be upgraded or not; if the upgrading mark is that upgrading is not needed, prompting a description of the condition that upgrading cannot be carried out; if the upgrading mark is in need of upgrading, analyzing information of an upgrading packet number, an upgrading packet length and a target version number through the code returning entity data, calculating the total packet number according to the total byte number and the upgrading packet length of a local cache, sending a block upgrading instruction with the upgrading packet number, the upgrading packet length and upgrading packet data to the intelligent water meter, receiving a next code returning instruction, and checking and analyzing the code returning instruction; when the code returning instruction type is a blocked upgrading packet instruction type, analyzing information of an upgrading packet number, an upgrading packet length and a target version number through the code returning entity data, sending a blocked upgrading instruction with the upgrading packet number, the upgrading packet length and upgrading packet data to the intelligent water meter, receiving a next code returning instruction, and verifying and analyzing the code returning instruction; when the code returning instruction type is an upgrading ending instruction type, analyzing an upgrading completion mark through a code returning entity number, and when the upgrading completion mark is upgrading success, prompting that the upgrading is successful by a mobile phone APP and updating a user interface; when the upgrade completion mark is upgrade failure, the mobile phone APP prompts the upgrade failure; and repeating the steps until the number of the upgrade package is the same as the total package number, and finishing the program upgrade when the code returning instruction type is the upgrade ending instruction type.
7. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 3 when executing the program.
8. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 3.
CN202111307818.4A 2021-11-05 2021-11-05 Bluetooth-based intelligent water meter program upgrading method, device, equipment and medium Pending CN114020297A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111307818.4A CN114020297A (en) 2021-11-05 2021-11-05 Bluetooth-based intelligent water meter program upgrading method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111307818.4A CN114020297A (en) 2021-11-05 2021-11-05 Bluetooth-based intelligent water meter program upgrading method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN114020297A true CN114020297A (en) 2022-02-08

Family

ID=80061868

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111307818.4A Pending CN114020297A (en) 2021-11-05 2021-11-05 Bluetooth-based intelligent water meter program upgrading method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114020297A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115686586A (en) * 2022-11-16 2023-02-03 深圳市拓邦自动化技术有限公司 Terminal device program upgrading method and device and electric equipment
CN116088912A (en) * 2023-04-11 2023-05-09 瑞纳智能设备股份有限公司 Application system, method and computer readable storage medium for upgrading user terminal equipment
CN117573156A (en) * 2023-10-19 2024-02-20 京源中科科技股份有限公司 Ultrasonic water meter upgrading method, system and device supporting infrared function

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115686586A (en) * 2022-11-16 2023-02-03 深圳市拓邦自动化技术有限公司 Terminal device program upgrading method and device and electric equipment
CN116088912A (en) * 2023-04-11 2023-05-09 瑞纳智能设备股份有限公司 Application system, method and computer readable storage medium for upgrading user terminal equipment
CN117573156A (en) * 2023-10-19 2024-02-20 京源中科科技股份有限公司 Ultrasonic water meter upgrading method, system and device supporting infrared function

Similar Documents

Publication Publication Date Title
CN114020297A (en) Bluetooth-based intelligent water meter program upgrading method, device, equipment and medium
CN106569847B (en) Method for vehicle-mounted system to realize IAP remote upgrade based on mobile network
CN108011935B (en) Program upgrading method of NB-IOT (network node B-IOT) equipment, server and NB-IOT equipment
CN106843942B (en) Wearable device and firmware upgrading method thereof
US11119849B2 (en) Erasure code-based partial write-in
EP3206110B1 (en) Method of providing handwriting style correction function and electronic device adapted thereto
CN108563567B (en) Automated testing method, apparatus, device and computer readable storage medium
CN105262627A (en) Firmware upgrade method, device and system
CN104090796A (en) Embedded device program updating method and system
CN107908417B (en) Firmware upgrading method and electronic equipment
CN110399153B (en) System upgrading method, device, terminal and computer readable storage medium
US20170068585A1 (en) Method and Apparatus for Recovering System Software of Intelligent Terminal
WO2016173128A1 (en) Method and device for downloading software version, and storage medium
CN112100081B (en) Upgrade test method and device based on double-core intelligent electric meter and computer equipment
CN113972990B (en) Data verification method and device, storage medium and electronic equipment
EP4224317A1 (en) Method and apparatus for controlling distributed operation system, and device, medium and program product
CN111555841A (en) Communication data checking method, device, equipment and medium
CN112631911A (en) Automatic testing method and device, computer equipment and storage medium
CN106055420A (en) Method, device and equipment for data verification
CN108897546A (en) Monitor method, apparatus, equipment and the readable storage medium storing program for executing of APK size
CN110704148A (en) Method and device for acquiring device page elements, server and storage medium
CN110532203B (en) NAND reset method, device, electronic equipment and storage medium
CN109150414B (en) Method, device, equipment and storage medium for enhancing Bluetooth communication stability between equipment
CN116243949A (en) Software upgrading method and device, embedded equipment and storage medium
CN115129509A (en) Data transmission method, device and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination