Device control method, device, electronic device and readable storage medium
By converting control instructions to the preset service library, the problem of inconsistent control protocols of terminal devices is solved, and flexible control and efficient control of multiple terminal devices is realized by the control end.
Patent Information
- Application Number
- CN202210998221.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-19
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-08-19
AI Technical Summary
In the control system, the diversity and brand differences of terminal equipment lead to inconsistent control protocols, making it difficult for the control end to flexibly operate multiple terminal equipment remotely.
The preset service library determines the operation code in the control protocol of the terminal device, extracts the operation code that matches the device from the received control instructions, and generates a second control command that matches the control protocol of the terminal device, thereby realizing effective control of the terminal device .
It realizes flexible control of multiple terminal devices by the control end, avoids control failure caused by the control instructions not complying with the equipment protocol, and improves the efficiency and flexibility of equipment control.
Smart Images

Figure CN115499617B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network technology, and in particular to a device control method, device, electronic device and readable storage medium. Background Art
[0002] With the development of the Internet, various control systems have emerged, such as monitoring systems, video transmission systems, etc. The control system usually includes a control terminal and multiple terminal devices. The control terminal can remotely control the terminal device by sending control requests.
[0003] However, the number and types of terminal devices in a control system are often large, so how to flexibly control the terminal devices is a technical problem that needs to be solved urgently. Summary of the invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a device control method, apparatus, electronic device and readable storage medium that overcome the above problems or at least partially solve the above problems.
[0005] In order to solve the above problems, an embodiment of the present invention discloses a device control method, which is applied to any terminal device in a control system, comprising:
[0006] In response to a received first control instruction corresponding to a control terminal in the control system, determining a first operation code indicated by the first control instruction;
[0007] Determine a second operation code corresponding to the first operation code based on a preset service library, and generate a second control instruction based on the second operation code; the second operation code is an operation code that complies with the control protocol of the terminal device;
[0008] Respond to the second control instruction to execute the operation indicated by the first control instruction.
[0009] The embodiment of the present invention further discloses a device control apparatus, which is applied to any terminal device in a control system, and the device includes:
[0010] A first determining module, configured to determine a first operation code indicated by a first control instruction in response to a first control instruction corresponding to a control terminal in a received control system;
[0011] A first generating module is used to determine a second operation code corresponding to the first operation code based on a preset service library, and generate a second control instruction based on the second operation code; the second operation code is an operation code that complies with the control protocol of the terminal device;
[0012] An execution module is used to respond to the second control instruction to execute the operation indicated by the first control instruction.
[0013] The embodiment of the present invention further discloses an electronic device, including: one or more processors; and
[0014] One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, enable the electronic device to perform the above-mentioned device control method.
[0015] The embodiment of the present invention further discloses a computer-readable storage medium, wherein a computer program stored in the storage medium enables a processor to execute the above-mentioned device control method.
[0016] The embodiments of the present invention include the following advantages:
[0017] The embodiment of the present invention determines the first operation code indicated by the first control instruction in response to the first control instruction corresponding to the control end in the control system; determines the second operation code corresponding to the first operation code based on the preset service library, and generates the second control instruction based on the second operation code; the second operation code is an operation code that conforms to the control protocol of the terminal device; responds to the second control instruction to perform the operation indicated by the first control instruction. In this way, the preset service library is used to obtain the operation code that conforms to the control protocol of the device from the received first control instruction, and further generates the second control instruction, so that the received instruction can be converted into an instruction that the device can recognize and respond to, thereby avoiding the problem that the first control instruction does not conform to the control protocol of the terminal device and cannot control the device, thereby enabling the control end to flexibly control the terminal device in the control system. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 is a flowchart of steps of an embodiment of a device control method of the present invention;
[0019] Figure 2 It is a schematic diagram of a control system under a visual networking of the present invention;
[0020] Figure 3 It is a structural block diagram of an embodiment of a device control device of the present invention. DETAILED DESCRIPTION
[0021] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0022] Reference Figure 1, shows a flow chart of steps of an embodiment of a device control method of the present invention, which can be applied to any terminal device in a control system, and specifically may include the following steps:
[0023] Step 101: In response to a received first control instruction corresponding to a control terminal in a control system, determine a first operation code indicated by the first control instruction.
[0024] Among them, the above-mentioned control system can be a system including multiple controllable terminal devices, and the above-mentioned terminal device refers to a device that can perform corresponding operations according to the received instructions. For example, the above-mentioned control system can be a monitoring system including multiple monitoring cameras, or it can be an online conference system including multiple sub-displays, or it can also be a visual network system. Among them, the above-mentioned terminal devices can be devices of different brands and models, and the embodiments of the present invention are not limited to this. Exemplarily, when the above-mentioned control system is a visual network system, the above-mentioned terminal device refers to a terminal device connected to the visual network for providing video resources. The terminal device in the control system can execute this step when it receives the first control instruction corresponding to the control end.
[0025] In an embodiment of the present invention, the above-mentioned control end is an end in the control system used to control the terminal device, and the above-mentioned first control instruction corresponds to the control end, that is, the first control instruction is generated based on the control request of the control end, and the above-mentioned first operation code is used to characterize the operation to be performed and is included in the above-mentioned first control instruction. For example, it can be "ON / OFF" to indicate the opening / closing of the device.
[0026] Step 102: determine a second operation code corresponding to the first operation code based on a preset service library, and generate a second control instruction based on the second operation code; the second operation code is an operation code that complies with the control protocol of the terminal device.
[0027] Among them, the above-mentioned preset service library is pre-established and used to store the operation codes of all terminal devices included in the control system. It should be noted that due to the differences in the brands, models, etc. of the terminal devices in the control system, the control protocols used by the terminal devices are different. Therefore, the second operation codes determined based on the same first operation code for different terminal devices are different, that is, the operation codes pre-stored in the above-mentioned preset service library correspond to each terminal device one by one. Exemplarily, when the first operation code is used to instruct the device to turn left, the operation code corresponding to the pan-tilt camera may be Left, and the operation code corresponding to the ordinary camera may be L. Therefore, the above-mentioned second operation code is defined by the control protocol of each device.
[0028] Step 103: respond to the second control instruction to execute the operation indicated by the first control instruction.
[0029] Among them, since the generated second control instruction is generated based on the second operation code that complies with the control protocol of the terminal device, the terminal device can directly execute the above second control instruction to complete the operation indicated by the received first control instruction.
[0030] In summary, in the embodiment of the present invention, by responding to the first control instruction corresponding to the control end in the received control system, the first operation code indicated by the first control instruction is determined; based on the preset service library, the second operation code corresponding to the first operation code is determined, and the second control instruction is generated based on the second operation code; the second operation code is an operation code that conforms to the control protocol of the terminal device; and the second control instruction is responded to to perform the operation indicated by the first control instruction. In this way, the preset service library is used to obtain the operation code that conforms to the control protocol of the present device from the received first control instruction, and the second control instruction is further generated, so that the received instruction can be converted into an instruction that the present device can recognize and respond to, thereby avoiding the problem that the first control instruction does not conform to the control protocol of the terminal device and cannot control the device, thereby enabling the control end to flexibly control the terminal device in the control system.
[0031] In a preferred embodiment of the present invention, the preset service library includes protocol operation codes pre-registered by the terminal device in the control system, and the protocol operation codes include operation codes supported by the control protocol of the terminal device; the above-mentioned operation of determining the second operation code corresponding to the first operation code based on the preset service library and generating the second control instruction based on the second operation code may specifically include the following steps:
[0032] Step 201: When the first operation code does not comply with the control protocol of the terminal device, determine the second operation code corresponding to the first operation code from the protocol operation codes pre-registered by the terminal device in the preset service library; the operation indicated by the second operation code is the same as the operation indicated by the first operation code.
[0033] Specifically, the protocol information of the control end can be obtained. When the control protocol represented by the protocol information is different from the control protocol of the terminal device, it is determined that the first operation code does not conform to the control protocol of the terminal device. On the contrary, it can be determined that the first operation code conforms to the control protocol of the terminal device. The control protocol represented by the protocol information is the control protocol followed by the control end. Alternatively, the terminal device can first respond to the first control instruction. When the terminal device cannot respond to the first control instruction, it indicates that the first operation code does not conform to the control protocol of the terminal device.
[0034] Furthermore, when the first operation code does not conform to the control protocol of the terminal device, it indicates that the control protocol of the terminal device is different from that of the control end, and the two belong to different platforms. The terminal device cannot directly execute the first control instruction, and at this time, an operation code that conforms to the control protocol of the terminal device can be obtained from the preset service library. Among them, the above-mentioned protocol operation code can be an operation code supported by the control protocol of the terminal device, which can include the operation code corresponding to the corresponding operation performed by the device under the control protocol. Specifically, the above-mentioned protocol operation code may include the format of the instruction received by the terminal device and the meaning represented by each data bit in the format. For example, the first bit of the received data may represent the address of the device, the second bit may represent the type of action that the device needs to perform (for example, when the terminal device is a camera, it may be to zoom in or out), and the third bit may represent the target value of the device when performing the corresponding action type (for example, the multiple of zooming in or out)... Accordingly, the above-mentioned operation code may correspond to the above-mentioned action type and target value that need to be performed. It can be understood that different terminal devices have different control protocols defined at the factory. Therefore, the above-mentioned protocol operation code and the operations supported by the control protocol can be set by the above-mentioned terminal device according to actual conditions. The embodiment of the present invention only proposes a possible form.
[0035] Optionally, the data stored in the preset service library may be in the form of a correspondence table. Specifically, the preset service library may pre-store a correspondence table between the protocol operation code of the control terminal and the protocol operation code pre-registered by each terminal device. Among them, for any protocol operation code of the control terminal, the protocol operation code corresponds to the protocol operation code representing the same operation in the protocol operation code pre-registered by the terminal device. Specifically, the operation code of the control terminal corresponding to the same operation may be directly corresponded to the operation code of the terminal device. Alternatively, identifiers may be set for different operations so that the operation code of the control terminal and the operation code pre-registered by each terminal device correspond to the corresponding identifiers, that is, the operation code of the control terminal corresponding to the same operation and the operation code of the terminal device correspond to the identifier corresponding to the operation respectively. Thus, the corresponding second operation code may be queried according to the first operation code in the received first control instruction.
[0036] Specifically, for each terminal device, a corresponding relationship table between the protocol operation code of the control end and the protocol operation code pre-registered by the terminal device is created respectively. That is to say, the preset service library stores the corresponding relationship table of each terminal device. Assuming that there are 10 terminal devices, the preset service library stores the corresponding relationship table of each of the 10 terminal devices. Among them, the corresponding relationship table of each terminal device can be associated with the device identification of the terminal device. Exemplarily, the device identification can include a device address, a device number, etc. Correspondingly, for the terminal device that receives the first control instruction, the terminal device can first determine the corresponding relationship table corresponding to itself from multiple corresponding relationship tables. Specifically, the corresponding relationship table whose associated device identification is consistent with the device identification of the terminal device can be determined as the corresponding relationship table corresponding to the terminal device. Then, the second operation code corresponding to the first operation code is searched from the corresponding relationship table corresponding to the terminal device. Specifically, the first operation code can be compared with the operation code of the control end in the corresponding relationship table corresponding to the terminal device, and the operation code corresponding to the operation code of the control end consistent with the first operation code can be determined as the second operation code.
[0037] Accordingly, when the first operation code complies with the control protocol of the terminal device, it indicates that the terminal device and the control end use the same control protocol. In this case, there is no need to generate a second control instruction, and the terminal device can directly respond to the first control instruction to perform the corresponding operation.
[0038] Step 202: Generate a second control instruction including the second operation code according to the control protocol of the terminal device.
[0039] It should be noted that, due to different operations to be performed, the number of bits of the operation code included in the instruction may also be different. Therefore, the first and second operation codes mentioned above can be single-bit data or multi-bit data.
[0040] Specifically, after obtaining the second operation code, since the control protocol includes the standard format of the instruction that can be recognized by the terminal device, the control instruction including the second operation code can be generated according to the standard format of the control protocol supported by the terminal device, that is, the corresponding data is set based on each bit of the standard format, and the second operation code is set at the position corresponding to the standard format, so that the corresponding operation can be performed based on the control instruction. For example, taking the first control instruction indicating to enlarge the screen to 2 times as an example, the first operation code in the first control instruction can be "Gain, 2", and since the device cannot recognize the operation indicated by the first operation code, after obtaining the pre-registered second operation code "zoom+, 2" from the preset service library, the second control instruction can be further generated as "0X00, zoom+, 2, 0X00", wherein the above "0X00" can be the start and end position of the instruction specified by the standard format of the control protocol of the device. It can be understood that different terminal devices have different control protocols, and the corresponding second operation codes and second control instructions are different. The above example only gives a possible form, and it can also be other forms, and the embodiment of the present invention does not limit this.
[0041] In an embodiment of the present invention, the preset service library includes the protocol operation codes pre-registered by each terminal device in the control system, and the protocol operation codes include the operation codes supported by the control protocol of the terminal device; by determining the second operation code corresponding to the first operation code from the protocol operation codes pre-registered by the terminal device in the preset service library when the first operation code does not conform to the control protocol of the terminal device; and generating the second control instruction containing the second operation code according to the control protocol of the terminal device. In this way, the second control instruction supported by the terminal device can be generated according to the control protocol through the operation codes supported by the pre-registered control protocol contained in the preset service library, so that the received instruction can be converted into an instruction that the device can recognize and respond to, thereby improving the flexibility of device control. At the same time, since the operation of determining the second operation code and generating the second control instruction is performed only when the first operation code does not conform to the control protocol of the terminal device, unnecessary processing operations can be avoided, thereby saving processing resources and improving the efficiency of device control.
[0042] In a preferred embodiment of the present invention, the following steps may also be included:
[0043] Step 301: Establish a connection based on the control service in the terminal device and the control service in the data service end.
[0044] The control service can be in the form of software (Software Development Kit, SDK) or application, and can be connected to the terminal device to enable the terminal device to support cross-platform control. Specifically, the terminal device can install or connect to the control service, so that the control service can be connected to the control service in the data service end through the control service. The control service in the data service end can be understood as the server end of the control service, and a connection can be established with the terminal device through the IP address of any terminal device that has installed or connected the control service.
[0045] Step 302: register the attribute information of the terminal device into the preset service library through the control service in the terminal device; the attribute information at least includes the protocol operation code of the terminal device.
[0046] Among them, the above-mentioned preset service library can be a database set in the above-mentioned data service end. When the terminal device establishes a connection with the above-mentioned control service, the attribute information of the device can be registered in the above-mentioned preset service library through the control service, so that when the terminal device receives the first control instruction, the protocol operation code corresponding to the device can be obtained from the preset service library.
[0047] Specifically, the above registration operation can be implemented through a pre-set registration interface or initialization interface, that is, the terminal device can upload the attribute information to the preset service library by calling the registration interface.
[0048] In the embodiment of the present invention, a connection is established based on the control service in the terminal device and the control service in the data service end; the attribute information of the terminal device is registered in the preset service library through the control service in the terminal device; the attribute information at least includes the protocol operation code of the terminal device. In this way, by pre-registering the attribute information of the device in the preset service library when establishing a connection with the control service, the operation code supported by the terminal device can be easily obtained, further improving the efficiency of device control.
[0049] In a preferred embodiment of the present invention, the following steps may be specifically included:
[0050] Step 401: Receive the first control instruction in a preset format forwarded by the management terminal in the control system; the first control instruction is generated based on the request instruction submitted by the control terminal.
[0051] The management end refers to the end in the control system for forwarding control instructions to the terminal device, and the preset format refers to the unified format for communication in the control system. Furthermore, a communication protocol can be predefined so that data or instruction transmission in the control system is carried out using the protocol. For example, the preset format can be:
[0052] Send:{“id”: message id, “server”: service type protocol number, “cmd”: command number corresponding to the service, “data”: “send data information”};
[0053] Receive:{“id”: message id, “server”: service type protocol number, “cmd”: command number, “ack”: “reply data information”}.
[0054] Among them, the message id (Identity document) refers to the identifier of the message instruction. Each message can be numbered in chronological order, or the message id can be obtained by receiving user input. The embodiment of the present invention does not limit this. It should be noted that the message id is the unique identifier of the instruction, which is used to distinguish different instructions. Therefore, the message ids of different instructions are different. The service type protocol number (server) refers to the number of the service type applied for by the instruction, which can be understood as the type of terminal device to be controlled. For example, it can be a pan-tilt camera, or a sub-display, etc. Specifically, the terminal devices to be controlled can be numbered in advance according to the type or platform, so that the type of terminal device to be controlled by the instruction can be obtained based on the number. The command number (Command Prompt, cmd) refers to the operation to be performed on the terminal device indicated in the server. For example, it can be a command number for power on or off, or a command number for left or right turn. Specifically, the specific form and number of the command number can be set according to actual needs. For example, some operations that may need to be performed can be predefined. For example, power on or off can be represented by ON / OFF, left or right turn can be represented by L / R, and the request version number can be represented by VN. The sent data information (data) and reply data information (ack) can be data or text information required to be carried in the instruction. It should be noted that the data or ack can be empty in some cases. For example, when the sent instruction is used to request the version number of the device, it is not necessary to carry specific data information, and the reply instruction can set the requested version number data in ack. When the sent instruction is used to instruct the device to turn left or right, the specific angle value of the device rotation can be set in data, and the reply instruction does not need to carry specific ack information, or the feedback information of "completed" can be set in ack. It can be understood that the first operation code in the aforementioned step 101 may refer to the aforementioned sever and cmd.
[0055] Optionally, the above-mentioned predefined command numbers can be set in the above-mentioned preset service library. When the terminal device establishes a connection with the control service, the operation code corresponding to the device can be uploaded according to the different command numbers pre-set therein. That is, each command number in the above-mentioned preset service library can correspond to the operation codes corresponding to multiple devices.
[0056] The above operation of determining the first operation code indicated by the first control instruction may include:
[0057] Step 402: Analyze the first control instruction based on the target file package included in the control service in the terminal device to obtain the first operation code; the target file package defines a parsing method of the preset format.
[0058] The target file package refers to a file package for storing the preset format, which includes a parsing method of the preset format. Correspondingly, the target file package may also include an encoding method of the preset format.
[0059] Specifically, after receiving the first control instruction, the terminal device can parse the first control instruction by calling the target file package in the control service to obtain the above-mentioned first operation code. It can be understood that the parsing methods of instructions of different formats are different. Therefore, using a file package containing a parsing method to analyze the format can improve the efficiency of obtaining the first operation code.
[0060] In the embodiment of the present invention, the first control instruction in a preset format forwarded by the management end in the control system is received; the first control instruction is generated based on the request instruction submitted by the control end in the control system; the first control instruction is analyzed based on the target file package contained in the control service in the terminal device to obtain the first operation code; the target file package defines the parsing method of the preset format. In this way, by defining the preset format, the first control instructions received by the terminal device are all in the preset format, and the first operation code can be obtained more conveniently according to the preset format, and the second operation code can be obtained from the preset service library. At the same time, it can also be realized that terminal devices of different platforms can be controlled by a set of instructions in a unified format, thereby improving control efficiency.
[0061] In a preferred embodiment of the present invention, the attribute information also includes the terminal address and type code of the terminal device; the first control instruction is generated by the management end after receiving the request instruction submitted by the control end, based on the first operation code and type code contained in the request instruction; the type code contained in the request instruction is pulled by the control end from the preset service library; the first control instruction is determined by the management end from the control system based on the terminal number contained in the request instruction, and the device address of the terminal device is pulled from the preset service library, and sent to the terminal device based on the device address of the terminal device.
[0062] The terminal address refers to the LAN address (Media Access Control Address, MAC address) of the terminal device, which is used to characterize the network node of each terminal device in the LAN. The type code is used to characterize the type of the terminal device, such as a PTZ camera or a sub-display.
[0063] Among them, the above-mentioned control end refers to the end used for device control in the control system, which can be understood as the host in the monitoring system, the chairman end in the conference system, etc. The above-mentioned request instruction refers to the instruction issued by the control end for requesting to perform a corresponding operation on a certain terminal device. Optionally, the control end can generate a request instruction by receiving user input. For example, when the control system is a monitoring system and it is necessary to perform a zoom operation on camera A in the monitoring system, the user can select the control of camera A on the host end and click the zoom operation in the interface corresponding to camera A, so that the type code corresponding to camera A can be obtained based on the preset service library, and a request instruction containing (camera A type code, zoom) is generated. Optionally, the above-mentioned control end can select multiple terminal devices to be controlled at the same time.
[0064] Optionally, the management terminal can also assign corresponding terminal numbers to each terminal device based on the terminal devices registered in the preset service library. The terminal numbers can be assigned in the order of the registration time of each device, or they can be randomly assigned. It is only necessary to ensure that the terminal number of each terminal device is unique. Furthermore, before generating a request instruction, the control terminal can also initiate an acquisition request to the management terminal to obtain a list of controllable terminal devices, wherein the list can include the terminal number and type code of each terminal device, so that the control terminal can select the terminal device to be controlled based on the list of controllable terminal devices. Alternatively, when the control terminal has determined the terminal device to be controlled based on the user's input, it can further determine whether the device exists in the list of controllable terminal devices. If so, it can further generate a request instruction and send the request instruction to the management terminal. Optionally, the request instruction can also be generated and sent according to the preset format.
[0065] Optionally, when there are multiple control terminals in the control system, after the request instruction is generated, the address and device number of the control terminal that issues the request instruction may be supplemented for the request instruction.
[0066] Specifically, after receiving the request instruction sent by the control end, the management end can obtain the terminal device indicated by the instruction based on the terminal number contained therein, and obtain the corresponding device address from the preset service library based on the terminal number. Further, the management end can identify the network location of the terminal device based on the device address, and supplement the corresponding protocol header for the request instruction based on the network location, thereby generating a first control instruction. For example, when the device address indicates that the terminal device and the management end are located in the same local area network, the protocol header can be empty, and the management end can directly send the first control instruction to the corresponding device address. When the device address indicates that the terminal device and the management end are located in different local area networks, the management end can further query the address of the local area network where the terminal device is located, and use the address as a protocol header to supplement the request instruction to generate the first control instruction, thereby sending the first control instruction to the device address.
[0067] Optionally, when the terminal device is a pan-tilt device, the above-mentioned attribute information may also include parameters such as a pan-tilt horizontal control interface, a pan-tilt vertical control interface, and a pan-tilt preset position setting interface, so that the management end can obtain the status of the pan-tilt in real time through the above-mentioned interface, and can also perform preset position configuration for each terminal device through the above-mentioned preset position setting interface, thereby realizing batch control of terminal devices and realizing simultaneous operation of multiple devices.
[0068] In the embodiment of the present invention, the attribute information registered with the preset service library is also set to include the terminal address and type code of the terminal device; the first control instruction is generated by the management end after receiving the request instruction submitted by the control end, based on the first operation code and type code contained in the request instruction; the type code contained in the request instruction is pulled by the control end from the preset service library; the first control instruction is determined by the management end from the terminal devices of the control system based on the terminal number contained in the request instruction, and the device address of the terminal device is pulled from the preset service library, and sent to the terminal device based on the device address of the terminal device. In this way, the control end can obtain the type code of the controllable device through the preset service library, and send a request instruction to the management end when necessary. At the same time, the management end can conveniently send a control instruction to the corresponding terminal device based on the device address in the preset service library, thereby further improving the efficiency of device control.
[0069] In a preferred embodiment of the present invention, the following steps may be specifically included:
[0070] Step 501: Generate a feedback instruction when the operation indicated by the first control instruction is completed.
[0071] Step 502: Send the feedback instruction to the management end in the control system; the management end is also used to send the feedback instruction to the control end in the control system.
[0072] When the terminal device completes the indicated operation, a feedback instruction may be generated and sent to the management end, and the management end further sends the feedback instruction to the control end.
[0073] Specifically, the feedback instruction is used to indicate that the operation has been completed. Furthermore, the feedback instruction may include the message ID of the first control instruction and feedback information, so that the management end can obtain the control end that issued the request through the message ID, and send the feedback information to the corresponding control end. The feedback information may be in the form of a string.
[0074] Optionally, the feedback instruction can also be generated and sent in a preset format. Specifically, the terminal device can generate a feedback instruction in a preset format by calling the control service. Optionally, the attribute information can also include a data transceiver interface of the terminal device, so that the control service can send the generated feedback instruction through the data sending interface, and can also obtain the control instruction received by the terminal device through the data receiving interface.
[0075] In the embodiment of the present invention, a feedback instruction is generated when the operation indicated by the first control instruction is completed; the feedback instruction is sent to the management end in the control system; and the management end is further used to send the feedback instruction to the control end in the control system. In this way, the control end can be informed of the control state of the current control in a timely manner, avoiding sending the same control instruction to the same terminal device in a short time, and reducing resource loss in the control system.
[0076] In a preferred embodiment of the present invention, the following steps may be specifically included:
[0077] Step 601: If the operation indicated by the first control instruction is not completed within a preset time, the first control instruction regenerated by the management terminal in the control system is received again.
[0078] Step 602: Re-execute the operation of determining the first operation code indicated by the first control instruction in response to receiving the first control instruction.
[0079] The preset time can be set according to actual needs, for example, it can be set to 3s or 5s, and the embodiment of the present invention does not limit this.
[0080] Specifically, when the terminal device fails to complete the indicated operation within the preset time, it may be due to problems in the data transmission process or terminal device failure. At this time, the management end can resend the above-mentioned first control instruction to the terminal device, and the terminal device can re-execute the above-mentioned steps 101-103.
[0081] Specifically, the management end may determine whether the terminal device completes the operation by whether a feedback instruction is received within a preset time, or may determine by obtaining the current operating status of the terminal device.
[0082] Optionally, a preset number of times can also be set. When the management end sends the same control instruction to the terminal device a preset number of times, it can be considered that the terminal device has a fault (data reception and transmission failure or operation failure). At this time, an instruction on the terminal device failure can be returned to the control end that initiated the request.
[0083] In the embodiment of the present invention, when the operation indicated by the first control instruction is not completed within the preset time, the first control instruction regenerated by the management end in the control system is re-received; and the operation of determining the first operation code indicated by the first control instruction in response to receiving the first control instruction is re-executed. In this way, when the terminal device does not complete the indicated operation within the preset time, the management end does not need to re-initiate a request, and the first control instruction is automatically re-sent by the management end, thereby reducing unnecessary occupancy of the control end.
[0084] Reference Figure 2 , showing a schematic diagram of a control system under a visual network of the present invention, wherein the visual network is an important milestone in the development of the network, a more advanced form of the Internet, and a real-time network that can achieve real-time transmission of high-definition video over the entire network that is currently unattainable on the Internet, and push many Internet applications towards high-definition video and high-definition face-to-face. Ultimately, the world will be free of distance, and the distance between people around the world will be the distance of a screen. By connecting the terminal to the visual network, the video resources of the monitoring terminal can be flexibly scheduled during the visual network conference.
[0085] like Figure 2 As shown, the conference control terminal in the figure refers to the control terminal, and the conference management system server refers to the above-mentioned management terminal, which is a visual network server that provides management services for video conferencing. Accordingly, Figure 2The terminal devices 1 to n shown in the figure are the above-mentioned terminal devices, which include PTZ devices and ordinary devices. Specifically, during a video conference, part of the video resources displayed by the conference control terminal (chairman terminal) are transmitted back by the PTZ device. However, due to the different manufacturers of different PTZ devices and the different control protocols defined, the conference control terminal cannot remotely control some monitoring terminals, resulting in a waste of resources. The method proposed in the embodiment of the present invention can solve the above problem.
[0086] Specifically, Figure 2 The visual network remote control service SDK shown in refers to the above-mentioned control service under the visual network system. It can be seen that the control service can be deployed in the control end, the management end and the terminal device. By deploying the control service in the terminal device, each terminal device can support the remote control function of the control end, and the management end can obtain the list of controllable terminal devices through the control service, realize real-time management of resources, and realize the sending, receiving and forwarding of instructions. Correspondingly, the control end can obtain the above-mentioned list of controllable terminal devices through the control service to realize flexible calling.
[0087] Optionally, an embodiment of the present invention further provides a device control method, the method is applied to a control system, the system includes a control end, a management end and a terminal device, the method includes:
[0088] The control end generates a request instruction based on the input operation in response to the input operation, and sends the request instruction to the management end.
[0089] The management end, upon receiving the request instruction sent by the control end, generates a first control instruction based on the request instruction, and determines a terminal device from the terminal devices based on the request instruction, so as to send the first control instruction to the terminal device;
[0090] When receiving the first control instruction, the terminal device determines a first operation code indicated by the first control instruction, and determines a second operation code corresponding to the first operation code based on a preset service library;
[0091] The terminal device generates a second control instruction based on the second operation code; the second operation code is an operation code that complies with the control protocol of the terminal device;
[0092] The terminal device responds to the second control instruction to execute the operation indicated by the first control instruction.
[0093] Optionally, when the terminal device completes the operation indicated by the first control instruction, it generates a feedback instruction and sends the feedback instruction to the management end;
[0094] When receiving the feedback instruction, the management end forwards the feedback instruction to the control end;
[0095] Optionally, when the management end does not receive the feedback instruction within a preset time, the management end resends the first control instruction to the terminal device.
[0096] In summary, the device control method applied in the control system according to the embodiment of the present invention is that the control end responds to the input operation, generates a request instruction based on the input operation, and sends the request instruction to the management end. When the management end receives the request instruction sent by the control end, it generates a first control instruction based on the request instruction, and determines the terminal device from the terminal device based on the request instruction to send the first control instruction to the terminal device; when the terminal device receives the first control instruction, it determines the first operation code indicated by the first control instruction, and determines the second operation code corresponding to the first operation code based on the preset service library; the terminal device generates a second control instruction based on the second operation code; the second operation code is an operation code that complies with the control protocol of the terminal device; the terminal device responds to the second control instruction to perform the operation indicated by the first control instruction; when the terminal device completes the operation indicated by the first control instruction, it generates a feedback instruction and sends the feedback instruction to the management end; when the management end receives the feedback instruction, it forwards the feedback instruction to the control end; when the management end does not receive the feedback instruction within a preset time, it resends the first control instruction to the terminal device. In this way, by using the preset service library to obtain the operation code that complies with the control protocol of this device from the received first control instruction, and further generate the second control instruction, the received instruction can be converted into an instruction that this device can recognize and respond to, thereby avoiding the problem that the first control instruction does not comply with the control protocol of the terminal device and the device cannot be controlled, thereby enabling the control end to flexibly control the terminal device in the control system.
[0097] Reference Figure 3 , shows a structural block diagram of an embodiment of a device control device of the present invention, which can be applied to any terminal device in a control system, and the device 70 includes:
[0098] A first determining module 701 is used to determine a first operation code indicated by a first control instruction in response to a first control instruction corresponding to a control terminal in a received control system;
[0099] A first generating module 702 is used to determine a second operation code corresponding to the first operation code based on a preset service library, and generate a second control instruction based on the second operation code; the second operation code is an operation code that complies with the control protocol of the terminal device;
[0100] The execution module 703 is used to respond to the second control instruction to execute the operation indicated by the first control instruction.
[0101] In a preferred embodiment of the present invention, the preset service library includes protocol operation codes pre-registered by terminal devices in the control system, and the protocol operation codes include operation codes supported by the control protocol of the terminal devices; the first generation module 702 includes:
[0102] a second determination submodule, configured to determine, when the first operation code does not conform to the control protocol of the terminal device, the second operation code corresponding to the first operation code from the protocol operation codes pre-registered by the terminal device in the preset service library; the operation indicated by the second operation code is the same as the operation indicated by the first operation code;
[0103] The second generating submodule is used to generate a second control instruction including the second operation code according to the control protocol of the terminal device.
[0104] In a preferred embodiment of the present invention, the device 70 further comprises:
[0105] A connection establishment module, used to establish a connection between the control service in the terminal device and the control service in the data service end;
[0106] A registration module is used to register the attribute information of the terminal device into the preset service library through the control service in the terminal device; the attribute information at least includes the protocol operation code of the terminal device.
[0107] In a preferred embodiment of the present invention, the device 70 further comprises:
[0108] A first receiving module, configured to receive the first control instruction in a preset format forwarded by a management terminal in the control system; the first control instruction is generated based on a request instruction submitted by the control terminal;
[0109] The first determination module 701 is specifically used to: analyze the first control instruction based on the target file package included in the control service in the terminal device to obtain the first operation code; the target file package defines the parsing method of the preset format.
[0110] In a preferred embodiment of the present invention, the attribute information further includes a terminal address and a type code of the terminal device;
[0111] The first control instruction is generated by the management end after receiving the request instruction submitted by the control end, based on the first operation code and the type code contained in the request instruction; the type code contained in the request instruction is pulled by the control end from the preset service library;
[0112] The first control instruction is that the management end determines the terminal device from the control system based on the terminal number contained in the request instruction, pulls the device address of the terminal device from the preset service library, and sends it to the terminal device based on the device address of the terminal device.
[0113] In a preferred embodiment of the present invention, the device 70 further comprises:
[0114] A third generating module, configured to generate a feedback instruction when the operation indicated by the first control instruction is completed;
[0115] The sending module is used to send the feedback instruction to the management end in the control system; the management end is also used to send the feedback instruction to the control end in the control system.
[0116] In a preferred embodiment of the present invention, the device 70 further comprises:
[0117] The second receiving module is used to re-receive the first control instruction regenerated by the management end in the control system when the operation indicated by the first control instruction is not completed within a preset time; and re-execute the operation of determining the first operation code indicated by the first control instruction in response to receiving the first control instruction.
[0118] In summary, the embodiment of the present invention determines the first operation code indicated by the first control instruction in response to the first control instruction corresponding to the received control terminal; determines the second operation code corresponding to the first operation code based on the preset service library, and generates the second control instruction based on the second operation code; the second operation code is an operation code that conforms to the control protocol of the terminal device; responds to the second control instruction to perform the operation indicated by the first control instruction. In this way, the preset service library is used to obtain the operation code that conforms to the control protocol of the device from the received first control instruction, and further generates the second control instruction, so that the received instruction can be converted into an instruction that the device can recognize and respond to, thereby avoiding the problem that the first control instruction does not conform to the control protocol of the terminal device and cannot control the device, and thus the control terminal can flexibly control the terminal device in the control system.
[0119] The present invention also provides an electronic device, comprising: one or more processors; and
[0120] One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, enable the electronic device to implement the device control method of the aforementioned embodiment when executing the program.
[0121] The present invention also provides a readable storage medium, the computer program stored in the medium enables a processor to execute the device control method of the aforementioned embodiment.
[0122] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0123] It should be noted that all actions of acquiring signals, information or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where they are located and with the authorization given by the owner of the corresponding device.
[0124] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0125] It will be appreciated by those skilled in the art that the embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0126] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0127] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0128] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0129] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.
[0130] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0131] The above is a detailed introduction to a device control method, apparatus, electronic device and readable storage medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for a general technician in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A device control method, characterized in that: Applied to any terminal device in a control system, the method comprises: In response to a received first control instruction corresponding to a control terminal in the control system, determining a first operation code indicated by the first control instruction, wherein the first operation code is used to represent an operation to be performed and is included in the first control instruction; Determine a second operation code corresponding to the first operation code based on a preset service library, and generate a second control instruction based on the second operation code; the second operation code is an operation code that complies with the control protocol of the terminal device, wherein the operation codes pre-stored in the preset service library correspond to each terminal device one by one; Responding to the second control instruction to perform the operation indicated by the first control instruction; The preset service library includes protocol operation codes pre-registered by terminal devices in the control system, and the protocol operation codes include operation codes supported by the control protocol of the terminal devices; The determining, based on a preset service library, a second operation code corresponding to the first operation code, and generating a second control instruction based on the second operation code, includes: In the case where the first operation code does not conform to the control protocol of the terminal device, determining the second operation code corresponding to the first operation code from the protocol operation codes pre-registered by the terminal device in the preset service library; the operation indicated by the second operation code is the same as the operation indicated by the first operation code; generating a second control instruction including the second operation code according to a control protocol of the terminal device; The method further includes: receiving the first control instruction conforming to a preset format forwarded by a management terminal in the control system; the first control instruction is generated based on a request instruction submitted by the control terminal; The determining the first operation code indicated by the first control instruction includes: Based on the target file package included in the control service in the terminal device, the first control instruction is analyzed to obtain the first operation code; the target file package defines a parsing method of the preset format.
2. The method according to claim 1, characterized in that: The method further comprises: Establishing a connection based on the control service in the terminal device and the control service in the data service end; The attribute information of the terminal device is registered in the preset service library through the control service in the terminal device; the attribute information at least includes the protocol operation code of the terminal device.
3. The method according to claim 2, characterized in that The attribute information also includes the terminal address and type code of the terminal device; The first control instruction is generated by the management end after receiving the request instruction submitted by the control end, based on the first operation code and the type code contained in the request instruction; the type code contained in the request instruction is pulled by the control end from the preset service library; The first control instruction is that the management end determines the terminal device from the control system based on the terminal number contained in the request instruction, pulls the device address of the terminal device from the preset service library, and sends it to the terminal device based on the device address of the terminal device.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: When the operation indicated by the first control instruction is completed, generating a feedback instruction; The feedback instruction is sent to the management end in the control system; the management end is also used to send the feedback instruction to the control end in the control system.
5. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: If the operation indicated by the first control instruction is not completed within a preset time, re-receiving the first control instruction regenerated by the management end in the control system; The operation of determining the first operation code indicated by the first control instruction in response to receiving the first control instruction is re-executed.
6. A device control device, characterized in that: Applicable to any terminal device in a control system, the device comprises: A first determining module, configured to determine a first operation code indicated by a received first control instruction corresponding to a control terminal in the control system, wherein the first operation code is used to represent an operation to be performed and is included in the first control instruction; A first generating module is used to determine a second operation code corresponding to the first operation code based on a preset service library, and generate a second control instruction based on the second operation code; the second operation code is an operation code that complies with the control protocol of the terminal device, wherein the operation codes pre-stored in the preset service library correspond to each terminal device one by one; an execution module, configured to respond to the second control instruction to execute the operation indicated by the first control instruction; The preset service library includes protocol operation codes pre-registered by terminal devices in the control system, and the protocol operation codes include operation codes supported by the control protocol of the terminal devices; The first generating module comprises: a second determination submodule, configured to determine, when the first operation code does not conform to the control protocol of the terminal device, the second operation code corresponding to the first operation code from the protocol operation codes pre-registered by the terminal device in the preset service library; the operation indicated by the second operation code is the same as the operation indicated by the first operation code; A second generating submodule, used for generating a second control instruction including the second operation code according to the control protocol of the terminal device; The device further comprises: a first receiving module, configured to receive the first control instruction conforming to a preset format forwarded by a management terminal in the control system; the first control instruction is generated based on a request instruction submitted by the control terminal; The first determination module is specifically used to: analyze the first control instruction based on the target file package included in the control service in the terminal device to obtain the first operation code; the target file package defines the parsing method of the preset format.
7. An electronic device, characterized in that: include: one or more processors; and One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, enable the electronic device to execute the device control method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer program stored therein enables the processor to execute the device control method as claimed in any one of claims 1 to 5.
