Character control method, device and equipment
By determining the device identification when the terminal establishes a connection with the controlled device and establishing a correspondence relationship based on the connection sequence, the problem of the terminal master-slave role allocation in the prior art is solved, and more efficient role control is achieved.
Patent Information
- Application Number
- CN202080005235.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-16
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2040-06-16
AI Technical Summary
In the prior art, the method of determining the terminal master-slave role is long and occupies more resources.
When the terminal establishes a connection with the controlled device, the device identification of the terminal is determined, and based on the order in which the multiple terminals establish connections with the controlled device, a correspondence relationship between the device identification and the device role is established to realize role control.
Reduce the duration of the role consumed and the resources occupied by determining the role, and improve the efficiency of role allocation.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a character control method, device and equipment. Background Art
[0002] Currently, a scenario has been proposed where multiple terminals are connected to the same controlled device, in which a master-slave relationship exists between the multiple terminals. For example, in a drone scenario, a terminal as a host can control the flight of the drone, and a terminal as a slave can control the shooting of a camera mounted on the drone.
[0003] Usually, the master-slave roles of the terminal are assigned through negotiation between the terminal and the controlled device, and multiple communications are required between the terminal and the controlled device to complete the negotiation. Specifically, after a terminal establishes a connection with a controlled device, the terminal first sends a role request to the controlled device to request a target role. If the controlled device agrees to assign the target role to the terminal, it returns a successful request response. The terminal sets the role to the target role according to the successful request response, and sends a successful setting response to the controlled device after the setting is successful. The controlled device also sets the role of the terminal to the target role on the controlled device side according to the successful setting response, thus completing the master-slave role assignment of the terminal. If the controlled device does not agree to assign the target role to the terminal, more communications are required between the terminal and the controlled device to complete the negotiation.
[0004] However, the above method of determining the master and slave roles of the terminals has the problem of being time-consuming and occupying a lot of resources. Summary of the invention
[0005] The embodiments of the present application provide a role control method, device and equipment to solve the problem that the method of determining the master and slave roles of terminals in the prior art is time-consuming and occupies more resources.
[0006] In a first aspect, an embodiment of the present application provides a role control method, which is applied to a controlled device, including:
[0007] Establishing a connection with the terminal by performing signaling interaction with the terminal;
[0008] When a connection is established with the terminal, determining a device identification of the terminal;
[0009] There is a correspondence between the device identifications and device roles of the multiple terminals, the correspondence is used to characterize the device roles of the multiple terminals respectively, and the correspondence is obtained based on the sequence in which the multiple terminals establish connections with the controlled devices.
[0010] In a second aspect, an embodiment of the present application provides a role control device, applied to a controlled device, comprising: a memory and a processor;
[0011] The memory is used to store program code;
[0012] The processor calls the program code, and when the program code is executed, is used to perform the following operations:
[0013] Establishing a connection with the terminal by performing signaling interaction with the terminal;
[0014] When a connection is established with the terminal, determining a device identification of the terminal;
[0015] There is a correspondence between the device identifications and device roles of the multiple terminals, the correspondence is used to characterize the device roles of the multiple terminals respectively, and the correspondence is obtained based on the sequence in which the multiple terminals establish connections with the controlled devices.
[0016] In a third aspect, an embodiment of the present application provides a drone, the drone comprising a fuselage, a power system disposed on the fuselage, a shooting device, and a character control device;
[0017] The power system is used to provide power for the UAV;
[0018] The shooting device is used to shoot video during the flight of the drone, and the shot video is used for image transmission;
[0019] The character control device includes a memory and a processor;
[0020] The memory is used to store program code;
[0021] The processor calls the program code, and when the program code is executed, is used to perform the following operations:
[0022] Establishing a connection with the terminal by performing signaling interaction with the terminal;
[0023] When a connection is established with the terminal, determining a device identification of the terminal;
[0024] There is a correspondence between the device identifications and device roles of the multiple terminals, the correspondence is used to characterize the device roles of the multiple terminals respectively, and the correspondence is obtained based on the sequence in which the multiple terminals establish connections with the controlled devices.
[0025] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes at least one segment of code, and the at least one segment of code can be executed by a computer to control the computer to execute any of the methods described in the first aspect above.
[0026] In a fifth aspect, an embodiment of the present application provides a computer program, which, when executed by a computer, is used to implement the method described in any one of the first aspects above.
[0027] The embodiments of the present application provide a role control method, apparatus and device, which determine the device identification of a terminal when establishing a connection with the terminal, wherein a corresponding relationship exists between the device identifications and device roles of multiple terminals, and the corresponding relationship is used to characterize the device roles of the multiple terminals respectively, and the corresponding relationship is obtained based on the order in which the multiple terminals establish connections with the controlled devices. Since the corresponding relationship is obtained based on the order in which the multiple terminals establish connections with the controlled devices, it is possible to implement a role control method in which the controlled device determines the device role of the terminal based on the order in which the terminal establishes connections with it. Compared with allocating the master and slave roles of the terminal through negotiation between the terminal and the controlled device, which requires multiple communications between the terminal and the controlled device to complete the negotiation, the time consumed for determining the role and the resources occupied are reduced. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0029] Figure 1 Schematic diagram of application scenarios of the character control method provided in the embodiment of the present application;
[0030] Figure 2 A flowchart of a character control method provided in one embodiment of the present application;
[0031] Figure 3 A flowchart of a character control method provided by another embodiment of the present application;
[0032] Figure 4 A flowchart of a character control method provided by another embodiment of the present application;
[0033] Figure 5 A schematic diagram of data forwarding provided in an embodiment of the present application;
[0034] Figure 6 A schematic diagram of data forwarding provided by another embodiment of the present application;
[0035] Figure 7 A schematic diagram of the structure of a character control device provided in one embodiment of the present application;
[0036] Figure 8A schematic diagram of the structure of a drone provided in one embodiment of the present application. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0038] The role control method provided in the embodiment of the present application can be applied to Figure 1 The control system 10 shown includes a controlled device 11 and multiple terminals 12. The multiple terminals 12 can establish a connection with the controlled device 11, and there is a master-slave relationship between the multiple terminals 12. Specifically, the device role of at least one of the multiple terminals 12 is a host, and the device role of at least one of the multiple terminals 12 is a slave. Among them, the controlled device 11 can use the role control method provided in the embodiment of the present application to control the device role of the terminal 12.
[0039] For different control systems, the specific types of the controlled device 11 and the terminal 12 may be different. In one embodiment, taking the control scenario of a drone as an example, the controlled device 11 may be a drone, and the terminal 12 may include a remote controller with a screen, a smart phone, and the like.
[0040] It should be noted that terminals 12 with different device roles may provide different functions for the controlled device 11. In one embodiment, taking the controlled device 11 as a drone, a terminal with a device role of a host can control the flight of the drone, while a terminal with a device role of a slave can control the shooting of a camera mounted on the drone.
[0041] The connection established between the terminal 12 and the controlled device 11 may be any type of connection that needs to be established through signaling interaction. Exemplarily, the connection established between the terminal 12 and the controlled device 11 may be a wireless fidelity (WiFi) connection. In one embodiment, taking the controlled device 11 as an example including a drone, the connection between the controlled device 11 and the terminal 12 may be used for image transmission.
[0042] The role control method provided in the embodiment of the present application determines the device identification of the terminal when establishing a connection with the terminal, wherein there is a correspondence between the device identifications and device roles of multiple terminals, the correspondence is used to characterize the device roles of the multiple terminals respectively, and the correspondence is obtained based on the order in which the multiple terminals establish connections with the controlled devices, thereby realizing a role control method in which the controlled device determines the device role of the terminal based on the order in which the terminals establish connections with it.
[0043] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0044] Figure 2 FIG. 1 is a flow chart of a character control method provided by an embodiment of the present application. The execution subject of this embodiment may be the controlled device 11. Figure 2 As shown, the method of this embodiment may include:
[0045] Step 21: Establish a connection with the terminal by performing signaling interaction with the terminal.
[0046] In this step, the connection established between the controlled device and the terminal may be different based on different communication protocols. Taking the communication protocol as the WiFi protocol as an example, the controlled device may establish a WiFi connection with the terminal by performing signaling interaction with the terminal.
[0047] It should be noted that for the specific manner in which the controlled device and the terminal establish a connection through signaling interaction, reference may be made to the contents in the relevant technology, and this application does not limit this.
[0048] Step 22: When a connection is established with the terminal, determine the device identification of the terminal.
[0049] In this step, there is a correspondence between the device identifications and device roles of the multiple terminals, the correspondence is used to characterize the device roles of the multiple terminals respectively, and the correspondence is obtained based on the sequence in which the multiple terminals establish connections with the controlled devices.
[0050] The device identification of the terminal can be any type of identification that can uniquely identify the terminal within a period of time. The method for determining the device identification can be flexibly implemented according to needs. For example, the device identification can be allocated by the controlled device to the terminal connected to it, or the device identification can be obtained by the controlled device from the terminal connected to it.
[0051] The device role of a terminal is reflected in the correspondence between the device identification of the terminal and the device role. For example, assuming that the device identification of terminal 1 corresponds to the host in the correspondence, it can be indicated that the device role of terminal 1 is the host. Exemplarily, the correspondence between the device identifications and device roles of multiple terminals can be reflected in the form of a table. Of course, in other embodiments, the correspondence can also be reflected in other forms, which is not limited in this application.
[0052] Since the corresponding relationship is obtained based on the order in which the multiple terminals and the controlled devices establish connections, the device roles of the multiple terminals are related to the order in which the multiple terminals and the controlled devices establish connections, that is, when determining the device roles of the multiple terminals, it is necessary to base it on the order in which the multiple terminals and the controlled devices establish connections.
[0053] In one embodiment, when determining the device roles of multiple terminals, the order in which the multiple terminals and the controlled device establish connections can be used alone. For example, assuming that the controlled device determines that the order in which the terminals establish connections with it within a period of time is that terminal 1 first establishes a connection with it, then terminal 2 establishes a connection with it, and finally terminal 3 establishes a connection with it, and the controlled device defaults that the device role of the terminal that first establishes a connection with it is the host role, then the device role assigned by the controlled device to terminal 1 is the host, and the device role assigned by the controlled device to terminals 2 and 3 is the slave. Among them, this period of time can be flexibly implemented according to needs. For example, this period of time can specifically be the time from the moment when the controlled device was last started to the current moment.
[0054] In another embodiment, when determining the device roles of the multiple terminals, in addition to the sequence in which the multiple terminals establish connections with the controlled device, other information may also be considered to improve the flexibility of role control.
[0055] In an embodiment of the present application, by determining the device identification of the terminal when establishing a connection with the terminal, there is a corresponding relationship between the device identifications and device roles of multiple terminals, the corresponding relationship is used to characterize the device roles of each of the multiple terminals, and the corresponding relationship is obtained based on the order in which the multiple terminals establish connections with the controlled devices. Since the corresponding relationship is obtained based on the order in which the multiple terminals establish connections with the controlled devices, it is possible to implement a role control method in which the controlled device determines the device role of the terminal based on the order in which the terminal establishes connections with it. Compared with allocating the master and slave roles of the terminal through negotiation between the terminal and the controlled device, which requires multiple communications between the terminal and the controlled device to complete the negotiation, the time consumed in determining the role and the resources occupied are reduced.
[0056] Figure 3 This is a flow chart of a character control method provided by another embodiment of the present application. Figure 2 Based on the embodiment shown, an optional implementation method of allocating device roles to terminals by the controlled device is mainly described. Figure 3 As shown, the method of this embodiment may include:
[0057] Step 31: Establish a connection with the terminal by performing signaling interaction with the terminal.
[0058] It should be noted that step 31 is similar to step 21 and will not be described in detail here.
[0059] Step 32, when establishing a connection with the terminal, allocate an IP address to the terminal from a plurality of Internet Protocol (IP) addresses with preset allocation priorities according to the order in which the terminal establishes a connection with the controlled device, and the IP address corresponds to the device role to obtain the device role corresponding to the device identification of the terminal.
[0060] In this step, the IP address of the terminal is the device identification of the terminal, and the IP address of the terminal is selected and allocated to the terminal from multiple IP addresses by the controlled device based on the position of the terminal in establishing a connection with it. Taking the establishment of a WiFi connection between the controlled device and the terminal as an example, in one embodiment, multiple IP addresses can be obtained by the controlled device using the Dynamic Host Configuration Protocol (DHCP).
[0061] Since there is a correspondence between the IP address and the device role, the device role of the terminal is determined after the IP address is allocated to the terminal. The correspondence between the IP address and the device role may be shown in Table 1 below, for example.
[0062] Table 1
[0063] IP address Device Role 192.168.1.2 Host 192.168.1.3 Slave 192.168.1.4 Slave 192.168.1.5 Slave …… ……
[0064] Since there is an allocation priority between multiple IP addresses, and the IP address is allocated to the terminal from the multiple IP addresses according to the order in which the terminal establishes a connection with the controlled device, the IP address allocated to the terminal can be related to the order in which the terminal and the controlled device establish a connection. In addition, since there is a corresponding relationship between the IP address and the device role, the device role of the terminal can be related to the order in which the terminal and the controlled device establish a connection.
[0065] For example, assuming that the allocation priorities of the four IP addresses in Table 1 are 192.168.1.2>192.168.1.3>192.168.1.4>192.168.1.5, and the controlled device determines that the order in which the terminals establish connections with it is terminal 1 first to establish connection with it, terminal 2 second to establish connection with it, terminal 3 third to establish connection with it, and terminal 4 fourth to establish connection with it, then the IP address allocated by the controlled device to terminal 1 is 192.168.1.2, so that the device role allocated by the controlled device to terminal 1 is the host, the IP address allocated by the controlled device to terminal 2 is 192.168.1.3, the IP address allocated to terminal 3 is 192.168.1.4, and the IP address allocated to terminal 4 is 192.168.1.5, so that the device roles allocated by the controlled device to terminals 2 to 4 are slaves. Similarly, the period of time can be flexibly implemented according to demand. For example, the period of time can specifically be the time from the time when the controlled device was last started to the current time.
[0066] In order to improve the flexibility of implementation, the correspondence between the IP address and the device role may include a first correspondence between the IP address and the subordinate identifier (Sub Id) of the terminal, and a second correspondence between the subordinate identifier and the device role. The subordinate identifier can be used to distinguish different terminals among multiple terminals. The first correspondence may be, for example, as shown in Table 2 below, and the second correspondence may be, for example, as shown in Table 3 below.
[0067] Table 2
[0068] IP address Sub Id 192.168.1.2 1 192.168.1.3 2 192.168.1.4 3 192.168.1.5 4 …… ……
[0069] Table 3
[0070] Sub Id Device Role 1 Host 2 Slave 3 Slave 4 Slave …… ……
[0071] Optionally, when the terminal needs to know its device role, the controlled device may also indicate the device role assigned to the terminal to the terminal. The specific method of indicating the device role to the terminal can be flexibly implemented according to needs and will not be described in detail here.
[0072] Optionally, the method of this embodiment may further include: if no heartbeat packet sent by the terminal is received within a period of time, updating the second corresponding relationship to delete the information corresponding to the terminal in the second corresponding relationship.
[0073] If the heartbeat packet sent by the terminal is not received for a period of time, the controlled device may consider that the connection between the terminal and it has been disconnected. In order to avoid the problem caused by the disconnected terminal being mistaken by the controlled device as a terminal communicating with it in a certain role, the second correspondence may be updated to delete the information corresponding to the terminal in the second correspondence. Taking the second correspondence as shown in Table 3, and the terminal being a terminal with Sub Id equal to 1 as an example, deleting the information corresponding to the terminal in the second correspondence may specifically be deleting the row "Sub Id equals 1, the device role is host" in Table 3. For scenarios where a host must exist, when it is determined that the row "Sub Id equals 1, the device role is host" in Table 3 needs to be deleted, a terminal may be selected from the remaining terminals whose device role is a slave and its device role may be switched to a host.
[0074] Further optionally, the method of this embodiment may also include: broadcasting the updated second corresponding relationship so that when the terminal determines that its own role is abnormal according to the second corresponding relationship, it sends a role request to the controlled device. The role request can be used to request a certain role from the controlled device. For the specific manner in which the controlled device handles the role request, please refer to the specific description of the subsequent embodiments.
[0075] When the controlled device broadcasts the updated second correspondence, all terminals that are not actually disconnected from the controlled device can receive the updated second correspondence. By broadcasting the updated second correspondence, it is helpful to ensure the consistency of the understanding of the terminal device role between the terminal and the controlled device. In addition, considering that there is a situation where the heartbeat packet sent by the terminal is not received by the controlled device in time due to some reason, causing the controlled device to mistakenly believe that the terminal has been disconnected from it, by broadcasting the updated second correspondence, it is also possible to avoid the problem of the terminal information in the second correspondence being accidentally deleted, which is helpful to improve reliability.
[0076] The method provided in the embodiment of the present application allocates an IP address to the terminal from a plurality of IP addresses with preset allocation priorities according to the order in which the terminal establishes connections with the controlled device when establishing a connection with the terminal. Since there is an allocation priority between the plurality of IP addresses and the IP address is allocated to the terminal from the plurality of IP addresses according to the order in which the terminal establishes connections with the controlled device, it is achieved that the IP address allocated to the terminal can be related to the order in which the terminal and the controlled device establish connections. Furthermore, since there is a corresponding relationship between the IP address and the device role, it is possible to achieve a role control method in which the controlled device determines the device role of the terminal based on the order in which the terminal establishes connections with it.
[0077] Figure 4A flowchart of a character control method provided in another embodiment of the present application. Figure 2 Based on the embodiment shown, another optional implementation method of the controlled device assigning a device role to a terminal is mainly described. Figure 4 As shown, the method of this embodiment may include:
[0078] Step 41: Establish a connection with the terminal by performing signaling interaction with the terminal.
[0079] It should be noted that step 31 is similar to step 21 and will not be described in detail here.
[0080] Step 42: when a connection is established with the terminal, obtain a device identification of the terminal from the terminal.
[0081] In this step, the device identification of the terminal may include a unique device identifier of the terminal. Exemplarily, the unique device identifier may specifically be a media access control (MAC) address of the terminal. In one embodiment, the terminal may actively send the device identification to the controlled device after establishing a connection with the controlled device. Of course, in other embodiments, the controlled device may also obtain the device identification of the terminal in other ways, which is not limited in this application.
[0082] Step 43: determining the device role corresponding to the device identification of the terminal according to the order in which the terminal establishes a connection with the controlled device.
[0083] In this step, after obtaining the device identification of the terminal, the device role corresponding to the device identification of the terminal is determined according to the location where the connection is established, so as to obtain the correspondence between the device identification and the device role. Since the device role corresponding to the device identification of the terminal is determined according to the location where the terminal establishes a connection with the controlled device, it is possible to implement a role control method in which the controlled device determines the device role of the terminal based on the order in which the terminal establishes a connection with it.
[0084] The order in which the terminal establishes a connection with the controlled device may specifically refer to the order in which the terminal establishes a connection with the controlled device within a period of time, and the period of time may be flexibly implemented according to demand.
[0085] For example, first, at the beginning of a period of time, the corresponding relationship can be initialized to empty. Then, after terminal 1 establishes a connection with the controlled device for the first time during this period of time, the device identification of terminal 1 (for example, aa:bb:cc:dd::ee:01) can be obtained from terminal 1 to determine that the device role corresponding to the device identification of terminal 1 is the host, thereby obtaining the following Table 3-1. Further, after terminal 2 establishes a connection with the controlled device for the second time during this period of time, the device identification of terminal 2 (for example, aa:bb:cc:dd::ee:02) can be obtained from terminal 2 to determine that the device role corresponding to the device identification of terminal 2 is the slave, thereby obtaining the following Table 3-2. Afterwards, after terminal 3 establishes a connection with the controlled device for the third time during this period of time, the device identification of terminal 3 (for example, aa:bb:cc:dd::ee:03) can be obtained from terminal 3 to determine that the device role corresponding to the device identification of terminal 3 is the slave, thereby obtaining the following Table 3-3.
[0086] Table 3-1
[0087] MAC Address Device Role aa:bb:cc:dd::ee:01 Host
[0088] Table 3-2
[0089] MAC Address Device Role aa:bb:cc:dd::ee:01 Host aa:bb:cc:dd::ee:02 Slave
[0090] Table 3-3
[0091] MAC Address Device Role aa:bb:cc:dd::ee:01 Host aa:bb:cc:dd::ee:02 Slave aa:bb:cc:dd::ee:03 Slave
[0092] Exemplarily, the period of time may specifically be the time from the moment when the controlled device was last started to the current moment. Based on this, in one embodiment, determining the device role corresponding to the device identification of the terminal according to the position of the terminal in establishing a connection with the controlled device may specifically include: if the terminal is the first terminal to establish a connection with the controlled device after the controlled device is started, then determining the device role corresponding to the device identification of the terminal is the host. In this way, it is possible to control the device role of the first terminal to establish a connection with the controlled device after the controlled device is started to be the host.
[0093] Further optionally, if the terminal is not the first terminal to establish a connection with the controlled device after the controlled device is started, the device role corresponding to the device identifier of the terminal is determined to be a slave. Thus, the device role of the terminal that is not the first terminal to establish a connection with the controlled device after the controlled device is started can be controlled as a slave.
[0094] Taking into account that after a terminal establishes a connection with a controlled device within a period of time, the connection may be disconnected due to various reasons, in order to ensure as much as possible that there is a host in the terminal that establishes a connection with the controlled device, in another embodiment, the device role corresponding to the device identifier of the terminal is determined according to the position of the terminal in establishing a connection with the controlled device, which may specifically include: if the terminal establishes a connection with the controlled device for the first time after the controlled device is started, and there is currently no host connected to the controlled device, then the device role corresponding to the device identifier of the terminal is determined to be the host.
[0095] Optionally, the determining the device role corresponding to the device identifier of the terminal according to the order in which the terminal establishes a connection with the controlled device may also include: if the terminal is not establishing a connection with the controlled device for the first time after the controlled device is started, the historical device role of the terminal is the host and there is no host currently connected to the controlled device, then determining the device role corresponding to the device identifier of the terminal is the host. In this way, after a terminal that serves as a host is disconnected for some reason, it can be achieved that the host role of the terminal can be maintained when a connection is established with the controlled terminal again and no other newly connected terminals exist during the period.
[0096] Optionally, the determining the device role corresponding to the device identification of the terminal according to the order of establishing the connection between the terminal and the controlled device may further include: if there is currently a host connected to the controlled device, determining the device role corresponding to the device identification of the terminal as a slave. In this way, a master-slave relationship can be achieved in which one of the multiple terminals serves as the host and the other terminals serve as slaves.
[0097] In order to know whether the terminal is establishing a connection with the controlled device for the first time after the controlled device is started, and the order in which multiple terminals establish connections with the controlled device, in one embodiment, the connection state of the terminal, the time of establishing the connection, and the device role of the terminal can be used together as the information corresponding to the device identification of the terminal. For example, the following table 4 can be used.
[0098] Table 4
[0099] MAC Address Connection Status Device Role Connection establishment timestamp aa:bb:cc:dd::ee:01 connect Host 123456781 aa:bb:cc:dd::ee:02 connect Slave 123456789 aa:bb:cc:dd::ee:03 Not connected Slave NULL
[0100] In Table 4, the terminals with device identifications aa:bb:cc:dd::ee:01 and aa:bb:cc:dd::ee:02 are currently in a connection establishment state with the controlled device, and the terminal with device identification aa:bb:cc:dd::ee:03 is currently in a disconnected state with the controlled device. The connection establishment timestamp 123456781 of the terminal with device identification aa:bb:cc:dd::ee:01 is earlier than the connection establishment timestamp 123456789 of the terminal with standby identification aa:bb:cc:dd::ee:02, so the device role corresponding to aa:bb:cc:dd::ee:01 can be the host, and the device role corresponding to aa:bb:cc:dd::ee:02 can be the slave. The device role corresponding to aa:bb:cc:dd::ee:01 is a slave, which means that when the terminal of aa:bb:cc:dd::ee:01 was previously connected to the controlled device, its device role was a slave.
[0101] The method provided in the embodiment of the present application obtains the device identification of the terminal from the terminal when establishing a connection with the terminal, and determines the device role corresponding to the device identification of the terminal according to the position in which the terminal establishes the connection with the controlled device. Since the device role corresponding to the device identification of the terminal is determined according to the position in which the terminal establishes the connection with the controlled device, it is possible to implement a role control method in which the controlled device determines the device role of the terminal based on the order in which the terminals establish connections with it.
[0102] Optionally, based on the above method embodiment, the method may further include: receiving a role request sent by the terminal; if the device role of the role request is the same as the device role corresponding to the terminal in the corresponding relationship, returning a successful response so that the terminal sets its own role according to the successful response. Thus, when the role requested by the terminal is the same as the role assigned to the terminal by the controlled device, the terminal can set its own role as the role requested by the terminal, thereby realizing a role control method that allows the terminal to request a role, which is conducive to improving the flexibility of role control.
[0103] Further optionally, the method provided by the embodiment of the present application may also include: if the role request is used to request to be a slave and the device role corresponding to the terminal in the corresponding relationship is a master, then the corresponding relationship is updated to modify the device role corresponding to the device identifier of the terminal in the corresponding relationship to a slave, and a successful response is returned. Thus, when the role requested by the terminal is a slave and the role assigned to the terminal by the controlled device is a master, the role of the terminal can be updated to a slave, thereby realizing a role control method that allows the terminal to request to switch from a master to a slave.
[0104] And or, further optionally, the method provided by the embodiment of the present application may also include: if the role request is used to request to be the host and the device role corresponding to the terminal in the corresponding relationship is a slave, a failure response is returned so that the terminal prompts the user with failure information according to the failure response. Thus, when the role requested by the terminal is the host and the role assigned to the terminal by the controlled device is the slave, the role of the terminal can be maintained as the slave, thereby realizing a role control mode that does not allow the terminal to request to switch from the slave to the host.
[0105] Optionally, based on the above method embodiment, it can also include: determining the device identification of the terminal (referred to as the first terminal) to which the first data is targeted according to the device role (referred to as the target device role) to which the first data to be sent is targeted and the corresponding relationship; and, based on the device identification of the first terminal, sending the first data to the first terminal. The first data refers to the data sent by the controlled device to the terminal, which can also be referred to as downlink data. When the controlled device sends downlink data to the terminal, it can specify the terminal with the device role to which the downlink data needs to be sent, that is, what the target device role of the downlink data is, so as to control the terminal with the target device role to respond to the downlink data.
[0106] In the traditional technology, the downlink data from the controlled device to the terminal is sent in the form of broadcast, and the target device role needs to be carried in the downlink data to indicate that the terminal with the target device role responds to the downlink data. However, in the case where the downlink data carries the target device role, the information of the target device role needs to occupy certain downlink resources. In the embodiment of the present application, on the basis of the aforementioned corresponding relationship, by determining the device identification of the first terminal targeted by the first data according to the target device role targeted by the first data and the corresponding relationship, and sending the first data to the first terminal based on the device identification of the first terminal, it is possible to avoid sending the information of the target device role to the terminal, reduce the occupation of downlink resources, and help save downlink resources.
[0107] In one embodiment, the method provided in the embodiment of the present application can be implemented by a main control chip, and the sending of data can be implemented by a communication module. In the scenario of main control chip + communication module, the sending of the first data to the first terminal based on the device identification of the first terminal can specifically include: the main control chip sends the first data together with the device identification of the first terminal to the communication module, so that the communication module sends the first data to the first terminal according to the device identification of the first terminal. It should be noted that the communication module refers to a hardware template. Taking the communication protocol as the WiFi protocol as an example, the communication module can specifically be a WiFi module.
[0108] Take the drone scene as an example. Figure 5 As shown, the first data may be generated by a gimbal controller (GCU) or an inertial measurement unit (IMU), etc. Of course, in other embodiments, the first data may also be generated by other hardware modules, for example, the first data may also be generated by a main control chip, and this application does not limit this. Taking the first data generated by the gimbal controller being sent to the terminal as an example, refer to Figure 5 , the PTZ controller can send the first data and the role information used to characterize the target device role targeted by the first data to the main control chip, and the main control chip determines the device identification of the first terminal targeted by the first data based on the target device role targeted by the first data. After determining the device identification of the first terminal, the main control chip can send the first data together with the device identification of the first terminal to the WiFi module, and the WiFi module can send the first data to the first terminal according to the device identification of the first terminal. Take the target device role as the host, and the device identification corresponding to the host in the corresponding relationship as the device identification of terminal 1 as an example, Figure 5 As shown, the WiFi module can send the first data to the terminal 1 according to the device identification of the terminal 1. It should be noted that when the device identification used in the communication module is inconsistent with the type of the device identification in the corresponding relationship, the main control chip can adapt the device identification.
[0109] Optionally, based on the above method embodiment, it may also include: when receiving the second data sent by the second terminal, determining the target device role to which the second data belongs according to the device identification of the second terminal and the corresponding relationship. The second data refers to the data sent by the terminal to the controlled device, which may also be called uplink data. Since the second terminal has a device role, the second data sent by it also has the attributes of the device role, and the device role of the second terminal is the target device role to which the second data belongs.
[0110] In the traditional technology, the uplink data from the terminal to the controlled device needs to carry the device role to which it belongs, so as to indicate to the controlled terminal what device role the data is sent by. However, in the case where the uplink data carries the device role, the information of the device role needs to occupy certain uplink resources. In the embodiment of the present application, on the basis of the aforementioned correspondence, by determining the target device role to which the second data belongs according to the device identification of the second terminal and the correspondence, it is possible to avoid the terminal from sending the device role information to the controlled device, reduce the occupation of uplink resources, and help save uplink resources.
[0111] In one embodiment, the method provided in the embodiment of the present application can be implemented by a main control chip, and the sending of data can be implemented by a communication module. In the scenario of main control chip + communication module, when receiving the second data sent by the second terminal, the target device role to which the second data belongs is determined according to the device identification of the second terminal and the corresponding relationship, which can specifically include: the main control chip determines the target device role to which the second data belongs according to the device identification of the second terminal and the corresponding relationship, and the device identification of the second terminal is sent to the main control chip by the communication module together with the second data.
[0112] After determining the target device role to which the second data belongs, in one scenario, the second data can be responded to by the main control chip. Based on this, the embodiment of the present application may further include: the main control chip responds to the second data based on the target device role to which the second data belongs. It should be noted that the specific manner in which the main control chip responds to the second data based on the target device role to which the second data belongs can be flexibly implemented according to demand, and this application does not limit this.
[0113] Alternatively, in another scenario, the second data may be responded to by other modules other than the main control chip, and the other modules refer to hardware modules. Based on this, the embodiment of the present application may also include: the main control chip forwards the second data together with the target device role to which the second data belongs to other modules, so that the other modules respond to the second data based on the device role described in the second data.
[0114] Taking into account that the serial number of the data packet is valid for a pair of transceivers, in the scenario where the controlled device communicates with multiple terminals at the same time, the traditional serial number cannot take effect. In order to ensure the validity of the serial number on the controlled device side in the scenario where the controlled device communicates with multiple terminals at the same time, the main control chip optionally forwards the second data to other modules, which may specifically include: the main control chip unpacks the data packet used to encapsulate the second data to obtain the first serial number of the second terminal for the data packet; and after the main control chip changes the serial number of the data packet from the first serial number to the second serial number, the main control chip forwards the data packet together with the device role to which the second data belongs to other modules, where the second serial number is generated based on a preset method and is a serial number used to uniquely identify the data packet in the main control chip.
[0115] Among them, the data packet may specifically be a data packet sent by the second terminal, and the data packet originally includes the number of the second terminal for the data packet, that is, the first serial number. However, since the serial numbers included in the data packets sent by multiple second terminals are the same, other modules cannot distinguish them, which causes the serial number to be invalid. Therefore, a preset method is used in this application to generate a serial number for uniquely identifying the data packet in the main control chip. Since the data packets need to be forwarded to other modules through the main control chip, the unique serial number in the main control chip can effectively distinguish different data packets. The preset method can be flexibly implemented according to demand. In one embodiment, the preset method can specifically be an incremental method with a step size of 1.
[0116] Further optionally, the reply packet for the data packet can be restored based on the serial number in the reply packet to ensure the validity of the serial number on the terminal side. Based on this, the embodiment of the present application may also include: the main control chip adds routing information including the relationship between the first serial number, the second serial number and the device identification of the second terminal; the main control chip receives the reply packet for the data packet sent by the other module; and the main control chip modifies the serial number of the reply packet from the second serial number to the first serial number according to the routing information, and then forwards the reply packet together with the device identification of the second terminal to the communication module, so that the communication module sends the reply packet to the second terminal.
[0117] Taking the example in Table 3-3 where the host with device identification aa:bb:cc:dd::ee:01 first sends a data packet to the controlled device, and the slave with device identification aa:bb:cc:dd::ee:02 sends a data packet to the controlled device, and then the slave with device identification aa:bb:cc:dd::ee:03 sends a data packet to the controlled device, the obtained routing information can be shown in Table 5 below.
[0118] Table 5
[0119] Second serial number Equipment identification First serial number 1 aa:bb:cc:dd::ee:01 2 2 aa:bb:cc:dd::ee:02 2 3 aa:bb:cc:dd::ee:03 3
[0120] Based on Table 5, it can be seen that the first serial number is not unique, and the main control chip can generate a unique serial number in a preset manner and replace the first serial number in the data packet.
[0121] Take the drone scene as an example. Figure 6 As shown, the second data may be generated by the terminal. For example, terminal 2 sends the second data to the PTZ controller. Figure 6, terminal 2 can send the second data to the WiFi module, and the second data is encapsulated in a data packet. Assume that the serial number of the data packet is 2. After receiving the second data, the WiFi module can send the device identification of terminal 2 together with the second data to the main control chip. On the one hand, the main control chip can determine the target device role to which the second data belongs based on the device identification of terminal 2 and the corresponding relationship. On the other hand, the main control chip can modify the serial number in the data packet. Assuming that the serial number generated by the main control chip for the data packet is 10, the main control chip modifies the serial number 2 in the data packet to 10. Afterwards, the main control chip can record the routing information of the routing information "10 terminal 2 device identification 2", and send the target device role to which the second data belongs together with the data packet with the modified serial number to the pan-tilt controller, so that the pan-tilt controller can respond.
[0122] Furthermore, the PTZ controller can generate a response packet for the data packet. Since the serial number of the data packet received by the PTZ controller is 10, the serial number in the response packet is also 10. The PTZ controller can send the response packet to the main control chip. The main control chip can modify the serial number in the response packet from 10 to 2 based on the recorded routing information, and determine that the response packet corresponds to the device identification of terminal 2. Therefore, the main control chip can send the device identification of terminal 2 together with the modified response packet to the WiFi module, and the WiFi module returns the response packet to terminal 2 according to the device identification of terminal 2.
[0123] It is understandable that in Figure 5 and Figure 6 In the scenario shown, the WiFi chip may send information such as the terminal's connection establishment timestamp to the main control chip.
[0124] Figure 7 A structural diagram of a character control device provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, the device 700 may include: a processor 701 and a memory 702 .
[0125] The memory 702 is used to store program codes;
[0126] The processor 701 calls the program code, and when the program code is executed, is used to perform the following operations:
[0127] Establishing a connection with the terminal by performing signaling interaction with the terminal;
[0128] When a connection is established with the terminal, determining a device identification of the terminal;
[0129] There is a correspondence between the device identifications and device roles of the multiple terminals, the correspondence is used to characterize the device roles of the multiple terminals respectively, and the correspondence is obtained based on the sequence in which the multiple terminals establish connections with the controlled devices.
[0130] The character control device provided in this embodiment can be used to execute the technical solution of the aforementioned method embodiment. Its implementation principle and technical effect are similar to those of the method embodiment and will not be repeated here.
[0131] Figure 8 A schematic diagram of the structure of a drone provided in one embodiment of the present application is shown in FIG. Figure 8 As shown, the drone 80 includes a fuselage 801, a power system 802 disposed on the fuselage, a shooting device 803 and a character control device 804;
[0132] The power system 802 is used to provide power for the UAV;
[0133] The shooting device 803 is used to shoot videos during the flight of the drone, and the shot videos are used for image transmission;
[0134] The character control device 804 includes a memory and a processor;
[0135] The memory is used to store program code;
[0136] The processor calls the program code, and when the program code is executed, is used to perform the following operations:
[0137] Establishing a connection with the terminal by performing signaling interaction with the terminal;
[0138] When a connection is established with the terminal, determining a device identification of the terminal;
[0139] There is a correspondence between the device identifications and device roles of the multiple terminals, the correspondence is used to characterize the device roles of the multiple terminals respectively, and the correspondence is obtained based on the sequence in which the multiple terminals establish connections with the controlled devices.
[0140] Optionally, the drone 80 may further include a gimbal 805, and the shooting device 803 may be disposed on the fuselage 801 via the gimbal 805. Of course, in addition to the above-listed devices, the drone may also include other elements or devices, which are not listed here one by one.
[0141] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0142] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A role control method, applied to a controlled device, characterized in that: include: Establishing a connection with the terminal by performing signaling interaction with the terminal; When a connection is established with the terminal, determining a device identification of the terminal; There is a correspondence between the device identifications and device roles of the multiple terminals, the correspondence is used to characterize the device roles of the multiple terminals, and the correspondence is obtained based on the order in which the multiple terminals establish connections with the controlled device; The device identification includes an Internet Protocol IP address, and the determining the device identification of the terminal includes: allocating an IP address to the terminal from a plurality of IP addresses with a preset allocation priority according to the order in which the terminal establishes a connection with the controlled device, the IP address corresponding to the device role, so as to obtain the device role corresponding to the device identification of the terminal; Alternatively, the device identifier includes a unique device identifier, and determining the device identifier of the terminal includes: obtaining the device identifier of the terminal from the terminal; the method also includes: if the terminal establishes a connection with the controlled device for the first time after the controlled device is started, and there is currently no host connected to the controlled device, then determining that the device role corresponding to the device identifier of the terminal is a host.
2. The method according to claim 1, characterized in that The corresponding relationship includes a first corresponding relationship between the IP address and the subordinate identifier of the terminal, and a second corresponding relationship between the subordinate identifier and the device role. The method further includes: If the heartbeat packet sent by the terminal is not received within a period of time, the second corresponding relationship is updated to delete the information corresponding to the terminal in the second corresponding relationship.
3. The method according to claim 2, characterized in that The method further comprises: The updated second corresponding relationship is broadcasted, so that when the terminal determines that its own role is abnormal according to the second corresponding relationship, the terminal sends a role request to the controlled device.
4. The method according to claim 1, characterized in that The method further comprises: If the terminal is not establishing a connection with the controlled device for the first time after the controlled device is started, the historical device role of the terminal is the host and there is no host currently connected to the controlled device, then it is determined that the device role corresponding to the device identifier of the terminal is the host.
5. The method according to claim 4, characterized in that The method further comprises: If there is currently a host connected to the controlled device, it is determined that the device role corresponding to the device identification of the terminal is a slave.
6. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: receiving a role request sent by the terminal; If the device role of the role request is the same as the device role corresponding to the terminal in the corresponding relationship, a success response is returned so that the terminal sets its own role according to the success response.
7. The method according to claim 6, characterized in that The method further comprises: If the role request is for requesting to be a slave and the device role corresponding to the terminal in the corresponding relationship is a master, the corresponding relationship is updated to modify the device role corresponding to the device identification of the terminal in the corresponding relationship to a slave, and a success response is returned.
8. The method according to claim 6, characterized in that The method further comprises: If the role request is used to request to be a host and the device role corresponding to the terminal in the corresponding relationship is a slave, a failure response is returned so that the terminal prompts the user with failure information according to the failure response.
9. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: Determine, according to the target device role to which the first data to be sent is directed and the corresponding relationship, a device identifier of the first terminal to which the first data is directed; The first data is sent to the first terminal based on the device identification of the first terminal.
10. The method according to claim 9, characterized in that The sending the first data to the first terminal based on the device identification of the first terminal includes: The main control chip sends the first data together with the device identification of the first terminal to the communication module, so that the communication module sends the first data to the first terminal according to the device identification of the first terminal.
11. The method according to any one of claims 1 to 5, characterized in that: The method further comprises: When the second data sent by the second terminal is received, the target device role to which the second data belongs is determined according to the device identification of the second terminal and the corresponding relationship.
12. The method according to claim 11, characterized in that The step of, when receiving the second data sent by the second terminal, determining the target device role to which the second data belongs according to the device identification of the second terminal and the corresponding relationship, includes: The main control chip determines the target device role to which the second data belongs according to the device identification of the second terminal and the corresponding relationship. The device identification of the second terminal is sent to the main control chip together with the second data by the communication module.
13. The method according to claim 12, characterized in that After determining the target device role to which the second data belongs, the method further includes: The main control chip responds to the second data based on the target device role to which the second data belongs, or the main control chip forwards the second data together with the target device role to which the second data belongs to other modules, so that the other modules respond to the second data based on the device role described in the second data.
14. The method according to claim 13, characterized in that The main control chip forwards the second data to other modules, including: The main control chip unpacks the data packet used to encapsulate the second data to obtain a first sequence number of the second terminal for the data packet; After the main control chip changes the serial number of the data packet from the first serial number to the second serial number, the data packet is forwarded together with the device role to which the second data belongs to other modules. The second serial number is generated based on a preset method and is used to uniquely identify the data packet in the main control chip.
15. The method according to claim 14, characterized in that The method further comprises: The main control chip adds routing information including the relationship between the first serial number, the second serial number and the device identification of the second terminal; The main control chip receives a response packet for the data packet sent by the other modules; The main control chip modifies the serial number of the response packet from the second serial number to the first serial number according to the routing information, and then forwards the response packet together with the device identification of the second terminal to the communication module, so that the communication module sends the response packet to the second terminal.
16. The method according to any one of claims 1 to 5, characterized in that: The controlled device includes a drone.
17. The method according to claim 16, characterized in that The connection between the controlled device and the terminal is used for image transmission.
18. A role control device, applied to a controlled device, characterized in that: include: Memory and processor; The memory is used to store program codes; The processor calls the program code, and when the program code is executed, is used to perform the following operations: Establishing a connection with the terminal by performing signaling interaction with the terminal; When a connection is established with the terminal, determining a device identification of the terminal; There is a correspondence between the device identifications and device roles of the multiple terminals, the correspondence is used to characterize the device roles of the multiple terminals, and the correspondence is obtained based on the order in which the multiple terminals establish connections with the controlled device; The device identification includes an Internet Protocol IP address; the processor is used to determine the device identification of the terminal specifically including: according to the order of the terminal to establish a connection with the controlled device, assigning an IP address to the terminal from a plurality of IP addresses with a preset allocation priority, the IP address corresponding to the device role, so as to obtain the device role corresponding to the device identification of the terminal; Alternatively, the device identification includes a unique device identifier; the processor is used to determine the device identification of the terminal specifically including: obtaining the device identification of the terminal from the terminal; the processor is also used to determine that the device role corresponding to the device identification of the terminal is a host if the terminal establishes a connection with the controlled device for the first time after the controlled device is started, and there is currently no host connected to the controlled device.
19. The device according to claim 18, characterized in that The corresponding relationship includes a first corresponding relationship between the IP address and the subordinate identifier of the terminal, and a second corresponding relationship between the subordinate identifier and the device role, and the processor is further configured to: If the heartbeat packet sent by the terminal is not received within a period of time, the second corresponding relationship is updated to delete the information corresponding to the terminal in the second corresponding relationship.
20. The device according to claim 19, characterized in that The processor is further configured to: The updated second corresponding relationship is broadcasted, so that when the terminal determines that its own role is abnormal according to the second corresponding relationship, the terminal sends a role request to the controlled device.
21. The device according to claim 18, characterized in that The processor is further configured to: If the terminal is not establishing a connection with the controlled device for the first time after the controlled device is started, the historical device role of the terminal is the host and there is no host currently connected to the controlled device, then it is determined that the device role corresponding to the device identifier of the terminal is the host.
22. The device according to claim 21, characterized in that The processor is further configured to determine that the device role corresponding to the device identification of the terminal is a slave if there is currently a host connected to the controlled device.
23. The device according to any one of claims 18 to 22, characterized in that The processor is further configured to: receiving a role request sent by the terminal; If the device role of the role request is the same as the device role corresponding to the terminal in the corresponding relationship, a success response is returned so that the terminal sets its own role according to the success response.
24. The device according to claim 23, characterized in that The processor is further configured to: If the role request is for requesting to be a slave and the device role corresponding to the terminal in the corresponding relationship is a master, the corresponding relationship is updated to modify the device role corresponding to the device identification of the terminal in the corresponding relationship to a slave, and a success response is returned.
25. The device according to claim 23, characterized in that The processor is further configured to: If the role request is used to request to be a host and the device role corresponding to the terminal in the corresponding relationship is a slave, a failure response is returned so that the terminal prompts the user with failure information according to the failure response.
26. The device according to any one of claims 18 to 22, characterized in that The processor is further configured to: Determine, according to the target device role to which the first data to be sent is directed and the corresponding relationship, a device identifier of the first terminal to which the first data is directed; The first data is sent to the first terminal based on the device identification of the first terminal.
27. The device according to claim 26, characterized in that The processor is a processor of a main control chip, and the processor is used to send the first data to the first terminal based on the device identification of the first terminal, specifically including: The first data together with the device identification of the first terminal are sent to a communication module, so that the communication module sends the first data to the first terminal according to the device identification of the first terminal.
28. The device according to any one of claims 18 to 22, characterized in that The processor is further configured to: When the second data sent by the second terminal is received, the target device role to which the second data belongs is determined according to the device identification of the second terminal and the corresponding relationship.
29. The device according to claim 28, characterized in that The processor is a processor of the main control chip, and the processor is used to determine, when receiving second data sent by the second terminal, the target device role to which the second data belongs according to the device identifier of the second terminal and the corresponding relationship, specifically including: The target device role to which the second data belongs is determined according to the device identification of the second terminal and the corresponding relationship, and the device identification of the second terminal is sent to the main control chip together with the second data by the communication module.
30. The device according to claim 29, characterized in that The processor is further configured to: Respond to the second data based on the target device role to which the second data belongs, or forward the second data together with the target device role to which the second data belongs to other modules so that the other modules respond to the second data based on the device role described in the second data.
31. The device according to claim 30, characterized in that The processor forwards the second data to other modules, specifically including: Unpacking a data packet used to encapsulate the second data to obtain a first sequence number of the second terminal for the data packet; After the serial number of the data packet is changed from the first serial number to the second serial number, the data packet is forwarded to other modules together with the device role to which the second data belongs. The second serial number is generated based on a preset method and is used to uniquely identify the data packet in the main control chip.
32. The device according to claim 31, characterized in that The processor is further configured to: Adding routing information including a relationship between the first serial number, the second serial number, and a device identifier of the second terminal; Receive a response packet sent by the other module for the data packet; After the sequence number of the response packet is modified from the second sequence number to the first sequence number according to the routing information, the response packet is forwarded together with the device identification of the second terminal to the communication module so that the communication module sends the response packet to the second terminal.
33. The device according to any one of claims 18 to 22, characterized in that The controlled device includes a drone.
34. The device according to claim 33, characterized in that The connection between the controlled device and the terminal is used for image transmission.
35. A drone, characterized in that: The drone includes a fuselage, a power system arranged on the fuselage, a shooting device and a character control device; The power system is used to provide power for the UAV; The shooting device is used to shoot video during the flight of the drone, and the shot video is used for image transmission; The character control device includes a memory and a processor; The memory is used to store program code; The processor calls the program code, and when the program code is executed, is used to perform the following operations: Establishing a connection with the terminal by performing signaling interaction with the terminal; When a connection is established with the terminal, determining a device identification of the terminal; There is a correspondence between the device identifications and device roles of the multiple terminals, the correspondence is used to characterize the device roles of the multiple terminals, and the correspondence is obtained based on the order in which the multiple terminals establish connections with the controlled devices; The device identification includes an Internet Protocol IP address; the processor is used to determine the device identification of the terminal specifically including: according to the order of the terminal to establish a connection with the controlled device, assigning an IP address to the terminal from a plurality of IP addresses with a preset allocation priority, the IP address corresponding to the device role, so as to obtain the device role corresponding to the device identification of the terminal; Alternatively, the device identification includes a unique device identifier; the processor is used to determine the device identification of the terminal specifically including: obtaining the device identification of the terminal from the terminal; the processor is also used to determine that the device role corresponding to the device identification of the terminal is a host if the terminal establishes a connection with the controlled device for the first time after the controlled device is started, and there is currently no host connected to the controlled device.
36. The drone according to claim 35, characterized in that: The corresponding relationship includes a first corresponding relationship between the IP address and the subordinate identifier of the terminal, and a second corresponding relationship between the subordinate identifier and the device role, and the processor is further configured to: If the heartbeat packet sent by the terminal is not received within a period of time, the second corresponding relationship is updated to delete the information corresponding to the terminal in the second corresponding relationship.
37. The drone according to claim 36, characterized in that: The processor is further configured to: The updated second corresponding relationship is broadcasted, so that when the terminal determines that its own role is abnormal according to the second corresponding relationship, the terminal sends a role request to the controlled device.
38. The drone according to claim 35, characterized in that: The processor is further configured to: If the terminal is not establishing a connection with the controlled device for the first time after the controlled device is started, the historical device role of the terminal is the host and there is no host currently connected to the controlled device, then it is determined that the device role corresponding to the device identifier of the terminal is the host.
39. The drone according to claim 38, characterized in that: The processor is further configured to determine that the device role corresponding to the device identification of the terminal is a slave if there is currently a host connected to the controlled device.
40. The drone according to any one of claims 35 to 39, characterized in that: The processor is further configured to: receiving a role request sent by the terminal; If the device role of the role request is the same as the device role corresponding to the terminal in the corresponding relationship, a success response is returned so that the terminal sets its own role according to the success response.
41. The drone according to claim 40, characterized in that The processor is further configured to: If the role request is for requesting to be a slave and the device role corresponding to the terminal in the corresponding relationship is a master, the corresponding relationship is updated to modify the device role corresponding to the device identification of the terminal in the corresponding relationship to a slave, and a success response is returned.
42. The drone according to claim 40, characterized in that The processor is further configured to: If the role request is used to request to be a host and the device role corresponding to the terminal in the corresponding relationship is a slave, a failure response is returned so that the terminal prompts the user with failure information according to the failure response.
43. The drone according to any one of claims 35 to 39, characterized in that: The processor is further configured to: Determine, according to the target device role to which the first data to be sent is directed and the corresponding relationship, a device identifier of the first terminal to which the first data is directed; The first data is sent to the first terminal based on the device identification of the first terminal.
44. The drone according to claim 43, characterized in that: The processor is a processor of a main control chip, and the processor is used to send the first data to the first terminal based on the device identification of the first terminal, specifically including: The first data together with the device identification of the first terminal are sent to a communication module, so that the communication module sends the first data to the first terminal according to the device identification of the first terminal.
45. The drone according to any one of claims 35 to 39, characterized in that: The processor is further configured to: When the second data sent by the second terminal is received, the target device role to which the second data belongs is determined according to the device identification of the second terminal and the corresponding relationship.
46. The drone according to claim 45, characterized in that The processor is a processor of the main control chip, and the processor is used to determine, when receiving second data sent by the second terminal, the target device role to which the second data belongs according to the device identifier of the second terminal and the corresponding relationship, specifically including: The target device role to which the second data belongs is determined according to the device identification of the second terminal and the corresponding relationship, and the device identification of the second terminal is sent to the main control chip together with the second data by the communication module.
47. The drone according to claim 46, characterized in that The processor is further configured to: Respond to the second data based on the target device role to which the second data belongs, or forward the second data together with the target device role to which the second data belongs to other modules so that the other modules respond to the second data based on the device role described in the second data.
48. The drone according to claim 47, characterized in that: The processor forwards the second data to other modules, specifically including: Unpacking a data packet used to encapsulate the second data to obtain a first sequence number of the second terminal for the data packet; After the serial number of the data packet is changed from the first serial number to the second serial number, the data packet is forwarded to other modules together with the device role to which the second data belongs. The second serial number is generated based on a preset method and is used to uniquely identify the data packet in the main control chip.
49. The drone according to claim 48, characterized in that The processor is further configured to: Adding routing information including a relationship between the first serial number, the second serial number, and a device identifier of the second terminal; Receive a response packet sent by the other module for the data packet; After the sequence number of the response packet is modified from the second sequence number to the first sequence number according to the routing information, the response packet is forwarded together with the device identification of the second terminal to the communication module so that the communication module sends the response packet to the second terminal.
50. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes at least one section of code, and the at least one section of code can be executed by a computer to control the computer to execute the method according to any one of claims 1 to 17.
Citation Information
Patent Citations
Data transmission method, device, machine readable storage medium and system
CN108513738A
Wireless headset pairing method and device and wireless headset
CN108811182A