Charging method and device, electronic equipment and storage medium
By exchanging charging data packets between mobile phones to determine the charging strategy, the problems of random charging direction and multiple plugging and unplugging are solved, realizing a convenient and efficient mobile phone mutual charging process.
Patent Information
- Application Number
- CN202011158974.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-26
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2041-04-01
AI Technical Summary
In existing technologies, the charging direction is random when two mobile phones are used to charge each other, which makes it difficult for the low-battery phone to charge the high-battery phone. It also requires multiple plugging and unplugging connections, which is inconvenient to use, and it is impossible to continuously monitor the phone status and adjust the charging direction.
By exchanging charging data packets between the first electronic device and the second electronic device, a charging strategy is determined, including sending and receiving data packets, generating and parsing the charging strategy based on mobile phone characteristic information, ensuring accurate charging direction and avoiding repeated plugging and unplugging connections.
It enables accurate determination of the charging direction after a single connection, avoids unfavorable charging schemes, improves the convenience and efficiency of the mutual charging process, and reduces the number of plugging and unplugging cycles.
Smart Images

Figure CN114498784B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the terminal field, and in particular, to a charging method and device, an electronic device, and a storage medium. BACKGROUND
[0002] With the advancement of technology, electronic devices such as mobile phones have more and more functions, and the hardware power consumption is also increasing, resulting in faster power consumption of electronic devices such as mobile phones. In related scenarios, such as when a user is outdoors or on a trip, the environment in which the user is located is not conducive to timely charging of the electronic device such as a mobile phone using a charger. Therefore, in related technologies, there is a charging method of mutual charging using two mobile phones.
[0003] However, in related technologies, the charging direction is random during mutual charging using two mobile phones, and there is an unfavorable solution of charging a mobile phone with low power to a mobile phone with high power. In addition, the user needs to plug and unplug the connection multiple times to achieve the purpose of charging the target mobile phone, which is very inconvenient to use. SUMMARY
[0004] To overcome the problems in related technologies, the present disclosure provides a charging method, device, electronic device, and storage medium
[0005] According to a first aspect of an embodiment of the present disclosure, a charging method is provided, applied to a first electronic device, the first electronic device being connected to a second electronic device through a preset charging line, and the method comprising:
[0006] sending a first data packet; wherein the first data packet comprises to-be-charged identification information and first characteristic information of the first electronic device;
[0007] receiving a second data packet corresponding to the first data packet sent by the second electronic device; wherein the second data packet comprises power supply identification information and charging strategy information;
[0008] determining and executing a charging strategy according to the second data packet; wherein the charging strategy comprises: the first electronic device receiving power supply from the second electronic device, or the first electronic device supplying power to the second electronic device.
[0009] Optionally, the method further comprises:
[0010] obtaining first characteristic information of the first electronic device; wherein the first characteristic information comprises first temperature information and first power information;
[0011] generating the first data packet according to the first characteristic information and the to-be-charged identification information.
[0012] Optionally, the determining the charging strategy according to the second data packet comprises:
[0013] parsing the second data packet to determine a charging strategy included in the second data packet.
[0014] Optionally, when the charging strategy is that the second electronic device receives power supply from the first electronic device, the method further includes:
[0015] determining a preset interval duration according to the second data packet;
[0016] sending an updated first data packet after the charging strategy is executed for the preset interval duration, wherein the updated first data packet includes current first characteristic information.
[0017] According to a second aspect of the embodiments of the present disclosure, a charging method is provided, applied to a second electronic device, a first electronic device and the second electronic device being connected through a preset charging line, and the method includes:
[0018] receiving a first data packet sent by the first electronic device, wherein the first data packet includes to-be-charged identification information and first characteristic information of the first electronic device;
[0019] generating a corresponding second data packet according to the first data packet, wherein the second data packet includes power supply identification information and charging strategy information, and the charging strategy information represents a charging strategy including that the second electronic device executes power supply for the first electronic device or the second electronic device receives power supply from the first electronic device;
[0020] sending the second data packet.
[0021] Optionally, the generating the corresponding second data packet according to the first data packet includes:
[0022] determining first characteristic information of the first electronic device according to the first data packet, wherein the first characteristic information includes first temperature information and first power information;
[0023] obtaining second characteristic information of the second electronic device, wherein the second characteristic information includes second temperature information and second power information;
[0024] determining charging strategy information according to the first characteristic information and the second characteristic information;
[0025] generating the second data packet according to the charging strategy information and the power supply identification information.
[0026] Optionally, the determining the charging strategy information according to the first characteristic information and the second characteristic information includes:
[0027] In response to the first temperature information or the second temperature information being outside a preset temperature range, the charging strategy is determined as: the second electronic device stops power supply.
[0028] Optionally, the determining the charging strategy information according to the first feature information and the second feature information further includes:
[0029] When the first temperature information or the second temperature information is within the preset temperature range, in response to the first power information and the second power information not satisfying a preset power supply condition, the charging strategy is determined as: the second electronic device stops power supply.
[0030] Optionally, the determining the charging strategy information according to the first feature information and the second feature information further includes:
[0031] When the first power information and the second power information satisfy the preset power supply condition:
[0032] In response to the power difference information between the first power information and the second power information reaching a preset power difference threshold, the charging strategy is determined as: the first electronic device and the second electronic device exchange power supply roles, and the first electronic device supplies power to the second electronic device; wherein the power supply role is used to represent a state of the first electronic device or the second electronic device as a charging state or a power supply state.
[0033] In response to the power difference information not reaching the preset power difference threshold, the charging strategy is determined as: the second electronic device performs power supply.
[0034] Optionally, the method further includes:
[0035] According to the first feature information and the second feature information, a preset interval duration is determined; wherein the preset interval duration is used to represent a time of the second electronic device performing power supply this time when the charging strategy is the second electronic device performing power supply for the first electronic device.
[0036] The generating the corresponding second data packet according to the first data packet includes:
[0037] The second data packet is generated according to the first data packet and the preset interval duration.
[0038] Optionally, the determining the preset interval duration according to the first feature information and the second feature information includes:
[0039] According to the first temperature information, the second temperature information, and the power difference information between the first power information and the second power information, interval durations corresponding to the first temperature information, the second temperature information, and the power difference information respectively are determined.
[0040] The preset interval duration is determined as the minimum duration in the corresponding interval durations.
[0041] Optionally, the determining of the interval duration corresponding to the first temperature information, the second temperature information, and the power difference information, respectively, according to the first temperature information, the second temperature information, and the power difference information of the first power and the second power, comprises:
[0042] obtaining first configuration information and second configuration information; wherein the first configuration information is used to represent the corresponding relationship between temperature intervals and interval durations, and the second configuration information is used to represent the corresponding relationship between power difference intervals and interval durations;
[0043] determining a first interval duration corresponding to the first temperature information according to the first temperature information and the first configuration information;
[0044] determining a second interval duration corresponding to the second temperature information according to the second temperature information and the first configuration information;
[0045] determining a third interval duration corresponding to the power difference information according to the power difference information and the second configuration information;
[0046] The determining of the preset interval duration comprises:
[0047] determining the minimum duration in the first interval duration, the second interval duration, and the third interval duration as the preset interval duration.
[0048] According to a third aspect of the embodiments of the present disclosure, a charging device is provided, which is applied to a first electronic device, and the first electronic device is connected with a second electronic device through a preset charging line, and the device comprises:
[0049] a first sending module, configured to send a first data packet; wherein the first data packet comprises to-be-charged identification information and first characteristic information of the first electronic device;
[0050] a first receiving module, configured to receive a second data packet corresponding to the first data packet sent by the second electronic device; wherein the second data packet comprises power supply identification information and charging strategy information;
[0051] a first determining module, configured to determine and execute a charging strategy according to the second data packet; wherein the charging strategy comprises that the first electronic device receives power supply from the second electronic device, or the first electronic device supplies power to the second electronic device.
[0052] Optionally, the device further comprises:
[0053] obtain a first characteristic information of the first electronic device, wherein the first characteristic information comprises first temperature information and first power information;
[0054] generate the first data packet according to the first characteristic information and the to-be-charged identification information.
[0055] Optionally, the first determining module is specifically configured to:
[0056] analyze the second data packet to determine a charging strategy contained in the second data packet.
[0057] Optionally, when the charging strategy is that the first electronic device receives power supply of the second electronic device,
[0058] The first determining module is further configured to determine a preset interval duration according to the second data packet.
[0059] The first sending module is further configured to send an updated first data packet after the charging strategy is executed for the preset interval duration, wherein the updated first data packet comprises current first characteristic information.
[0060] According to a fourth aspect of the embodiments of the present disclosure, a charging device is provided, applied to a second electronic device, a first electronic device and the second electronic device being connected through a preset charging line, and the device comprises:
[0061] a second receiving module configured to receive a first data packet sent by the first electronic device, wherein the first data packet comprises to-be-charged identification information and first characteristic information of the first electronic device;
[0062] a second generating module configured to generate a corresponding second data packet according to the first data packet, wherein the second data packet comprises power supply identification information and charging strategy information; and wherein the charging strategy information represents a charging strategy, which comprises that the second electronic device executes power supply for the first electronic device or the second electronic device receives power supply of the first electronic device;
[0063] a second sending module configured to send the second data packet.
[0064] Optionally, the second generating module is specifically configured to:
[0065] determine first characteristic information of the first electronic device according to the first data packet, wherein the first characteristic information comprises first temperature information and first power information;
[0066] obtain second characteristic information of the second electronic device, wherein the second characteristic information comprises second temperature information and second power information;
[0067] determine charging strategy information according to the first feature information and the second feature information;
[0068] generate the second data packet according to the charging strategy information and the power supply identifier information.
[0069] Optionally, the second generation module is specifically configured to:
[0070] determine the charging strategy as the second electronic device stopping power supply in response to the first temperature information or the second temperature information being outside a preset temperature range.
[0071] Optionally, the second generation module is specifically configured to:
[0072] determine the charging strategy as the second electronic device stopping power supply in response to the first electric quantity information and the second electric quantity information not satisfying a preset power supply condition when the first temperature information or the second temperature information is within a preset temperature range.
[0073] Optionally, the second generation module is specifically configured to:
[0074] when the first electric quantity information and the second electric quantity information satisfy a preset power supply condition:
[0075] determine the charging strategy as the first electronic device and the second electronic device exchanging power supply roles to make the first electronic device supply power to the second electronic device in response to an electric quantity difference information of the first electric quantity information and the second electric quantity information reaching a preset electric quantity difference threshold, wherein the power supply role is used to represent a state of the first electronic device or the second electronic device as a charging state or a power supply state;
[0076] determine the charging strategy as the second electronic device performing power supply in response to the electric quantity difference information not reaching the preset electric quantity difference threshold.
[0077] Optionally, the apparatus further includes:
[0078] a second determination module configured to determine a preset interval duration according to the first feature information and the second feature information, wherein the preset interval duration is used to represent a time of the second electronic device performing power supply this time when the charging strategy is the second electronic device performing power supply to the first electronic device.
[0079] the second generation module is specifically configured to generate the second data packet according to the first data packet and the preset interval duration.
[0080] Optionally, the second determination module is specifically configured to:
[0081] determine, according to the first temperature information, the second temperature information, and the power difference information of the first power information and the second power information, a corresponding interval duration corresponding to the first temperature information, the second temperature information, and the power difference information respectively;
[0082] determine the preset interval duration as the minimum interval duration among the corresponding interval durations.
[0083] Optionally, the second determining module is specifically configured to:
[0084] obtain first configuration information and second configuration information, wherein the first configuration information is used to represent a corresponding relationship between a temperature interval and an interval duration, and the second configuration information is used to represent a corresponding relationship between a power difference interval and an interval duration;
[0085] determine, according to the first temperature information and the first configuration information, a first interval duration corresponding to the first temperature information;
[0086] determine, according to the second temperature information and the first configuration information, a second interval duration corresponding to the second temperature information;
[0087] determine, according to the power difference information and the second configuration information, a third interval duration corresponding to the power difference information;
[0088] determine the preset interval duration as the minimum interval duration among the first interval duration, the second interval duration, and the third interval duration.
[0089] According to a fifth aspect of the embodiments of the present disclosure, an electronic device is provided, comprising:
[0090] a processor;
[0091] a memory for storing executable instructions of the processor;
[0092] The processor is configured to perform the charging method according to any one of the above aspects.
[0093] According to a sixth aspect of the embodiments of the present disclosure, a non-transitory computer readable storage medium is provided, when the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can perform the charging method according to any one of the above aspects.
[0094] Embodiments of the present disclosure provide technical solutions that can include the following beneficial effects: using the method of the present disclosure, after the first electronic device and the second electronic device are connected by the charging cable, the first electronic device and the second electronic device can interact and communicate charging data, and then determine the charging strategy, thereby accurately determining the target mobile phone and charging the target mobile phone. This effectively avoids the adverse charging scheme caused by random charging direction in the related art, and does not require multiple plugging and unplugging of the charging cable. Only one connection is required to determine the charging direction, and the mutual charging process is more convenient and efficient.
[0095] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0096] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0097] Figure 1 is a flowchart of a method according to an exemplary embodiment.
[0098] Figure 2 is a flowchart of a method according to an exemplary embodiment.
[0099] Figure 3 is a flowchart of a method according to an exemplary embodiment.
[0100] Figure 4 is a flowchart of a method according to an exemplary embodiment.
[0101] Figure 5 is a flowchart of a method according to an exemplary embodiment.
[0102] Figure 6 is a flowchart of a method according to an exemplary embodiment.
[0103] Figure 7 is a flowchart of a method according to an exemplary embodiment.
[0104] Figure 8 is a schematic diagram of a first data packet according to an exemplary embodiment.
[0105] Figure 9 is a schematic diagram of a second data packet according to an exemplary embodiment.
[0106] Figure 10 is a schematic diagram of first configuration information according to an exemplary embodiment.
[0107] Figure 11is a schematic diagram of second configuration information according to an example embodiment.
[0108] Figure 12 is a schematic diagram of interaction between a first electronic device and a second electronic device according to an example embodiment.
[0109] Figure 13 is a block diagram of an apparatus according to an example embodiment.
[0110] Figure 14 is a block diagram of an apparatus according to an example embodiment.
[0111] Figure 15 is a block diagram of an electronic device according to an example embodiment. DETAILED DESCRIPTION
[0112] The example embodiments will be described in detail herein with reference to the attached drawings. In the following description, same numbers refer to same elements in all figures. The following detailed description does not limit the present disclosure to the explicit examples disclosed herein and could be applied to other examples functioning in a similar manner. The present disclosure is applicable to other embodiments or of being practiced or carried out in various ways. Also, the phraseology and terminology used herein is for the purpose of description and should not be regarded as limiting. The use of "including," "comprising," or "having" and variations thereof herein is meant to encompass the items listed thereafter and equivalents thereof as well as additional items. Unless specified or limited otherwise, the terms "connected" and "coupled" and variations thereof are used broadly and encompass both direct and indirect connections and couplings.
[0113] As technology advances, electronic devices such as mobile phones have more and more functions, and the hardware power consumption is also increasing, which leads to faster power consumption of electronic devices such as mobile phones. In related scenarios, such as when a user is outdoors or on a trip, the environment in which the user is located is not conducive to timely charging of the electronic device such as the mobile phone using a charger.
[0114] In the related art, two mobile phones can be used for wired mutual charging. For example, two mobile phones are connected by a c to c line, one of the mobile phones is used as a power supply, the other mobile phone is used as a power receiver, and charging is performed according to the charging power negotiated by the PD protocol. The c to c line refers to a charging line with type c interfaces at both ends, which can be used to connect two electronic devices with type c ports.
[0115] However, in the related art, the charging direction is always random during mutual charging of two mobile phones, and there is an unfavorable solution of charging a mobile phone with low power to a mobile phone with high power. In addition, the user needs to plug and unplug the connection multiple times to achieve the purpose of charging the target mobile phone, which is very inconvenient.
[0116] In addition, in the mutual charging solution of the related art, the state of the two mobile phones cannot be continuously monitored, and the charging direction or state of the two mobile phones cannot be adjusted in a timely manner according to the state of the mobile phones.
[0117] To solve the above technical problems, the present disclosure provides a charging method applied to a first electronic device, which comprises the following steps: sending a first data packet; receiving a second data packet corresponding to the first data packet sent by a second electronic device; and determining and executing a charging strategy according to the second data packet. By using the method of the present disclosure, after the first electronic device and the second electronic device are connected by a charging line, the first electronic device and the second electronic device can interact and communicate charging data, and then determine the charging strategy, so as to accurately determine the target mobile phone and charge the target mobile phone. The method effectively avoids the adverse charging scheme caused by random charging direction in the related art, and does not need to plug and unplug the charging line multiple times. Only one connection is needed to determine the charging direction, and the mutual charging process is more convenient and efficient.
[0118] In an exemplary embodiment, the charging method of the present embodiment is applied to a first electronic device, which can be a portable electronic device such as a mobile phone, a notebook computer, a tablet computer, a smart watch, a Bluetooth headset, etc. The electronic device executing the method is the power receiving device in the initial moment of connection with the charging line, or the initial power receiving device in each communication process. In the present embodiment, the CPU (Central Processing Unit) of the first electronic device can execute the method.
[0119] In the present embodiment, the first electronic device and the second electronic device are connected by a preset charging line, which can be a c to c line (both ends of the charging line are type c interfaces). For example, when a user needs mutual charging, the mobile phone M1 and the mobile phone M2 are connected by a c to c line. In the initial moment of connection, one party is randomly the power receiving device and the other party is the power supply device. Assuming that the mobile phone M1 is the power receiving device and the mobile phone M2 is the power supply device in the initial moment. In the present embodiment, the power receiving device (sink) in the initial moment is defined as the first electronic device, and the power supply device (source) in the initial moment is defined as the second electronic device. For example, the mobile phone M1 is the first electronic device and the mobile phone M2 is the second electronic device. When the first electronic device and the second electronic device are connected by the preset charging line, the second electronic device sends the manufacturer identification information by default.
[0120] As shown in Figure 1 The method of the present embodiment comprises the following steps:
[0121] S110, sending a first data packet.
[0122] S120, receiving a second data packet corresponding to the first data packet sent by a second electronic device.
[0123] S130, determining and executing a charging strategy according to the second data packet.
[0124] In step S110, the first data packet is sent by the first electronic device.Figure 12 As shown, when the first electronic device detects that one end of the preset charging line is inserted (the other end of the preset charging line is connected to the second electronic device), the charging protocol is checked, and it is determined whether the manufacturer identification information sent by the second electronic device satisfies the preset identification information.
[0125] In this step, when the first connection information is satisfied, the first electronic device and the second electronic device complete the connection and then perform the intelligent mutual charging communication. The first connection information can be used as a signal capable of performing the intelligent mutual charging mode. The first connection information at least includes: the charging protocol satisfies the preset protocol. In this embodiment, the preset protocol can be a new PD protocol improved on the basis of the original PD protocol, and the interactive information (the first data packet or the second data packet) can be sent based on the new PD protocol. The first connection information can also include: the manufacturer identification information of the second electronic device satisfies the preset identification information. The preset identification information can be, for example, the manufacturer identification information of the first electronic device, that is, the first electronic device and the second electronic device have the same manufacturer identification, and then the intelligent mutual charging mode is performed.
[0126] In one example, when the charging protocol of the preset charging line satisfies the preset protocol, the first electronic device can initiate the intelligent mutual charging communication and send the first data packet. In another example, when the charging protocol of the preset charging line satisfies the preset protocol, and the manufacturer identification of the second electronic device is the same as that of the first electronic device, the first electronic device can initiate the intelligent mutual charging communication and send the first data packet. It can be understood that in other examples, the first connection information can be customized in combination with product functions.
[0127] In this step, the first data packet can be a VDM (Vendor Defined Message) form data packet, which is defined as sink_VDM. The VDM is a data packet reserved by the PD protocol, and the use method can be customized by the manufacturer. In this embodiment, the first data packet includes the identification information of the first electronic device and the first characteristic information of the first electronic device. The identification information of the first electronic device can include, for example, the manufacturer identification information and the power role (Power Role) identification information. The power role is used to represent the state of the first electronic device or the second electronic device as a charging state or a power supply state, that is, the power role indicates a sink or a source. The power role identification information of the first electronic device is charging identification information, which represents that the first electronic device is a sink.
[0128] The first data packet (sink_VDM) includes two sub-packets (package 11 and package 12), each of which is composed of 32 bits, each bit is represented by a binary number (0 or 1), and the meaning of each bit in the first data packet can be set according to actual needs.
[0129] For example, the power role is divided into two types, so that a single bit "0 or 1" can effectively distinguish the power role, so that a bit in package 11 or package 12 can represent the power role. The manufacturer's identification is generally represented by a four-digit hexadecimal number (which can be converted into a 16-bit binary number), so 16 bits in package 11 or package 12 need to be reserved to represent the manufacturer's identification. The first feature information includes two factors of temperature and power, and the temperature or power is generally two digits, so 8 bits need to be reserved for temperature or power, and a total of 16 bits are needed to represent the first feature information. The meaning of the remaining bits can be adjusted according to actual needs, such as setting a bit to represent the CPU load condition. According to the above principle, the meaning of the bits in the two sub-packets package 11 and package 12 of the first data packet can be configured.
[0130] For example, the composition of the first data packet in the embodiment is as shown in Figure 8 "Reserved" in the figure represents the undefined meaning of the corresponding bit in the embodiment.
[0131] Among them, bit0 in package 11 represents the power role identification information, for example, bit0 is 0, which represents the charging identification information, that is, the first electronic device is a sink, and the transmitted data is the first data packet (sink_VDM). Bit16-bit31 represents the manufacturer's identification information (SVID) of the first electronic device. The SVID is an identification ID assigned by the PD standard organization to each manufacturer and includes 16 bits, for example, assuming that the SVID of manufacturer A to which the electronic device belongs is 0x2717 (0x represents hexadecimal).
[0132] Bit0-bit7 in package 12 represents the power percentage of the first electronic device, and bit8-bit15 represents the whole machine temperature of the first electronic device.
[0133] In step S120, the second data packet is generated by the second electronic device according to the received first data packet, and is transmitted based on a wired connection and a preset protocol, and the first electronic device can receive the second data packet. Among them, the second data packet includes a charging strategy determined according to the feature information of the first electronic device.
[0134] In step S130, the charging strategy is used to represent whether the second electronic device supplies power, such as the charging strategy including: the first electronic device receives power supply from the second electronic device, or the first electronic device supplies power to the second electronic device. In this step, after the first electronic device receives the second data packet, the second data packet can be parsed to determine the charging strategy contained in the second data packet.
[0135] In one example, if the charging strategy contained in the second data packet is to receive charging of the second electronic device, the first electronic device can execute the charging strategy. For example, the charging strategy executed by the mobile phone M1 at this time is to receive power supply from the mobile phone M2.
[0136] In another example, if the charging strategy contained in the second data packet is not to receive charging of the second electronic device. In this example, the scheme of not receiving charging of the second electronic device can include the following two ways: the first way, the mobile phone M1 has more power, so the mobile phone M1 needs to change the power supply role with the mobile phone M2, that is, the mobile phone M1 changes from sink to source, and charges the mobile phone M2 with the mobile phone M1. The second way, the mobile phone M1 has dangerous factors for the mobile phone M2, and the second electronic device stops charging. The dangerous factors may be, for example, that the first electronic device or the second electronic device has a poor state, low power or high temperature during mutual charging. Stopping charging can effectively avoid danger.
[0137] Steps S110 to S130 represent one intelligent mutual charging communication between the first electronic device and the second electronic device. In this embodiment, the duration of each communication is about 0.3 seconds. Therefore, even if the mobile phone M1 and the mobile phone M2 are randomly connected as the power receiving side and the power supply side in the initial moment of connection, the method according to the present disclosure can still adjust the charging strategy in time, so as to accurately charge the target mobile phone. It is not necessary to plug in and out the charging line many times, and the accurate charging direction can be quickly determined based on one connection, so as to avoid the adverse scheme of charging the mobile phone with high power by the mobile phone with low power.
[0138] In one example embodiment, as shown in FIG. 1, before step S110, the method of the present embodiment further includes: Figure 2
[0139] S102, obtaining first characteristic information of the first electronic device.
[0140] S104, generating a first data packet according to the first characteristic information and the to-be-charged identification information.
[0141] In step S102, the CPU of the first electronic device acquires first characteristic information of itself, which includes first temperature information and first power information. The first temperature information can be the whole machine temperature information of the first electronic device, which can be detected by a temperature sensor arranged in the first electronic device. The first power information can be the current power information of the first electronic device.
[0142] In step S104, the first electronic device generates a first data packet according to the acquired first characteristic information and the to-be-charged identification information. It can be understood that the first data packet can further include manufacturer identification information. In combination with Figure 8 As shown in the figure, the first characteristic information can be filled in the package 12, and the identification information (including the manufacturer identification information and the to-be-charged identification information) can be filled in the package 11. The bit 0 of the package 11 is set to 0, indicating that this VDM is a sink_VDM.
[0143] In an exemplary embodiment, as Figure 3 shown, when the charging strategy is to receive power supply from the second electronic device, the method of the present embodiment further includes:
[0144] S140, determining a preset interval duration according to the second data packet.
[0145] S150, after executing the charging strategy for the preset interval duration, sending an updated first data packet.
[0146] In the present embodiment, the time when the second communication starts is determined after the first communication, and when the charging strategy is to receive power supply from the second electronic device, which can be considered as the time when the charging strategy is executed.
[0147] In step S140, the second data packet further includes the execution time when the charging strategy is to receive power supply from the second electronic device, i.e. the interval duration of the next intelligent mutual charging communication. After receiving the second data packet, the first electronic device can analyze the second data packet to determine the preset interval duration.
[0148] In step S150, after executing the charging strategy for the preset interval duration (or after the preset interval duration of the last communication), the first electronic device can initiate communication again, i.e. send an updated first data packet. The updated first data packet includes the current first characteristic information (the current first temperature information and the current first power information of the first electronic device).
[0149] After step S150, in combination with Figure 12The first data packet updated in the embodiment is sent to the second electronic device, and the second electronic device generates a new second data packet (including a new charging strategy) according to the updated first data packet and the re-determined preset interval length, to complete a new communication. The first data packet of each communication has a corresponding second data packet. For example, by analogy, the first electronic device and the second electronic device can complete multiple communications according to the corresponding preset interval length.
[0150] In an exemplary embodiment, the charging method of the embodiment is applied to the second electronic device, which can be a mobile phone, a notebook computer, a tablet computer, a smart watch, a Bluetooth headset, or the like. The electronic device performing the method can be a power supply device connected at the initial moment of charging, or an initial power supply device in each communication process. In the embodiment, the electronic device performing the method can be a CPU (Central Processing Unit) of the second electronic device.
[0151] As shown in Figure 4 The method of the embodiment includes:
[0152] S210, receiving a first data packet sent by a first electronic device.
[0153] S220, generating a corresponding second data packet according to the first data packet.
[0154] S230, sending the second data packet.
[0155] In step S210, the first data packet includes to-be-charged identification information and first characteristic information of the first electronic device. The first characteristic information can include first temperature information and first power information of the first electronic device.
[0156] In step S220, the second data packet includes power supply identification information and charging strategy information; wherein the charging strategy information represents a charging strategy for representing whether the second electronic device performs power supply, such as the charging strategy including that the second electronic device performs power supply for the first electronic device, or the second electronic device receives power supply from the first electronic device.
[0157] The second data packet can be in the form of a VDM, defined as source_VDM. The second data packet (source_VDM) includes two sub-packets (package21 and package22), each of which is composed of 32 bits. The meaning of each bit can be set according to the configuration principle of the first data packet described above. In addition, the second data packet involves a specific charging strategy and a preset interval length. As described above, there can be three charging strategies involved in the present embodiment, so two bits can achieve the purpose of representing three different strategies. Similarly, if there are three possible preset interval lengths, two bits can represent three preset interval lengths.
[0158] In the present embodiment, as shown in Figure 9 bit0 in package21 represents power role identification information, for example, bit0 being 1 represents power supply identification information, i.e., the second electronic device is a power supply (source) and the data sent is the second data packet (source_VDM). SVID of bit16-bit31 represents the manufacturer identification information of the second electronic device. "Reserved" in the figure represents the meaning of the corresponding bit in the present embodiment.
[0159] bit0-bit1 in package22 represent the charging strategy determined by the second electronic device. Among them, "00" represents the strategy of the second electronic device executing power supply (Go on), "01" represents the strategy of switching power role (Switch power role), and "10" represents the strategy of the second electronic device stopping power supply (Stop charge). Bit2-bit3 represent the preset interval length of communication when the goon strategy is executed; among them, "00" represents 0.5 min, "01" represents 1 min, and "11" represents 2 min.
[0160] In step S230, the second electronic device sends the generated second data packet to the first electronic device based on the preset protocol.
[0161] In an exemplary embodiment, as shown in Figure 5 the step S220 specifically includes the following steps:
[0162] S221, determining the first characteristic information of the first electronic device according to the first data packet.
[0163] S222, obtaining the second characteristic information of the second electronic device.
[0164] S223, determining the charging strategy information according to the first characteristic information and the second characteristic information.
[0165] S224, generating a second data packet according to the charging strategy information and the power supply identification information.
[0166] In step S221, the first data packet includes the first characteristic information of the first electronic device, and the second electronic device can obtain the first characteristic information by analyzing the received first data packet. The first characteristic information includes the first temperature information and the first power information.
[0167] In step S222, the second electronic device obtains the second characteristic information of itself, which includes the second temperature information and the second power information. The second temperature information can be the whole machine temperature information of the second electronic device, which can be detected by a temperature sensor arranged in the device. The second power information can be the current power information of the second electronic device.
[0168] In step S223, the current state of the first electronic device can be determined according to the first temperature information and the first power information. For example, if the temperature represented by the first temperature information is higher than a threshold value, it indicates that the state of the first electronic device is not healthy and not suitable for mutual charging. The current state of the second electronic device can be determined according to the second temperature information and the second power information. For example, if the power percentage represented by the second power information is lower than a threshold value, it indicates that the state of the second electronic device is not healthy and not suitable for mutual charging. The state of the first electronic device can also be determined according to the CPU load.
[0169] In step S224, the second electronic device generates a second data packet according to the determined charging strategy information and the identification information. As shown in FIG. 9, the charging strategy information can be filled in the package 22, and the identification information can be filled in the package 21. The identification information includes the manufacturer identification information of the second electronic device and the power supply role identification information, such as the power supply role identification information of the second electronic device at this time.
[0170] In an exemplary embodiment, as shown in FIG. 8, step S223 can include the following steps: Figure 6
[0171] S2231, determining whether the first temperature information or the second temperature information is within a preset temperature range. If yes, i.e., when the first temperature information or the second temperature information is within the preset temperature range, step S2233 is performed; if not, step S2232 is performed.
[0172] S2232, in response to the first temperature information or the second temperature information being outside the preset temperature range, determining that the charging strategy is that the second electronic device stops supplying power (Stop charge). This prevents the mobile phone from overheating.
[0173] S2233, determine whether the first power information and the second power information satisfy a preset power supply condition. If yes, i.e., when the first power information and the second power information satisfy the preset power supply condition, execute step S2235; if no, execute step S2234.
[0174] S2234, in response to the first power information and the second power information not satisfying the preset power supply condition, determine the charging strategy as: the second electronic device stops power supply (Stop charge). Prevent power supply shortage caused by low-power mobile phone supplying power to the outside.
[0175] S2235, determine whether the power difference information of the first power information and the second power information reaches a preset power difference threshold.
[0176] If yes, i.e., the power difference information of the first power information and the second power information reaches the preset power difference threshold, determine the charging strategy as: the first electronic device and the second electronic device switch power roles (Switch power role) to supply power to the second electronic device with the first electronic device; at this time, the first electronic device (mobile phone M1) needs to exchange power roles with the second electronic device (mobile phone M2), i.e., the mobile phone M1 changes from sink to source to supply power to the mobile phone M2.
[0177] If no, i.e., the power difference information does not reach the preset power difference threshold, determine the charging strategy as: the second electronic device executes power supply (Go on).
[0178] In step S2231, the preset temperature range may be, for example, [-10℃, 45℃].
[0179] In step S2233, the preset power supply condition may be, for example, that the power percentage is not less than 30%.
[0180] In step S2235, the preset power difference threshold may be, for example, 3%. Alternatively, the preset power difference threshold is set to a range of 3%-5%. The setting of the preset power difference threshold can exclude the interference of a low power difference threshold (such as less than 3%) and prevent the power roles of the two mobile phones from being frequently switched when the power of the first electronic device and the second electronic device is close.
[0181] In an exemplary embodiment, when the charging strategy is for the second electronic device to supply power to the first electronic device, after step S210, the method of the present embodiment further comprises:
[0182] S212, determine a preset interval duration according to the first feature information and the second feature information.
[0183] Then, step S220 executes the following method: generate a second data packet according to the first data packet and the preset interval duration.
[0184] That is, in step S220, the second data packet includes not only the charging strategy, but also time length information of executing the strategy, i.e., the preset interval time length. The time length information can also represent time length information of one intelligent mutual charging communication.
[0185] In step S212, interval time lengths corresponding to the first temperature information, the second temperature information, and the power difference information are determined according to the first temperature information, the second temperature information, and the power difference information, respectively. The preset interval time length is determined as the minimum time length among the corresponding interval time lengths.
[0186] In an exemplary embodiment, as shown in FIG. 2, step S212 can specifically include the following steps: Figure 7
[0187] S2121, obtaining first configuration information and second configuration information.
[0188] S2122, determining a first interval time length corresponding to the first temperature information according to the first temperature information and the first configuration information.
[0189] S2123, determining a second interval time length corresponding to the second temperature information according to the second temperature information and the first configuration information.
[0190] S2124, determining a third interval time length corresponding to the power difference information according to the power difference information and the second configuration information.
[0191] S2125, determining the preset interval time length as the minimum time length among the first interval time length, the second interval time length, and the third interval time length.
[0192] In step S2121, the first configuration information is used to represent the correspondence between temperature intervals and interval time lengths. In the process of dividing the preset temperature range into multiple temperature intervals, the principle of "the closer to the dangerous temperature interval, the smaller the length" can be used, for example, the interval length near the upper and lower limits of the preset temperature range is smaller, so that the first electronic device and the second electronic device can directly communicate more frequently and timely and accurately discover dangerous situations. The lengths of the remaining intervals can be set according to actual needs.
[0193] In the embodiment, as shown in FIG. 2, Figure 10 As shown, the preset temperature range [-10℃, 45℃] is set as multiple temperature intervals, and the interval length near the upper and lower limits of the preset temperature range is smaller, so as to more accurately divide the high temperature threshold interval (such as: (40℃, 45℃]) and the low temperature threshold interval (such as: [-10℃, -5℃]). When the electronic device is in the high temperature threshold interval or the low temperature threshold interval, it is considered to be an unhealthy state, and there may be a danger. Therefore, the time interval corresponding to such a temperature interval should be shorter (0.5 min), so as to realize more frequent communication between the first electronic device and the second electronic device, facilitate timely discovery of danger, and timely adjust the charging strategy. The length of the remaining temperature intervals can be adaptively increased, and the corresponding time interval can also be adaptively increased (such as 1 or 2 min).
[0194] The second configuration information is used to represent the correspondence between the power difference interval and the interval length. In the process of dividing the power difference interval, the principle of "the smaller the power difference, the more frequent the communication" can be used to achieve the purpose of timely stopping charging. The length of the remaining power difference intervals can be set according to actual needs.
[0195] In this embodiment, as shown in the figure, Figure 11 According to the preset power difference threshold range (3%-5%), three power difference intervals are set. The power difference interval close to the preset power difference threshold range is smaller in length, and when the electronic device is in this interval, it is considered to be an unhealthy state. Therefore, the time interval corresponding to this interval is shorter (0.5 min), so as to realize more frequent communication between the first electronic device and the second electronic device, facilitate timely discovery of danger, and timely adjust the charging strategy. The length of the remaining power difference intervals can be adaptively increased, and the corresponding time interval can also be adaptively adjusted (such as 1 or 2 min).
[0196] In one specific example, as shown in the figure, Figure 12 This embodiment shows the communication process of intelligent interactive charging based on c to c line connection between the first electronic device and the second electronic device.
[0197] S1, the first electronic device detects that one end of the preset charging line is inserted, checks whether the charging protocol meets the preset protocol (such as PD protocol), and judges whether the manufacturer identification information of the second electronic device (power supply side) meets the preset identification information (such as 0x2717).
[0198] If yes, that is, the charging protocol meets the preset protocol, and the manufacturer identification information of the second electronic device meets the preset identification information (denoted as first connection information), step S3 is performed;
[0199] If no, that is, the charging protocol does not meet the preset protocol, or the manufacturer identification information of the second electronic device does not meet the preset identification information (denoted as second connection information), step S2 is performed.
[0200] S2, in response to the second connection information, the first electronic device charges in a normal charging mode and reports to a UI (user interface).
[0201] S3, in response to the first connection information, the first electronic device sends a first data packet (step S110). Wherein, package 11 of the first data packet (sink_VDM) is 0x27170000, and package 12 is 0x00001910.
[0202] S4, the second electronic device receives the first data packet (step S210).
[0203] S5, the second electronic device generates a second data packet (source_VDM) according to the first data packet (step S220).
[0204] S51, the first data packet is parsed to determine the first characteristic information (step S221).
[0205] In this example, the first data packet is "0x00001910", and through parsing the package 12, it can be known that the percentage of the power of the first electronic device (sink) is 16%, and the temperature is 25℃.
[0206] Wherein, 0x in 0x00001910 indicates that the data is hexadecimal data. Therefore, in the parsing process: each number in "00001910" after 0x is converted into binary (each number contains 4 bits), and a 32-bit data is obtained, the first bit of the 32-bit data represents bit31, and the last bit represents bit0.
[0207] Wherein, "19" (hexadecimal) corresponds to the binary number "0001 1001", and "0001 1001" represents the meaning that the whole machine temperature of the first electronic device (see the meaning of bit15-bit8 of package 12 in Figure 8 ). Wherein, bit15 is 0, that is, the temperature is positive; the decimal number corresponding to "19" (hexadecimal) is "25", that is, the temperature is 25℃.
[0208] Similarly, the binary number corresponding to "10" (hexadecimal) represents the meaning that the percentage of the power of the first electronic device (see the meaning of bit7-bit0 of package 12 in Figure 8 ). Wherein, the decimal number corresponding to "10" (hexadecimal) is "16", that is, the percentage of the power is 16%.
[0209] The parsing process of other VDM data packets involved in the diagram can refer to this example.
[0210] S52, the second electronic device (source) acquires its own second characteristic information. (Step S222)
[0211] In this example, the second characteristic information of the second electronic device includes: the power is 80%, and the whole machine temperature is 25℃.
[0212] S53, the second electronic device determines the charging strategy according to the first characteristic information and the second characteristic information. (Step S223)
[0213] In this example, the charging strategy determined in combination with the first configuration information of the first electronic device is: the second electronic device executes power supply (Go on). According to the charging strategy, the preset interval duration also needs to be determined according to step S212. Figure 6
[0214] Among them, the temperature of the first electronic device is the same as that of the second electronic device, both are 25℃, in combination with the first configuration information of the first electronic device, the first interval duration and the second interval duration are both 2min; the power difference between the first electronic device and the second electronic device is (80-16) % = 64%, in combination with the second configuration information of the second electronic device, the third interval duration is determined to be 2min. In this example, the three interval durations are the same, and the preset interval duration is determined to be 2min. Figure 10 Figure 11
[0215] S54, a second data packet is generated. (Step S224)
[0216] S6, the second electronic device sends the second data packet.
[0217] S7, the first electronic device receives the second data packet. (Step S120)
[0218] S8, the first electronic device parses the second data packet, determines and executes the charging strategy: receives the power supply (Go on) of the second electronic device. (Step S130)
[0219] So far, the first intelligent mutual charging communication is completed.
[0220] After the preset interval duration of 2min, the second communication starts:
[0221] S9, the first electronic device sends the updated first data packet.
[0222] S10, the second electronic device receives and parses the updated first data packet, determines a new charging strategy, generates and sends a new second data packet.
[0223] S11, the first electronic device receives the new second data packet, determines and executes the new charging strategy.
[0224] Thus, the second intelligent mutual charging communication is completed.
[0225] As shown in FIG. 1, it is assumed that the determined charging strategy in the n-th communication in the present example is: switching power roles. Figure 12
[0226] For example, in the first and second communications, the mobile phone M1 corresponds to the first electronic device and is a sink, and the mobile phone M2 corresponds to the second electronic device and is a source. When the charging strategy is "switching power roles", the mobile phone M1 becomes a source and the mobile phone M2 becomes a sink, the mobile phone M1 charges the mobile phone M2, and the n-th communication is completed. After that, if the communication continues, the mobile phone M2 determines whether to initiate a new round of communication according to the actual situation (0.5 min in the figure is only for illustration and is not used as a reference).
[0227] It can be understood that the above embodiment relates to a scheme of intelligent mutual charging between two mobile phones based on a c to c line connection. When there are multiple mobile phones, for example, one source and multiple sinks, the source mobile phone needs to receive first data packets sent by multiple sinks, and determine a charging strategy based on the multiple first data packets. The charging strategy can generate a second data packet, which is sent to each sink, or a second data packet is generated for each sink charging strategy, and each second data packet is sent to the sink.
[0228] In an exemplary embodiment, the present embodiment provides a charging device applied to a first electronic device, and the first electronic device is connected to a second electronic device through a preset charging line, as shown in FIG. 1, the device of the present embodiment includes: a first sending module 110, a first receiving module 120, and a first determining module 130. Wherein, the first sending module 110 is used for sending a first data packet; wherein, the first data packet includes to-be-charged identification information and first characteristic information of the first electronic device. The first receiving module 120 is used for receiving a second data packet corresponding to the first data packet sent by the second electronic device. The first determining module 130 is used for determining and executing a charging strategy according to the second data packet; wherein, the charging strategy includes: the first electronic device receives power supply from the second electronic device, or the first electronic device supplies power to the second electronic device. Figure 13
[0229] In an exemplary embodiment, the apparatus further includes: an acquisition module configured to acquire first characteristic information of a first electronic device; wherein the first characteristic information includes first temperature information and first power information; a first generation module configured to generate a first data packet based on the first characteristic information and the charging identification information; and in this embodiment, the first determination module is configured to parse a second data packet and determine a charging policy contained in the second data packet.
[0230] In an exemplary embodiment, when the charging strategy is for a first electronic device to receive power from a second electronic device, the first determination module is further used to determine a preset interval duration based on the second data packet; the first sending module is further used to send an updated first data packet after the preset interval duration, wherein the updated first data packet includes the current first characteristic information.
[0231] In an exemplary embodiment, this embodiment provides a charging device, which is applied to a second electronic device, such as Figure 14 As shown, the apparatus of this embodiment includes: a second receiving module 210, a second generating module 220, and a second sending module 230. The second receiving module 210 is used to receive a first data packet sent by a first electronic device; wherein the first data packet includes identification information to be charged and first characteristic information of the first electronic device. The second generating module 220 is used to generate a corresponding second data packet based on the first data packet; wherein the second data packet includes power supply identification information and charging strategy information; wherein the charging strategy represented by the charging strategy information includes: the second electronic device performs power supply for the first electronic device, or the second electronic device receives power from the first electronic device. The second sending module 230 is used to send a second data packet.
[0232] In an exemplary embodiment, the second generation module is specifically used to: determine first characteristic information of a first electronic device based on a first data packet; wherein the first characteristic information includes first temperature information and first power information; obtain second characteristic information of a second electronic device; wherein the second characteristic information includes second temperature information and second power information; determine charging strategy information based on the first characteristic information and the second characteristic information; and generate a second data packet based on the charging strategy information and the power supply identification information.
[0233] In an exemplary embodiment, the second generating module is specifically configured to: in response to the first temperature information or the second temperature information being outside a preset temperature range, determine the charging strategy as: stopping power supply to the second electronic device.
[0234] In an exemplary embodiment, the second generation module is specifically used to: when the first temperature information or the second temperature information is within a preset temperature range, in response to the first power information and the second power information not meeting the preset power supply conditions, determine the charging strategy as: the second electronic device stops supplying power.
[0235] In an example embodiment, the second generation module is specifically configured to: when the first power information and the second power information satisfy the preset power supply condition: in response to the power difference information between the first power information and the second power information reaching a preset power difference threshold, determining the charging strategy as: the first electronic device and the second electronic device exchange the power supply role, and the first electronic device supplies power to the second electronic device; wherein the power supply role is used to represent the state of the first electronic device or the second electronic device as a charging state or a power supply state; in response to the power difference information not reaching the preset power difference threshold, determining the charging strategy as: the second electronic device performs power supply.
[0236] In an example embodiment, optionally, when the charging strategy is the second electronic device performing power supply, the apparatus further includes: a second determination module configured to determine a preset interval duration according to the first feature information and the second feature information; and the second generation module is specifically configured to: generate a second data packet according to the first data packet and the preset interval duration.
[0237] In an example embodiment, the second determination module is specifically configured to: respectively determine interval durations corresponding to the first temperature information, the second temperature information, and the power difference information between the first power information and the second power information; and determine the preset interval duration as the smallest duration among the corresponding interval durations.
[0238] In this embodiment, the second determination module is specifically configured to: obtain first configuration information and second configuration information; wherein the first configuration information is used to represent the corresponding relationship between the temperature interval and the interval duration, and the second configuration information is used to represent the corresponding relationship between the power difference interval and the interval duration; determine a first interval duration corresponding to the first temperature information according to the first temperature information and the first configuration information; determine a second interval duration corresponding to the second temperature information according to the second temperature information and the first configuration information; and determine a third interval duration corresponding to the power difference information according to the power difference information and the second configuration information.
[0239] As shown in FIG. 5, which is a block diagram of an electronic device. The present disclosure also provides an electronic device, for example, the device 500 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc. Figure 15 The device 500 can include one or more of the following components: a processing component 502, a memory 504, a power component 506, a multimedia component 508, an audio component 510, an input / output (I / O) interface 512, a sensor component 514, and a communication component 516.
[0240]
[0241] The processing component 502 generally controls the overall operations of the device 500, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 502 can include one or more processors 520 to execute instructions
[0242] The memory 504 is configured to store various types of data to support operations of the device 500. Examples of these data include instructions for any applications or methods operating on the device 500, contact data, phonebook data, messages, pictures, videos, and so on. The memory 504 can be implemented by any type of volatile or non-volatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0243] The power component 506 provides power to the various components of the device 500. The power component 506 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 500.
[0244] The multimedia component 508 includes a screen providing an output interface between the device 500 and a user. In some embodiments, the screen can include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes the touch panel, the screen can be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense a touch, a slide, and a gesture on the touch panel. The touch sensor can not only sense a boundary of a touching or sliding action, but also detect duration and pressure related to the touching or sliding action. In some embodiments, the multimedia component 508 includes a front-facing camera and / or a rear-facing camera. When the device 500 is in an operation mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera can receive external multimedia data. Each of the front-facing camera and the rear-facing camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0245] The audio component 510 is configured to output and / or input audio signals. For example, the audio component 510 includes a microphone (MIC) that is configured to receive an external audio signal when the device 500 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 504 or transmitted via the communication component 516. In some embodiments, the audio component 510 also includes a speaker for outputting audio signals.
[0246] The I / O interface 512 provides an interface between the processing component 502 and peripheral interface modules, which can include a keypad, a click wheel, buttons, and so on. The buttons can include, but are not limited to, a home button, a volume button, a start button, and a lock button.
[0247] The sensor component 514 includes one or more sensors for providing status assessments of various aspects of the device 500. For example, the sensor component 514 can detect an open / closed position of the device 500, relative positioning of components, such as a display and a keypad of the device 500, a change of position of the device 500 or a component of the device 500, presence or absence of user contact with the device 500, a change in orientation or acceleration / deceleration of the device 500, and temperature changes of the device 500, among other possibilities. The sensor component 514 can include proximity sensor configured to detect presence of an object in proximity to the device 500 without any physical touch. The sensor component 514 can also include a light sensor (e.g., a CMOS or CCD image sensor) configured to work in conjunction with an imaging application. In some embodiments, the sensor component 514 can also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0248] The communication component 516 is configured to facilitate wired or wireless communication between the device 500 and another device. The device 500 can access a wireless network based on a corresponding communication standard, such as WiFi, 2G, or 3G, or a combination thereof. In an example embodiment, the communication component 516 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an example embodiment, the communication component 516 further includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0249] In an exemplary embodiment, the device 500 can be implemented with one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components, for performing the above-described methods.
[0250] Another exemplary embodiment of the present disclosure provides a non-transitory computer-readable storage medium, such as the memory 504 including instructions executable by the processor 520 of the device 500 to perform the above-described methods. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disc, and an optical data storage device, etc. When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to perform the above-described methods.
[0251] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. It is intended that the present application cover any and all variations of the application that come within the scope of the present application, along with all of the equivalents thereof. It is intended that the specification and examples be considered exemplary only, with the true scope and spirit of the application being indicated by the following claims.
[0252] It is to be understood that the application is not limited to the precise details of construction and the exemplary embodiments described above and illustrated in the drawings. The scope of the application is to be determined by the appended claims only.
Claims
1. A charging method, applied to a first electronic device, wherein the first electronic device is connected to a second electronic device via a preset charging cable, characterized in that: The method comprises: Sending a first data packet; wherein the first data packet includes identification information of the electronic device to be charged and first characteristic information of the first electronic device, the identification information of the electronic device to be charged indicates that the first electronic device is a power recipient, and the first characteristic information includes first temperature information and first power information; receiving a second data packet corresponding to the first data packet and sent by a second electronic device, wherein the second data packet includes power supply identification information and charging strategy information, the power supply identification information indicating that the second electronic device is a power supplier, and the charging strategy information is determined by the second electronic device based on the first characteristic information and second characteristic information of the second electronic device, the second characteristic information including second temperature information and second power information; Determine and execute a charging strategy based on the second data packet; wherein the charging strategy includes: the first electronic device receives power from the second electronic device, or the first electronic device supplies power to the second electronic device; When the charging strategy is that the first electronic device receives power from the second electronic device, the method further includes: Determine a preset interval duration according to the second data packet, wherein the preset interval duration is determined according to the first characteristic information and the second characteristic information, and the second data packet includes the preset interval duration; After executing the charging strategy for a preset interval, an updated first data packet is sent, wherein the updated first data packet includes the current first characteristic information.
2. The charging method according to claim 1, wherein: The method further comprises: Acquiring first characteristic information of a first electronic device; The first data packet is generated according to the first characteristic information and the identification information to be charged.
3. The charging method according to claim 1, wherein: The determining of the charging strategy according to the second data packet includes: Parse the second data packet to determine the charging strategy included in the second data packet.
4. A charging method, applied to a second electronic device, wherein a first electronic device and a second electronic device are connected via a preset charging cable, characterized in that: The method comprises: Receive a first data packet sent by a first electronic device; wherein the first data packet includes charging identification information and first characteristic information of the first electronic device, the charging identification information indicates that the first electronic device is a power recipient, and the first characteristic information includes first temperature information and first power information; Generate a corresponding second data packet based on the first data packet; wherein the second data packet includes power supply identification information and charging strategy information; wherein the power supply identification information indicates that the second electronic device is a power supplier, and the charging strategy information is determined based on the first characteristic information and second characteristic information of the second electronic device, the second characteristic information including second temperature information and second power information, and the charging strategy represented by the charging strategy information includes: the second electronic device supplies power to the first electronic device, or the second electronic device receives power from the first electronic device; sending the second data packet; The method further comprises: Determining a preset interval duration based on the first characteristic information and the second characteristic information; wherein the preset interval duration is used to represent the time during which the second electronic device performs power supplying to the first electronic device when the charging strategy is: the second electronic device performs power supplying to the first electronic device. After executing the charging strategy for the preset interval duration, the first electronic device sends an updated first data packet, wherein the updated first data packet includes the current first characteristic information; Generating a corresponding second data packet according to the first data packet includes: The second data packet is generated according to the first data packet and the preset interval duration.
5. The charging method according to claim 4, characterized in that: Generating a corresponding second data packet according to the first data packet includes: determining first characteristic information of the first electronic device according to the first data packet; Acquiring second characteristic information of a second electronic device; determining charging strategy information according to the first characteristic information and the second characteristic information; The second data packet is generated according to the charging strategy information and the power supply identification information.
6. The charging method according to claim 5, characterized in that: The determining charging strategy information according to the first characteristic information and the second characteristic information includes: In response to the first temperature information or the second temperature information being outside a preset temperature range, the charging strategy is determined to be: the second electronic device stops supplying power.
7. The charging method according to claim 6, characterized in that: The determining charging strategy information according to the first feature information and the second feature information further includes: When the first temperature information or the second temperature information is within a preset temperature range, in response to the first power information and the second power information not meeting a preset power supply condition, a charging strategy is determined as: the second electronic device stops supplying power.
8. The charging method according to claim 7, characterized in that: The determining charging strategy information according to the first feature information and the second feature information further includes: When the first power information and the second power information meet the preset power supply condition: In response to a power difference between the first power information and the second power information reaching a preset power difference threshold, determining a charging strategy as follows: the first electronic device and the second electronic device swap power roles, with the first electronic device powering the second electronic device; wherein the power role is used to indicate whether the state of the first electronic device or the second electronic device is a charging state or a power supply state; In response to the power difference information not reaching the preset power difference threshold, the charging strategy is determined as: the second electronic device performs power supply.
9. The charging method according to claim 4, characterized in that: The determining of the preset interval duration according to the first characteristic information and the second characteristic information includes: Determining, based on the first temperature information, the second temperature information, and the power difference information between the first power information and the second power information, interval durations corresponding to the first temperature information, the second temperature information, and the power difference information, respectively; The preset interval duration is determined to be: the minimum duration among the corresponding interval durations.
10. The charging method according to claim 9, characterized in that: The determining, based on the first temperature information, the second temperature information, and the power difference information between the first power information and the second power information, respectively, the interval durations corresponding to the first temperature information, the second temperature information, and the power difference information, includes: Obtaining first configuration information and second configuration information; wherein the first configuration information is used to represent the corresponding relationship between the temperature range and the interval duration, and the second configuration information is used to represent the corresponding relationship between the power difference range and the interval duration; determining, according to the first temperature information and the first configuration information, a first interval duration corresponding to the first temperature information; determining, according to the second temperature information and the first configuration information, a second interval duration corresponding to the second temperature information; Determining a third interval duration corresponding to the power difference information according to the power difference information and the second configuration information; Determining the preset interval duration includes: The minimum duration among the first interval duration, the second interval duration, and the third interval duration is determined as the preset interval duration.
11. A charging device, applied to a first electronic device, wherein the first electronic device is connected to a second electronic device via a preset charging cable, characterized in that: The device comprises: A first sending module, configured to send a first data packet; wherein the first data packet includes identification information of a first electronic device to be charged and first characteristic information of the first electronic device, the identification information of the first electronic device to be charged indicating that the first electronic device is a power recipient, and the first characteristic information includes first temperature information and first power information; a first receiving module, configured to receive a second data packet corresponding to the first data packet and sent by a second electronic device; wherein the second data packet includes power supply identification information and charging strategy information, the power supply identification information indicating that the second electronic device is a power supplier, and the charging strategy information is determined by the second electronic device based on the first characteristic information and second characteristic information of the second electronic device, the second characteristic information including second temperature information and second power information; A first determining module is configured to determine and execute a charging strategy based on the second data packet; wherein the charging strategy includes: the first electronic device receiving power from the second electronic device, or the first electronic device providing power to the second electronic device; When the charging strategy is that the first electronic device receives power from the second electronic device, The first determining module is further configured to determine a preset interval duration based on the second data packet, wherein the preset interval duration is determined based on the first characteristic information and the second characteristic information, and the second data packet includes the preset interval duration; The first sending module is further configured to send an updated first data packet after executing the charging strategy for a preset interval, wherein the updated first data packet includes the current first feature information.
12. The charging device according to claim 11, characterized in that: The device further comprises: an acquisition module, configured to acquire first characteristic information of a first electronic device; The first generating module generates the first data packet according to the first characteristic information and the identification information to be charged.
13. The charging device according to claim 11, characterized in that The first determining module is specifically configured to: Parse the second data packet to determine the charging strategy included in the second data packet.
14. A charging device, applied to a second electronic device, wherein a first electronic device and a second electronic device are connected via a preset charging cable, characterized in that: The device comprises: a second receiving module, configured to receive a first data packet sent by a first electronic device; wherein the first data packet includes charging identification information and first characteristic information of the first electronic device, the charging identification information indicating that the first electronic device is a power recipient, and the first characteristic information including first temperature information and first power information; a second generating module, configured to generate a corresponding second data packet based on the first data packet; wherein the second data packet includes power supply identification information and charging strategy information; wherein the power supply identification information indicates that the second electronic device is a power supplier, and the charging strategy information is determined based on the first characteristic information and second characteristic information of the second electronic device, wherein the second characteristic information includes second temperature information and second power information, and the charging strategy indicated by the charging strategy information includes: the second electronic device supplies power to the first electronic device, or the second electronic device receives power from the first electronic device; A second sending module, configured to send the second data packet; The device further comprises: a second determining module, configured to determine a preset interval duration based on the first characteristic information and the second characteristic information; wherein the preset interval duration is used to represent the time during which the second electronic device performs power supplying to the first electronic device when the charging strategy is for the second electronic device to perform power supplying to the first electronic device; after executing the charging strategy for the preset interval duration, the first electronic device sends an updated first data packet, wherein the updated first data packet includes the current first characteristic information; The second generating module is specifically configured to generate the second data packet according to the first data packet and the preset interval duration.
15. The charging device according to claim 14, characterized in that: The second generating module is specifically used for: determining first characteristic information of the first electronic device according to the first data packet; Acquiring second characteristic information of a second electronic device; determining charging strategy information according to the first characteristic information and the second characteristic information; The second data packet is generated according to the charging strategy information and the power supply identification information.
16. The charging device according to claim 15, characterized in that: The second generating module is specifically used for: In response to the first temperature information or the second temperature information being outside a preset temperature range, the charging strategy is determined to be: the second electronic device stops supplying power.
17. The charging device according to claim 16, characterized in that The second generating module is specifically used for: When the first temperature information or the second temperature information is within a preset temperature range, in response to the first power information and the second power information not meeting a preset power supply condition, a charging strategy is determined as: the second electronic device stops supplying power.
18. The charging device according to claim 17, characterized in that The second generating module is specifically used for: When the first power information and the second power information meet the preset power supply condition: In response to a power difference between the first power information and the second power information reaching a preset power difference threshold, determining a charging strategy as follows: the first electronic device and the second electronic device swap power roles, with the first electronic device powering the second electronic device; wherein the power role is used to indicate whether the state of the first electronic device or the second electronic device is a charging state or a power supply state; In response to the power difference information not reaching the preset power difference threshold, the charging strategy is determined as: the second electronic device performs power supply.
19. The charging device according to claim 14, characterized in that The second determining module is specifically configured to: Determining, based on the first temperature information, the second temperature information, and the power difference information between the first power information and the second power information, interval durations corresponding to the first temperature information, the second temperature information, and the power difference information, respectively; The preset interval duration is determined to be: the minimum duration among the corresponding interval durations.
20. The charging device according to claim 19, characterized in that The second determining module is specifically configured to: Obtaining first configuration information and second configuration information; wherein the first configuration information is used to represent the corresponding relationship between the temperature range and the interval duration, and the second configuration information is used to represent the corresponding relationship between the power difference range and the interval duration; determining, according to the first temperature information and the first configuration information, a first interval duration corresponding to the first temperature information; determining, according to the second temperature information and the first configuration information, a second interval duration corresponding to the second temperature information; Determining a third interval duration corresponding to the power difference information according to the power difference information and the second configuration information; The minimum duration among the first interval duration, the second interval duration, and the third interval duration is determined as the preset interval duration.
21. An electronic device, characterized in that: include: processor; a memory for storing executable instructions for the processor; The processor is configured to execute the charging method according to any one of claims 1 to 3 or 4 to 10.
22. A non-transitory computer-readable storage medium, characterized in that When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the charging method according to any one of claims 1 to 3 or 4 to 10.
Citation Information
Patent Citations
Method and electronic device for controlling connection of electronic devices
CN103249174A
Charging method and device
CN106299515A
Charging method and device
CN111384737A
Method and apparatus for balancing energy between portable devices
US20070236975A1
Electronic device, method of transmitting electric power, and electric power transmission system
US20150280478A1