WO2021253221A1 - 角色控制方法、装置及设备 - Google Patents

角色控制方法、装置及设备 Download PDF

Info

Publication number
WO2021253221A1
WO2021253221A1 PCT/CN2020/096335 CN2020096335W WO2021253221A1 WO 2021253221 A1 WO2021253221 A1 WO 2021253221A1 CN 2020096335 W CN2020096335 W CN 2020096335W WO 2021253221 A1 WO2021253221 A1 WO 2021253221A1
Authority
WO
WIPO (PCT)
Prior art keywords
terminal
role
data
processor
connection
Prior art date
Application number
PCT/CN2020/096335
Other languages
English (en)
French (fr)
Inventor
陈哲斯
Original Assignee
深圳市大疆创新科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市大疆创新科技有限公司 filed Critical 深圳市大疆创新科技有限公司
Priority to PCT/CN2020/096335 priority Critical patent/WO2021253221A1/zh
Priority to CN202080005235.3A priority patent/CN112753276A/zh
Publication of WO2021253221A1 publication Critical patent/WO2021253221A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/11Allocation or use of connection identifiers
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B64AIRCRAFT; AVIATION; COSMONAUTICS
    • B64CAEROPLANES; HELICOPTERS
    • B64C39/00Aircraft not otherwise provided for
    • B64C39/02Aircraft not otherwise provided for characterised by special use
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • H04L67/125Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks involving control of end-device applications over a network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/18Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast
    • H04N7/183Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast for receiving images from a single remote source
    • H04N7/185Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast for receiving images from a single remote source from a mobile camera, e.g. for remote control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/20Services signaling; Auxiliary data signalling, i.e. transmitting data via a non-traffic channel
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B64AIRCRAFT; AVIATION; COSMONAUTICS
    • B64UUNMANNED AERIAL VEHICLES [UAV]; EQUIPMENT THEREFOR
    • B64U2101/00UAVs specially adapted for particular uses or applications

Definitions

  • This application relates to the field of communication technology, and in particular to a role control method, device and equipment.
  • the terminal as the master can control the flight of the drone
  • the terminal as the slave can control the shooting of the camera mounted on the drone.
  • the master-slave role of the terminal is assigned through negotiation between the terminal and the controlled device, and multiple communications between the terminal and the controlled device are required to complete the negotiation. Specifically, after a terminal establishes a connection with the controlled device, the terminal first sends a role request to the controlled device to request the target role. If the controlled device agrees to assign the target role to the terminal, it returns a request success response, and the terminal responds according to Request a successful response to set the role as the target role, and after the setting is successful, send a setting success response to the controlled device. The controlled device also sets the role of the terminal as the target role on the controlled device side according to the successful setting response. The master-slave role assignment of the terminal. If the controlled device does not agree to assign a target role to the terminal, more communication is needed between the terminal and the controlled device to complete the negotiation.
  • the embodiments of the present application provide a role control method, device, and equipment to solve the problem of determining the master-slave role of a terminal in the prior art, which is time-consuming and takes up more resources.
  • an embodiment of the present application provides a role control method, which is applied to a controlled device, and includes:
  • an embodiment of the present application provides a role control device, which is applied to a controlled device, and includes: a memory and a 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:
  • an embodiment of the present application provides an unmanned aerial vehicle, the unmanned aerial vehicle including a fuselage, a power system provided on the fuselage, a photographing device, and a character control device;
  • the power system is used to provide power for the drone
  • the shooting device is used for video shooting during the flight of the drone, and the captured video is used for image transmission;
  • the character control device includes a memory and a 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:
  • an embodiment of the present application provides a computer-readable storage medium, the computer-readable storage medium stores a computer program, the computer program includes at least one piece of code, the at least one piece of code can be executed by a computer to control all The computer executes the method described in any one of the above-mentioned first aspects.
  • an embodiment of the present application provides a computer program, when the computer program is executed by a computer, it is used to implement the method described in any one of the above-mentioned first aspects.
  • the embodiments of the present application provide a role control method, device, and device, which determine the device identifier of the terminal when a connection is established with the terminal.
  • the device identities of multiple terminals and the device roles there is a correspondence between the device identities of multiple terminals and the device roles, and the corresponding relationship is It is used to characterize the respective device roles of multiple terminals, and the corresponding relationship is obtained based on the sequence of establishing connections between multiple terminals and the controlled device. Since the corresponding relationship is obtained based on the sequence of establishing connections between multiple terminals and the controlled device, Therefore, the controlled device can determine the role control mode of the terminal's device role based on the sequence in which the terminal establishes a connection with the terminal, and negotiate with the terminal and the controlled device to assign the master-slave role of the terminal. There is a lot of need between the terminal and the controlled device. Compared with the completion of the negotiation in only one communication, it reduces the time and resources consumed to determine the role.
  • FIG. 1 is a schematic diagram of an application scenario of a role control method provided by an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a role control method provided by an embodiment of this application.
  • FIG. 3 is a schematic flowchart of a role control method provided by another embodiment of this application.
  • FIG. 5 is a schematic diagram of data forwarding provided by an embodiment of this application.
  • FIG. 6 is a schematic diagram of data forwarding provided by another embodiment of this application.
  • FIG. 7 is a schematic structural diagram of a role control device provided by an embodiment of this application.
  • Fig. 8 is a schematic structural diagram of a drone provided by an embodiment of the application.
  • the role control method provided by the embodiment of the present application can be applied to the control system 10 shown in FIG.
  • the device role of at least one of the multiple terminals 12 is the master, and the device role of at least one of the multiple terminals 12 is the slave.
  • the controlled device 11 may use the role control method provided in the embodiment of the present application to control the device role of the terminal 12.
  • the specific types of the controlled device 11 and the terminal 12 may be different.
  • the controlled device 11 may specifically be a drone
  • the terminal 12 may specifically include a remote controller with a screen, a smart phone, and the like.
  • terminals 12 with different device roles may provide different functions for the controlled device 11.
  • the terminal whose device role is the master can control the flight of the drone, and the terminal whose device role is the slave can control the shooting of the camera mounted on the drone. .
  • connection established between the terminal 12 and the controlled device 11 may specifically be any type of connection that needs to be established through signaling interaction.
  • the connection established between the terminal 12 and the controlled device 11 may be a wireless fidelity (Wireless Fidelity, WiFi) connection.
  • WiFi Wireless Fidelity
  • the connection between the controlled device 11 and the terminal 12 can be used for image transmission.
  • the role control method provided by the embodiments of the present application determines the device identity of the terminal when a connection is established with the terminal.
  • the device identities of multiple terminals and the device roles there is a correspondence between the device identities of multiple terminals and the device roles, and the correspondence is used to characterize multiple
  • the respective device roles of the terminals and the corresponding relationships are obtained based on the sequence of establishing connections between multiple terminals and the controlled device, which implements a role control method in which the controlled device determines the device role of the terminal based on the sequence of establishing connections between the terminal and the controlled device.
  • FIG. 2 is a schematic flowchart of a role control method provided by an embodiment of this application.
  • the execution subject of this embodiment may be the controlled device 11.
  • the method of this embodiment may include:
  • Step 21 Establish a connection with the terminal through signaling interaction with the terminal.
  • the connections established between the controlled device and the terminal can be different.
  • the controlled device can establish a WiFi connection with the terminal through signaling interaction with the terminal.
  • Step 22 In the case of establishing a connection with the terminal, determine the device identifier of the terminal.
  • this step there is a correspondence between the device identities and device roles of the multiple terminals, and the correspondence is used to characterize the respective device roles of the multiple terminals, and the correspondence is based on the multiple terminals and the device roles.
  • the order in which the controlled device establishes a connection is obtained.
  • the device identifier of the terminal may specifically be any type of identifier that can uniquely identify the terminal within a period of time.
  • the method for determining the device identification can be implemented flexibly according to requirements.
  • the device identification may be allocated by the controlled device to the terminal that establishes a connection with it, or the device identification may be obtained by the controlled device from the terminal that establishes a connection with it.
  • the device role of the terminal is reflected in the corresponding relationship between the device identifier and the device role of the terminal.
  • the device identifier of the terminal 1 corresponds to the host in the corresponding relationship, it can indicate that the device role of the terminal 1 is the host.
  • the correspondence relationship between the device identities and device roles of multiple terminals may be embodied in the form of a table.
  • the correspondence relationship may also be embodied in other forms, which is not limited in this application.
  • the respective device roles of multiple terminals are related to the sequence of establishing connections between the multiple terminals and the controlled device.
  • the device roles of each terminal need to be based on the sequence of establishing connections between multiple terminals and the controlled device.
  • the device roles of the multiple terminals may be determined based only on the sequence of establishing connections between the multiple terminals and the controlled device. For example, suppose that the controlled device determines the order in which the terminal establishes a connection with it within a period of time: 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 to the first terminal to establish a connection with it. If the device role of is the master role, the device role assigned to terminal 1 by the controlled device is the master, and the device role assigned to terminal 2 and terminal 3 by the controlled device is the slave. Among them, the period of time can be flexibly implemented according to requirements. Illustratively, the period of time may specifically be the time from the time when the controlled device was last started to the current time.
  • the device identity of the terminal is determined when a connection is established with the terminal.
  • the device identities of the multiple terminals and the device roles there is a correspondence between the device identities of the multiple terminals and the device roles, and the correspondence is used to characterize the respective devices of the multiple terminals.
  • Role and the corresponding relationship is obtained based on the sequence of establishing connections between multiple terminals and the controlled device. Since the corresponding relationship is obtained based on the sequence of establishing connections between multiple terminals and the controlled device, the controlled device can be based on the terminal and the controlled device.
  • the order in which the connection is established determines the role control method of the terminal's device role. Compared with the assignment of the master-slave role of the terminal through the negotiation between the terminal and the controlled device, the terminal and the controlled device need multiple communications to complete the negotiation, which reduces To determine the time consumed by the role and the resources occupied.
  • FIG. 3 is a schematic flowchart of a role control method provided by another embodiment of the application.
  • This embodiment based on the embodiment shown in FIG. 2, mainly describes an optional implementation manner for the controlled device to assign device roles to the terminal .
  • the method of this embodiment may include:
  • Step 31 Establish a connection with the terminal through signaling interaction with the terminal.
  • step 31 is similar to step 21 and will not be repeated here.
  • Step 32 In the case of establishing a connection with the terminal, according to the order in which the terminal establishes a connection with the controlled device, assign multiple Internet Protocol (IP, Internet Protocol) addresses with a preset priority from the preset existence The IP address is assigned to the terminal, and the IP address corresponds to the device role to obtain the device role corresponding to the device identifier of the terminal.
  • IP Internet Protocol
  • the IP address of the terminal is the device identification of the terminal, and the IP address of the terminal is selected and allocated by the controlled device from multiple IP addresses based on the order in which the terminal establishes a connection with it.
  • multiple IP addresses may be obtained by the controlled device using a dynamic host configuration protocol (Dynamic Host Configuration Protocol, DHCP).
  • DHCP Dynamic Host Configuration Protocol
  • the device role of the terminal is determined after the IP address is assigned to the terminal.
  • the correspondence between the IP address and the device role may be as shown in Table 1 below, for example.
  • the terminal Since there is an allocation priority among multiple IP addresses, and the terminal is assigned an IP address from 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 compared with the terminal and the controlled device. The order in which devices establish connections is related. In addition, due to the corresponding relationship between the IP address and the device role, the device role of the terminal can be related to the sequence of establishing connections between the terminal and the controlled device.
  • the controlled device determines that the order in which the terminal establishes a connection with it is the first to connect to the terminal 1.
  • terminal 2 establishes a connection with it the second, terminal 3 establishes a connection with it, and terminal 4 establishes a connection with it, then the IP address assigned to terminal 1 by the controlled device is 192.168.1.2, thus realizing the control
  • the device role assigned to terminal 1 is the host, the IP address assigned to terminal 2 by the controlled device is 192.168.1.3, the IP address assigned to terminal 3 is 192.168.1.4, and the IP address assigned to terminal 4 is 192.168.1.5.
  • the device role assigned to the terminal 2 to the terminal 4 by the controlled device is a slave.
  • the period of time can be flexibly implemented according to requirements.
  • the period of time may specifically be the time from the time when the controlled device was last started to the current time.
  • the correspondence between the IP address and the device role may include a first correspondence between the IP address and the terminal's SubId, and a second correspondence between the subId and the device role.
  • the subordinate identifier can be used to distinguish different terminals among multiple terminals.
  • the first correspondence relationship may be as shown in Table 2 below, and the second correspondence relationship may be as shown in Table 3 below, for example.
  • IP address SubId 192.168.1.2 1 192.168.1.3 2 192.168.1.4 3 192.168.1.5 4
  • SubId Device role 1 Host 2 Slave 3 Slave 4 Slave ... ...
  • the controlled device can also indicate the device role assigned to the terminal to the terminal.
  • the specific method of indicating its device role to the terminal can be implemented flexibly according to requirements. This will not be repeated here.
  • the method of this embodiment may further include: if the heartbeat packet sent by the terminal is not received within a period of time, updating the second correspondence relationship to delete the terminal correspondence in the second correspondence relationship Information.
  • the controlled device can consider that the connection between the terminal and it has been disconnected.
  • the second correspondence can 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 is a terminal with SubId equal to 1, as an example, deleting the information corresponding to the terminal in the second correspondence may specifically be deleting "SubId equals to 1 in Table 3."
  • the device role is the host" line.
  • the method of this embodiment may further include: broadcasting the updated second correspondence relationship, so that when the terminal determines that its role is abnormal according to the second correspondence relationship, it may report to the accused
  • the device sends a role request.
  • the role request can be used to request a certain role from the controlled device.
  • the specific manner in which the controlled device processes the role request reference may be made to the specific description in the subsequent embodiments.
  • 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. Broadcasting the updated second correspondence is helpful to ensure the consistency of the terminal device role understanding between the terminal and the controlled device.
  • the updated second correspondence Broadcasting can also avoid the problem of erroneous deletion of terminal information in the second correspondence relationship, which is beneficial to improving reliability.
  • the method provided by the embodiment of the present application allocates an IP address to the terminal from a plurality of preset IP addresses with priority distribution based on the order in which the terminal establishes a connection with the controlled device when a connection is established with the terminal, Since there is an allocation priority among multiple IP addresses, and the terminal is assigned an IP address from multiple IP addresses according to the order in which the terminal establishes a connection with the controlled device, it is realized that the IP address assigned to the terminal can be connected to the terminal. It is related to the order in which the controlled device establishes a connection, and further because there is a corresponding relationship between the IP address and the device role, the controlled device can determine the role control mode of the terminal's device role based on the order in which the terminal establishes a connection with it.
  • Figure 4 is a schematic flow diagram of a role control method provided by another embodiment of this application. Based on the embodiment shown in Figure 2, this embodiment mainly describes another alternative implementation for the controlled device to assign device roles to the terminal Way. As shown in Figure 4, the method of this embodiment may include:
  • Step 41 Establish a connection with the terminal through signaling interaction with the terminal.
  • step 31 is similar to step 21 and will not be repeated here.
  • Step 42 In the case of establishing a connection with the terminal, obtain the device identifier of the terminal from the terminal.
  • the device identifier of the terminal may include the unique device identifier of the terminal.
  • the unique device identifier may specifically be a Media Access Control (MAC) address of the terminal.
  • the terminal may actively send the device identification to the controlled device after establishing a connection with the controlled device.
  • the controlled device may also obtain the device identification of the terminal in other ways. There is no restriction on this.
  • Step 43 Determine 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.
  • 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 identifier of the terminal is determined according to the location where the terminal establishes a connection with the controlled device, the controlled device can determine the role control mode of the terminal's device role based on the sequence in which the terminal establishes a connection with the controlled device.
  • the order in which the terminal establishes a connection with the controlled device can specifically refer to the order in which the terminal establishes a connection with the controlled device within a period of time, and this period of time can be flexibly implemented according to requirements.
  • the corresponding relationship can be initialized to null at the beginning of a period of time. Then, after terminal 1 is the first to establish a connection with the controlled device within this period of time, it can obtain the device identification of terminal 1 (for example, aa:bb:cc:dd::ee:01) from terminal 1 to determine the The device role corresponding to the device identifier is the host, and the following table 3-1 is obtained.
  • the device identification of terminal 1 for example, aa:bb:cc:dd::ee:01
  • the device identification of the terminal 2 (for example, aa:bb:cc:dd::ee:02) can be obtained from the terminal 2 to determine the terminal 2
  • the device role corresponding to the device identifier of is the slave, and the following table 3-2 is obtained.
  • the terminal 3’s device identification (for example, aa:bb:cc:dd::ee:03) can be obtained from the terminal 3 to determine the terminal 3’s
  • the device role corresponding to the device identifier is the slave, and the following table 3-3 is obtained.
  • the period of time may specifically be the time from the time when the controlled device was last started up to the current time.
  • 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 specifically include: If the first terminal to establish a connection with the controlled device after the controlled device is started, it is determined that the device role corresponding to the device identifier of the terminal is the host. As a result, the device role of the first terminal to establish a connection with the controlled device can be controlled as the host after the controlled device is started.
  • the terminal is not the first terminal to establish a connection with the controlled device after the controlled device is started, it is determined that the device role corresponding to the device identifier of the terminal is a slave. In this way, the device role of the terminal that is not the first to establish a connection with the controlled device can be controlled as a slave after the controlled device is started.
  • the connection may be disconnected due to various reasons.
  • the The order of establishing a connection between the terminal and the controlled device, and determining the device role corresponding to the device identifier of the terminal may specifically include: If the controlled device establishes a connection, and there is no host connected to the controlled device currently, it is determined that the device role corresponding to the device identifier of the terminal is the host.
  • 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 started on the controlled device After that, it is not the first time to establish a connection with the controlled device, the historical device role of the terminal is the host and there is no host connected to the controlled device at present, then it is determined that the device role corresponding to the device identifier of the terminal is Host. As a result, it can be realized that after a terminal as the host disconnects due to some reason, a connection with the controlled terminal is established again, and there are no other newly connected terminals during the period, the role of the host of the terminal can be maintained.
  • 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 there is currently a device connected to the controlled device The master determines that the device role corresponding to the device identifier of the terminal is the slave.
  • a master-slave relationship can be realized in which one terminal of the multiple terminals serves as the master, and the other terminals all serve as slaves.
  • connection status of the terminal and the establishment serve as the information corresponding to the device identification of the terminal.
  • the following table 4 can be used.
  • the terminal and the controlled device with the device identifiers aa:bb:cc:dd::ee:01 and aa:bb:cc:dd::ee:02 are currently in the state of establishing a connection, and the device identifier is aa
  • the terminal of :bb:cc:dd::ee:03 is currently disconnected from the controlled device.
  • connection establishment timestamp 123456781 of the terminal with the equipment identification aa:bb:cc:dd::ee:01 is earlier than the connection establishment timestamp 123456789 of the terminal with the standby identification aa:bb:cc:dd::ee:02, Therefore, the device role corresponding to aa:bb:cc:dd::ee:01 can be the master, 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 the slave, which can indicate that when the terminal of aa:bb:cc:dd::ee:01 is connected to the controlled device before, its device role is Slave.
  • the method provided in the embodiments of this application obtains the device ID of the terminal from the terminal when a connection is established with the terminal, and determines the device role corresponding to the device ID of the terminal according to the order in which the terminal establishes a connection with the controlled device.
  • the device role corresponding to the device identifier is determined according to the location where the terminal establishes a connection with the controlled device, so that the controlled device can determine the role control mode of the terminal's device role based on the sequence in which the terminal establishes a connection with it.
  • it 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.
  • the terminal can set its own role as the requested role, thereby realizing the role control method that allows the terminal to request the role, which is beneficial to improve the role Flexibility of control.
  • the method provided in the embodiment of the present application may further include: if the role request is for requesting to be a slave and the device role corresponding to the terminal in the correspondence relationship is the master, then updating the correspondence relationship, The device role corresponding to the device identifier of the terminal in the corresponding relationship is modified as a slave, and a success response is returned.
  • the role requested by the terminal is the slave and the role assigned to the terminal by the controlled device is the master, the role of the terminal can be updated to the slave, thereby allowing the terminal to request the switch from the master to the slave.
  • Role control method if the role request is for requesting to be a slave and the device role corresponding to the terminal in the correspondence relationship is the master, then updating the correspondence relationship, The device role corresponding to the device identifier of the terminal in the corresponding relationship is modified as a slave, and a success response is returned.
  • the method provided in the embodiment of the present application may further include: if the role request is used to request to be a master and the device role corresponding to the terminal in the correspondence relationship is a slave, returning a failure response , So that the terminal prompts the user with failure information according to the failure response. Therefore, it can be realized that when the role requested by the terminal is the master 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, thus realizing that the terminal request is not allowed to switch from the slave to the master Role control method.
  • the device may further include: determining the device role for which the first data is to be sent (denoted as the target device role) and the corresponding relationship.
  • the device identifier of the terminal (denoted as the first terminal); and, based on the device identifier of the first terminal, sending the first data to the first terminal.
  • the first data refers to data sent by the controlled device to the terminal, and may also be referred to as downlink data.
  • the controlled device sends downlink data to the terminal, it can specify which device role the downlink data needs to be sent to, that is, what is the role of the target device targeted by the downlink data, so as to control that the terminal with the target device role responds to the downlink data.
  • the downlink data from the controlled device to the terminal is sent in the form of broadcast, and the role of the target device needs to be carried in the downlink data to indicate that the terminal with the role of the target device responds to the downlink data.
  • the downlink data carries the role of the target device, the information of the role of the target device needs to occupy a certain amount of downlink resources.
  • the device identification of the first terminal targeted by the first data is determined based on the target device role targeted by the first data and the correspondence relationship, and based on the device identification of the first terminal
  • the identifier sends the first data to the first terminal, which can avoid sending information about the role of the target device to the terminal, reduce the occupation of downlink resources, and help save downlink resources.
  • the method provided in the embodiment of the present application may be implemented by the main control chip, and the data transmission may be implemented by the communication module.
  • the sending the first data to the first terminal based on the device identifier of the first terminal may specifically include: the main control chip transmits the first data
  • the device identifier of the first terminal is sent to the communication module together, so that the communication module sends the first data to the first terminal according to the device identifier of the first terminal.
  • the communication module refers to a hardware template. Taking the communication protocol as the WiFi protocol as an example, the communication module may specifically be a WiFi module.
  • the first data may be generated by a gimbal controller (GCU) or an inertial measurement unit (IMU).
  • GCU gimbal controller
  • IMU inertial measurement unit
  • the first data can also be generated by other hardware modules.
  • the first data can also be generated by the main control chip, which is not limited in this application.
  • the PTZ controller may send the first data and the role information used to characterize the role of the target device for which the first data is targeted to the main control chip.
  • the main control chip determines the device identification of the first terminal targeted by the first data based on the role of the target device targeted by the first data.
  • the main control chip After the main control chip determines the device identification of the first terminal, it 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.
  • the WiFi module can send the first data to terminal 1 according to the device ID of terminal 1. It should be noted that when the type of the device identifier used in the communication module is inconsistent with the type of the device identifier in the corresponding relationship, the main control chip can adapt the device identifier.
  • it may further include: in the case of receiving the second data sent by the second terminal, determining the second terminal according to the device identifier of the second terminal and the corresponding relationship.
  • the second data refers to data sent by the terminal to the controlled device, and may also be referred to as uplink data. Since the second terminal has a device role, the second data it sends also has the attribute of the device role, and the device role of the second terminal is the target device role to which the second data belongs.
  • 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 which device role the terminal sends the data.
  • the device role information needs to occupy a certain amount of uplink resources.
  • the terminal can prevent the terminal from sending device role information to the controlled device and reduce The occupation of uplink resources is conducive to saving uplink resources.
  • the method provided in the embodiment of the present application may be implemented by the main control chip, and the data transmission may be implemented by the communication module.
  • the main control chip+communication module in the case of receiving the second data sent by the second terminal, according to the device identifier of the second terminal and the corresponding relationship, it is determined to which the second data belongs
  • the role of the target device may specifically include: the main control chip determines the role of the target device to which the second data belongs based on the device identifier of the second terminal and the corresponding relationship, and the device identifier of the second terminal is used by the communication module together with the corresponding relationship.
  • the second data is sent to the main control chip together.
  • the second data may be responded by the main control chip.
  • the embodiment of the present application may further include: the main control chip is based on the The target device role to which the second data belongs responds to the second data. It should be noted that the specific manner in which the main control chip responds to the second data based on the role of the target device to which the second data belongs can be implemented flexibly according to requirements, which is not limited in this application.
  • a module other than the main control chip may respond to the second data, and the other module refers to a hardware module.
  • the embodiment of the present application may further include: the main control chip forwards the second data together with the role of the target device to which the second data belongs to other modules, so that the other modules are based on the second data The device role responds to the second data.
  • the main control chip forwards the second data to other modules, which may specifically include: the main control chip pair is used to encapsulate the second data Unpacking the data packet to obtain the first serial number of the second terminal for the data packet; and the main control chip modifies the serial number of the data packet from the first serial number to the second serial number After that, the data packet is forwarded to other modules along 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 perform the data packet in the main control chip. The identified serial number.
  • 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 sequence number.
  • a preset method is used to generate unique data in the main control chip.
  • the serial number of the package identifier Since 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 mode can be flexibly implemented according to requirements. In one embodiment, the preset mode may specifically be an incremental mode with a step length of 1.
  • the response packet for the data packet may be restored based on the sequence number in the response packet to ensure the validity of the sequence number on the terminal side.
  • the embodiment of the present application may further include: the main control chip adds routing information including the relationship between the first serial number, the second serial number, and the device identifier of the second terminal; The control chip receives the response packet for the data packet sent by the other module; and the main control chip modifies the sequence number of the response packet from the second sequence number to the After the first serial number, the response packet is forwarded to the communication module together with the device identification of the second terminal, so that the communication module sends the response packet to the second terminal.
  • the main control chip can generate a unique serial number in a preset manner and replace the first serial number in the data packet.
  • the second data may be generated by the terminal. Take the terminal 2 sending the second data to the PTZ controller as an example. Referring to Figure 6, the terminal 2 can send the second data to the WiFi module. 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 the terminal 2 together with the second data to the main control chip. On the one hand, the main control chip can determine the role of the target device to which the second data belongs according to the device identifier of the terminal 2 and the corresponding relationship. On the other hand, the main control chip can modify the serial number in the data packet.
  • the main control chip modifies the serial number 2 in the data packet to 10. After that, the main control chip can record the routing information of the routing information "10 Device ID 2 of the terminal 2", and send the target device role to which the second data belongs together with the data packet with the modified sequence number to the pan/tilt controller, so that the pan/tilt The controller responds.
  • the pan/tilt controller may generate a response packet for the data packet. Since the serial number of the data packet received by the pan/tilt controller is 10, the serial number in the response packet is also 10.
  • the pan/tilt controller can send the response packet to the main control chip, and the main control chip can modify the serial number in the response packet from 10 back to 2 based on the recorded routing information, and determine the device ID of the terminal 2 corresponding to the response packet.
  • the main control chip can send the device identification of the terminal 2 together with the modified response packet to the WiFi module, and the WiFi module returns the response packet to the terminal 2 according to the device identification of the terminal 2.
  • the WiFi chip may send information such as the time stamp of the connection establishment of the terminal to the main control chip.
  • FIG. 7 is a schematic structural diagram of a role control apparatus provided by an embodiment of this application. As shown in FIG. 7, the apparatus 700 may include: a processor 701 and a memory 702.
  • the memory 702 is used to store program codes
  • the processor 701 calls the program code, and when the program code is executed, is used to perform the following operations:
  • the role control device provided in this embodiment can be used to implement the technical solutions of the foregoing method embodiments, and its implementation principles and technical effects are similar to those of the method embodiments, and will not be repeated here.
  • FIG. 8 is a schematic structural diagram of a drone provided by an embodiment of the application.
  • the drone 80 includes a fuselage 801, a power system 802 provided on the fuselage, a camera 803, and a character Control device 804;
  • the power system 802 is used to provide power for the drone
  • the shooting device 803 is used for video shooting during the flight of the drone, and the captured video is used for image transmission;
  • the character control device 804 includes a memory and a 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:
  • the drone 80 may further include a pan/tilt 805, and the camera 803 may be set on the fuselage 801 through the pan/tilt 805.
  • the drone can also include other components or devices, which are not listed here.
  • a person of ordinary skill in the art can understand that all or part of the steps in the foregoing method embodiments can be implemented by a program instructing relevant hardware.
  • the aforementioned program can be stored in a computer readable storage medium. When the program is executed, it executes the steps including the foregoing method embodiments; and the foregoing storage medium includes: ROM, RAM, magnetic disk, or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Aviation & Aerospace Engineering (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Multimedia (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

一种角色控制方法、装置及设备。该方法包括:通过与终端(12)进行信令交互,与终端建立连接(21);在与终端建立连接的情况下,确定终端的设备标识;其中,多个终端的设备标识和设备角色之间存在对应关系,对应关系用于表征多个终端各自的设备角色,对应关系是基于多个终端和被控设备建立连接的先后顺序得到(22)。该方法减少了确定角色所消耗的时长以及所占用的资源。

Description

角色控制方法、装置及设备 技术领域
本申请涉及通信技术领域,尤其涉及一种角色控制方法、装置及设备。
背景技术
目前,已提出了多个终端连接同一被控设备的场景,其中,多个终端之间存在主从关系。例如,无人机场景下,作为主机的终端可以控制无人机的飞行,作为从机的终端可以控制搭载在无人机上相机的拍摄。
通常,是通过终端和被控设备协商来分配终端的主从角色,终端和被控设备之间需要多次通信才能完成协商。具体的,一终端在与被控设备建立连接之后,先由该终端向被控设备发送角色请求以请求目标角色,如果被控设备同意向该终端分配目标角色则返回请求成功响应,该终端根据请求成功响应将角色设置为目标角色,并在设置成功之后向被控设备发送设置成功响应,被控设备根据设置成功响应在被控设备侧将该终端的角色也设置为目标角色,至此完成了该终端的主从角色分配。如果被控设备不同意向该终端分配目标角色,则该终端和被控设备之间还需要更多的通信才能完成协商。
然而,上述确定终端主从角色的方式,存在耗时较长、占用资源较多的问题。
发明内容
本申请实施例提供一种角色控制方法、装置及设备,用以解决现有技术中确定终端主从角色的方式,存在耗时较长、占用资源较多的问题。
第一方面,本申请实施例提供一种角色控制方法,应用于被控设备,包括:
通过与终端进行信令交互,与所述终端建立连接;
在与所述终端建立连接的情况下,确定所述终端的设备标识;
其中,多个终端的设备标识和设备角色之间存在对应关系,所述对应关系用于表征所述多个终端各自的设备角色,所述对应关系是基于所述多个终端和所述被控设备建立连接的先后顺序得到。
第二方面,本申请实施例提供一种角色控制装置,应用于被控设备,包括:存储器和处理器;
所述存储器,用于存储程序代码;
所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:
通过与终端进行信令交互,与所述终端建立连接;
在与所述终端建立连接的情况下,确定所述终端的设备标识;
其中,多个终端的设备标识和设备角色之间存在对应关系,所述对应关系用于表征所述多个终端各自的设备角色,所述对应关系是基于所述多个终端和所述被控设备建立连接的先后顺序得到。
第三方面,本申请实施例提供一种无人机,所述无人机包括机身、设置于所述机身上的动力系统、拍摄装置和角色控制装置;
所述动力系统,用于为所述无人机提供动力;
所述拍摄装置,用于在所述无人机飞行过程中进行视频拍摄,所拍摄的视频用于图传;
所述角色控制装置包括存储器和处理器;
所述存储器,用于存储程序代码;
所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:
通过与终端进行信令交互,与所述终端建立连接;
在与所述终端建立连接的情况下,确定所述终端的设备标识;
其中,多个终端的设备标识和设备角色之间存在对应关系,所述对应关系用于表征所述多个终端各自的设备角色,所述对应关系是基于所述多个终端和所述被控设备建立连接的先后顺序得到。
第四方面,本申请实施例提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序包含至少一段代码,所述至 少一段代码可由计算机执行,以控制所述计算机执行上述第一方面任一项所述的方法。
第五方面,本申请实施例提供一种计算机程序,当所述计算机程序被计算机执行时,用于实现上述第一方面任一项所述的方法。
本申请实施例提供一种角色控制方法、装置及设备,通过在与终端建立连接的情况下,确定终端的设备标识,其中,多个终端的设备标识和设备角色之间存在对应关系,对应关系用于表征多个终端各自的设备角色,且对应关系是基于多个终端和被控设备建立连接的先后顺序得到,由于对应关系是基于多个终端和被控设备建立连接的先后顺序得到的,因此能够实现被控设备基于终端与其建立连接的先后顺序来决定终端的设备角色的角色控制方式,与通过终端和被控设备协商来分配终端的主从角色,终端和被控设备之间需要多次通信才能完成协商相比,减少了确定角色所消耗的时长以及所占用的资源。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1本申请实施例提供的角色控制方法的应用场景示意图;
图2为本申请一实施例提供的角色控制方法的流程示意图;
图3为本申请另一实施例提供的角色控制方法的流程示意图;
图4为本申请又一实施例提供的角色控制方法的流程示意图;
图5为本申请一实施例提供的数据转发的示意图;
图6为本申请另一实施例提供的数据转发的示意图;
图7为本申请一实施例提供的角色控制装置的结构示意图;
图8为本申请一实施例提供的无人机的结构示意图。
具体实施方式
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本申请实施例提供的角色控制方法可以应用于如图1所示的控制系统10,控制系统10包括被控设备11和多个终端12,多个终端12均可以与被控设备11建立连接,且多个终端12之间存在主从关系,具体的,多个终端12中至少一个终端的设备角色是主机,多个终端12中至少一个终端的设备角色是从机。其中,被控设备11可以采用本申请实施例提供的角色控制方法来控制终端12的设备角色。
针对于不同的控制系统,被控设备11和终端12的具体类型可以不同。在一个实施例中,以无人机的控制场景为例,被控设备11具体可以是无人机,终端12具体可以包括带屏遥控器、智能手机等。
需要说明的是,设备角色不同的终端12,其针对被控设备11提供的功能可以不同。在一个实施例中,以被控设备11为无人机为例,设备角色是主机的终端可以控制无人机的飞行,而设备角色是从机的终端可以控制搭载在无人机上相机的拍摄。
终端12与被控设备11之间建立的连接具体可以是需要通过信令交互方式建立的任意类型连接。示例性的,终端12与被控设备11之间建立的连接可以是无线保真(Wireless Fidelity,WiFi)连接。在一个实施例中,以被控设备11包括无人机为例,被控设备11与终端12之间的连接可以用于图传。
本申请实施例提供的角色控制方法,通过在与终端建立连接的情况下,确定终端的设备标识,其中,多个终端的设备标识和设备角色之间存在对应关系,对应关系用于表征多个终端各自的设备角色,且对应关系是基于多个终端和被控设备建立连接的先后顺序得到,实现了由被控设备基于终端与其建立连接的先后顺序来决定终端的设备角色的角色控制方式。
下面结合附图,对本申请的一些实施方式作详细说明。在不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。
图2为本申请一实施例提供的角色控制方法的流程示意图,本实施例的执行主体可以为被控设备11。如图2所示,本实施例的方法可以包括:
步骤21,通过与终端进行信令交互,与所述终端建立连接。
本步骤中,基于通信协议的不同,被控设备与终端之间所建立的连接可以不同。以通信协议为WiFi协议为例,被控设备通过与终端进行信令交互,可以与终端建立WiFi连接。
需要说明的是,对于被控设备与终端通过信令交互建立连接的具体方式,可以参见相关技术中的内容,本申请对此不做限定。
步骤22,在与所述终端建立连接的情况下,确定所述终端的设备标识。
本步骤中,多个终端的设备标识和设备角色之间存在对应关系,所述对应关系用于表征所述多个终端各自的设备角色,所述对应关系是基于所述多个终端和所述被控设备建立连接的先后顺序得到。
终端的设备标识具体可以是能够在一段时间内对终端进行唯一标识的任意类型标识。对于设备标识的确定方式,可以根据需求灵活实现,示例性的,设备标识可以由被控设备为与其建立连接的终端分配,或者设备标识可以是被控设备从与其建立连接的终端获取。
终端的设备角色是体现在终端的设备标识和设备角色之间存在的对应关系中,例如,假设对应关系中终端1的设备标识和主机对应,则可以表示终端1的设备角色是主机。示例性的,多个终端的设备标识和设备角色之间的对应关系可以以表格的形式体现,当然,在其他实施例中,对应关系还可以以其他形式体现,本申请对此不做限定。
由于对应关系是基于多个终端和被控设备建立连接的先后顺序得到,因此,多个终端分别的设备角色,是与该多个终端和被控设备建立连接的先后顺序相关,即在确定多个终端分别的设备角色时需要基于多个终端和被控设备建立连接的先后顺序。
在一个实施例中,在确定多个终端分别的设备角色时可以仅基于多个终端和被控设备建立连接的先后顺序。例如,假设被控设备确定一段时间内终端与其建立连接的先后顺序为终端1先与其建立连接、然后终端2与其建立连接、最后终端3与其建立连接且被控设备默认最先与其建立连接的终端的设备角色为主机角色,则被控设备为终端1分配的设备角色为主机,被控设备为终端2和终端3分配的设备角色为从机。其中,该一段时间可以根据需求灵活实 现,示例性的,该一段时间具体可以为被控设备最近一次启动完成的时刻到当前时刻的时间。
在另一个实施例中,在确定多个终端分别的设备角色时除了基于多个终端和被控设备建立连接的先后顺序之外,还可以考虑其他信息,以提高角色控制的灵活性。
本申请实施例中,通过在与终端建立连接的情况下,确定终端的设备标识,其中,多个终端的设备标识和设备角色之间存在对应关系,对应关系用于表征多个终端各自的设备角色,且对应关系是基于多个终端和被控设备建立连接的先后顺序得到,由于对应关系是基于多个终端和被控设备建立连接的先后顺序得到的,因此能够实现被控设备基于终端与其建立连接的先后顺序来决定终端的设备角色的角色控制方式,与通过终端和被控设备协商来分配终端的主从角色,终端和被控设备之间需要多次通信才能完成协商相比,减少了确定角色所消耗的时长以及所占用的资源。
图3为本申请另一实施例提供的角色控制方法的流程示意图,本实施例在图2所示实施例的基础上,主要描述了被控设备为终端分配设备角色的一种可选实现方式。如图3所示,本实施例的方法可以包括:
步骤31,通过与终端进行信令交互,与所述终端建立连接。
需要说明的是,步骤31与步骤21类似,在此不再赘述。
步骤32,在与所述终端建立连接的情况下,根据所述终端与所述被控设备建立连接的位次,从预设的存在分配优先级的多个互联网协议(IP,Internet Protocol)地址中为所述终端分配IP地址,IP地址与设备角色对应,以得到所述终端的设备标识对应的设备角色。
本步骤中,终端的IP地址即为终端的设备标识,且终端的IP地址是由被控设备基于终端与其建立连接的位次,从多个IP地址中为终端选择分配的。以被控设备和终端之间建立WiFi连接为例,在一个实施例中,多个IP地址可以是被控设备采用动态主机配置协议(Dynamic Host Configuration Protocol,DHCP)获得。
由于IP地址与设备角色之间是存在对应关系的,因此在为终端分配IP地址之后即决定了该终端的设备角色。其中,IP地址与设备角色之间的对应关系例如可以如下表1所示。
表1
IP地址 设备角色
192.168.1.2 主机
192.168.1.3 从机
192.168.1.4 从机
192.168.1.5 从机
…… ……
由于多个IP地址之间存在分配优先级,且是根据终端与被控设备建立连接的位次从多个IP地址中为终端分配IP地址,因此为终端分配的IP地址能够与终端和被控设备建立连接的先后顺序相关。另外,由于IP地址与设备角色之间存在对应关系,因此终端的设备角色能够与终端和被控设备建立连接的先后顺序相关。
例如,假设表1中4个IP地址的分配优先级为192.168.1.2>192.168.1.3>192.168.1.4>192.168.1.5,且被控设备确定终端与其建立连接的先后顺序为终端1第一个与其建立连接、终端2第二个与其建立连接、终端3第三个与其建立连接、终端4第四个与其建立连接,则被控设备为终端1分配的IP地址为192.168.1.2,从而实现被控设备为终端1分配的设备角色为主机,被控设备为终端2分配的IP地址为192.168.1.3,为终端3分配的IP地址为192.168.1.4,为终端4分配的IP地址为192.168.1.5,从而实现被控设备为终端2至终端4分配的设备角色为从机。类似的,该一段时间可以根据需求灵活实现,示例性的,该一段时间具体可以为被控设备最近一次启动完成的时刻到当前时刻的时间。
为了提高实现的灵活性,IP地址与设备角色之间的对应关系可以包括IP地址与终端的从属标识(Sub Id)的第一对应关系,以及从属标识与设备角色的第二对应关系。其中,从属标识可以用于在多个终端中区分不同的终端。第一对应关系例如可以如下表2所示,第二对应关系例如可以如下表3所示。
表2
IP地址 Sub Id
192.168.1.2 1
192.168.1.3 2
192.168.1.4 3
192.168.1.5 4
…… ……
表3
Sub Id 设备角色
1 主机
2 从机
3 从机
4 从机
…… ……
可选的,在终端需要获知其设备角色的情况下,被控设备还可以将为终端所分配的设备角色指示给终端,对于向终端指示其设备角色的具体方式,可以根据需求灵活实现,在此不再赘述。
可选的,本实施例的方法还可以包括:若一段时间内未接收到所述终端发送的心跳包,则更新所述第二对应关系,以删除所述第二对应关系中所述终端对应的信息。
一段时间内未接收到所述终端发送的心跳包,被控设备可以认为所述终端与其之间的连接已断开,为了避免连接已断开的终端被被控设备误认为是以一定角色与其进行通信的终端所带来的问题,可以更新第二对应关系,以删除第二对应关系中所述终端对应的信息。以第二对应关系如表3所示,且所述终端为Sub Id等于1的终端为例,删除第二对应关系中所述终端对应的信息具体可以为删除表3中“Sub Id等于1,设备角色是主机”这一行。针对于必须存在主机的场景,在确定需要删除表3中“Sub Id等于1,设备角色是主机”这一行的情况下,可以从剩余的设备角色是从机的终端中选择一个终端并将其设备角色切换为主机。
进一步可选的,本实施例的方法还可以包括:对更新后的所述第二对应关系进行广播,以便所述终端在根据所述第二对应关系确定自身角色异常时,向所述被控设备发送角色请求。其中,角色请求可以用于向被控设备请求一定的角色。关于被控设备处理角色请求的具体方式,可以参见后续实施例的具体描述。
在被控设备对更新后的所述第二对应关系进行广播时,与所述被控设备之间实际未断开连接的终端均可以接收到更新后的第二对应关系。通过对更新后的第二对应关系进行广播,有利于确保终端和被控设备双方对于终端设 备角色理解的一致性。另外,考虑到存在由于某种原因导致终端发送的心跳包未能及时被被控设备收到,导致被控设备误认为终端与其已断开连接的情况,通过对更新后的第二对应关系进行广播,还能够避免第二对应关系中终端的信息被误删除的问题,有利于提高可靠性。
本申请实施例提供的方法,通过在与终端建立连接的情况下,根据终端与被控设备建立连接的位次,从预设的存在分配优先级的多个IP地址中为终端分配IP地址,由于多个IP地址之间存在分配优先级,且是根据终端与被控设备建立连接的位次从多个IP地址中为终端分配IP地址的,因此实现了为终端分配的IP地址能够与终端和被控设备建立连接的先后顺序相关,进一步的由于IP地址与设备角色之间存在对应关系,从而能够实现被控设备基于终端与其建立连接的先后顺序来决定终端的设备角色的角色控制方式。
图4为本申请又一实施例提供的角色控制方法的流程示意图,本实施例在图2所示实施例的基础上,主要描述了被控设备为终端分配设备角色的另一种可选实现方式。如图4所示,本实施例的方法可以包括:
步骤41,通过与终端进行信令交互,与所述终端建立连接。
需要说明的是,步骤31与步骤21类似,在此不再赘述。
步骤42,在与所述终端建立连接的情况下,从所述终端获取所述终端的设备标识。
本步骤中,所述终端的设备标识可以包括所述终端的设备唯一标识符,示例性的,所述设备唯一标识符具体可以为所述终端的媒体访问控制(Media Access Control,MAC)地址。在一个实施例中,终端可以在与被控设备建立连接之后,主动将设备标识发送至被控设备,当然,在其他实施例中被控设备也可以通过其他方式获得终端的设备标识,本申请对此不做限定。
步骤43,根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色。
本步骤中,在获取到终端的设备标识之后,根据建立连接的位置确定终端的设备标识对应的设备角色,以得到设备标识与设备角色的对应关系。由于终端的设备标识对应的设备角色是根据终端与被控设备建立连接的位置确定的,因此能够实现被控设备基于终端与其建立连接的先后顺序来决定终端的设备角色的角色控制方式。
终端与被控设备建立连接的位次,具体可以是指一段时间内终端与被控 设备建立连接的位次,该一段时间可以根据需求灵活实现。
例如,首先,在一段时间的起始可以将对应关系初始化为空。然后,在该段时间内终端1第一个与被控设备建立连接之后,可以从终端1获取终端1的设备标识(例如,aa:bb:cc:dd::ee:01)确定终端1的设备标识对应的设备角色为主机,从而得到如下表3-1。进一步的,在该段时间内终端2第二个与被控设备建立连接之后,可以从终端2获取终端2的设备标识(例如,aa:bb:cc:dd::ee:02)确定终端2的设备标识对应的设备角色为从机,从而得到如下表3-2。之后,在该段时间内终端3第三个与被控设备建立连接之后,可以从终端3获取终端3的设备标识(例如,aa:bb:cc:dd::ee:03)确定终端3的设备标识对应的设备角色为从机,从而得到如下表3-3。
表3-1
MAC地址 设备角色
aa:bb:cc:dd::ee:01 主机
表3-2
MAC地址 设备角色
aa:bb:cc:dd::ee:01 主机
aa:bb:cc:dd::ee:02 从机
表3-3
MAC地址 设备角色
aa:bb:cc:dd::ee:01 主机
aa:bb:cc:dd::ee:02 从机
aa:bb:cc:dd::ee:03 从机
示例性的,所述一段时间具体可以为被控设备最近一次启动完成的时刻到当前时刻的时间。基于此,在一个实施例中,所述根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色,具体可以包括:若所述终端为在所述被控设备启动之后第一个与所述被控设备建立连接的终端,则确定所述终端的设备标识对应的设备角色为主机。由此,可以实现将被控设备启动之后第一个与其建立连接的终端的设备角色控制为主机。
进一步可选的,若所述终端为在所述被控设备启动之后非第一个与所述被控设备建立连接的终端,则确定所述终端的设备标识对应的设备角色为从 机。由此,可以实现将被控设备启动之后非第一个与其建立连接的终端的设备角色控制为从机。
考虑到一段时间内在终端与被控设备建立连接之后,可能由于各种原因导致连接断开,为了尽可能的确保与被控设备建立连接终端中存在主机,在另一个实施例中,所述根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色,具体可以包括:若所述终端是在所述被控设备启动之后第一次与所述被控设备建立连接,且当前不存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为主机。
可选的,所述根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色,还可以包括:若所述终端是在所述被控设备启动之后非第一次与所述被控设备建立连接,所述终端的历史设备角色是主机且当前不存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为主机。由此,可以实现在作为主机的一终端由于某种原因断链之后,再次与被控终端建立连接,且期间不存在其他新接入的终端情况下,可以保持该终端的主机角色。
可选的,所述根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色,还可以包括:若当前已存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为从机。由此,可以实现多个终端中一个终端作为主机,其余终端均作为从机的主从关系。
为了便于获知终端是否是在被控设备启动之后第一次与被控设备建立连接,以及多个终端与被控设备建立连接的先后顺序,在一个实施例中,可以将终端的连接状态、建立连接时间和终端的设备角色一起作为终端的设备标识所对应的信息。例如可以如下表4。
表4
MAC地址 连接状态 设备角色 连接建立时间戳
aa:bb:cc:dd::ee:01 连接 主机 123456781
aa:bb:cc:dd::ee:02 连接 从机 123456789
aa:bb:cc:dd::ee:03 未连接 从机 NULL
表4中,设备标识为aa:bb:cc:dd::ee:01和aa:bb:cc:dd::ee:02的终端与被控设备当前是处于连接建立的状态,设备标识为aa:bb:cc:dd::ee:03的终端与被控设备当前是处于断开连接的状态。建立连接设备标识为aa:bb:cc:dd::ee:01终端的 建立连接时间戳123456781是早于备标识为aa:bb:cc:dd::ee:02终端的建立连接时间戳123456789,由此aa:bb:cc:dd::ee:01对应的设备角色可以为主机,aa:bb:cc:dd::ee:02对应的设备角色可以为从机。aa:bb:cc:dd::ee:01对应的设备角色为从机,可以表示aa:bb:cc:dd::ee:01的终端与被控设备之前处于连接状态时,其设备角色是从机。
本申请实施例提供的方法,通过在与终端建立连接的情况下,从终端获取终端的设备标识,根据终端与被控设备建立连接的位次,确定终端的设备标识对应的设备角色,由于终端的设备标识对应的设备角色是根据终端与被控设备建立连接的位置确定的,从而能够实现被控设备基于终端与其建立连接的先后顺序来决定终端的设备角色的角色控制方式。
可选的,在上述方法实施例的基础上还可以包括:接收所述终端发送的角色请求;若所述角色请求的设备角色与所述对应关系中所述终端对应的设备角色相同,则返回成功响应,以便所述终端根据所述成功响应设置自身的角色。由此,可以实现在终端请求的角色与被控设备为终端分配的角色相同时,终端可以设置自身的角色为其请求的角色,从而实现了允许终端请求角色的角色控制方式,有利于提高角色控制的灵活性。
进一步可选的,本申请实施例提供的方法还可以包括:若所述角色请求用于请求作为从机且所述对应关系中所述终端对应的设备角色为主机,则更新所述对应关系,以将所述对应关系中所述终端的设备标识对应的设备角色修改为从机,并返回成功响应。由此,可以实现在终端请求的角色是从机,而被控设备为终端分配的角色是主机时,可以将终端的角色更新为从机,从而实现了允许终端请求由主机切换为从机的角色控制方式。
和或,进一步可选的,本申请实施例提供的方法还可以包括:若所述角色请求用于请求作为主机且所述对应关系中所述终端对应的设备角色为从机,则返回失败响应,以便所述终端根据所述失败响应向用户提示失败信息。由此,可以实现在终端请求的角色是主机,而被控设备为终端分配的角色是从机时,可以保持终端的角色为从机,从而实现了不允许终端请求由从机切换为主机的角色控制方式。
可选的,在上述方法实施例的基础上还可以包括:根据待发送的第一数据所针对的设备角色(记为目标设备角色)以及所述对应关系,确定所述第一数据所针对的终端(记为第一终端)的设备标识;以及,基于所述第一终 端的设备标识,将所述第一数据发送至所述第一终端。其中,所述第一数据是指被控设备向终端发送的数据,也可以称为下行数据。被控设备在向终端发送下行数据时,可以指定下行数据是需要发送至什么设备角色的终端,即下行数据针对的目标设备角色是什么,以实现控制由目标设备角色的终端响应下行数据。
传统技术中由被控设备至终端的下行数据是以广播的形式进行发送的,需要在下行数据携带有目标设备角色,以指示是由目标设备角色的终端对下行数据进行响应。然而,下行数据携带有目标设备角色的方式下,目标设备角色的信息需要占用一定的下行资源。本申请实施例中,在前述对应关系的基础上,通过根据第一数据所针对的目标设备角色以及对应关系,确定第一数据所针对的第一终端的设备标识,并基于第一终端的设备标识将第一数据发送至第一终端,能够避免向终端发送目标设备角色的信息,减少对于下行资源的占用,有利于节省下行资源。
在一个实施例中,本申请实施例提供的方法可以由主控芯片实现,数据的发送可以由通信模块实现。在主控芯片+通信模块的场景下,所述基于所述第一终端的设备标识,将所述第一数据发送至所述第一终端,具体可以包括:主控芯片将所述第一数据连同所述第一终端的设备标识一起发送至通信模块,以便所述通信模块根据所述第一终端的设备标识,将所述第一数据发送至所述第一终端。需要说明的是,所述通信模块是指硬件模板,以通信协议为WiFi协议为例,通信模块具体可以为WiFi模块。
以无人机场景为例,如图5所示,第一数据可以是由云台控制器(GCU)或者惯性测量装置(Inertial measurement unit,IMU)等生成,当然,在其他实施例中第一数据也可以由其他硬件模块生成,例如第一数据还可以由主控芯片生成,本申请对此不做限定。以向终端发送由云台控制器生成的第一数据为例,参考图5,云台控制器可以将第一数据及用于表征第一数据针对的目标设备角色的角色信息发送至主控芯片,由主控芯片基于第一数据针对的目标设备角色确定第一数据所针对的第一终端的设备标识。主控芯片在确定第一终端的设备标识之后,可以将第一数据连同第一终端的设备标识一起发送至WiFi模块,WiFi模块可以通根据第一终端的设备标识,将第一数据发送至第一终端。以目标设备角色为主机,且对应关系中主机对应的设备标识为终端1的设备标识为例,如图5所示,WiFi模块可以根据终端1的设备标识将第一 数据发送至终端1。需要说明的是,在通信模块中使用的设备标识与对应关系中的设备标识的类型不一致时,可以由主控芯片对设备标识进行适配。
可选的,在上述方法实施例的基础上还可以包括:在接收到第二终端发送的第二数据情况下,根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色。其中,所述第二数据是指终端向被控设备发送的数据,也可以称为上行数据。由于第二终端是存在设备角色的,因此其发送的第二数据也存在设备角色的属性,第二终端的设备角色即为第二数据所属的目标设备角色。
传统技术中由终端至被控设备的上行数据中需要携带其所属的设备角色,以向被控终端指示数据是由什么设备角色的终端发送的。然而,上行数据携带有设备角色的方式下,设备角色的信息需要占用一定的上行资源。本申请实施例中,在前述对应关系的基础上,通过根据第二终端的设备标识以及对应关系,确定第二数据所属的目标设备角色,能够避免终端向被控设备发送设备角色的信息,减少对于上行资源的占用,有利于节省上行资源。
在一个实施例中,本申请实施例提供的方法可以由主控芯片实现,数据的发送可以由通信模块实现。在主控芯片+通信模块的场景下,所述在接收到第二终端发送的第二数据情况下,根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色,具体可以包括:主控芯片根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色,所述第二终端的设备标识由通信模块连同所述第二数据一起发送至所述主控芯片。
在确定所述第二数据所属的目标设备角色之后,在一种场景下,所述第二数据可以由主控芯片响应,基于此,本申请实施例还可以包括:所述主控芯片基于所述第二数据所属的目标设备角色响应所述第二数据。需要说明的是,对于主控芯片基于第二数据所属的目标设备角色响应第二数据的具体方式,可以根据需求灵活实现,本申请对此不做限定。
或者,在另一种场景下,可以由主控芯片之外的其他模块响应第二数据,该其他模块是指硬件模块。基于此,本申请实施例还可以包括:所述主控芯片将所述第二数据连同所述第二数据所属的目标设备角色一起转发至其他模块,以便所述其他模块基于所述第二数据所述的设备角色针对所述第二数据进行响应。
考虑到数据包的序列号是针对一对收发端有效的,在被控设备与多个终端同时通信的场景下,传统的序列号无法生效,为了确保被控设备与多个终端同时通信的场景下被控设备侧序列号的有效性,可选的,所述主控芯片将所述第二数据转发至其他模块,具体可以包括:所述主控芯片对用于封装所述第二数据的数据包进行解包,以获得所述第二终端针对所述数据包的第一序列号;以及,所述主控芯片将所述数据包的序列号由第一序列号修改为第二序列号之后,将所述数据包连同所述第二数据所属的设备角色一起转发至其他模块,所述第二序列号为基于预设方式生成的,用于在所述主控芯片中唯一进行数据包标识的序列号。
其中,所述数据包具体可以是第二终端发送的数据包,该数据包中原本包括有第二终端针对该数据包的编号,即第一序列号。但是由于多个第二终端发送的数据包中包括的序列号会相同,导致其他模块无法区分,从而导致序列号失效,因此本申请中采用预设方式生成用于在主控芯片中唯一进行数据包标识的序列号。由于数据包均需要经过主控芯片转发至其他模块,因此在主控芯片中唯一的序列号,能够有效区分不同的数据包。预设方式可以根据需求灵活实现,在一个实施例中,预设方式具体可以为以1为步长的递增方式。
进一步可选的,针对所述数据包的应答包,可以基于对应答包中的序列号进行还原,以确保终端侧序列号的有效性。基于此,本申请实施例还可以包括:所述主控芯片添加包括所述第一序列号、所述第二序列号以及所述第二终端的设备标识之间关系的路由信息;所述主控芯片接收所述其他模块发送的针对所述数据包的应答包;以及,所述主控芯片根据所述路由信息,将所述应答包的序列号由所述第二序列号修改为所述第一序列号之后,将所述应答包连同所述第二终端的设备标识一起转发至所述通信模块,以便所述通信模块将所述应答包发送至所述第二终端。
以表3-3中设备标识为aa:bb:cc:dd::ee:01的主机先向被控设备发送一个数据包,设备标识为aa:bb:cc:dd::ee:02的从机再向被控设备发送一个数据包,之后,设备标识为aa:bb:cc:dd::ee:03的从机再向被控设备发送一个数据包为例,所得到的路由信息可以如下表5所示。
表5
第二序列号 设备标识 第一序列号
1 aa:bb:cc:dd::ee:01 2
2 aa:bb:cc:dd::ee:02 2
3 aa:bb:cc:dd::ee:03 3
基于表5可以看出,第一序列号并不唯一,主控芯片采用预设方式可以生成唯一的序列号并替换数据包中的第一序列号。
以无人机场景为例,如图6所示,第二数据可以是由终端生成。以终端2向云台控制器发送第二数据为例,参考图6,终端2可以将第二数据发送至WiFi模块,该第二数据是封装在数据包中,假设数据包的序列号是2。WiFi模块在接收到第二数据之后,可以将终端2的设备标识连同第二数据一起发送至主控芯片。一方面主控芯片可以根据终端2的设备标识以及对应关系可以确定第二数据所属的目标设备角色。另一方面,主控芯片可以修改数据包中的序列号,假设主控芯片针对数据包生成的序列号是10,则主控芯片将数据包中的序列号2修改为10。之后,主控芯片可以记录路由信息“10终端2的设备标识2”的路由信息,并将第二数据所属的目标设备角色连同修改序号的数据包一起发送至云台控制器,以由云台控制器进行响应。
进一步的,云台控制器可以针对该数据包生成应答包,由于云台控制器接收到的该数据包的序列号是10,因此该应答包中的序列号也是10。云台控制器可以将应答包发送至主控芯片,主控芯片可以基于记录的路由信息将应答包中的序列号由10修改回2,并确定该应答包对应终端2的设备标识。由此,主控芯片可以将终端2的设备标识连同修改后的应答包一起发送至WiFi模块,由WiFi模块根据终端2的设备标识将应答包返回给终端2。
可以理解的是,在图5和图6所示的场景中,可以由WiFi芯片将终端的连接建立时间戳等信息发送给主控芯片。
图7为本申请一实施例提供的角色控制装置的结构示意图,如图7所示,该装置700可以包括:处理器701和存储器702。
所述存储器702,用于存储程序代码;
所述处理器701,调用所述程序代码,当程序代码被执行时,用于执行以下操作:
通过与终端进行信令交互,与所述终端建立连接;
在与所述终端建立连接的情况下,确定所述终端的设备标识;
其中,多个终端的设备标识和设备角色之间存在对应关系,所述对应关 系用于表征所述多个终端各自的设备角色,所述对应关系是基于所述多个终端和所述被控设备建立连接的先后顺序得到。
本实施例提供的角色控制装置,可以用于执行前述方法实施例的技术方案,其实现原理和技术效果与方法实施例类似,在此不再赘述。
图8为本申请一实施例提供的无人机的结构示意图,如图8所示,该无人机80包括机身801、设置于所述机身上的动力系统802、拍摄装置803和角色控制装置804;
所述动力系统802,用于为所述无人机提供动力;
所述拍摄装置803,用于在所述无人机飞行过程中进行视频拍摄,所拍摄的视频用于图传;
所述角色控制装置804包括存储器和处理器;
所述存储器,用于存储程序代码;
所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:
通过与终端进行信令交互,与所述终端建立连接;
在与所述终端建立连接的情况下,确定所述终端的设备标识;
其中,多个终端的设备标识和设备角色之间存在对应关系,所述对应关系用于表征所述多个终端各自的设备角色,所述对应关系是基于所述多个终端和所述被控设备建立连接的先后顺序得到。
可选的,无人机80还可以包括云台805,拍摄装置803可以通过云台805设置在机身801上。当然,无人机除上述列出装置外,还可以包括其他元件或装置,这里不一一例举。
本领域普通技术人员可以理解:实现上述各方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成。前述的程序可以存储于一计算机可读取存储介质中。该程序在执行时,执行包括上述各方法实施例的步骤;而前述的存储介质包括:ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是:以上各实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述各实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的范围。

Claims (63)

  1. 一种角色控制方法,应用于被控设备,其特征在于,包括:
    通过与终端进行信令交互,与所述终端建立连接;
    在与所述终端建立连接的情况下,确定所述终端的设备标识;
    其中,多个终端的设备标识和设备角色之间存在对应关系,所述对应关系用于表征所述多个终端各自的设备角色,所述对应关系是基于所述多个终端和所述被控设备建立连接的先后顺序得到。
  2. 根据权利要求1所述的方法,其特征在于,所述设备标识包括互联网协议IP地址;
    所述确定所述终端的设备标识,包括:
    根据所述终端与所述被控设备建立连接的位次,从预设的存在分配优先级的多个IP地址中为所述终端分配IP地址,IP地址与设备角色对应,以得到所述终端的设备标识对应的设备角色。
  3. 根据权利要求2所述的方法,其特征在于,所述对应关系包括IP地址与终端的从属标识的第一对应关系,以及从属标识与设备角色的第二对应关系,所述方法还包括:
    若一段时间内未接收到所述终端发送的心跳包,则更新所述第二对应关系,以删除所述第二对应关系中所述终端对应的信息。
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    对更新后的所述第二对应关系进行广播,以便所述终端在根据所述第二对应关系确定自身角色异常时,向所述被控设备发送角色请求。
  5. 根据权利要求1所述的方法,其特征在于,所述设备标识包括设备唯一标识符;
    所述确定所述终端的设备标识,包括:从所述终端获取所述终端的设备标识;
    所述方法还包括:根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色。
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色,包括:
    若所述终端为在所述被控设备启动之后第一个与所述被控设备建立连接的终端,则确定所述终端的设备标识对应的设备角色为主机。
  7. 根据权利要求5所述的方法,其特征在于,所述根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色,包括:
    若所述终端是在所述被控设备启动之后第一次与所述被控设备建立连接,且当前不存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为主机。
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:
    若所述终端是在所述被控设备启动之后非第一次与所述被控设备建立连接,所述终端的历史设备角色是主机且当前不存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为主机。
  9. 根据权利要求7或8所述的方法,其特征在于,所述方法还包括:
    若当前已存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为从机。
  10. 根据权利要求1-9任一项所述的方法,其特征在于,所述方法还包括:
    接收所述终端发送的角色请求;
    若所述角色请求的设备角色与所述对应关系中所述终端对应的设备角色相同,则返回成功响应,以便所述终端根据所述成功响应设置自身的角色。
  11. 根据权利要求10所述的方法,其特征在于,所述方法还包括:
    若所述角色请求用于请求作为从机且所述对应关系中所述终端对应的设备角色为主机,则更新所述对应关系,以将所述对应关系中所述终端的设备标识对应的设备角色修改为从机,并返回成功响应。
  12. 根据权利要求10所述的方法,其特征在于,所述方法还包括:
    若所述角色请求用于请求作为主机且所述对应关系中所述终端对应的设备角色为从机,则返回失败响应,以便所述终端根据所述失败响应向用户提示失败信息。
  13. 根据权利要求1-12任一项所述的方法,其特征在于,所述方法还包括:
    根据待发送的第一数据所针对的目标设备角色以及所述对应关系,确定所述第一数据所针对的第一终端的设备标识;
    基于所述第一终端的设备标识,将所述第一数据发送至所述第一终端。
  14. 根据权利要求13所述的方法,其特征在于,所述基于所述第一终端的设备标识,将所述第一数据发送至所述第一终端,包括:
    主控芯片将所述第一数据连同所述第一终端的设备标识一起发送至通信 模块,以便所述通信模块根据所述第一终端的设备标识,将所述第一数据发送至所述第一终端。
  15. 根据权利要求1-12任一项所述的方法,其特征在于,所述方法还包括:
    在接收到第二终端发送的第二数据情况下,根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色。
  16. 根据权利要求15所述的方法,其特征在于,所述在接收到第二终端发送的第二数据情况下,根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色,包括:
    主控芯片根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色,所述第二终端的设备标识由通信模块连同所述第二数据一起发送至所述主控芯片。
  17. 根据权利要求16所述的方法,其特征在于,所述确定所述第二数据所属的目标设备角色之后,还包括:
    所述主控芯片基于所述第二数据所属的目标设备角色响应所述第二数据,或者,所述主控芯片将所述第二数据连同所述第二数据所属的目标设备角色一起转发至其他模块,以便所述其他模块基于所述第二数据所述的设备角色针对所述第二数据进行响应。
  18. 根据权利要求17所述的方法,其特征在于,所述主控芯片将所述第二数据转发至其他模块,包括:
    所述主控芯片对用于封装所述第二数据的数据包进行解包,以获得所述第二终端针对所述数据包的第一序列号;
    所述主控芯片将所述数据包的序列号由第一序列号修改为第二序列号之后,将所述数据包连同所述第二数据所属的设备角色一起转发至其他模块,所述第二序列号为基于预设方式生成的,用于在所述主控芯片中唯一进行数据包标识的序列号。
  19. 根据权利要求18所述的方法,其特征在于,所述方法还包括:
    所述主控芯片添加包括所述第一序列号、所述第二序列号以及所述第二终端的设备标识之间关系的路由信息;
    所述主控芯片接收所述其他模块发送的针对所述数据包的应答包;
    所述主控芯片根据所述路由信息,将所述应答包的序列号由所述第二序列号修改为所述第一序列号之后,将所述应答包连同所述第二终端的设备标 识一起转发至所述通信模块,以便所述通信模块将所述应答包发送至所述第二终端。
  20. 根据权利要求1-12任一项所述的方法,其特征在于,所述被控设备包括无人机。
  21. 根据权利要求20所述的方法,其特征在于,所述被控设备与所述终端之间的连接用于图传。
  22. 一种角色控制装置,应用于被控设备,其特征在于,包括:存储器和处理器;
    所述存储器,用于存储程序代码;
    所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:
    通过与终端进行信令交互,与所述终端建立连接;
    在与所述终端建立连接的情况下,确定所述终端的设备标识;
    其中,多个终端的设备标识和设备角色之间存在对应关系,所述对应关系用于表征所述多个终端各自的设备角色,所述对应关系是基于所述多个终端和所述被控设备建立连接的先后顺序得到。
  23. 根据权利要求22所述的装置,其特征在于,所述设备标识包括互联网协议IP地址;
    所述处理器用于确定所述终端的设备标识,具体包括:
    根据所述终端与所述被控设备建立连接的位次,从预设的存在分配优先级的多个IP地址中为所述终端分配IP地址,IP地址与设备角色对应,以得到所述终端的设备标识对应的设备角色。
  24. 根据权利要求23所述的装置,其特征在于,所述对应关系包括IP地址与终端的从属标识的第一对应关系,以及从属标识与设备角色的第二对应关系,所述处理器还用于:
    若一段时间内未接收到所述终端发送的心跳包,则更新所述第二对应关系,以删除所述第二对应关系中所述终端对应的信息。
  25. 根据权利要求24所述的装置,其特征在于,所述处理器还用于:
    对更新后的所述第二对应关系进行广播,以便所述终端在根据所述第二对应关系确定自身角色异常时,向所述被控设备发送角色请求。
  26. 根据权利要求22所述的装置,其特征在于,所述设备标识包括设备 唯一标识符;
    所述处理器用于确定所述终端的设备标识,具体包括:从所述终端获取所述终端的设备标识;
    所述处理器,还用于根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色。
  27. 根据权利要求26所述的装置,其特征在于,所述处理器用于根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色,具体包括:
    若所述终端为在所述被控设备启动之后第一个与所述被控设备建立连接的终端,则确定所述终端的设备标识对应的设备角色为主机。
  28. 根据权利要求26所述的装置,其特征在于,所述处理器用于根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色,具体包括:
    若所述终端是在所述被控设备启动之后第一次与所述被控设备建立连接,且当前不存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为主机。
  29. 根据权利要求28所述的装置,其特征在于,所述处理器还用于:
    若所述终端是在所述被控设备启动之后非第一次与所述被控设备建立连接,所述终端的历史设备角色是主机且当前不存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为主机。
  30. 根据权利要求28或29所述的装置,其特征在于,所述处理器,还用于,若当前已存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为从机。
  31. 根据权利要求22-30任一项所述的装置,其特征在于,所述处理器还用于:
    接收所述终端发送的角色请求;
    若所述角色请求的设备角色与所述对应关系中所述终端对应的设备角色相同,则返回成功响应,以便所述终端根据所述成功响应设置自身的角色。
  32. 根据权利要求31所述的装置,其特征在于,所述处理器还用于:
    若所述角色请求用于请求作为从机且所述对应关系中所述终端对应的设备角色为主机,则更新所述对应关系,以将所述对应关系中所述终端的设备 标识对应的设备角色修改为从机,并返回成功响应。
  33. 根据权利要求31所述的装置,其特征在于,所述处理器还用于:
    若所述角色请求用于请求作为主机且所述对应关系中所述终端对应的设备角色为从机,则返回失败响应,以便所述终端根据所述失败响应向用户提示失败信息。
  34. 根据权利要求22-33任一项所述的装置,其特征在于,所述处理器还用于:
    根据待发送的第一数据所针对的目标设备角色以及所述对应关系,确定所述第一数据所针对的第一终端的设备标识;
    基于所述第一终端的设备标识,将所述第一数据发送至所述第一终端。
  35. 根据权利要求34所述的装置,其特征在于,所述处理器为主控芯片的处理器,所述处理器用于基于所述第一终端的设备标识,将所述第一数据发送至所述第一终端,具体包括:
    将所述第一数据连同所述第一终端的设备标识一起发送至通信模块,以便所述通信模块根据所述第一终端的设备标识,将所述第一数据发送至所述第一终端。
  36. 根据权利要求22-33任一项所述的装置,其特征在于,所述处理器还用于:
    在接收到第二终端发送的第二数据情况下,根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色。
  37. 根据权利要求36所述的装置,其特征在于,所述处理器为主控芯片的处理器,所述处理器用于在接收到第二终端发送的第二数据情况下,根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色,具体包括:
    根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色,所述第二终端的设备标识由通信模块连同所述第二数据一起发送至所述主控芯片。
  38. 根据权利要求37所述的装置,其特征在于,所述处理器还用于:
    基于所述第二数据所属的目标设备角色响应所述第二数据,或者,所述将所述第二数据连同所述第二数据所属的目标设备角色一起转发至其他模块,以便所述其他模块基于所述第二数据所述的设备角色针对所述第二数据 进行响应。
  39. 根据权利要求38所述的装置,其特征在于,所述处理器将所述第二数据转发至其他模块,具体包括:
    对用于封装所述第二数据的数据包进行解包,以获得所述第二终端针对所述数据包的第一序列号;
    将所述数据包的序列号由第一序列号修改为第二序列号之后,将所述数据包连同所述第二数据所属的设备角色一起转发至其他模块,所述第二序列号为基于预设方式生成的,用于在所述主控芯片中唯一进行数据包标识的序列号。
  40. 根据权利要求39所述的装置,其特征在于,所述处理器还用于:
    添加包括所述第一序列号、所述第二序列号以及所述第二终端的设备标识之间关系的路由信息;
    接收所述其他模块发送的针对所述数据包的应答包;
    根据所述路由信息,将所述应答包的序列号由所述第二序列号修改为所述第一序列号之后,将所述应答包连同所述第二终端的设备标识一起转发至所述通信模块,以便所述通信模块将所述应答包发送至所述第二终端。
  41. 根据权利要求22-33任一项所述的装置,其特征在于,所述被控设备包括无人机。
  42. 根据权利要求41所述的装置,其特征在于,所述被控设备与所述终端之间的连接用于图传。
  43. 一种无人机,其特征在于,所述无人机包括机身、设置于所述机身上的动力系统、拍摄装置和角色控制装置;
    所述动力系统,用于为所述无人机提供动力;
    所述拍摄装置,用于在所述无人机飞行过程中进行视频拍摄,所拍摄的视频用于图传;
    所述角色控制装置包括存储器和处理器;
    所述存储器,用于存储程序代码;
    所述处理器,调用所述程序代码,当程序代码被执行时,用于执行以下操作:
    通过与终端进行信令交互,与所述终端建立连接;
    在与所述终端建立连接的情况下,确定所述终端的设备标识;
    其中,多个终端的设备标识和设备角色之间存在对应关系,所述对应关系用于表征所述多个终端各自的设备角色,所述对应关系是基于所述多个终端和所述被控设备建立连接的先后顺序得到。
  44. 根据权利要求43所述的无人机,其特征在于,所述设备标识包括互联网协议IP地址;
    所述处理器用于确定所述终端的设备标识,具体包括:
    根据所述终端与所述被控设备建立连接的位次,从预设的存在分配优先级的多个IP地址中为所述终端分配IP地址,IP地址与设备角色对应,以得到所述终端的设备标识对应的设备角色。
  45. 根据权利要求44所述的无人机,其特征在于,所述对应关系包括IP地址与终端的从属标识的第一对应关系,以及从属标识与设备角色的第二对应关系,所述处理器还用于:
    若一段时间内未接收到所述终端发送的心跳包,则更新所述第二对应关系,以删除所述第二对应关系中所述终端对应的信息。
  46. 根据权利要求45述的无人机,其特征在于,所述处理器还用于:
    对更新后的所述第二对应关系进行广播,以便所述终端在根据所述第二对应关系确定自身角色异常时,向所述被控设备发送角色请求。
  47. 根据权利要求43所述的无人机,其特征在于,所述设备标识包括设备唯一标识符;
    所述处理器用于确定所述终端的设备标识,具体包括:从所述终端获取所述终端的设备标识;
    所述处理器,还用于根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色。
  48. 根据权利要求47所述的无人机,其特征在于,所述处理器用于根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色,具体包括:
    若所述终端为在所述被控设备启动之后第一个与所述被控设备建立连接的终端,则确定所述终端的设备标识对应的设备角色为主机。
  49. 根据权利要求47所述的无人机,其特征在于,所述处理器用于根据所述终端与所述被控设备建立连接的位次,确定所述终端的设备标识对应的设备角色,具体包括:
    若所述终端是在所述被控设备启动之后第一次与所述被控设备建立连接,且当前不存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为主机。
  50. 根据权利要求49所述的无人机,其特征在于,所述处理器还用于:
    若所述终端是在所述被控设备启动之后非第一次与所述被控设备建立连接,所述终端的历史设备角色是主机且当前不存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为主机。
  51. 根据权利要求49或50所述的无人机,其特征在于,所述处理器,还用于,若当前已存在与所述被控设备连接的主机,则确定所述终端的设备标识对应的设备角色为从机。
  52. 根据权利要求43-51任一项所述的无人机,其特征在于,所述处理器还用于:
    接收所述终端发送的角色请求;
    若所述角色请求的设备角色与所述对应关系中所述终端对应的设备角色相同,则返回成功响应,以便所述终端根据所述成功响应设置自身的角色。
  53. 根据权利要求52所述的无人机,其特征在于,所述处理器还用于:
    若所述角色请求用于请求作为从机且所述对应关系中所述终端对应的设备角色为主机,则更新所述对应关系,以将所述对应关系中所述终端的设备标识对应的设备角色修改为从机,并返回成功响应。
  54. 根据权利要求52所述的无人机,其特征在于,所述处理器还用于:
    若所述角色请求用于请求作为主机且所述对应关系中所述终端对应的设备角色为从机,则返回失败响应,以便所述终端根据所述失败响应向用户提示失败信息。
  55. 根据权利要求43-54任一项所述的无人机,其特征在于,所述处理器还用于:
    根据待发送的第一数据所针对的目标设备角色以及所述对应关系,确定所述第一数据所针对的第一终端的设备标识;
    基于所述第一终端的设备标识,将所述第一数据发送至所述第一终端。
  56. 根据权利要求55所述的无人机,其特征在于,所述处理器为主控芯片的处理器,所述处理器用于基于所述第一终端的设备标识,将所述第一数据发送至所述第一终端,具体包括:
    将所述第一数据连同所述第一终端的设备标识一起发送至通信模块,以便所述通信模块根据所述第一终端的设备标识,将所述第一数据发送至所述第一终端。
  57. 根据权利要求43-54任一项所述的无人机,其特征在于,所述处理器还用于:
    在接收到第二终端发送的第二数据情况下,根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色。
  58. 根据权利要求57所述的无人机,其特征在于,所述处理器为主控芯片的处理器,所述处理器用于在接收到第二终端发送的第二数据情况下,根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色,具体包括:
    根据所述第二终端的设备标识以及所述对应关系,确定所述第二数据所属的目标设备角色,所述第二终端的设备标识由通信模块连同所述第二数据一起发送至所述主控芯片。
  59. 根据权利要求58所述的无人机,其特征在于,所述处理器还用于:
    基于所述第二数据所属的目标设备角色响应所述第二数据,或者,所述将所述第二数据连同所述第二数据所属的目标设备角色一起转发至其他模块,以便所述其他模块基于所述第二数据所述的设备角色针对所述第二数据进行响应。
  60. 根据权利要求59所述的无人机,其特征在于,所述处理器将所述第二数据转发至其他模块,具体包括:
    对用于封装所述第二数据的数据包进行解包,以获得所述第二终端针对所述数据包的第一序列号;
    将所述数据包的序列号由第一序列号修改为第二序列号之后,将所述数据包连同所述第二数据所属的设备角色一起转发至其他模块,所述第二序列号为基于预设方式生成的,用于在所述主控芯片中唯一进行数据包标识的序列号。
  61. 根据权利要求60所述的无人机,其特征在于,所述处理器还用于:
    添加包括所述第一序列号、所述第二序列号以及所述第二终端的设备标识之间关系的路由信息;
    接收所述其他模块发送的针对所述数据包的应答包;
    根据所述路由信息,将所述应答包的序列号由所述第二序列号修改为所述第一序列号之后,将所述应答包连同所述第二终端的设备标识一起转发至所述通信模块,以便所述通信模块将所述应答包发送至所述第二终端。
  62. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序包含至少一段代码,所述至少一段代码可由计算机执行,以控制所述计算机执行如权利要求1-21任一项所述的方法。
  63. 一种计算机程序,其特征在于,当所述计算机程序被计算机执行时,用于实现如权利要求1-21任一项所述的方法。
PCT/CN2020/096335 2020-06-16 2020-06-16 角色控制方法、装置及设备 WO2021253221A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/096335 WO2021253221A1 (zh) 2020-06-16 2020-06-16 角色控制方法、装置及设备
CN202080005235.3A CN112753276A (zh) 2020-06-16 2020-06-16 角色控制方法、装置及设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/096335 WO2021253221A1 (zh) 2020-06-16 2020-06-16 角色控制方法、装置及设备

Publications (1)

Publication Number Publication Date
WO2021253221A1 true WO2021253221A1 (zh) 2021-12-23

Family

ID=75651298

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/096335 WO2021253221A1 (zh) 2020-06-16 2020-06-16 角色控制方法、装置及设备

Country Status (2)

Country Link
CN (1) CN112753276A (zh)
WO (1) WO2021253221A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113452698A (zh) * 2021-06-25 2021-09-28 佛山市顺德区美的电子科技有限公司 一种终端身份分配方法、控制终端和受控设备
WO2023082188A1 (zh) * 2021-11-12 2023-05-19 深圳市大疆创新科技有限公司 可移动平台的控制方法、装置、系统及控制终端

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102833632A (zh) * 2012-08-24 2012-12-19 Tcl集团股份有限公司 多屏互动主从控制设备管理方法、智能电视及控制设备
US20150246618A1 (en) * 2012-01-23 2015-09-03 Current Ways, Inc. Flexible Charger Network
CN106507249A (zh) * 2016-12-02 2017-03-15 歌尔科技有限公司 一种手环
CN106851532A (zh) * 2017-01-06 2017-06-13 悦物电子科技(上海)有限公司 低功耗蓝牙设备间确定主设备的方法及系统
CN108513738A (zh) * 2017-05-16 2018-09-07 深圳市大疆创新科技有限公司 数据传输方法、设备、机器可读存储介质以及系统
CN108811182A (zh) * 2018-06-14 2018-11-13 歌尔科技有限公司 一种无线耳机配对的方法、装置及无线耳机

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105187097B (zh) * 2015-08-21 2018-09-07 惠州Tcl移动通信有限公司 一种基于蓝牙的内外设备互联互通实现方法及系统
CN108810741B (zh) * 2018-06-14 2021-01-29 歌尔科技有限公司 一种双无线耳机连接的方法、装置及无线耳机
CN111245635B (zh) * 2018-11-29 2022-12-23 山东新北洋信息技术股份有限公司 具有主从设备的系统及其从设备的id号设置方法

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150246618A1 (en) * 2012-01-23 2015-09-03 Current Ways, Inc. Flexible Charger Network
CN102833632A (zh) * 2012-08-24 2012-12-19 Tcl集团股份有限公司 多屏互动主从控制设备管理方法、智能电视及控制设备
CN106507249A (zh) * 2016-12-02 2017-03-15 歌尔科技有限公司 一种手环
CN106851532A (zh) * 2017-01-06 2017-06-13 悦物电子科技(上海)有限公司 低功耗蓝牙设备间确定主设备的方法及系统
CN108513738A (zh) * 2017-05-16 2018-09-07 深圳市大疆创新科技有限公司 数据传输方法、设备、机器可读存储介质以及系统
CN108811182A (zh) * 2018-06-14 2018-11-13 歌尔科技有限公司 一种无线耳机配对的方法、装置及无线耳机

Also Published As

Publication number Publication date
CN112753276A (zh) 2021-05-04

Similar Documents

Publication Publication Date Title
CN109842906B (zh) 一种通信的方法、装置及系统
KR102328388B1 (ko) 서비스 품질의 제어 방법 및 관련 장치
EP3585095B1 (en) Method and device for controlling qos, smf, upf, ue, pcf and an
US11856065B2 (en) Data transmission for service integration between a virtual private cloud and an intranet
US11895197B2 (en) Communication method and apparatus
US20200195606A1 (en) Ip address allocation system and method
WO2021253221A1 (zh) 角色控制方法、装置及设备
CN106506717A (zh) 一种自动发现方法及设备
CN111526223A (zh) 边缘业务服务器的管理方法、业务数据处理方法及装置
EP3021533A1 (en) Switching device, controller, and method and system for switching device configuration and packet processing
CN113747513A (zh) 一种服务质量管理方法和装置
EP3086512B1 (en) Implementation method and apparatus for vlan to access vf network and fcf
EP3503484A1 (en) Message transmission method, device and network system
CN116996908A (zh) 主从网关和无线ap的融合管理方法、装置、设备和介质
WO2021248971A1 (zh) 网络接入方法、电子设备及存储介质
CN112416495A (zh) 一种超融合云终端资源统一管理系统及方法
US20200137726A1 (en) Communications device and communication method
WO2018188447A1 (zh) 一种ip地址配置方法及装置
US20230188957A1 (en) Communication Method and Apparatus
WO2023035777A1 (zh) 网络配置方法、代理组件、控制器、电子设备和存储介质
CN115150363B (zh) Ip地址更新方法、网关设备、网关下挂设备和存储介质
US20230421647A1 (en) Method for communicating between sweeping robot and base station, electronic device and storage medium
WO2024067509A1 (zh) 网桥端口分配方法及装置
CN116634470B (zh) 机器人协同作业方法、控制服务器及本地网络管理服务器
US20230006998A1 (en) Management of private networks over multiple local networks

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20940583

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20940583

Country of ref document: EP

Kind code of ref document: A1