CN112783310A - Terminal equipment control method and device, storage medium and terminal equipment - Google Patents
Terminal equipment control method and device, storage medium and terminal equipment Download PDFInfo
- Publication number
- CN112783310A CN112783310A CN202110056957.8A CN202110056957A CN112783310A CN 112783310 A CN112783310 A CN 112783310A CN 202110056957 A CN202110056957 A CN 202110056957A CN 112783310 A CN112783310 A CN 112783310A
- Authority
- CN
- China
- Prior art keywords
- identification
- character string
- terminal equipment
- terminal
- equipment
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 61
- 238000004891 communication Methods 0.000 claims description 11
- 238000001514 detection method Methods 0.000 claims description 9
- 238000005516 engineering process Methods 0.000 description 16
- 230000005540 biological transmission Effects 0.000 description 6
- 230000006870 function Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- WHXSMMKQMYFTQS-UHFFFAOYSA-N Lithium Chemical compound [Li] WHXSMMKQMYFTQS-UHFFFAOYSA-N 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000011982 device technology Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 229910052744 lithium Inorganic materials 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000001052 transient effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F1/00—Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
- G06F1/26—Power supply means, e.g. regulation thereof
- G06F1/266—Arrangements to supply power to external peripherals either directly from the computer or under computer control, e.g. supply of power through the communication port, computer controlled power-strips
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
- G06F16/90335—Query processing
- G06F16/90344—Query processing by using string matching techniques
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Evolutionary Computation (AREA)
- Evolutionary Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Computational Biology (AREA)
- Artificial Intelligence (AREA)
- Computer Hardware Design (AREA)
- Computational Linguistics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Telephone Function (AREA)
Abstract
The application discloses a control method and a control device of terminal equipment, a storage medium and the terminal equipment, wherein the control method of the terminal equipment comprises the steps that the terminal equipment is connected with external equipment, and whether an identification array configured by the external equipment is matched with an identification array configured by the terminal equipment; and if the identification array is matched with the identification array, the terminal equipment supplies power to the external equipment. According to the method and the device, when the terminal device is connected with the external device, the identification data configured by the terminal device is matched with the identification array configured by the external device, so that whether the terminal device can supply power for the external device or not is determined, and the damage to the mobile terminal and/or the external device caused by the matching of the current and/or the voltage of the mobile terminal and the current and/or the voltage of the external device can be avoided.
Description
Technical Field
The present application relates to the field of terminal device technologies, and in particular, to a method and an apparatus for controlling a terminal device, a storage medium, and a terminal device.
Background
At present, an OTG technology is commonly used On a mobile terminal, so that The mobile terminal may connect an external device (e.g., a mouse, a keyboard, etc.) through The OTG technology, wherein The OTG is an english abbreviation of On-The-Go, which is a technology that has been developed and widely used in recent years; the OTG technology of 12 months in 2001 is released by usb implementers forum, and is mainly applied to connection and data exchange between various devices or mobile terminal devices. However, when the mobile terminal is connected to the external device through the OTG technology, the mobile terminal may automatically supply power to the OTG peripheral device, and when the current and/or voltage of the mobile terminal is matched with the current and/or voltage of the external device, the mobile terminal and/or the external device may be damaged, or even a safety accident may be caused.
Thus, the prior art has yet to be improved and enhanced.
Disclosure of Invention
The technical problem to be solved by the present application is to provide a method and an apparatus for controlling a terminal device, a storage medium, and a terminal device, aiming at the deficiencies of the prior art.
In order to solve the foregoing technical problem, a first aspect of an embodiment of the present application provides a method for controlling a terminal device, where the method includes:
the terminal equipment is connected with external equipment and detects whether an identification array configured by the external equipment is matched with an identification array configured by the terminal equipment;
and if the identification array is matched with the identification array, the terminal equipment supplies power to the external equipment.
The control method of the terminal device, wherein the identification array comprises a plurality of identification character strings, and the identification character strings in the identification character strings are different from each other.
The control method of the terminal device, wherein the terminal device is connected to an external device, and detecting whether an identification array configured by the external device matches an identification array configured by the terminal device itself specifically includes:
the method comprises the steps that terminal equipment is connected with external equipment, and the connection mode of the terminal equipment and the external equipment is obtained;
and when the connection mode is OTG connection, the terminal equipment detects whether the identification array configured by the external equipment is matched with the identification array configured by the terminal equipment.
The control method of the terminal device comprises the steps that the identification array comprises a plurality of identification character strings, and the identification character strings in the identification character strings are different from each other; the detecting whether the identification array configured by the external device matches the identification array configured by the terminal device specifically includes:
the terminal equipment receives the identification character string periodically sent by the external equipment;
for each received identification character string, the terminal equipment detects whether a candidate identification character string which is the same as the identification character string exists in the received identification character string;
if the candidate identification character string identical to the identification character string exists, the identification character string is received to obtain an identification array configured by the external equipment;
and the terminal equipment compares the identification array with the identification array configured by the terminal equipment to detect whether the identification data is matched with the identification array configured by the terminal equipment.
The control method of the terminal device, wherein the detecting whether the identification array configured by the external device matches the identification array configured by the terminal device specifically includes:
the terminal equipment receives an identification character string periodically sent by external equipment;
when the identification character string is received, the terminal equipment selects the identification character string corresponding to the identification character string from the identification array configured by the terminal equipment;
if the identification character string corresponding to the identification character string is selected, the terminal equipment detects whether a candidate identification character string is stored in an identification array configured by the terminal equipment, wherein the candidate character string is the identification character string of which the corresponding identification character string is not received;
when the candidate recognition character string is not detected, the identification array is judged to be matched with the recognition array.
The control method of the terminal device, wherein the detecting whether the identification array configured by the external device matches the identification array configured by the terminal device specifically comprises;
when the candidate identification character string is detected, continuing to execute the step of receiving the identification character string periodically sent by the external equipment by the terminal equipment until the candidate identification character string is not detected or the receiving time length reaches the preset time length;
and if the receiving time length reaches the preset time length, judging that the identification array is not matched with the identification array.
The control method of the terminal device, wherein the method further comprises:
and if the identification array is not matched with the identification array, the terminal equipment does not supply power to the external equipment.
A second aspect of the embodiments of the present application provides a control apparatus, where the identification apparatus includes:
the terminal equipment comprises a detection module, a judging module and a judging module, wherein the detection module is used for detecting whether an identification array configured by the external equipment is matched with an identification array configured by the terminal equipment when the terminal equipment is connected with the external equipment;
and the control module is used for controlling the terminal equipment to supply power to the external equipment when the identification array is matched with the identification array.
A third aspect of embodiments of the present application provides a computer-readable storage medium storing one or more programs, which are executable by one or more processors to implement steps in a control method of a terminal device as described in any one of the above.
A fourth aspect of the embodiments of the present application provides a terminal device, including: a processor, a memory, and a communication bus; the memory has stored thereon a computer readable program executable by the processor;
the communication bus realizes connection communication between the processor and the memory;
the processor, when executing the computer readable program, implements the steps in the control method of the terminal device as described in any one of the above.
Has the advantages that: compared with the prior art, the control method of the terminal equipment comprises the steps that the terminal equipment is connected with external equipment, and whether an identification array configured by the external equipment is matched with an identification array configured by the terminal equipment or not is detected; and if the identification array is matched with the identification array, the terminal equipment supplies power to the external equipment. According to the method and the device, when the terminal device is connected with the external device, the identification data configured by the terminal device is matched with the identification array configured by the external device, so that whether the terminal device can supply power for the external device or not is determined, and the damage to the mobile terminal and/or the external device caused by the matching of the current and/or the voltage of the mobile terminal and the current and/or the voltage of the external device can be avoided.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without any inventive work.
Fig. 1 is a flowchart of a control method of a terminal device provided in the present application.
Fig. 2 is a flowchart of step S10 in the control method of the terminal device provided in the present application.
Fig. 3 is a schematic structural diagram of a control device provided in the present application.
Fig. 4 is a schematic structural diagram of a terminal device provided in the present application.
Detailed Description
In order to make the purpose, technical scheme and effect of the present application clearer and clearer, the present application is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
It will be understood by those within the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the prior art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
In particular implementations, the terminal devices described in embodiments of the present application include, but are not limited to, other portable devices such as mobile phones, laptops, or tablet computers with touch sensitive surfaces (e.g., touch displays and/or touch pads). It should also be understood that in some embodiments, the device is not a portable communication device, but is a desktop computer having a touch-sensitive surface (e.g., a touch-sensitive display screen and/or touchpad).
In the discussion that follows, a terminal device that includes a display and a touch-sensitive surface is described. However, it should be understood that the terminal device may also include one or more other physical user interface devices such as a physical keyboard, mouse, and/or joystick.
The terminal device supports various applications, such as one or more of the following: a drawing application, a presentation application, a word processing application, a video conferencing application, a disc burning application, a spreadsheet application, a gaming application, a telephone application, a video conferencing application, an email application, an instant messaging application, an exercise support application, a photo management application, a data camera application, a digital video camera application, a web browsing application, a digital music player application, and/or a digital video playing application, etc.
Various applications that may be executed on the terminal device may use at least one common physical user interface device, such as a touch-sensitive surface. The first or more functions of the touch-sensitive surface and the corresponding information displayed on the terminal may be adjusted and/or changed between applications and/or within respective applications. In this way, a common physical framework (e.g., touch-sensitive surface) of the terminal can support various applications with user interfaces that are intuitive and transparent to the user.
It should be understood that, the sequence numbers and sizes of the steps in this embodiment do not mean the execution sequence, and the execution sequence of each process is determined by its function and inherent logic, and should not constitute any limitation on the implementation process of this embodiment.
The inventor finds that The OTG technology is commonly used in The existing mobile terminal, so that The mobile terminal may connect external devices (such as a mouse, a keyboard, etc.) through The OTG technology, wherein The OTG is an english abbreviation of On-The-Go, which is a technology developed and widely used in recent years; the OTG technology of 12 months in 2001 is released by usb implementers forum, and is mainly applied to connection and data exchange between various devices or mobile terminal devices. However, when the mobile terminal is connected to the external device through the OTG technology, the mobile terminal may automatically supply power to the OTG peripheral device, and when the current and/or voltage of the mobile terminal is matched with the current and/or voltage of the external device, the mobile terminal and/or the external device may be damaged, or even a safety accident may be caused.
In order to solve the above problem, in the embodiment of the present application, a terminal device is connected to an external device, and detects whether an identification array configured by the external device matches an identification array configured by the terminal device itself; and if the identification array is matched with the identification array, the terminal equipment supplies power to the external equipment. According to the method and the device, when the terminal device is connected with the external device, the identification data configured by the terminal device is matched with the identification array configured by the external device, so that whether the terminal device can supply power for the external device or not is determined, and the damage to the mobile terminal and/or the external device caused by the matching of the current and/or the voltage of the mobile terminal and the current and/or the voltage of the external device can be avoided.
The following further describes the content of the application by describing the embodiments with reference to the attached drawings.
This embodiment provides a control method for a terminal device, as shown in fig. 1, the method includes:
s10, the terminal device is connected with an external device, and whether the identification array configured by the external device is matched with the identification array configured by the terminal device is detected;
specifically, the external device is an electronic device having a component for storing energy (e.g., a lithium battery, etc.), and the terminal device may be connected to the external device wirelessly, for example, the terminal device may be connected to the external device via bluetooth. The terminal device is pre-configured with an identification array, the external device is pre-configured with an identification array, the identification array is used for measuring identification information of whether the terminal device can supply power for the external device connected with the terminal device, the identification array is used for identifying the identification information of the external device, and the terminal device can determine whether the terminal device can supply power for the external device based on the identification array.
In one implementation manner of this embodiment, the identification array includes a plurality of identification strings, and each of the plurality of identification strings is different. The identification array comprises a plurality of identification character strings, and the identification character strings in the identification character strings are different from each other. The identification array comprises an identification array, in other words, for each identification string in the identification array, one identification string can be found in the identification array, and the identification string is the same as the identification string. For example, the identification array includes "ab, fr119, mahataeng, ZD 112", and the like. In addition, the identification array configured by the terminal device may be configured when the terminal device leaves the factory, or may be configured by the terminal device according to a configuration instruction sent by an external terminal, or may be configured by the terminal device according to a configuration instruction formed by triggering a configuration key set by the terminal device itself. The identification array configured by the external device can be configured in factory, etc.
In an implementation manner of this embodiment, as shown in fig. 2, the connecting, by the terminal device, an external device, and detecting whether the identification array configured by the external device matches the identification array configured by the terminal device specifically includes:
s11, connecting the terminal equipment with external equipment, and acquiring the connection mode of the terminal equipment and the external equipment;
and S12, when the connection mode is OTG connection, the terminal equipment detects whether the identification array configured by the external equipment is matched with the identification array configured by the terminal equipment.
Specifically, The OTG connection is through OTG technology connection, wherein OTG is English abbreviation of On-The-Go, a technology developed and widely used in recent years; the OTG technology of 12 months in 2001 is released by usb implementers forum, and is mainly applied to connection and data exchange between various devices or mobile terminal devices. With the development of technologies such as OTG, the mobile terminal may supply power to devices such as a usb disk connected thereto and perform common operations such as file copying through the OTG technology, and the mobile terminal may also supply power to devices such as a mouse connected thereto and acquire a track of the mouse through the OTG technology. Therefore, when the terminal device is connected with the external device, the connection mode of the terminal device and the external device is detected to be OTG connection, if the connection mode is OTG connection, whether the identification array configured by the external device is matched with the identification array configured by the terminal device, and if the connection mode is not OTG connection, the operation is ended.
In an implementation manner of this embodiment, the detecting whether the identification array configured by the external device matches the identification array configured by the terminal device specifically includes:
the terminal equipment receives an identification character string periodically sent by external equipment;
when the identification character string is received, the terminal equipment selects the identification character string corresponding to the identification character string from the identification array configured by the terminal equipment;
if the identification character string corresponding to the identification character string is selected, the terminal equipment detects whether a candidate identification character string is stored in an identification array configured by the terminal equipment, wherein the candidate character string is the identification character string of which the corresponding identification character string is not received;
when the candidate recognition character string is not detected, the identification array is judged to be matched with the recognition array.
Specifically, after the terminal device is connected to the external device, the external device periodically transmits an identification string, where the identification string periodically transmitted by the external device refers to an identification array cyclically transmitted by the external device, and in the process of cyclically transmitting the identification array, an interval time between any two adjacent identification strings is a preset time, for example, 200 milliseconds, etc., the identification array is "ab, fr119, mahatateng, ZD 112", then a time interval between a transmission time of the identification string "ab" and a transmission time of the identification string "fr 119" is 200 milliseconds, a time interval between a transmission time of the identification string "fr 119" and a transmission time of the identification string "mahatateng" is 200 milliseconds, and a time interval between a transmission time of the identification string "mahatateng" and a transmission time of the identification string "ZD 112" is 200 milliseconds.
For example, the following steps are carried out: the identification array configured by the external device is "ab, fr119, mahataeng, ZD 112", then the external device periodically and cyclically transmits the character strings in the identification array "ab, fr119, mahataeng, ZD 112", for example, the external device cyclically transmits one identification character string every 200 milliseconds, that is, the external device transmits each identification character string in the order of ab, fr119, mahataeng, ZD112, … … ab.
In one implementation of this embodiment, the identification array includes several identification strings, and each of the several identification strings is different from each other, and the identification array is denoted as "qtr [1], qtr [2], … …, qtr [ N ]", where qtr [ i ] denotes an identification string. The specific process of the identification character string periodically sent by the external device may be as follows: the external equipment starts a timer with the timeout time of 200 milliseconds, sets a variable y to be 1 and judges whether the timer is overtime, when the timer is overtime, the character string is sent to qrt [ y ], judges whether y is equal to N, if y is equal to N, sets the variable y to be 1 and judges whether the timer is overtime, and if y is not equal to N; then the variable y is set to y +1 and a determination is made as to whether the timer has timed out.
In an implementation manner of this embodiment, after receiving an identification character string sent by an external device, a terminal device may select, from an identification array stored in the terminal device, an identification character string corresponding to the identification character string, where the identification character string corresponding to the identification character string refers to an identification character string that is the same as the identification character string. If the identification character string corresponding to the identification character string is selected, the terminal equipment detects whether a candidate identification character string is stored in an identification array configured by the terminal equipment, wherein the candidate character string is the identification character string of the corresponding identification character string which is not received; and if the identification character string corresponding to the identification character string is not selected, continuously receiving the identification character string sent by the external equipment.
In addition, the terminal device detects whether the candidate identification character strings are stored in the identification array configured by the terminal device, namely detects whether the identification character strings corresponding to the identification character strings are received or not for each identification character string in the identification array, and selects the identification character strings which are not received and correspond to the identification character strings to obtain the candidate identification character strings. In an implementation manner of this embodiment, a matching identifier may be configured for each recognition character string in the recognition array, where the matching identifier includes a matched identifier and an unmatched identifier, and when an identifier character string corresponding to the recognition character string is received, the matching identifier of the recognition character string is set to be matched; when the identification character string corresponding to the identification character string is not received, the matching identification of the identification character string is set to be unmatched, so that the candidate identification character string can be quickly determined according to the matching identification of the identification character string, and the matching speed of the identification array and the identification array is improved. In an implementation manner of this embodiment, a matching character string set may be preset, and when an identification character string corresponding to a recognition character string is received, the identification character string is backed up in the matching character string set, so that when a candidate recognition character string is detected, only the recognition array and the matching character string set need to be matched, the recognition character string that is included in the recognition array and not included in the matching character string set is selected, and the recognition character string that is selected as the candidate character string is selected at the same time, so that the candidate character string can be accurately acquired.
In an implementation manner of this embodiment, the detecting whether the identification array configured by the external device matches the identification array configured by the terminal device specifically includes;
when the candidate identification character string is detected, continuing to execute the step of receiving the identification character string periodically sent by the external equipment by the terminal equipment until the candidate identification character string is not detected or the receiving time length reaches the preset time length;
and if the receiving time length reaches the preset time length, judging that the identification array is not matched with the identification array.
Specifically, when the candidate identification character string is detected, it is indicated that the identification array and the identification array are successfully matched, at this time, the identification character string in the identification array may be sent in a cycle, or the terminal device may miss a certain identification character string, or the identification array and the identification array are matched in ratio. Therefore, it is necessary to continue receiving the identification character string periodically sent by the external device until no candidate identification character string is detected or the receiving time length reaches a preset time length, where the preset time length is preset and is greater than the time length required by the identification array in the external device to cycle for one period, for example, the identification array includes "ab, fr119, mahataeng, ZD 112", "ab, fr119, mahataeng, ZD 112" and cycles for one period to be 800 milliseconds, and then the preset time length may be 1000 milliseconds and the like. In addition, in practical applications, in order to avoid a matching error caused by that the terminal device misses a certain identification character string, the preset time length may be greater than or equal to 2 times of the time length required by the identification array in the external device to cycle for one period, for example, the time length in which the identification array includes "ab, fr119, mahataeng, ZD 112", "ab, fr119, mahataeng, ZD 112" cycles for one period is 800 milliseconds, and the preset time length is 1600 milliseconds.
In an implementation manner of this embodiment, the identification array includes a plurality of identification character strings, and each identification character string in the plurality of identification character strings is different from each other; the detecting whether the identification array configured by the external device matches the identification array configured by the terminal device specifically includes:
the terminal equipment receives the identification character string periodically sent by the external equipment;
for each received identification character string, the terminal equipment detects whether a candidate identification character string which is the same as the identification character string exists in the received identification character string;
if the candidate identification character string identical to the identification character string exists, the identification character string is received to obtain an identification array configured by the external equipment;
and the terminal equipment compares the identification array with the identification array configured by the terminal equipment to detect whether the identification data is matched with the identification array configured by the terminal equipment.
Specifically, the terminal device receives an identification character string sent by the external device, and detects whether all identification character strings in the identification array have been received. The external equipment sends the identification array in a circulating manner, so that after the identification character string is obtained, whether the identification character string exists in the received identification character string can be detected, when the identification character string exists, all the identification character strings in the identification array are received, and at the moment, the identification character string sent by the external equipment can be stopped being received, so that the identification array configured by the external equipment can be obtained. In practical application, when the identification character string exists, the number of times of receiving the identification character string is obtained, and if the number of times is greater than a preset number threshold, the identification character string is received to obtain an identification array configured by the external device, wherein the preset number threshold can be greater than 2, so that each identification character string in the identification array can be received more than 2 times, and thus the situation that the received identification character string is less than the character string in the identification array due to missed connection, and further the identification array is matched with the identification array for identification can be avoided.
In addition, after the identification array is obtained, the terminal equipment compares the identification array with an identification array configured by the terminal equipment. It is assumed here that the recognition arrays "str [1], str [2], … …, str [ N ]", where str [1], str [2], … …, str [ N ] represent N mutually exclusive recognition strings; the comparison process of the terminal device comparing the identification array with the identification array configured by the terminal device may specifically be:
setting a variable x to 1, searching whether an identification character string is the same as the x-th identification character string in the identification array (namely str [ x ]) in the received identification array, if the identification character string which is the same as the x-th identification character string in the identification array is searched, judging whether x is equal to N, judging that the identification array is matched with the identification array when x is equal to N, and setting x to x +1 when x is not equal to N; searching whether an identification character string is the same as the xth identification character string in the identification array or not in the received identification array; and if the identification character string which is the same as the x-th identification character string in the identification array is not found, judging that the identification array is not matched with the identification array.
And S20, if the identification array is matched with the identification array, the terminal equipment supplies power to the external equipment.
Specifically, the identification array is matched with the identification array, which indicates that the current and/or voltage of the terminal device does not conflict with the current and/or voltage of the external device, and the terminal device can supply power to the external device, and at this time, the terminal device supplies power to the external device. On the contrary, if the identification array is not matched with the identification array, it is indicated that the current and/or voltage of the terminal device conflicts with the current and/or voltage of the external device, the terminal device cannot supply power to the external device, and at this time, the terminal device does not supply power to the external device.
In summary, the present embodiment provides a method, an apparatus, a storage medium, and a terminal device for controlling a terminal device, where the method for controlling a terminal device includes connecting the terminal device to an external device, and detecting whether an identification array configured by the external device matches an identification array configured by the terminal device; and if the identification array is matched with the identification array, the terminal equipment supplies power to the external equipment. According to the method and the device, when the terminal device is connected with the external device, the identification data configured by the terminal device is matched with the identification array configured by the external device, so that whether the terminal device can supply power for the external device or not is determined, and the damage to the mobile terminal and/or the external device caused by the matching of the current and/or the voltage of the mobile terminal and the current and/or the voltage of the external device can be avoided.
Based on the control method of the terminal device, this embodiment provides a control device, as shown in fig. 3, where the identification device includes:
the detection module 100 is configured to detect whether an identification array configured by the external device matches an identification array configured by the terminal device when the terminal device is connected to the external device;
and the control module 200 is used for controlling the terminal equipment to supply power to the external equipment when the identification array is matched with the identification array.
In one embodiment, the identification array includes a plurality of identification strings, and each of the plurality of identification strings is different from each other.
In one embodiment, the detection module is specifically configured to:
the method comprises the steps that terminal equipment is connected with external equipment, and the connection mode of the terminal equipment and the external equipment is obtained;
and when the connection mode is OTG connection, the terminal equipment detects whether the identification array configured by the external equipment is matched with the identification array configured by the terminal equipment.
In one embodiment, the identification array comprises a plurality of identification character strings, and each identification character string in the plurality of identification character strings is different from each other; the detection module is specifically configured to:
the terminal equipment receives the identification character string periodically sent by the external equipment;
for each received identification character string, the terminal equipment detects whether a candidate identification character string which is the same as the identification character string exists in the received identification character string;
if the candidate identification character string identical to the identification character string exists, the identification character string is received to obtain an identification array configured by the external equipment;
and the terminal equipment compares the identification array with the identification array configured by the terminal equipment to detect whether the identification data is matched with the identification array configured by the terminal equipment.
In one embodiment, the detection module is specifically configured to:
the terminal equipment receives an identification character string periodically sent by external equipment;
when the identification character string is received, the terminal equipment selects the identification character string corresponding to the identification character string from the identification array configured by the terminal equipment;
if the identification character string corresponding to the identification character string is selected, the terminal equipment detects whether a candidate identification character string is stored in an identification array configured by the terminal equipment, wherein the candidate character string is the identification character string of which the corresponding identification character string is not received;
when the candidate recognition character string is not detected, the identification array is judged to be matched with the recognition array.
In one embodiment, the detection module is specifically configured to:
when the candidate identification character string is detected, continuing to execute the step of receiving the identification character string periodically sent by the external equipment by the terminal equipment until the candidate identification character string is not detected or the receiving time length reaches the preset time length;
and if the receiving time length reaches the preset time length, judging that the identification array is not matched with the identification array.
In one embodiment, the control module is specifically configured to:
and when the identification array is not matched with the identification array, controlling the terminal equipment not to supply power for the external equipment.
It should be noted that the working process of the control apparatus provided in this embodiment is the same as the working process of the control method of the terminal device, and details are not repeated here, and reference may be specifically made to the working process of the control method of the terminal device.
Based on the control method of the terminal device described above, the present embodiment provides a computer-readable storage medium storing one or more programs, which are executable by one or more processors, to implement the steps in the control method of the terminal device described above in the embodiments.
Based on the control method of the terminal device, the present application further provides a terminal device, as shown in fig. 4, including at least one processor (processor) 20; a display screen 21; and a memory (memory)22, and may further include a communication Interface (Communications Interface)23 and a bus 24. The processor 20, the display 21, the memory 22 and the communication interface 23 can communicate with each other through the bus 24. The display screen 21 is configured to display a user guidance interface preset in the initial setting mode. The communication interface 23 may transmit information. The processor 20 may call logic instructions in the memory 22 to perform the methods in the embodiments described above.
Furthermore, the logic instructions in the memory 22 may be implemented in software functional units and stored in a computer readable storage medium when sold or used as a stand-alone product.
The memory 22, which is a computer-readable storage medium, may be configured to store a software program, a computer-executable program, such as program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 executes the functional application and data processing, i.e. implements the method in the above-described embodiments, by executing the software program, instructions or modules stored in the memory 22.
The memory 22 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal device, and the like. Further, the memory 22 may include a high speed random access memory and may also include a non-volatile memory. For example, a variety of media that can store program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, may also be transient storage media.
In addition, the specific processes loaded and executed by the storage medium and the instruction processors in the mobile terminal are described in detail in the method, and are not stated herein.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.
Claims (10)
1. A control method of a terminal device, the method comprising:
the terminal equipment is connected with external equipment and detects whether an identification array configured by the external equipment is matched with an identification array configured by the terminal equipment;
and if the identification array is matched with the identification array, the terminal equipment supplies power to the external equipment.
2. The method according to claim 1, wherein the identification array includes a plurality of identification strings, and each of the plurality of identification strings is different from each other.
3. The method according to claim 1, wherein the terminal device connects to an external device, and detecting whether the identification array configured by the external device matches the identification array configured by the terminal device itself specifically comprises:
the method comprises the steps that terminal equipment is connected with external equipment, and the connection mode of the terminal equipment and the external equipment is obtained;
and when the connection mode is OTG connection, the terminal equipment detects whether the identification array configured by the external equipment is matched with the identification array configured by the terminal equipment.
4. The method according to claim 1, wherein the identification array includes a plurality of identification character strings, and each of the plurality of identification character strings is different from each other; the detecting whether the identification array configured by the external device matches the identification array configured by the terminal device specifically includes:
the terminal equipment receives the identification character string periodically sent by the external equipment;
for each received identification character string, the terminal equipment detects whether a candidate identification character string which is the same as the identification character string exists in the received identification character string;
if the candidate identification character string identical to the identification character string exists, the identification character string is received to obtain an identification array configured by the external equipment;
and the terminal equipment compares the identification array with the identification array configured by the terminal equipment to detect whether the identification data is matched with the identification array configured by the terminal equipment.
5. The method according to claim 1, wherein the detecting whether the identification array configured by the external device matches the identification array configured by the terminal device comprises:
the terminal equipment receives an identification character string periodically sent by external equipment;
when the identification character string is received, the terminal equipment selects the identification character string corresponding to the identification character string from the identification array configured by the terminal equipment;
if the identification character string corresponding to the identification character string is selected, the terminal equipment detects whether a candidate identification character string is stored in an identification array configured by the terminal equipment, wherein the candidate character string is the identification character string of which the corresponding identification character string is not received;
when the candidate recognition character string is not detected, the identification array is judged to be matched with the recognition array.
6. The method according to claim 5, wherein the detecting whether the identification array configured by the external device matches the identification array configured by the terminal device itself specifically comprises;
when the candidate identification character string is detected, continuing to execute the step of receiving the identification character string periodically sent by the external equipment by the terminal equipment until the candidate identification character string is not detected or the receiving time length reaches the preset time length;
and if the receiving time length reaches the preset time length, judging that the identification array is not matched with the identification array.
7. The method for controlling a terminal device according to claim 1 or 6, wherein the method further comprises:
and if the identification array is not matched with the identification array, the terminal equipment does not supply power to the external equipment.
8. A control device, characterized in that the identification means comprises:
the terminal equipment comprises a detection module, a judging module and a judging module, wherein the detection module is used for detecting whether an identification array configured by the external equipment is matched with an identification array configured by the terminal equipment when the terminal equipment is connected with the external equipment;
and the control module is used for controlling the terminal equipment to supply power to the external equipment when the identification array is matched with the identification array.
9. A computer-readable storage medium, characterized in that the computer-readable storage medium stores one or more programs which are executable by one or more processors to implement the steps in the control method of the terminal device according to any one of claims 1 to 7.
10. A terminal device, comprising: a processor, a memory, and a communication bus; the memory has stored thereon a computer readable program executable by the processor;
the communication bus realizes connection communication between the processor and the memory;
the processor, when executing the computer readable program, implements the steps in the control method of the terminal device according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110056957.8A CN112783310A (en) | 2021-01-15 | 2021-01-15 | Terminal equipment control method and device, storage medium and terminal equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110056957.8A CN112783310A (en) | 2021-01-15 | 2021-01-15 | Terminal equipment control method and device, storage medium and terminal equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112783310A true CN112783310A (en) | 2021-05-11 |
Family
ID=75756878
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110056957.8A Pending CN112783310A (en) | 2021-01-15 | 2021-01-15 | Terminal equipment control method and device, storage medium and terminal equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112783310A (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106685007A (en) * | 2017-01-24 | 2017-05-17 | 维沃移动通信有限公司 | Power supply control circuit for peripheral equipment, power supply method and mobile terminal |
CN108196894A (en) * | 2018-01-02 | 2018-06-22 | 联想(北京)有限公司 | A kind of method and electronic equipment for detecting external equipment access |
CN109005531A (en) * | 2018-08-27 | 2018-12-14 | 惠州Tcl移动通信有限公司 | mobile terminal NFC device control method, mobile terminal and storage medium |
CN109508084A (en) * | 2017-09-15 | 2019-03-22 | 华为终端(东莞)有限公司 | Terminal device, method of supplying power to, processing equipment, storage medium and chip system |
US20190131810A1 (en) * | 2017-11-01 | 2019-05-02 | Samsung Electronics Co., Ltd | Electronic device and method for controlling power supply |
CN110100366A (en) * | 2017-07-21 | 2019-08-06 | 华为技术有限公司 | Mobile terminal, peripheral equipment and its charging method |
CN111742459A (en) * | 2018-02-21 | 2020-10-02 | 三星电子株式会社 | Method for controlling voltage output to external electronic device according to voltage magnitude detected at signal terminal connected to external electronic device, and electronic device |
-
2021
- 2021-01-15 CN CN202110056957.8A patent/CN112783310A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106685007A (en) * | 2017-01-24 | 2017-05-17 | 维沃移动通信有限公司 | Power supply control circuit for peripheral equipment, power supply method and mobile terminal |
CN110100366A (en) * | 2017-07-21 | 2019-08-06 | 华为技术有限公司 | Mobile terminal, peripheral equipment and its charging method |
CN109508084A (en) * | 2017-09-15 | 2019-03-22 | 华为终端(东莞)有限公司 | Terminal device, method of supplying power to, processing equipment, storage medium and chip system |
US20190131810A1 (en) * | 2017-11-01 | 2019-05-02 | Samsung Electronics Co., Ltd | Electronic device and method for controlling power supply |
CN108196894A (en) * | 2018-01-02 | 2018-06-22 | 联想(北京)有限公司 | A kind of method and electronic equipment for detecting external equipment access |
CN111742459A (en) * | 2018-02-21 | 2020-10-02 | 三星电子株式会社 | Method for controlling voltage output to external electronic device according to voltage magnitude detected at signal terminal connected to external electronic device, and electronic device |
CN109005531A (en) * | 2018-08-27 | 2018-12-14 | 惠州Tcl移动通信有限公司 | mobile terminal NFC device control method, mobile terminal and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20200183704A1 (en) | Method and apparatus for waking up computer from sleep state | |
CN107193598B (en) | Application starting method, mobile terminal and computer readable storage medium | |
CN103294336A (en) | Automatic magnification and selection confirmation | |
EP2993572A1 (en) | Method and apparatus for processing touch input | |
EP3206110A1 (en) | Method of providing handwriting style correction function and electronic device adapted thereto | |
CN108681514B (en) | Device detection method and device, storage medium and electronic device | |
CN104572348A (en) | Terminal | |
AU2015318901A1 (en) | Device for handling touch input and method thereof | |
US9098196B2 (en) | Touch system inadvertent input elimination | |
CN108924325B (en) | Data processing method and related device | |
CN105279110B (en) | A kind of method and USB device of USB device identification host system | |
CN112783310A (en) | Terminal equipment control method and device, storage medium and terminal equipment | |
US12001556B2 (en) | Anti-virus chip and anti-virus method | |
CN106775835B (en) | Method, server and terminal for acquiring upgrade file | |
CN110874729B (en) | Switching method and switching device for electronic red packet identification strategy and mobile terminal | |
CN112711955A (en) | NFC information transmission method, NFC information transmission device and NFC terminal | |
WO2020113469A1 (en) | Power on self test method, power on self test device and mobile terminal | |
US20060038787A1 (en) | Processing system and method for detecting hotkey activation | |
US20120072711A1 (en) | Computer Apparatus and Method for Charging Portable Electronic Device Using the Computer Apparatus | |
CN108632366B (en) | File downloading method and device and terminal equipment | |
CN108008854B (en) | Method, device and terminal equipment for avoiding antenna carrier interference | |
CN110874730B (en) | Information processing method, information processing device and mobile terminal | |
US9152429B2 (en) | Computer system having a near field communication tag with user identification function | |
CN111399871A (en) | System updating method, device, equipment and medium for HBA card | |
CN112714494A (en) | Control method of mobile terminal, storage medium and mobile terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |