Equipment control method and device, storage medium and electronic equipment
By using edge devices to broadcast device control messages in smart classrooms, including control instructions and distance thresholds, the problem of cumbersome control of smart classroom equipment is solved, simple and efficient control between devices is achieved, the connection between control devices and controlled devices is improved, and resources and energy consumption are saved.
Patent Information
- Application Number
- CN202510422654.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-18
- Publication Date
- 2025-08-08
AI Technical Summary
In smart classrooms, equipment control is cumbersome, especially in large educational institutions, servers need to take up more resources by controlling each smart device in each classroom, and each additional device needs to be configured on the device and the server.
The control device broadcasts the device control message, including control instructions and a specified distance threshold, and the controlled device executes control instructions when the distance of the first device is less than or equal to the specified distance threshold. The controlled device is divided into groups according to the function type, uses edge devices for control, and uses ultrasonic or radio signals to measure the distance, so as to achieve simple and convenient control between devices.
There is no need to make complex settings for controlled equipment and control equipment, which realizes simple and convenient control between equipment, improves connectivity and saves resources and energy consumption.
Smart Images

Figure CN120447414A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of control, and in particular, to a device control method, apparatus, storage medium, and electronic device. Background Art
[0002] To improve teaching quality, smart classrooms are increasingly being used. These are achieved by adding computers, projectors, interactive whiteboards, cameras, audio equipment, lighting, and smart locks to traditional classrooms. These devices, when controlled and operated, assist in presenting teaching content, facilitate access to learning resources, promote classroom activities, and enable intelligent classroom management. However, smart classrooms involve numerous devices, making control of each device complex and cumbersome. Summary of the Invention
[0003] In order to solve the above problems, the present disclosure provides a device control method, apparatus, storage medium and electronic device.
[0004] In a first aspect, the present disclosure provides a device control method, applied to control a device, the method comprising: Obtaining control instructions for controlling the controlled device; Obtaining a first preset broadcast time and a specified distance threshold corresponding to the controlled device; broadcasting a device control message at a first preset broadcast time of each preset broadcast cycle, wherein the device control message includes the control instruction and a specified distance threshold, the device control message being used to control the controlled device to obtain a first device distance between the controlled device and the controlling device, and to execute the control instruction if the first device distance is less than or equal to the specified distance threshold; There are multiple controlled devices, and the multiple controlled devices are divided into one or more controlled device groups according to their functional types. The acquiring of the first preset broadcast time corresponding to the controlled devices includes: According to the preset broadcast time correspondence relationship of the controlled device group, the first preset broadcast time corresponding to each controlled device group is obtained, and the first preset broadcast time is used as the first preset broadcast time corresponding to the controlled devices under the controlled device group, wherein the preset controlled device group broadcast time correspondence relationship includes the correspondence relationship between the controlled device group and the first preset broadcast time, different controlled device groups correspond to different first preset broadcast times, and the controlled devices in the same controlled device group correspond to the same first preset broadcast time.
[0005] Optionally, obtaining a specified distance threshold corresponding to the controlled device includes: For each controlled device group, obtaining a second device distance between the control device and each controlled device in the controlled device group; The second device distance with the smallest distance is used as the candidate distance threshold corresponding to the controlled device in the controlled device group; The designated distance threshold corresponding to the controlled device is acquired according to the candidate distance threshold.
[0006] Optionally, acquiring the designated distance threshold corresponding to the controlled device according to the candidate distance threshold includes: The candidate distance threshold is increased by a preset distance adjustment value to obtain the designated distance threshold.
[0007] Optionally, acquiring the second device distance between the control device and each controlled device includes: sending a second ultrasonic signal to the controlled device; receiving a second ultrasonic feedback signal returned by the controlled device according to the second ultrasonic signal; calculating a third time difference between a reception time of the second ultrasonic feedback signal and a transmission time of the second ultrasonic signal; A second device distance between the device and the controlled device is determined according to the third time difference.
[0008] Optionally, acquiring a second device distance from the controlled device includes: receiving a response message sent by the controlled device in response to the device control message, wherein the response message includes a time when the response message is sent; Calculating a fourth time difference between a reception time of the response message and a sending time of the response message; A second device distance between the control device and the controlled device is determined according to the fourth time difference.
[0009] Optionally, the method further includes: At the second preset broadcast time of each preset broadcast cycle, a device initialization message is broadcast, wherein the second preset broadcast time is before the first preset broadcast time, and the initialization message is used to control the controlled device to perform a device initialization operation.
[0010] In a second aspect, the present disclosure provides another device control apparatus, which is applied to control a device, the apparatus comprising: A control instruction acquisition module, used to acquire control instructions for controlling a controlled device; The preset broadcast time acquisition module is used to obtain the first preset broadcast time corresponding to the controlled device A designated distance threshold acquisition module, configured to acquire a designated distance threshold corresponding to the controlled device; a message broadcast module, configured to broadcast a device control message at a first preset broadcast time of each preset broadcast cycle, wherein the device control message includes the control instruction and a specified distance threshold, and the device control message is used to control the controlled device to obtain a first device distance between the controlled device and the controlling device, and execute the control instruction if the first device distance is less than or equal to the specified distance threshold; There are multiple controlled devices, and the multiple controlled devices are divided into one or more controlled device groups according to their functional types. The preset broadcast time acquisition module is used to: According to the preset broadcast time correspondence relationship of the controlled device group, the first preset broadcast time corresponding to each controlled device group is obtained, and the first preset broadcast time is used as the first preset broadcast time corresponding to the controlled devices under the controlled device group, wherein the preset controlled device group broadcast time correspondence relationship includes the correspondence relationship between the controlled device group and the first preset broadcast time, different controlled device groups correspond to different first preset broadcast times, and the controlled devices in the same controlled device group correspond to the same first preset broadcast time.
[0011] In a third aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in the first aspect of the present disclosure.
[0012] In a fourth aspect, the present disclosure provides an electronic device, comprising: a memory on which a computer program is stored; and a processor for executing the computer program in the memory to implement the steps of the method described in the first aspect of the present disclosure.
[0013] Using the above technical solution, the controlling device obtains a control instruction for controlling the controlled device; obtains a first preset broadcast time and a specified distance threshold corresponding to the controlled device; and broadcasts a device control message at the first preset broadcast time of each preset broadcast cycle. The device control message includes the control instruction and the specified distance threshold. The device control message is used to control the controlled device to obtain a first device distance between the controlled device and the controlling device, and execute the control instruction if the first device distance is less than or equal to the specified distance threshold. This allows for simple and convenient control of the controlled device by the controlling device without requiring complex configuration of the controlled and controlling devices.
[0014] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following detailed description, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings: Figure 1 is a schematic diagram of an application scenario of a device control system provided by an embodiment of the present disclosure; Figure 2 is a flow chart of a device control method provided by an embodiment of the present disclosure; Figure 3 is a structural diagram of a device control apparatus provided by an embodiment of the present disclosure; Figure 4 is a structural diagram of another device control device provided by an embodiment of the present disclosure; Figure 5 is a block diagram of an electronic device provided by an embodiment of the present disclosure; Figure 6 It is a block diagram of another electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0016] The following describes the specific embodiments of the present disclosure in detail with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only used to illustrate and explain the present disclosure and are not intended to limit the present disclosure.
[0017] It should be noted that, in this disclosure, terms such as "first" and "second" are used solely for descriptive purposes and should not be construed as indicating or implying relative importance or order. Terms such as "S301," "S302," "S401," and "S402" are used to distinguish steps and should not necessarily be construed as implying that the method steps must be performed in a specific order or sequential sequence. In the following description, unless otherwise indicated, identical numbers in different figures represent identical or similar elements.
[0018] First, the application scenario of the present disclosure is described. The present disclosure can be applied to smart classroom scenarios, especially device control in smart classrooms. A smart classroom will be equipped with various devices such as computer equipment, interactive whiteboards, projection equipment, video equipment, audio equipment, lighting equipment and smart lock equipment. During the teaching process, it is necessary to control and operate the above-mentioned devices in the smart classroom to assist in the development of teaching activities and realize intelligent management of the classroom. However, in a smart classroom, there are many devices involved, and the control of each device is relatively cumbersome. In the related art, Wi-Fi can be used to connect all smart devices in the smart classroom to the network, and each smart device can be managed by a server. However, in large educational institutions, there are generally multiple classrooms, and each classroom has multiple smart devices. Using this method, the server controls each smart device in each classroom separately, which is cumbersome and requires more resources. Moreover, each additional device needs to be configured separately on the device and the server so that the device can be controlled by the server.
[0019] To address the aforementioned issues, the present disclosure provides a device control method, apparatus, storage medium, and electronic device. In this method, a controlling device broadcasts a device control message containing a control instruction and a specified distance threshold. The controlled device then obtains a first device distance from the controlling device and, if the first device distance is less than or equal to the specified distance threshold, executes the control instruction. This allows for simple and convenient control of the controlled device by the controlling device through broadcasting, without requiring complex configuration of the controlled and controlling devices, thereby increasing connectivity between the controlling and controlled devices.
[0020] The specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0021] Figure 1 is a schematic diagram of an application scenario of a device control system provided by an embodiment of the present disclosure, such as Figure 1 As shown, the device control system includes a controlled device 101 and a control device 102, wherein the controlled device 101 may be one or more, for example, it may include a first controlled device 1011, a second controlled device 1012, ..., an Nth controlled device 101n. In the embodiment of the present disclosure, the controlled device 101 may be a smart device in a smart classroom, such as one or more of a computer device, an interactive whiteboard, a projection device, a camera device, an audio device, a lighting device, and a smart lock device; the control device 102 may be set in each classroom to control the smart devices in the classroom. Therefore, as Figure 1As shown, in the scenario of multiple classrooms, the device control system can also include a central controller 103, and there can also be multiple control devices 102. The central controller 103 is connected to multiple control devices 102, and each control device is connected to the controlled device in the classroom where the control device is located.
[0022] It should be noted that traditional centralized cloud computing services cannot meet the real-time, security, and low-energy requirements of device control. The device control system in this disclosure can use edge devices as control devices. These edge devices can have processors and memory to implement the device control methods in this disclosure. For example, the edge device can be an AI development board, or a traditional computer or server.
[0023] Figure 2 is a flow chart of another device control method provided by an embodiment of the present disclosure, such as Figure 2 As shown, the execution subject of this method can be Figure 1 The control device in the embodiment of the present invention comprises: S301: Acquire a control instruction for controlling a controlled device.
[0024] The control instruction can be a user-input control instruction, or it can be a control instruction proactively generated by the control device based on information sent by a controlled device. For example, the multiple controlled devices include a smart lock device, a lighting device, and an audio device. If the smart lock device is damaged, it can send an alarm message to the control device. Based on the first alarm message, the control device can generate a light-on instruction for the lighting device and an alarm sound-play instruction for the audio device.
[0025] S302: Obtain a first preset broadcast time and a specified distance threshold corresponding to the controlled device.
[0026] The control device can pre-set the first preset broadcast time corresponding to each controlled device. For example, the control device can store a device broadcast time correspondence relationship, which includes a pre-set correspondence between each controlled device and the first preset broadcast time. In this way, the first preset broadcast time corresponding to the controlled device can be obtained through the device broadcast time correspondence relationship.
[0027] Likewise, the specified distance threshold may be a preset distance, and the specified distance threshold may be greater than or equal to the distance between the controlled device and the controlling device.
[0028] S303: Broadcast a device control message at the first preset broadcast time of each preset broadcast cycle.
[0029] The device control message includes a control instruction and a specified distance threshold. The device control message is used to control the controlled device to obtain a first device distance between the controlled device and the control device, and execute the control instruction when the first device distance is less than or equal to the specified distance threshold.
[0030] Likewise, the control instruction is used to control the controlled device to perform related actions; for example, the control instruction may be an instruction to turn on a sound system or an instruction to play specified music.
[0031] Using the above method, a controlling device obtains a control instruction for controlling a controlled device; obtains a first preset broadcast time and a specified distance threshold corresponding to the controlled device; and broadcasts a device control message at the first preset broadcast time of each preset broadcast cycle. The device control message includes the control instruction and the specified distance threshold. The device control message controls the controlled device to obtain a first device distance between the controlled device and the controlling device and executes the control instruction if the first device distance is less than or equal to the specified distance threshold. This allows for simple and convenient control of the controlled device by the controlling device without requiring complex configuration of the controlled device or the controlling device.
[0032] Figure 3 is a flow chart of another device control method provided by an embodiment of the present disclosure, such as Figure 3 As shown, the method includes: S401: A control device obtains a first preset broadcast time and a specified distance threshold corresponding to the controlled device.
[0033] In this embodiment, there may be multiple controlled devices, and the multiple controlled devices are divided into one or more controlled device groups according to their functional types. In this way, the first preset broadcast time corresponding to each controlled device group can be obtained according to the preset broadcast time correspondence relationship of the controlled device group, and the first preset broadcast time can be used as the first preset broadcast time corresponding to the controlled device under the controlled device group.
[0034] Among them, the preset correspondence between the controlled device group broadcast time includes the correspondence between the controlled device group and the first preset broadcast time. Different controlled device groups correspond to different first preset broadcast times, and controlled devices in the same controlled device group correspond to the same first preset broadcast time.
[0035] For example, if the multiple controlled devices include a smart lock device and two audio devices, the multiple controlled devices can be divided into a smart lock device group and an audio device group, where the audio device group includes two audio devices. The preset broadcast time correspondence relationship of the controlled device groups can include that the first preset broadcast time corresponding to the audio device group is 5ms, that is, the first preset broadcast time corresponding to the two audio devices is 5ms, and the first preset broadcast time corresponding to the smart lock device group is 15ms.
[0036] In this way, through the form of a controlled device group, a device control message can be sent at the first preset broadcast time to control multiple controlled devices of the same functional type, thereby reducing the number of control messages and improving control efficiency.
[0037] Furthermore, the specified distance threshold can be obtained by: First, for each controlled device group, a second device distance between the control device and each controlled device in the controlled device group is obtained.
[0038] Next, the second device distance with the smallest distance is used as a candidate distance threshold corresponding to the controlled device in the controlled device group.
[0039] Finally, the designated distance threshold corresponding to the controlled device is obtained according to the candidate distance threshold.
[0040] For example, the candidate distance threshold may be used as the designated distance threshold, or a preset distance adjustment value may be added to the candidate distance threshold to obtain the designated distance threshold. The preset distance adjustment value may be any value between 0.1 meters and 0.5 meters.
[0041] In this way, based on the distance of the second device with the smallest distance in the controlled device group, the specified distance threshold corresponding to the controlled device is obtained. When there are multiple controlled devices of the same functional type, only the controlled device with the closest distance can be controlled to execute the control instruction, avoiding the problem of mistakenly controlling multiple controlled devices to execute control instructions due to the broadcast device control message.
[0042] It should be noted that, in this method, there are also multiple ways to obtain the distance of the second device. One way to obtain the distance of the second device may include the following steps: First, a second ultrasonic signal is sent to the controlled device.
[0043] Likewise, in this embodiment, an ultrasonic component may be provided on the control device to transmit and receive ultrasonic signals.
[0044] Secondly, a second ultrasonic feedback signal returned by the controlled device according to the second ultrasonic signal is received.
[0045] Thirdly, a third time difference between the reception time of the second ultrasonic feedback signal and the transmission time of the second ultrasonic signal is calculated.
[0046] Finally, a second device distance between the device and the controlled device is determined according to the third time difference.
[0047] For example, in this method, the second device distance can be calculated using the following formula: L2 = V1 * T3 / 2, Wherein, L2 represents the second device distance, V1 represents the propagation speed of ultrasound in the air, which may be 340 m / s, and T3 represents the third time difference.
[0048] In this way, the second device distance between the control device and the controlled device can be accurately measured by the ultrasonic device.
[0049] Another method of obtaining the distance of the second device may include the following steps: First, the control device sends a device control message to the controlled device.
[0050] Secondly, the controlled device receives the device control message broadcast by the control device at the first preset receiving time of the preset broadcast period, and sends a response message to the control device. The response message includes the sending time of the response message, so that the control device determines the second device distance between itself and the controlled device according to the sending time, and determines the specified distance threshold in the device control message according to the second device distance.
[0051] Thirdly, the control device receives a response message sent by the controlled device in response to the device control message, and calculates a fourth time difference between a reception time of the response message and a sending time of the response message.
[0052] Finally, the control device determines a second device distance between the control device and the controlled device according to the fourth time difference.
[0053] For example, in this method, the second device distance can be calculated using the following formula: L2 = V2 * T4, Wherein, L2 represents the distance of the second device, V2 represents the propagation speed of the radio signal in the air, which can be 3*10 8 m / s, T4 represents the fourth time difference.
[0054] In this way, the second device distance between the control device and the controlled device can also be calculated based on the sending time and receiving time of the response message.
[0055] S402: The control device broadcasts a device initialization message at a second preset broadcast time in the preset broadcast cycle.
[0056] The second preset broadcast time is before the first preset broadcast time, and the initialization message is used to control the controlled device to perform a device initialization operation.
[0057] For example, the second preset broadcast time may be 4 ms earlier than the first preset broadcast time.
[0058] S403: The controlled device receives a device initialization message sent by the control device at a second preset receiving time in the preset broadcast period, and performs a device initialization operation according to the device initialization message.
[0059] It should be noted that the above-mentioned controlled device can be in a dormant state when it does not receive a device control message or a device initialization message. In the dormant state, the controlled device can power off some devices with high power consumption, but will still receive messages sent by the control device according to the preset broadcast cycle. In this way, the energy consumption of the controlled device can be saved, and the device control message sent by the control device can be received. However, when the controlled device receives a device control message in the dormant state, it is necessary to power on and initialize the powered-off devices before it can execute the corresponding control instructions. This will cause the controlled device to be unable to execute the control instructions in a timely manner. In this way, in this embodiment, by sending a device initialization message in advance, the controlled device can be notified to perform device initialization, thereby improving the efficiency of the controlled device in executing control instructions.
[0060] S404: The control device broadcasts a device control message at a first preset broadcast time in a preset broadcast period.
[0061] The device control message includes a control instruction and a specified distance threshold.
[0062] S405: The controlled device receives the device control message broadcast by the control device at a first preset receiving time in a preset broadcast period.
[0063] S406: The controlled device obtains a first device distance between the controlled device and the control device, and executes the control instruction if the first device distance is less than or equal to the specified distance threshold.
[0064] In this way, by adopting the above method, by broadcasting control messages, it is possible to achieve simple and convenient control of the controlled device by the controlling device without performing complex settings on the controlled device and the controlling device.
[0065] In another embodiment of the present disclosure, the device control message may further include transmit power, and the method may further include: First, the control device determines the transmit power of the device control message and sends a device control message including the transmit power and a control instruction.
[0066] Next, the controlled device obtains the received receiving power of the device control message, and calculates the path loss of the device control message according to the receiving power and the transmitting power.
[0067] In this step, the path loss can be calculated using the following formula: PL = PT – PR, Wherein, PL represents the path loss, PT represents the transmit power of the control device, and PR represents the receive power of the controlled device.
[0068] For example, the transmission power of the control device is -20dBm, and the receiving power of the controlled device is -75dBm, then the path loss is 55dB.
[0069] Finally, the controlled device obtains the first device distance between the controlled device and the control device when the path loss is greater than or equal to the preset path loss threshold, and executes the control instruction when the first device distance is less than or equal to the specified distance threshold.
[0070] It should be noted that the preset power can be determined based on the transmission distance between the controlled device and the control device and the operating frequency used. The path loss of radio waves in the air can be calculated using the following formula: L=32.44 + 20 * LOG(D) + 20 * LOG(F), Where L is the path loss in dB, D is the transmission distance in km, and F is the operating frequency in MHz.
[0071] For example, using an operating frequency of 2400 MHz, if the transmission distance is 1 meter, the path loss is 40 dB; if the transmission distance is 2 meters, the path loss is 46 dB; if the transmission distance is 4 meters, the path loss is 52 dB.
[0072] According to empirical data, at the same operating frequency of 2400MHz, the path loss of radio waves passing through cement brick walls is between 13dB and 18dB.
[0073] As can be seen, in a classroom scenario, radio waves will generate significant path loss after passing through the walls between classrooms. To prevent the controlled device from mistakenly executing the control instructions of the control device in the adjacent classroom, the preset path loss threshold can be obtained in the following way: determining a first path loss of radio waves propagating in the air according to a transmission distance between the controlled device and the controlling device and a used operating frequency; The first path loss is used as the preset path loss threshold, or the sum of the first path loss and the preset path loss offset is used as the preset path loss threshold. The preset path loss offset can be any value between 2 and 18 dB, for example, 5 dB, 10 dB or 13 dB.
[0074] For example, if the transmission distance between the controlled device and the control device is 4 meters and both are applicable to an operating frequency of 2400 MHz, the first path loss can be 52 dB, the preset path loss offset can be 5 dB, and the preset path loss threshold is 57 dB.
[0075] In this way, by adopting this method, the control accuracy can be further increased, ensuring that the controlled device only executes the control instructions of the control device in this classroom, and avoids being affected by the control devices in adjacent classrooms.
[0076] Optionally, the transmission power of the device control message may also be the sum of the first path loss and the receiver sensitivity of the controlled device.
[0077] Receiver sensitivity defines the minimum signal strength that a controlled device's receiver can receive and still operate normally.
[0078] For example, the receiver sensitivity of the controlled device may be -80 dBm, and the first path loss calculated according to the distance between the control device and the controlled device is 52 dB, so the generated power may be -28 dBm.
[0079] In this way, by determining the appropriate transmission power, it is possible to ensure that the controlled devices in this classroom receive the device control message, and prevent the device control message from being received by the controlled devices in adjacent classrooms and affecting the normal operation of the controlled devices in adjacent classrooms.
[0080] Optionally, in order to ensure that the time when the control device sends the control instruction is consistent with the time when the controlled device receives the control instruction, in another embodiment of the present disclosure, time synchronization between the control device and the controlled device can be achieved by any one of the following methods.
[0081] Method 1: Both the control device and the controlled device are equipped with a time synchronization module. The clock synchronization device can be a Beidou satellite navigation module, a GPS (Global Positioning System) module, or a GLONASS (GLOBAL NAVIGATION SATELLITE SYSTEM) module.
[0082] Through this time synchronization module, both the control device and the controlled device can be synchronized with the global standard time, thereby ensuring the time synchronization of the control device and the controlled device. The above time synchronization modules can all achieve high-precision time signal output, which can achieve nanosecond-level timing accuracy.
[0083] Method 2: The control device and the controlled device are respectively equipped with independent clock modules. The control device periodically sends time synchronization messages to the controlled device. After receiving the time synchronization message, the controlled device calibrates its own clock module, that is, corrects the current time information of the controlled device's own clock module according to the time information in the time synchronization message, thereby ensuring time synchronization between the control device and the controlled device.
[0084] It should be noted that the clock module can be a low-power real-time clock chip. Due to the varying accuracy of different clock modules, the time between the controlling device and the controlled device may become out of sync after prolonged operation. In this approach, the clock module can be calibrated using the aforementioned time synchronization message before the out-of-sync situation occurs.
[0085] The periodicity at which the control device sends time synchronization messages to the controlled devices can be determined based on the preset broadcast period, the number of controlled devices, and the accuracy of the clock module. For example, if the preset broadcast period is 50 milliseconds, there are five controlled devices, and the accuracy of the clock module is a maximum error of ±10 milliseconds per day, then the periodicity can be set to a time period less than one day and can be any value between one hour and 24 hours, for example, 12 hours. By setting this periodicity, time synchronization between the control device and the controlled devices can be ensured while reducing the amount of data sent and saving device energy consumption.
[0086] Figure 4 is a structural diagram of another device control device provided by an embodiment of the present disclosure, such as Figure 4 As shown, the device is applied to a control device, and the device includes: A control instruction acquisition module 701 is used to acquire a control instruction for controlling a controlled device; The preset broadcast time acquisition module 702 is used to acquire a first preset broadcast time corresponding to the controlled device; The designated distance threshold acquisition module 703 is used to acquire the designated distance threshold corresponding to the controlled device; The message broadcast module 704 broadcasts a device control message at the first preset broadcast time of each preset broadcast cycle, wherein the device control message includes the control instruction and the specified distance threshold. The device control message is used to control the controlled device to obtain the first device distance between the controlled device and the control device, and execute the control instruction when the first device distance is less than or equal to the specified distance threshold.
[0087] Optionally, there are multiple controlled devices, and the multiple controlled devices are divided into one or more controlled device groups according to their functional types. The preset broadcast time acquisition module 702 is used to obtain the first preset broadcast time corresponding to each controlled device group according to the preset controlled device group broadcast time correspondence, and use the first preset broadcast time as the first preset broadcast time corresponding to the controlled devices under the controlled device group, wherein the preset controlled device group broadcast time correspondence includes the correspondence between the controlled device group and the first preset broadcast time, different controlled device groups correspond to different first preset broadcast times, and the controlled devices in the same controlled device group correspond to the same first preset broadcast time.
[0088] Optionally, the specified distance threshold acquisition module 703 can be used to obtain, for each controlled device group, a second device distance between the control device and each controlled device in the controlled device group; use the second device distance with the smallest distance as a candidate distance threshold corresponding to the controlled device under the controlled device group; and obtain the specified distance threshold corresponding to the controlled device based on the candidate distance threshold.
[0089] Optionally, the designated distance threshold acquisition module 703 is specifically configured to increase the candidate distance threshold by a preset distance adjustment value to obtain the designated distance threshold.
[0090] Optionally, the specified distance threshold acquisition module 703 can be used to send a second ultrasonic signal to the controlled device; receive a second ultrasonic feedback signal returned by the controlled device based on the second ultrasonic signal; calculate a third time difference between the reception time of the second ultrasonic feedback signal and the transmission time of the second ultrasonic signal; and determine the second device distance between the controlled device and the controlled device based on the third time difference.
[0091] Optionally, the specified distance threshold acquisition module 703 can be used to receive a response message sent by the controlled device in response to the device control message, the response message including the response message sending time; calculate a fourth time difference between the reception time of the response message and the response message sending time; and determine the second device distance between the control device and the controlled device based on the fourth time difference.
[0092] Optionally, the message broadcast module 704 is also used to broadcast a device initialization message at the second preset broadcast time of each preset broadcast cycle, wherein the second preset broadcast time is before the first preset broadcast time, and the initialization message is used to control the controlled device to perform device initialization operations.
[0093] Regarding the apparatus in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0094] Figure 5 FIG. 8 is a block diagram of an electronic device 800 according to an exemplary embodiment. Figure 5 As shown, the electronic device 800 may include: a processor 801 , a memory 802 , and may further include one or more of a multimedia component 803 , an input / output (I / O) interface 804 , and a communication component 805 .
[0095] The processor 801 is used to control the overall operation of the electronic device 800 to complete all or part of the steps in the device control method described above. The memory 802 is used to store various types of data to support the operation of the electronic device 800. This data may include, for example, instructions for any application or method operating on the electronic device 800, as well as application-related data such as contact information, sent and received messages, images, audio, video, etc. The memory 802 can be implemented by any type of volatile or non-volatile storage device, 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. The multimedia component 803 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in the memory 802 or transmitted via the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, which may be a keyboard, a mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the electronic device 800 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more thereof, is not limited here. Therefore, the corresponding communication component 805 may include: a Wi-Fi module, a Bluetooth module, an NFC module, etc.
[0096] In an exemplary embodiment, the electronic device 800 may be implemented by 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, microcontrollers, microprocessors, or other electronic components to execute the above-mentioned device control method.
[0097] In another exemplary embodiment, a computer-readable storage medium including program instructions is further provided. When the program instructions are executed by a processor, the steps of the aforementioned device control method are implemented. For example, the computer-readable storage medium may be the aforementioned memory 802 including the program instructions. The program instructions may be executed by the processor 801 of the electronic device 800 to implement the aforementioned device control method.
[0098] Figure 6 1 is a block diagram of an electronic device 900 according to an exemplary embodiment. For example, the electronic device 900 can be provided as a server. Figure 6 The electronic device 900 includes a processor 922, which may be one or more, and a memory 932 for storing a computer program executable by the processor 922. The computer program stored in the memory 932 may include one or more modules, each corresponding to a set of instructions. In addition, the processor 922 may be configured to execute the computer program to perform the above-mentioned device control method.
[0099] In addition, the electronic device 900 may further include a power supply component 926 and a communication component 950. The power supply component 926 may be configured to perform power management for the electronic device 900, and the communication component 950 may be configured to enable communication, such as wired or wireless communication, with the electronic device 900. Furthermore, the electronic device 900 may further include an input / output (I / O) interface 958. The electronic device 900 may operate based on an operating system stored in the memory 932, such as Windows Server, Mac OS, Unix, Linux, and the like.
[0100] In another exemplary embodiment, a computer-readable storage medium including program instructions is further provided. When the program instructions are executed by a processor, the steps of the aforementioned device control method are implemented. For example, the computer-readable storage medium may be the aforementioned memory 932 including the program instructions. The program instructions may be executed by the processor 922 of the electronic device 900 to implement the aforementioned device control method.
[0101] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program executable by a programmable device, and the computer program has a code portion for executing the above-mentioned device control method when executed by the programmable device.
[0102] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings. However, the present disclosure is not limited to the specific details of the above embodiments. Within the technical concept of the present disclosure, various simple modifications can be made to the technical solutions of the present disclosure, and these simple modifications all fall within the scope of protection of the present disclosure.
[0103] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. To avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0104] In addition, the various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.
Claims
1. A device control method, characterized in that: Applied to a control device, the method includes: Obtaining control instructions for controlling the controlled device; Obtaining a first preset broadcast time and a specified distance threshold corresponding to the controlled device; broadcasting a device control message at a first preset broadcast time of each preset broadcast cycle, wherein the device control message includes the control instruction and a specified distance threshold, the device control message being used to control the controlled device to obtain a first device distance between the controlled device and the controlling device, and to execute the control instruction if the first device distance is less than or equal to the specified distance threshold; There are multiple controlled devices, and the multiple controlled devices are divided into one or more controlled device groups according to their functional types. The acquiring of the first preset broadcast time corresponding to the controlled devices includes: According to the preset broadcast time correspondence relationship of the controlled device group, the first preset broadcast time corresponding to each controlled device group is obtained, and the first preset broadcast time is used as the first preset broadcast time corresponding to the controlled devices under the controlled device group, wherein the preset controlled device group broadcast time correspondence relationship includes the correspondence relationship between the controlled device group and the first preset broadcast time, different controlled device groups correspond to different first preset broadcast times, and the controlled devices in the same controlled device group correspond to the same first preset broadcast time.
2. The method according to claim 1, characterized in that Obtaining the specified distance threshold corresponding to the controlled device includes: For each controlled device group, obtaining a second device distance between the control device and each controlled device in the controlled device group; The second device distance with the smallest distance is used as the candidate distance threshold corresponding to the controlled device in the controlled device group; The designated distance threshold corresponding to the controlled device is acquired according to the candidate distance threshold.
3. The method according to claim 2, characterized in that The acquiring the designated distance threshold corresponding to the controlled device according to the candidate distance threshold comprises: The candidate distance threshold is increased by a preset distance adjustment value to obtain the designated distance threshold.
4. The method according to claim 2, characterized in that The acquiring of the second device distance between the control device and each controlled device in the controlled device group includes: sending a second ultrasonic signal to the controlled device; receiving a second ultrasonic feedback signal returned by the controlled device according to the second ultrasonic signal; calculating a third time difference between a reception time of the second ultrasonic feedback signal and a transmission time of the second ultrasonic signal; A second device distance between the device and the controlled device is determined according to the third time difference.
5. The method according to claim 2, characterized in that The acquiring of the second device distance between the control device and each controlled device in the controlled device group includes: receiving a response message sent by the controlled device in response to the device control message, wherein the response message includes a time when the response message is sent; Calculating a fourth time difference between a reception time of the response message and a sending time of the response message; A second device distance between the control device and the controlled device is determined according to the fourth time difference.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: At the second preset broadcast time of each preset broadcast cycle, a device initialization message is broadcast, wherein the second preset broadcast time is before the first preset broadcast time, and the initialization message is used to control the controlled device to perform a device initialization operation.
7. A device control device, characterized in that: Applied to a control device, the device comprises: A control instruction acquisition module, used to acquire control instructions for controlling a controlled device; The preset broadcast time acquisition module is used to obtain the first preset broadcast time corresponding to the controlled device A designated distance threshold acquisition module, configured to acquire a designated distance threshold corresponding to the controlled device; a message broadcast module, configured to broadcast a device control message at a first preset broadcast time of each preset broadcast cycle, wherein the device control message includes the control instruction and a specified distance threshold, and the device control message is used to control the controlled device to obtain a first device distance between the controlled device and the controlling device, and execute the control instruction if the first device distance is less than or equal to the specified distance threshold; There are multiple controlled devices, and the multiple controlled devices are divided into one or more controlled device groups according to their functional types. The preset broadcast time acquisition module is used to: According to the preset broadcast time correspondence relationship of the controlled device group, the first preset broadcast time corresponding to each controlled device group is obtained, and the first preset broadcast time is used as the first preset broadcast time corresponding to the controlled devices under the controlled device group, wherein the preset controlled device group broadcast time correspondence relationship includes the correspondence relationship between the controlled device group and the first preset broadcast time, different controlled device groups correspond to different first preset broadcast times, and the controlled devices in the same controlled device group correspond to the same first preset broadcast time.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
9. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 6.