WO2021184225A1 - 一种通信方法及装置 - Google Patents

一种通信方法及装置 Download PDF

Info

Publication number
WO2021184225A1
WO2021184225A1 PCT/CN2020/079791 CN2020079791W WO2021184225A1 WO 2021184225 A1 WO2021184225 A1 WO 2021184225A1 CN 2020079791 W CN2020079791 W CN 2020079791W WO 2021184225 A1 WO2021184225 A1 WO 2021184225A1
Authority
WO
WIPO (PCT)
Prior art keywords
processing unit
wireless communication
service processing
communication device
data packet
Prior art date
Application number
PCT/CN2020/079791
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 CN202080098569.XA priority Critical patent/CN115280890A/zh
Priority to PCT/CN2020/079791 priority patent/WO2021184225A1/zh
Priority to EP20925835.9A priority patent/EP4113932A4/en
Publication of WO2021184225A1 publication Critical patent/WO2021184225A1/zh
Priority to US17/946,381 priority patent/US20230017306A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • H04W52/0251Power saving arrangements in terminal devices using monitoring of local events, e.g. events related to user activity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • H04W52/0225Power saving arrangements in terminal devices using monitoring of external events, e.g. the presence of a signal
    • H04W52/0229Power saving arrangements in terminal devices using monitoring of external events, e.g. the presence of a signal where the received signal is a wanted signal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • H04W52/0261Power saving arrangements in terminal devices managing power supply demand, e.g. depending on battery level
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • H04W52/0209Power saving arrangements in terminal devices
    • H04W52/0261Power saving arrangements in terminal devices managing power supply demand, e.g. depending on battery level
    • H04W52/0274Power saving arrangements in terminal devices managing power supply demand, e.g. depending on battery level by switching on or off the equipment or parts thereof
    • H04W52/028Power saving arrangements in terminal devices managing power supply demand, e.g. depending on battery level by switching on or off the equipment or parts thereof switching on or off only a part of the equipment circuit blocks
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Definitions

  • This application relates to the field of communication technology, and in particular to a communication method and device.
  • battery-powered shooting equipment generally includes a camera chip and a Wi-Fi chip.
  • the camera chip is responsible for the collection, encoding and storage of audio and video.
  • the Wi-Fi chip is responsible for the sending and receiving of wireless network data.
  • the Camera chip is generally in a power-off state when the shooting device is in standby mode, and the Wi-Fi chip is generally in a working state.
  • the Camera chip is in the power-on state, that is, the working state.
  • a peer-to-peer (P2P) channel may be established between the shooting device and the terminal device.
  • P2P peer-to-peer
  • the P2P hole punching process can only be started after the business processing unit is powered on, and the P2P hole punching process is cumbersome.
  • the service processing unit can only perform data transmission with the terminal device after the hole is successfully drilled. This will affect the timeliness of data transmission.
  • the embodiments of the present application provide a communication method and device, which are used to solve the problem that the delay in establishing a communication channel affects the timeliness of data transmission.
  • an embodiment of the present application provides a communication method, which is applied to a first communication device powered by a battery.
  • the first communication device includes a service processing unit and a wireless communication unit, and the method includes: Before the processing unit enters the working mode, the wireless communication unit establishes a transmission channel with the second communication device; after the service processing unit enters the working mode, the service processing unit exchanges data with the second communication device through the transmission channel, For example, sending the first network data packet to be sent to the second communication device.
  • the wireless communication unit opens the transmission channel, so that the business processing unit can directly use (or inherit) the established transmission channel and the second communication device after entering the working module Interactive data. Compared with triggering the hole punching process after the business processing unit enters the working mode, it avoids wasting time and resources, and the timeliness of data transmission is guaranteed.
  • the first communication device may be a terminal device
  • the second communication device may be a terminal device or a server.
  • the transmission channel between the first communication device and the second communication device may be a directly connected transmission channel.
  • the first communication device and the second communication device create a transmission channel (also called a communication connection), such as a message queue telemetry transmission protocol (message queuing transmission protocol).
  • a transmission channel also called a communication connection
  • a transmission channel such as a message queue telemetry transmission protocol (message queuing transmission protocol).
  • telemetry transport MQTT
  • Constrained application protocol CoAP
  • transmission control protocol transmission control protocol, TCP
  • the second communication device is a terminal device, and the transmission channel between the first communication device and the second communication device may be a directly connected transmission channel.
  • the transmission channel is a point-to-point P2P channel; the wireless communication unit establishes a transmission channel with the second communication device, which can be specifically implemented in the following manner: the wireless communication unit establishes a P2P channel with the second communication device through a P2P hole punching method.
  • the method further includes: the service processing unit sends the occupation to the wireless communication unit Notice, the occupation notification is used to indicate that the service processing unit occupies the transmission channel; after receiving the occupation notification, the wireless communication unit suspends using the transmission channel to send the network data packet generated by the wireless communication unit to the second communication device.
  • the wireless communication unit when the service processing unit occupies the transmission channel, the wireless communication unit no longer occupies the channel. The impact of data transmitted by the wireless communication unit on the service data transmitted by the service processing unit is reduced, thereby reducing the transmission delay of the service data.
  • the wireless communication unit suspends using the transmission channel to send network data packets generated by the wireless communication unit to the second communication device, including: the wireless communication unit allocates ports for communicating with the second communication device through the transmission channel To the business processing unit.
  • the wireless communication unit gives up the port to the service processing unit for use, which is simple and easy to implement.
  • the method further includes: the wireless communication unit modifies the second mapping relationship in the stored mapping relationship to the first mapping relationship; or, the wireless communication unit is storing The first mapping relationship is added to the mapping relationship; the first mapping relationship is the association relationship between the first parameter information and the identifier of the service processing unit, and the first mapping relationship is used to determine that the communication data packet carrying the first parameter information is processed by the service processing unit
  • the second mapping relationship is an association relationship between the second parameter information and the identifier of the wireless communication unit, and the second mapping relationship is used to determine that the network data packet carrying the second parameter information is processed by the wireless communication unit.
  • the service processing unit enters the working mode and needs to use the transmission channel to modify the forwarding rule of the wireless communication unit in time to ensure the correct distribution of the network data packet from the second communication device.
  • the method further includes: when it is determined that the service processing unit does not need to communicate with the second communication device, the service processing unit sends a release of occupation to the wireless communication unit Informing, the unoccupied notification is used to notify the wireless communication unit service processing unit to end using the transmission channel; after the wireless communication unit receives the unoccupied notification, the wireless communication unit continues to use the transmission channel to send network data packets generated by the wireless communication unit to the second communication device.
  • the service processing unit when the service processing unit does not need to use the channel, it notifies the wireless communication unit in time, which improves the utilization rate of the channel and reduces the waste of resources.
  • sending the first network data packet to be sent to the second communication device through the transmission channel includes: the service processing unit encapsulates the service data to be sent as the first network data packet. Format data, the first format data includes data type information, and the data type information is used to indicate the data type of the service data; the service processing unit encapsulates the first format data into the first network data according to the channel information of the transmission channel through the first network protocol stack Packet and send the first network data packet to the wireless communication unit; the wireless communication unit sends the first network data packet to the second communication device.
  • the service processing unit deploys a network protocol stack, and interacts with the second communication device independently of network data packets. Such as the transmission of audio and video streams.
  • the business processing unit can independently develop network applications, and it also facilitates the business deployment of the business processing unit.
  • the channel information of the above-mentioned transmission channel includes the IP address of the service processing unit, the port number used for communicating with the second communication device on the first communication device, the protocol type, the IP address of the second communication device, or One or more of the port numbers of the second communication device.
  • the IP address of the service processing unit is the same as the IP address of the wireless communication unit. There is no need to perform address conversion, so the increase in data transmission delay caused by address conversion can be avoided, thereby improving data transmission efficiency.
  • the wireless communication unit sending the first network data packet to the second communication device includes: the wireless communication unit converts the source address of the first network data packet from the address information of the service processing unit to the wireless communication unit After the address information, the first network data packet after address conversion is sent to the second communication device.
  • the method further includes: the wireless communication unit receives a second network data packet sent by the second communication device through the transmission channel, and the second network data packet carries the first parameter information; The wireless communication unit determines that the second network data packet is processed by the service processing unit according to the first parameter information and the first mapping relationship, and sends the second network data packet to the service processing unit; Network packet decapsulation.
  • the wireless communication unit sending the second network data packet to the service processing unit includes: the wireless communication unit converts the destination address of the second network data packet from the address information of the wireless communication unit to the service processing unit With the address information, the second network data packet after the address conversion is sent to the service processing unit according to the converted destination address.
  • the service processing unit before entering the working mode, further includes: the wireless communication unit receives a third network data packet from the second communication device through the transmission channel, and the third network data packet carries the second parameter information; When the wireless communication unit determines that the third network data packet is processed by the wireless communication unit according to the second parameter information and the second mapping relationship, the third network data packet is decapsulated through the second network protocol stack.
  • the first parameter information includes one or more of the port number used by the service processing unit to communicate with the second communication device, the IP address of the second communication device, or the port number of the second communication device ;
  • the second parameter information includes one or more of the port number used by the wireless communication unit to communicate with the second communication device, the IP address of the second communication device, or the port number of the second communication device.
  • the wireless communication unit encapsulates the to-be-sent first communication information into a fourth network data packet according to the channel information of the transmission channel through the second network protocol stack, and sends the second network data packet to the second communication device.
  • the wireless communication unit encapsulates the to-be-sent first communication information into a fourth network data packet according to the channel information of the transmission channel through the second network protocol stack, and sends the second network data packet to the second communication device.
  • the wireless communication unit encapsulates the to-be-sent first communication information into a fourth network data packet according to the channel information of the transmission channel through the second network protocol stack, and sends the second network data packet to the second communication device.
  • the first communication information is used to communicate with the second communication device.
  • the protocol used for communication between the first communication device and the second communication device is the transmission control protocol TCP, which further includes: after the service processing unit enters the working mode, the service processing unit prohibits the transmission channel to the second communication device Sending a TCP handshake request message; or, after the service processing unit enters the working mode, when the wireless communication unit receives the TCP handshake request message sent by the service processing unit to the second communication device, it replies with a TCP handshake confirmation message to the wireless communication unit.
  • TCP transmission control protocol
  • the TCP handshake message is intercepted in time to avoid the lag of service data transmission caused by the TCP handshake, thereby improving the timeliness of data transmission.
  • an embodiment of the present application provides a communication device that is powered by a battery.
  • the communication device includes a service processing unit and a wireless communication unit; wherein, the wireless communication unit is used before the service processing unit enters a working mode.
  • the second communication device is a terminal device, and the transmission channel is a point-to-point P2P channel; the wireless communication unit is specifically configured to establish a P2P channel with the second communication device through a P2P hole punching method.
  • the service processing unit is also used to send an occupation notice to the wireless communication unit before sending the first network data packet to be sent to the second communication device through the transmission channel after the service processing unit enters the working mode ,
  • the occupancy notification is used to indicate that the service processing unit occupies the transmission channel;
  • the wireless communication unit is also used to suspend the use of the transmission channel to send the network data packet generated by the wireless communication unit to the second communication device after receiving the occupancy notification.
  • the wireless communication unit when the wireless communication unit suspends using the transmission channel to send the network data packet generated by the wireless communication unit to the second communication device, it is specifically used to use the port for communicating with the second communication device through the transmission channel. Assigned to the business processing unit.
  • the wireless communication unit is further configured to: modify the second mapping relationship in the stored mapping relationship to the first mapping relationship; or, in the stored mapping relationship Add a first mapping relationship; the first mapping relationship is the association relationship between the first parameter information and the identifier of the service processing unit, the first mapping relationship is used to determine that the communication data packet carrying the first parameter information is processed by the service processing unit, and the second mapping The relationship is an association relationship between the second parameter information and the identifier of the wireless communication unit, and the second mapping relationship is used to determine that the network data packet carrying the second parameter information is processed by the wireless communication unit.
  • the service processing unit is also used to send an occupation notice to the wireless communication unit, and when it is determined that the service processing unit does not need to communicate with the second communication device, send an unoccupied notice to the wireless communication unit to release the occupation
  • the notification is used to notify the wireless communication unit that the service processing unit ends using the transmission channel; the wireless communication unit is also used to continue to use the transmission channel to send the network data packets generated by the wireless communication unit to the second communication device after receiving the unoccupied notification.
  • the service processing unit when sending the first network data packet to be sent to the second communication device through the transmission channel, it is specifically used to: encapsulate the service data to be sent as the first network data packet.
  • Format data the first format data includes data type information, and the data type information is used to indicate the data type of the service data; the first format data is encapsulated into the first network data packet according to the channel information of the transmission channel through the first network protocol stack, and The first network data packet is sent to the wireless communication unit; the wireless communication unit is also used to send the first network data packet to the second communication device.
  • the channel information of the transmission channel includes the IP address of the service processing unit, the port number used on the communication device to communicate with the second communication device, the protocol type, the IP address of the second communication device, or the second communication One or more of the port numbers of the device.
  • the IP address of the service processing unit is the same as the IP address of the wireless communication unit.
  • the wireless communication unit is also used to convert the source address of the first network data packet from the address information of the service processing unit to the address information of the wireless communication unit, and transmit it to the second communication device through the transmission channel. Send the first network data packet that has undergone address translation.
  • the service processing unit after the service processing unit enters the working mode, it is also used to receive the second network data packet from the second communication device through the transmission channel, and the second network data packet carries the first parameter information;
  • the parameter information and the first mapping relationship determine that the second network data packet is processed by the service processing unit, and the second network data packet is sent to the service processing unit;
  • the service processing unit is further configured to decapsulate the second network data packet through the first network protocol stack.
  • the wireless communication unit is also used to convert the destination address of the second network data packet from the address information of the wireless communication unit to the address information of the service processing unit, and convert the address according to the converted destination address.
  • the second network data packet is sent to the service processing unit.
  • the service processing unit before entering the working mode, is further used for: receiving a third network data packet from the second communication device through the transmission channel, the third network data packet carrying second parameter information; wireless communication The unit is further configured to decapsulate the third network data packet through the second network protocol stack when it is determined that the third network data packet is processed by the wireless communication unit according to the second parameter information and the second mapping relationship.
  • the first parameter information includes one or more of the port number used by the service processing unit to communicate with the second communication device, the IP address of the second communication device, or the port number of the second communication device ;
  • the second parameter information includes one or more of the port number used by the wireless communication unit to communicate with the second communication device, the IP address of the second communication device, or the port number of the second communication device.
  • the wireless communication unit is further configured to encapsulate the first communication information to be sent into a fourth network data packet according to the channel information of the transmission channel through the second network protocol stack, and send it to the second communication device In the fourth network data packet, the first communication information is used to communicate with the second communication device.
  • the protocol used by the communication device to communicate with the second communication device is the transmission control protocol TCP.
  • TCP handshake request message or, the service processing unit is also used to send a TCP handshake request message to the second communication device after entering the working mode; the wireless communication unit is also used to send a TCP handshake request message to the second communication device after receiving the service processing unit
  • TCP handshake confirmation message is returned to the service processing unit.
  • the present application provides a communication device used in an electronic device or a chip of an electronic device, including at least two processing elements (used to realize the function of a service processing unit and a function of a wireless communication unit) and at least one storage element, wherein at least One storage element is used to store programs and data, and at least one processing element is used to execute the foregoing first aspect or the method in any possible implementation of the first aspect.
  • the present application provides a communication device, including a processor and an interface circuit.
  • the interface circuit is used to receive signals from other communication devices other than the communication device and transmit them to the processor or send signals from the processor to the communication device.
  • the processor is used to implement the functions of the service processing unit and the wireless communication unit. Specifically, it can be used to implement the foregoing first aspect or any possible implementation manner of the first aspect through logic circuits or execution code instructions. method.
  • the present application provides a computer program product.
  • the computer program product includes computer instructions. When the computer instructions are executed, the foregoing first aspect or any possible implementation of the first aspect is executed.
  • the present application provides a computer-readable storage medium that stores computer instructions.
  • the computer instructions When the computer instructions are executed, the method in the foregoing first aspect or any possible implementation of the first aspect Be executed.
  • FIG. 1 is a schematic diagram of state transition provided by an embodiment of this application.
  • FIG. 2 is a schematic structural diagram of a possible electronic device provided by an embodiment of this application.
  • FIG. 3 is a schematic structural diagram of another possible electronic device provided by an embodiment of this application.
  • Figure 4 is a schematic diagram of a communication connection provided by an embodiment of the application.
  • FIG. 5 is a schematic diagram of a communication system architecture provided by an embodiment of this application.
  • FIG. 6 is a schematic diagram of a P2P hole punching process provided by an embodiment of this application.
  • FIG. 7 is a schematic diagram of a possible network protocol stack and P2P function deployment method provided by an embodiment of the application.
  • FIG. 8 is a schematic diagram of another possible network protocol stack and P2P function deployment mode provided by an embodiment of the application.
  • FIG. 9 is a schematic diagram of another possible network protocol stack and P2P function deployment mode provided by an embodiment of the application.
  • FIG. 10 is a schematic diagram of another communication system architecture provided by an embodiment of this application.
  • FIG. 11 is a schematic flowchart of a communication method provided by an embodiment of this application.
  • FIG. 12 is a schematic flowchart of another communication method provided by an embodiment of this application.
  • FIG. 13A is a schematic diagram of an exemplary deployment architecture of a variant network bridge provided by an embodiment of this application.
  • FIG. 13B is a schematic diagram of another exemplary deployment architecture of a variant network bridge provided by an embodiment of this application.
  • FIG. 14 is a schematic flowchart of a communication method in a variant network bridge deployment scenario provided by an embodiment of the application.
  • 15A is a schematic diagram of an exemplary NAT deployment architecture provided by an embodiment of this application.
  • 15B is a schematic diagram of another exemplary NAT deployment architecture provided by an embodiment of the application.
  • FIG. 16 is a schematic flowchart of a communication method in a NAT deployment scenario provided by an embodiment of the application.
  • a battery-powered communication device may include a device that is entirely battery-powered, or a device that is partially battery-powered, for example, a device that is powered by a mixture of normal power and a battery. Normal electricity can be powered by a power adapter.
  • the first communication device can perform wireless communication.
  • the wireless communication may include a 3G network, a 4G network, a 5G network, or a future 6G network, or may adopt wireless fidelity (Wi-Fi) network communication, or Bluetooth communication.
  • the first communication device may be a battery-powered terminal device.
  • Battery-powered terminal equipment can be battery-type camera equipment (also called battery-type camera equipment), such as cameras, video cameras, camcorders, etc., or battery-type terminal equipment capable of wireless communication, such as early childhood education machines, Wearable terminal equipment, etc.
  • the first communication device includes a service processing unit and a wireless communication unit.
  • the first communication device may also include a microprocessor control unit (MCU).
  • the first communication device may also include other sensors and other devices.
  • the business processing unit is responsible for business processing. For example, taking battery-type camera equipment as an example, it is responsible for the collection, encoding, storage, etc. of audio and video, and sends the encoded stream data to the wireless communication chip for transmission.
  • the service processing unit is usually in a non-working state (power-off state or standby state, the following power-on state is taken as an example for description), and is controlled by the MCU to power on or wake up for service processing as needed. Since the first communication device is powered by a battery, in order to save power, the power-on working time of the service processing unit is generally short.
  • the memory of the business processing unit is generally 16MB and above, and the memory available for applications is generally more abundant.
  • the MCU As the main control, it is responsible for the overall control of the first communication device, including the control of the wireless communication unit, the power-on and power-off control of the service processing unit, and the collection and processing of other peripheral sensors. In the standby state of the first communication device, the MCU is generally in a constant power supply state.
  • Wireless communication unit Mainly responsible for the sending and receiving of wireless network data.
  • the wireless communication chip When the first communication device is in the working state, the wireless communication chip is generally in a constant power supply state. It should be noted that when the first communication device includes an MCU chip, when the first communication device is in a standby state, the wireless communication chip may be in an extraordinary power supply state like the service processing chip.
  • the memory on the side of the wireless communication unit is generally several hundred KB, and the available memory is generally about tens of KB to hundreds of KB.
  • the first communication device is in a working state, and in addition to the working state, the first communication device may also be in a standby state.
  • the first communication device when the first communication device is in a working state, the first communication device performs sensor data collection, service processing, data transmission, and the like.
  • the first communication device is in a power-on state.
  • the first communication device After receiving the standby instruction, the first communication device is in a standby state.
  • the first communication device may be responsible for key-press wake-up detection, wireless transceiver wake-up detection, PIR wake-up detection, network keep-alive, and so on.
  • the service processing unit In the standby state, in order to reduce power consumption, the service processing unit is in a power-off state, and the wireless communication unit and/or MCU are in a low-power consumption working state. After receiving the wake-up instruction, the first communication device in the standby state enters the working state.
  • the service processing unit, the wireless communication unit, and the MCU are respectively deployed in different chips.
  • a battery-type camera device it may generally include a camera chip, a wireless communication chip, and an MCU chip, as shown in FIG. 2.
  • the camera chip may include one or more service processing units, which are mainly responsible for processing camera-related services.
  • the wireless communication chip may include one or more wireless communication units, which are mainly responsible for sending and receiving wireless network data.
  • the MCU chip as the main control, is responsible for the overall control of the camera equipment, including the control of the wireless communication chip and the control of the camera chip.
  • the wireless communication chip and MCU chip are part of the regular power supply.
  • the wireless communication unit and the MCU are deployed on the same chip.
  • it may generally include a camera chip and a wireless communication chip.
  • the wireless communication chip performs the functions of the wireless communication unit and the single-chip processing unit.
  • the pins on the wireless communication chip may not be enough to meet the requirements of the number of sensors to be connected.
  • the MCU chip is an optional device, and it is determined whether it is set in a battery-type camera device according to the needs.
  • the wireless communication unit, the MCU, and the service processing unit may all be deployed in one chip.
  • the functions of the MCU can also be incorporated into the wireless communication unit. See Figure 3.
  • the above-mentioned wireless communication unit can be used as a regular power supply part to control the entire first communication device, send and receive wireless data, and keep the network alive with the server.
  • MCU is added as an option as needed. In the case that multiple sensors need to be set up, and the pins of the chip are not enough to meet the requirement of the number of sensors to be connected, an MCU is added.
  • the wireless communication unit, MCU, and service processing unit may all be implemented by a processor.
  • the processor may include a central processing unit (CPU), an image processing unit (GPU), an image signal processor (ISP), and a digital signal processor (DSP). ), or one or more of neural processing unit (NPU).
  • CPU central processing unit
  • GPU image processing unit
  • ISP image signal processor
  • DSP digital signal processor
  • NPU neural processing unit
  • the service processing unit and the wireless communication processing unit can be connected through a hardware interconnection bus.
  • the hardware interconnection bus can include a serial peripheral interface (Serial Peripheral Interface, SPI), a secure digital input and output card (secure digital input and output card). input and output, SDIO), or inter-core bus, etc.
  • SPI Serial Peripheral Interface
  • SDIO Secure Digital input and output card
  • inter-core bus etc. It should be noted that the inter-core bus scenario is applicable to the situation where the service processing unit and the wireless communication unit coexist on the same chip.
  • the business processing unit and the wireless communication unit are directly connected through the system bus, and can directly access the storage unit of the other party.
  • the communication system includes the above-mentioned first communication device and also includes a second communication device.
  • the second communication device may be a terminal device or a server.
  • the terminal device can be a battery-type terminal device or a power-powered terminal device, such as a mobile phone, a tablet computer, a wearable device with wireless communication function (such as a smart watch), etc.
  • the second communication device may also be a vehicle-mounted terminal, a laptop computer (Laptop), or the like.
  • the terminal device in the embodiment of the present application may also be a desktop computer, a smart TV, etc., which is not limited.
  • the communication system may also include other electronic devices.
  • the number of communication devices (the first communication device and the second communication device) included in the communication system is not limited.
  • the communication system may also include a server.
  • the server involved in the embodiment of the present application may be a router, an access network device (ie, a base station), or a cloud server.
  • the first communication device and the second communication device create a transmission channel, for example, it may be a message queue telemetry transport protocol (MQTT) or a receiving device.
  • MQTT message queue telemetry transport protocol
  • the first communication device and the second communication device create a transmission channel, for example, it may be a message queue telemetry transport protocol (MQTT) or a receiving device.
  • MQTT message queue telemetry transport protocol
  • the second communication device when the second communication device is a terminal device, for example, the first communication device is a battery-type camera device, and the second communication device is a mobile phone.
  • the audio and video stream when transmitted between the first communication device and the second communication device, it can be transferred through the server that provides business services, and it can also establish a direct transmission channel, such as a P2P channel, to transmit audio and video through the direct transmission channel flow.
  • the directly connected transmission channel may be a directly connected network connection established between communication devices, and may be implemented by a socket connection channel.
  • the first communication device and the second communication device adopt a hole punching technique to establish a P2P channel.
  • data exchange is carried out through the established P2P channel.
  • a P2P channel may also be called a P2P connection, or P2P for short.
  • FIG. 6 for a schematic diagram of the hole punching process of the first communication device and the second communication device.
  • the second communication device initiates a hole punching request as an example.
  • the second communication device sends a first P2P connection request to the server.
  • the first P2P connection request carries P2P information of the second communication device.
  • the P2P information of the second communication device may include the port number and/or IP address of the second communication device.
  • S602 The server sends the foregoing first P2P connection request to the first communication device.
  • the first communication device After receiving the first P2P connection request, the first communication device saves the P2P information of the second communication device, and initiates a second P2P connection request to the server.
  • the second P2P connection request carries P2P information of the first communication device.
  • the P2P information of the first communication device may include the port number and/or IP address of the first communication device.
  • the second communication device After receiving the P2P information of the first communication device, the second communication device sends a first P2P direct connection request to the first communication device according to the P2P information of the first communication device.
  • the first communication device After receiving the first P2P direct connection request sent by the second communication device, the first communication device will initiate a second P2P direct connection request to the second communication device according to the P2P information of the second communication device.
  • the P2P channel is successfully opened between the first communication device and the second communication device.
  • S607 Perform data exchange between the first communication device and the second communication device through a P2P channel.
  • IP stack IP Stack
  • the IP stack can also be referred to as a network protocol stack. Used to encapsulate IP packets.
  • the first communication device is a battery-type camera device as an example.
  • FIG. 7 A possible deployment architecture is shown in Figure 7. Both the IP stack and P2P functions are deployed on the service processing unit.
  • the P2P hole punching process can be started after the business processing unit is powered on, and the P2P hole punching process is cumbersome.
  • the service processing unit can only perform data transmission with the second communication device after the hole punching is successful. This will affect the timeliness of data transmission from the first communication device to the second communication device.
  • FIG. 8 Another possible deployment architecture is shown in Figure 8.
  • the IP stack is deployed on the wireless communication unit, and the P2P function is deployed on the service processing unit.
  • the P2P hole punching process can be started after the business processing unit is powered on, and the P2P hole punching process is cumbersome.
  • the service processing unit can only perform data transmission with the second communication device after the hole punching is successful. This will affect the timeliness of data transmission from the first communication device to the second communication device.
  • both the IP stack and P2P functions are deployed in the wireless communication unit.
  • the service processing unit When the service processing unit is in the power-on state, it collects the video stream and sends the video stream to the wireless communication unit, so that the wireless communication unit encapsulates the received video stream into an IP packet and sends it to the service device.
  • the available memory on the wireless communication unit is relatively small, usually tens of KB to hundreds of KB, and applications that require a large amount of memory cannot be deployed on the wireless communication unit.
  • the service processing unit directly sends a video I frame (such as 150KB) to the wireless communication unit, which may be caused by insufficient memory The transmission failed.
  • network retransmission functions such as transmission control protocol (transmission control protocol, TCP) retransmission and P2P retransmission, all require a large memory space. If the memory space is insufficient and packet loss occurs, the retransmission cannot be obtained. Data packets, leading to business interruption.
  • RTSP/P2P service processing If part of the RTSP/P2P service processing is transferred to the wireless communication unit, such as unpacking of audio and video data streams, data encryption and decryption, network retransmission processing, etc., it will cause a heavier load on the wireless communication unit and further increase the wireless communication unit The processing burden of this system leads to a decrease in the throughput of wireless communication and so on.
  • At least one refers to one or more, and “multiple” refers to two or more.
  • And/or describes the association relationship of the associated object, indicating that there can be three relationships, for example, A and/or B, which can mean: A alone exists, A and B exist at the same time, and B exists alone, where A, B can be singular or plural.
  • the character “/” generally indicates that the associated objects before and after are in an “or” relationship.
  • the following at least one (item) or similar expressions refers to any combination of these items, including any combination of a single item (a) or a plurality of items (a).
  • At least one of a, b, or c can mean: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c It can be single or multiple.
  • words such as “first” and “second” are only used for the purpose of distinguishing description, and cannot be understood as indicating or implying relative importance, nor can it be understood as indicating Or imply the order.
  • the various numerical numbers involved in the embodiments of the present application are only for easy distinction for description, and are not used to limit the scope of the embodiments of the present application.
  • the size of the sequence number of the above processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic.
  • the embodiments of the present application provide a communication method and device, in which a network protocol stack is deployed in both the service processing unit and the wireless communication unit, and each is responsible for the encapsulation of their respective data packets.
  • the wireless communication unit is responsible for channel opening, that is, the wireless communication unit has the channel opening function, and the service processing unit deploys the P2P data transmission function.
  • the wireless communication unit In this deployment mode, before the service processing unit enters the working mode, the wireless communication unit establishes a transmission channel between the first communication device and the second communication device. After the service processing unit enters the working mode, it can inherit and use the transmission channel already established by the wireless communication unit to transmit data with the second communication device.
  • the method and the device are based on the same inventive concept. Since the principles of the method and the device to solve the problem are similar, the implementation of the device and the method can be referred to each other, and the repetition will not be repeated.
  • FIG. 10 is a schematic diagram of a communication system architecture provided by an embodiment of this application.
  • Both the service processing unit and the wireless communication unit of the first communication device deploy a network protocol stack and a P2P function.
  • the network protocol stack deployed on the wireless communication unit is referred to as the second network protocol stack.
  • the network protocol stack deployed on the service processing unit is called the first network protocol stack.
  • the network protocol may be transmission control protocol/internet protocol (TCP/IP) or user datagram protocol (UDP), etc.
  • FIG. 11 is a schematic flowchart of a communication method provided by an embodiment of this application. Take the P2P channel as an example.
  • the wireless communication unit Before the service processing unit enters the working mode, the wireless communication unit establishes a transmission channel with the second communication device.
  • the service processing unit entering the working mode may be when the service processing unit is powered on, or the service processing unit is awakened from the standby state.
  • the service processing unit may first take over the transmission channel (or inherit the transmission channel). That is, when the service processing unit uses the transmission channel, the wireless communication unit no longer uses the transmission channel.
  • the wireless communication unit may be notified that the transmission channel with the second communication device has been established, so that the service processing unit can take over Transmission channel.
  • the service transmission unit takes over the transmission channel, and the transmission channel can be taken over in the following manner.
  • the wireless communication unit passively yields the transmission channel.
  • the service processing unit After the service processing unit enters the working mode, it may send an occupation notification to the wireless communication unit, and the occupation notification is used to notify that the transmission channel is occupied by the service processing unit. Furthermore, after receiving the occupancy notification, the wireless communication unit suspends the use of the transmission channel. Specifically, suspending the use of the transmission channel by the wireless communication unit may be suspending sending the network data packet generated by the wireless communication unit to the second communication device through the transmission channel.
  • the wireless communication unit forwards them to the service processing unit for processing according to the mapping relationship.
  • mapping relationship The related description of the mapping relationship will be described in detail later, and will not be repeated here.
  • the wireless communication unit suspends the use of the transmission channel, and the port used for communication with the second electronic communication may be allocated to the service processing unit.
  • Another possible way is for the wireless communication unit to actively give up the transmission channel.
  • the service processing unit After the service processing unit wakes up the wireless communication unit, it can actively suspend the use of the transmission channel. Specifically, the transmission channel is suspended to send the network data packet generated by the wireless communication unit to the second communication device.
  • the wireless communication unit may forward it to the service processing unit for processing according to the mapping relationship.
  • the service transmission unit takes over the transmission channel, and the wireless communication unit may also process the saved mapping relationship. For example, the wireless communication unit modifies the second mapping relationship in the stored mapping relationship to the first mapping relationship; or, the wireless communication unit adds the first mapping relationship to the stored mapping relationship.
  • the first mapping relationship is an association relationship between the first parameter information and the identifier of the service processing unit, and the first mapping relationship is used to determine that the communication data packet carrying the first parameter information is processed by the service processing unit
  • the second mapping relationship is an association relationship between the second parameter information and the identifier of the wireless communication unit, and the second mapping relationship is used to determine that the network data packet carrying the second parameter information is processed by the wireless communication unit.
  • mapping relationship The use of the mapping relationship will be described in detail later, and will not be repeated here.
  • the service transmission unit communicating with the second communication device through the transmission channel may include:
  • the service processing unit sends the network data packet to be sent to the second communication device through the transmission channel.
  • the service processing unit encapsulates the service data to be sent on the service processing unit into data in a first format through a data transmission function.
  • the data in the first format carries data type information, and the data type information is used to indicate the data type of the service data.
  • the data in the first format may conform to the format of the network protocol adopted by the first network protocol stack.
  • the service processing unit encapsulates the data in the first format into the first network data packet according to the channel information of the transmission channel through the first network protocol stack, and sends it to the wireless communication unit, and then the wireless communication unit sends the first network data packet to the second network data packet. Communication device.
  • the wireless communication unit receives the network data packet from the second communication device, and then forwards it to the service processing unit for processing.
  • the service processing unit may decapsulate the received network data packet forwarded by the wireless communication unit through the first network protocol stack.
  • the channel information of the transmission channel may include address information of the second communication device.
  • the address information includes an IP address and/or port number.
  • the channel information may also include one or more of the IP address, port number, and protocol type of the service processing unit.
  • the IP address of the service processing unit and the IP address of the wireless communication unit may be the same or different. This part will be described in detail later, and will not be repeated here.
  • the address information of the second communication device can be obtained by the service processing unit in the following manner:
  • the wireless communication unit receives the occupation notification, and may send the address information of the second communication device to the service processing unit.
  • the address information of the second communication device may be sent to the service processing unit.
  • the service processing unit after the service processing unit enters the working mode, it can actively obtain it from the wireless communication unit. For example, a first acquisition request is sent, and the first acquisition request is used to request the address information of the second communication device.
  • the wireless communication unit occupies the transmission channel before the service processing unit takes over the transmission channel.
  • the wireless communication unit occupies the transmission channel.
  • the business processing unit is in the standby mode, which may be the business processing unit being in a power-off state or the business processing unit being in a standby state with low power consumption. In the low-power standby state, the service processing unit does not perform the transmission and processing of service data packets.
  • the wireless communication unit can continue to use the transmission channel.
  • the service processing unit may send an occupancy release notification to the wireless communication unit when it is about to be powered off, and the occupancy release notification is used to notify the wireless communication unit that the service processing unit no longer uses the transmission channel.
  • the network data packet encapsulating the service data is sent, and the second communication device successfully receives it, then the occupancy release notification may be sent to the wireless communication unit.
  • the wireless communication unit can take over the transmission channel, so that the wireless communication unit can use the transmission channel to send the network data packet generated by the wireless communication unit to the second communication device.
  • the wireless communication unit decapsulates and processes it through the second network protocol stack.
  • the network data packet sent by the second communication device through the transmission channel is first received by the wireless communication unit, and the wireless communication unit determines the distribution of the network data packet It is processed by the wireless communication unit or distributed to the service processing unit for processing.
  • the wireless communication unit After the wireless communication unit establishes the transmission channel and before the service processing unit enters the working mode, the wireless communication unit takes over the transmission channel.
  • the second mapping relationship is stored on the wireless communication unit.
  • the second mapping relationship is an association relationship between the second parameter information used for communicating with the second communication device and the identifier of the wireless communication unit.
  • the wireless communication unit After the service processing unit enters the working mode, the wireless communication unit stores a first mapping relationship, and the first mapping relationship is a mapping relationship between the first parameter information used to communicate with the second communication device and the identifier of the service processing unit.
  • the business processing unit After the business processing unit enters the working mode, the business processing unit takes over the transmission channel, and the wireless communication unit can also perform the following operations:
  • the wireless communication unit adds the first mapping relationship to the saved mapping relationship. It is also possible to delete the second mapping relationship in the saved mapping relationship. For another example, the wireless communication unit may modify the second mapping relationship in the saved mapping relationship to the first mapping relationship.
  • the second parameter information used to communicate with the second communication device may include one of the port number used by the wireless communication unit to communicate with the second communication device, the IP address of the second communication device, and the port number of the second communication device. Item or multiple items.
  • the first parameter information used to communicate with the first communication device may include one of the port number used by the service processing unit to communicate with the second communication device, the IP address of the second communication device, and the port number of the second communication device Or multiple.
  • the port number used by the wireless communication unit to communicate with the second communication device, and the port number used by the service processing unit to communicate with the second communication device may be the same or different.
  • the port number used by the wireless communication unit to communicate with the second communication device, and the port number used by the service processing unit to communicate with the second communication device are the same, the service processing unit takes over the transmission channel, and the wireless communication unit can also The port used for communication with the second communication device is allocated to the service processing unit.
  • the wireless communication unit closes the port for communication between the local side and the second communication device, and opens the port for communication between the service processing unit and the second communication device. Therefore, the port for communicating with the second communication device is only used by the service processing unit.
  • the first mapping relationship may include an association relationship between the port number and the identifier of the service processing unit.
  • the second mapping relationship may include an association relationship between the port number and the identifier of the wireless communication unit.
  • the port number used by the wireless communication unit to communicate with the second communication device and the port number used by the service processing unit to communicate with the second communication device are different.
  • the service processing unit takes over the transmission channel, and the wireless communication unit can also connect the wireless The port used by the communication unit to communicate with the second communication device is closed, and the port used by the service processing unit to communicate with the second communication device is opened.
  • one possible deployment method is that the service processing unit and the wireless communication unit can share the same IP address, for example, a variant network bridge deployment method is adopted.
  • the variant network bridge is a similar way to the deployment method of the network bridge. The difference is that the service processing unit and the wireless communication unit share the same IP address. If a network bridge is used to deploy the service processing unit and the wireless communication unit in the communication device, the IP addresses of the service processing unit and the wireless communication unit are different.
  • the identifier of the service processing unit may be the ID of the service processing unit; the identifier of the wireless communication unit may be the ID of the wireless communication unit.
  • Another possible deployment method is that the service processing unit and the wireless communication unit may use different IP addresses, such as a NAT deployment method.
  • the identification of the business processing unit may include one or more of the ID of the business processing unit or the IP address of the business processing unit.
  • the identification of the wireless communication unit may include one or more of the ID of the wireless communication unit or the IP address of the wireless communication unit.
  • the wireless communication unit receives the network data packet sent by the second communication device through the transmission channel, and the network data packet carries an indication parameter used to determine whether to be processed by the wireless communication unit or distributed to the service processing unit for processing. For example, when the indicating parameter is the first parameter information, it is determined to be processed by the service processing unit; when the indicating parameter is the second parameter information, it is determined to be processed by the wireless communication unit. Therefore, the wireless communication unit determines that the network data packet is processed by the service processing unit or the wireless communication unit according to the indication parameter and the stored mapping relationship.
  • the wireless communication unit receives the network data packet 1 from the second communication device through the transmission channel, and the network data packet 1 carries the first parameter information; the wireless communication unit according to the first parameter information And the first mapping relationship determines that the network data packet 1 is processed by the service processing unit, and the network data packet 1 is sent to the service processing unit; the service processing unit decapsulates the network data packet 1 through the first network protocol stack.
  • the wireless communication unit before the service processing unit enters the working mode, the wireless communication unit receives the network data packet 2 from the second communication device through the transmission channel, and the network data packet 1 carries the second parameter information; the wireless communication unit according to the second parameter When the information and the second mapping relationship determine that the network data packet 2 is processed by the wireless communication unit, the third network data packet is decapsulated through the second network protocol stack.
  • mapping relationship may be stored in the form of a linked list, or stored in the form of an array, or other storage forms, which are not limited in the embodiment of the present application.
  • FIG. 12 is a schematic flow diagram of the communication method provided by this embodiment of the present application.
  • the second communication device Take the second communication device as a terminal device and the transmission channel as a P2P channel as an example.
  • a P2P channel is established between the wireless communication unit of the first communication device and the second communication device through the P2P hole punching technology.
  • the specific method of establishing the P2P channel can be referred to as shown in FIG. 6, which will not be repeated here.
  • the mobile phone can initiate a P2P connection request to the battery-type camera device through the P2P server after starting an application for connecting to the battery-type camera device.
  • the information related to hole punching transmitted by the wireless communication unit to the second communication device or the P2P server may be encapsulated or decapsulated through the second network protocol stack on the wireless communication unit.
  • S1202 The wireless communication unit of the first communication device wakes up the service processing unit.
  • the business processing unit enters the working mode.
  • the wireless communication unit may receive the wake-up instruction sent by the second communication device, and execute the wake-up service processing unit. It can also wake up the service processing unit through a local wake-up command. It may also be to power on the business processing unit to wake up the business processing unit.
  • S1203 The wireless communication unit sends channel information of the P2P channel to the service processing unit, and the service processing unit takes over the P2P channel.
  • the operation for the service processing unit to take over the P2P channel is as described above, and will not be repeated here.
  • the service processing unit encapsulates the sent service data into data in the first format.
  • the first format data includes data type information.
  • the data type information is used to indicate the data type of the business data.
  • the service processing unit encapsulates the first format data into a first network data packet according to the channel information of the P2P channel through the first network protocol stack.
  • S1206 The service processing unit sends the first network data packet to the wireless communication unit.
  • the wireless communication unit sends the first network data packet to the second communication device.
  • FIG. 13A and FIG. 13B are schematic diagrams of deployment architectures of two exemplary variant network bridges provided in the embodiments of this application.
  • the service processing unit of the first communication device includes a first P2P module and a first network protocol stack.
  • the first P2P module is used to encapsulate the service data to be sent into the first format data.
  • the service processing unit also includes a first processing module (camera app), and the first processing module is used to obtain service data to be sent.
  • the service processing unit may not be provided with a physical network interface card (network interface card, NIC).
  • the network interface card may be referred to as a network card for short.
  • a virtual (network interface card, NIC) may be deployed in the service processing unit to be used as the network card of the first network protocol stack.
  • the first processing module may be an app used to implement services, such as a camera app.
  • the IP address of the virtual network card is the same as the IP address of the wireless network card driver.
  • the wireless communication unit of the first communication device includes a second P2P module and a second network protocol stack.
  • the second P2P module is responsible for making holes to establish a P2P channel with the second communication device.
  • the second network protocol stack is responsible for the encapsulation and decapsulation of network data packets.
  • the wireless communication unit may also include a second processing module and a transceiver module.
  • the transceiver module may be a radio frequency (RF), which is used to send and receive network data packets.
  • the distribution module is used to distribute the received network data packet from the second communication device, and determine whether the received network data packet is processed by the wireless communication unit or the service processing unit.
  • the distribution module can be deployed in combination with the second network protocol stack, or in other words, the distribution module can be deployed in the second network protocol stack.
  • the wireless communication unit also includes a wireless network card driver.
  • the distribution module can also be deployed in the wireless network card driver.
  • the distribution module can also be deployed independently, and this application does not specifically limit the deployment location of the distribution module.
  • Figure 13A takes the distribution module deployed in the wireless network card driver as an example.
  • Figure 13B a separate deployment of the distribution module is taken as an example.
  • the first processing module may be a wireless application (application, app), such as a Wi-Fi app.
  • the wireless communication unit also includes a virtual protocol stack, which is used as a proxy protocol stack of the first network protocol stack in the service processing unit. Therefore, the network data packets sent by the wireless communication unit and the service processing unit can have the same IP address and/or media access control (MAC) address.
  • MAC media access control
  • the service processing unit and the wireless communication unit may be connected by a hardware interconnection bus.
  • UDP is a connectionless protocol.
  • the port used for communication with the second electronic communication can be allocated to the service processing unit. For example, the port connected between the wireless communication unit and the MCU is allocated to the service processing unit. Therefore, the network data packet from the second communication device is not sent to the MCU for processing, but is forwarded to the service processing unit for processing.
  • the first P2P module When the network protocol stack adopts TCP, after the service processing unit is powered on or awakened, the first P2P module will trigger the execution of the TCP handshake.
  • the virtual network card may be responsible for intercepting the TCP handshake. For example, the first P2P module sends a TCP handshake request, and when the virtual network card receives the TCP handshake request, it sends a TCP handshake confirmation to the first P2P module. Therefore, the service processing unit prohibits sending the TCP handshake message to the second communication device through the P2P channel.
  • the wireless communication unit may also be responsible for intercepting the relevant messages of the TCP handshake. For example, the virtual protocol stack is responsible for intercepting the TCP handshake request message, or the distribution module is responsible for intercepting the TCP handshake request message, or the wireless network card driver is responsible for intercepting the TCP handshake request message.
  • FIG. 14 is a schematic flowchart of a communication method provided by an embodiment of this application.
  • S1401-S1410 describe the transmission and processing of receiving downlink data packets.
  • Steps S1411-S1417 describe the processing and transmission of the uplink data generated by the service processing unit.
  • Steps S1418-S1423 are to describe the processing and transmission of the uplink data generated by the wireless communication unit.
  • the transceiver module receives the network data packet 1 from the second communication device.
  • the network data packet 1 carries indication parameters.
  • the transceiver module sends the first network data packet to the wireless network card driver.
  • the indicating parameter is used to determine that the network data packet 1 is processed by the wireless communication unit or the service processing unit.
  • the indicating parameter is the first parameter information, and the mapping relationship on the first communication device includes the first mapping relationship.
  • the indicating parameter is the second parameter information, and the mapping relationship of the first communication device includes the second mapping relationship.
  • S1402 The distribution module in the wireless network card driver determines that the network data packet 1 is processed by the wireless communication unit or the service processing unit according to the indication parameter and the mapping relationship (the first mapping relationship or the second mapping relationship). When it is determined that the network data packet 1 is processed by the wireless communication unit, S1403 is executed.
  • the indicated parameter in the header of the network data packet 1 is the first parameter information, it is processed by the wireless communication unit.
  • the indicated parameter in the header of the network data packet 1 is the second parameter information, which is processed by the service processing unit.
  • S1406 When it is determined that the network data packet 1 is processed by the service processing unit, S1406 is executed.
  • the distribution module forwards the network data packet 1 to the virtual protocol stack.
  • the distribution module forwards the network data packet 1 to the second network protocol stack.
  • the second network protocol stack decapsulates the network data packet 1, and sends the communication information obtained by the decapsulation to the second P2P module.
  • the communication information is, for example, P2P information of the second communication device.
  • the first P2P module recognizes that the communication information is P2P information, and saves the P2P information.
  • S1406 The distribution module forwards the network data packet 1 to the virtual protocol stack.
  • the virtual protocol stack sends the network data packet 1 to the virtual network card through the hardware interconnection bus.
  • S1408 The virtual network card sends the network data packet 1 to the first network protocol stack.
  • the first network protocol stack decapsulates the network data packet 1, and sends the service information obtained by the decapsulation to the first processing module through the first P2P module.
  • the first processing module processes the information obtained by decapsulating the network data packet 1.
  • the first processing module generates business data, for example, a camera app generates a media stream.
  • the media stream can be an audio stream, a video stream, or an audio and video stream.
  • the first processing module sends the service data to the first P2P module.
  • the first P2P module encapsulates the service data into data in the first format, and sends it to the first network protocol stack.
  • the first network protocol stack encapsulates the data in the first format into a network data packet 2.
  • the first network protocol stack sends the network data packet 2 to the wireless communication unit through the virtual network card.
  • the virtual protocol stack receives the network data packet 2 from the wireless communication unit, and sends it to the wireless network card driver.
  • the wireless network card driver sends network data packet 2 to the transceiver module, so that the transceiver module sends network data packet 2.
  • the second P2P module encapsulates the indication information used to indicate the P2P information in the communication information to be sent, and sends it to the second network protocol stack.
  • the second network protocol stack encapsulates the communication information containing the indication information into a network data packet 3.
  • the second network protocol stack sends the network data packet 3 to the wireless network card driver.
  • the wireless network card driver sends the network data packet 3 to the transceiver module, so that the transceiver module sends the network data packet 3.
  • the resources in the wireless communication unit are limited, such as less available memory and weak CPU processing capabilities.
  • network data packets carrying service data sent by the service processing unit may not be processed in time, and the available memory of the wireless communication unit is insufficient, which may result in data packets sent by the service processing unit Failure to send in time, resulting in packet loss and business interruption.
  • this application proposes a back pressure mechanism.
  • the memory on the side of the service processing unit can be used to cache network packets.
  • the wireless communication unit When the wireless communication unit determines that the remaining memory space is less than the first threshold, it sends a first notification to the service processing unit, where the first notification is used to notify the service processing unit to suspend sending network data packets. If the service processing unit currently has a network data packet to be sent, or if the service processing unit receives the first notification from the wireless communication unit before sending the network data packet to the wireless communication unit, the sending of the network data packet is suspended temporarily.
  • the time to start sending network data packets can be determined by any of the following methods:
  • the wireless communication unit actively instructs the service processing unit to continue sending network data packets according to the remaining memory space.
  • the wireless communication unit After the wireless communication unit sends the first notification to the service processing unit, it determines that the remaining memory space is greater than the second threshold, and sends a second notification to the service processing unit.
  • the second notification is used to notify the service processing unit to continue sending network data packets.
  • the second threshold is greater than the first threshold. Therefore, after receiving the second notification, the service processing unit sends a network data packet to the wireless communication unit.
  • the second possible way the service processing unit actively makes a tentative transmission to the wireless communication unit.
  • the service processing unit sends the network data packet to the wireless communication unit after the duration of receiving the first notification reaches the preset duration. After receiving the network data packet, the wireless communication unit determines that the remaining memory space is greater than the second threshold, and can continue to process the network data packet. If the wireless communication unit determines that the remaining memory space is less than the first threshold after receiving the network data packet, it may send the first notification to the service processing unit.
  • the service processing unit by setting up a back pressure mechanism, when the wireless communication unit memory is insufficient, the service processing unit is notified to postpone the transmission.
  • the wireless communication unit memory is sufficient, for example, the network data packet transmission on the wireless communication unit is completed, or the transmission is repeated.
  • the sending party has received the packet, the data packet on the service processing unit will reach the wireless communication unit, which can solve the packet loss of the wireless network due to network jitter, and improve the network transmission efficiency and user experience.
  • the service processing unit After the service processing unit sends the first network data packet to the wireless communication unit, it needs to convert the address information of the service processing unit to the address information of the wireless communication unit for the source address of the first network data packet, and then according to the channel information of the P2P channel
  • the first network data packet is sent to the second communication device through the P2P channel.
  • the wireless communication unit of the first communication device includes a transceiver module, a second network protocol stack, and a second P2P module. It may also include a second processing module.
  • the transceiver module may be a radio frequency (RF), which is used to send and receive network data packets.
  • the second network protocol stack is used to encapsulate data packets.
  • the second network protocol stack also has a distribution function for distributing received network data packets from the second communication device, and determining whether the received network data packets are processed by the wireless communication unit or the service processing unit.
  • the first network protocol stack also has a NAT translation function, see FIG. 15A.
  • the NAT translation function can also be deployed outside the first network protocol stack and executed by a separate module.
  • a NAT module is deployed in the wireless communication unit, which can process the IP header of the network data packet sent by the service processing unit, change the source IP address and/or source port number and then resend it to the second communication device.
  • it can be determined whether it is sent to the service processing unit or the wireless communication unit itself according to the indication parameters and the mapping relationship in the network data packet. If it is sent to the service For the processing unit, the corresponding relationship is found from the ground conversion table, the destination IP address and destination port number are replaced, and then sent to the service processing unit.
  • the service processing unit of the electronic device includes a first network protocol stack, a first P2P module, and a first processing module (camera app).
  • the service processing unit may not be provided with a physical network card.
  • a virtual network card may be deployed in the service processing unit to be used as the network card of the second network protocol stack.
  • the virtual network card deployed in the service processing unit is referred to as the first virtual network card.
  • the second processing module may be an app used to implement services, such as a camera app.
  • the IP address of the first virtual network card is different from the IP address of the wireless network card driver.
  • a virtual network card is also deployed in the wireless communication unit.
  • the virtual network card deployed in the wireless communication unit is referred to as a second virtual network card.
  • the second virtual network card is used as a proxy network card of the first virtual network card. Send the registration information of the second virtual network card to the first network protocol stack.
  • the registration information of the second virtual network card may include the IP address and/or port number of the second virtual network card.
  • the service processing unit and the wireless communication unit may be connected by a hardware interconnection bus.
  • the IP address of the first virtual network card may be 192.168.1.2, which is used as the IP address of the service processing unit.
  • the IP address of the second virtual network card may be 192.168.1.1, which is used as the IP address of the wireless communication unit pair.
  • the IP address in the wireless communication unit pair can be used for communication between the service processing unit and the wireless communication unit. It should be noted that the communication between the service processing unit and the wireless communication unit mentioned here does not include the service processing unit and the service service. Communication between devices via wireless communication unit.
  • the IP address of the wireless network card driver can be 192.168.0.2, which serves as the IP address of the wireless communication unit to the external network.
  • the IP address of the first virtual network card may be the same as the IP address of the second virtual network card.
  • FIG. 16 is a schematic flowchart of a communication method provided by an embodiment of this application.
  • S1601-S1610 describe the reception and processing of downlink data packets.
  • Steps S1611-S1618 describe the processing and transmission of the uplink data generated by the service processing unit.
  • Steps S1619-S1623 are to describe the processing and transmission of the uplink data generated by the wireless communication unit.
  • S1602 The second network protocol stack determines, according to the indication parameter and the mapping relationship ((first mapping relationship or second mapping relationship)), that the network data packet 1 is processed by the wireless communication unit or processed by the service processing unit. When it is determined that the network data packet 1 is processed by the wireless communication unit, S1603 is executed.
  • the indicated parameter in the header of the network data packet 1 is the first parameter information, it is processed by the wireless communication unit.
  • the indicated parameter in the header of the network data packet 1 is the second parameter information, which is processed by the service processing unit.
  • the second network protocol stack decapsulates the network data packet 1, and sends the decapsulated information to the second P2P module.
  • the second P2P module recognizes that the communication information is P2P information, and saves the P2P information.
  • the second network protocol stack converts the destination address of the network data packet 1 from the address information of the wireless communication unit to the address information of the service processing unit.
  • the address information includes an IP address and/or port number.
  • the destination address of the network data packet 1 is the address information of the wireless communication unit, and after the address conversion, the destination address of the network data packet 1 is the address information of the service processing unit.
  • the address information includes an IP address.
  • the destination IP address of network data packet 1 is 192.168.0.2, and the destination IP address of the converted network data packet is 192.168.1.2.
  • An address conversion table is stored in the electronic device, and there is a mapping relationship between 192.168.0.2 and 192.168.1.2 in the address conversion table.
  • the address information includes IP address and port number.
  • the destination IP address of network data packet 1 is 192.168.0.2, and the port number is 888.
  • the destination IP address of the converted network data packet is 192.168.1.2, and the port number is 666.
  • S1606 The second network protocol stack forwards the network data packet 1 after the address conversion to the second virtual network card.
  • the second virtual network card sends the network data packet 1 to the first virtual network card through the hardware interconnection bus.
  • S1608 The first virtual network card sends the network data packet 1 to the first network protocol stack.
  • the first network protocol stack decapsulates the network data packet 1, and sends the service information obtained by the decapsulation to the first processing module through the first P2P module.
  • the first network protocol stack determines that it is a data packet sent to the service processing unit for processing, and then sends it to the first processing module for processing.
  • the first processing module processes the business information.
  • the first P2P module encapsulates the service data generated by the first processing module into data in the first format.
  • the business data generated by the first processing module for example, a camera app generates a media stream.
  • the media stream can be an audio stream, a video stream, or an audio and video stream.
  • the first P2P module sends the first format data to the first network protocol stack.
  • the first network protocol stack encapsulates the service data into network data packet 2.
  • the first network protocol stack sends the network data packet 2 to the wireless communication unit through the first virtual network card.
  • the first virtual network card receives the network data packet 2 from the wireless communication unit, and sends it to the second network protocol stack.
  • the second network protocol stack converts the source address of the network data packet 2 from the address information of the wireless communication unit to the address information of the service processing unit.
  • the second network protocol stack sends the network data packet 2 after the address conversion to the wireless network card driver.
  • the wireless network card driver sends the network data packet 2 after the address conversion to the transceiver module, so that the transceiver module sends the network data packet 2 after the address conversion.
  • the second processing module generates communication information, such as a heartbeat packet.
  • the second processing module sends the communication information to the first network protocol stack through the second P2P module.
  • the second network protocol stack encapsulates the communication information into a network data packet 3.
  • the second network protocol stack sends the network data packet 3 to the wireless network card driver.
  • the wireless network card driver sends the network data packet 3 to the transceiver module, so that the transceiver module sends the network data packet 3.
  • the wireless communication unit may send a data packet to the service processing unit.
  • the wireless communication unit For example, the wireless communication unit generates data packet 1.
  • the source IP address of data packet 1 is the internal IP address of the wireless communication unit, such as 192.168.1.1
  • the destination IP address of data packet 1 is the IP address of the business processing unit, such as 192.168.1.2 .
  • the service processing unit receives the data packet 1, and can determine that the data packet 1 is the data packet 1 sent by the wireless communication unit, so as to decapsulate and process the data packet 1.
  • the business processing unit can also send data packets to the wireless network communication unit, such as data packet 2.
  • the source IP address of data packet 2 is the IP address of the business processing unit
  • the destination IP address of data packet 2 is the internal IP of the wireless communication unit. address.
  • the second network protocol stack sends the data packet to the wireless communication unit for processing when the destination IP address is determined, and then forwards it to the second processing module for processing.
  • the network protocol stack is set in both the service processing unit and the wireless communication unit, and the wireless communication unit is responsible for distribution.
  • the processing capability of the wireless communication unit is weak, the processing of network services can be guaranteed, and Can improve the throughput of the wireless network.
  • a network protocol stack is deployed on the wireless communication unit, and when the service processing unit is powered off, it can still communicate with external devices. Such as network keep-alive, remote wake-up, etc.
  • the wireless communication unit can independently develop network applications, which also facilitates the service deployment of the low-power wireless communication unit.
  • a network protocol stack is deployed on the service processing unit. After power-on, it can interact with external devices independently of network data packets. Such as the transmission of audio and video streams.
  • the business processing unit can independently develop network applications, and it also facilitates the business deployment of the business processing unit.
  • this application can be provided as methods, systems, or computer program products. Therefore, this application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.

Landscapes

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

Abstract

一种通信方法及装置,用于解决由于建立通信连接不及时对数据传输及时性产生影响的问题。第一通信装置中的业务处理单元以及无线通信单元均部署网络协议栈,从而在业务处理单元进入工作模式之前,无线通信单元可以基于部署的网络协议栈与第二通信装置之间建立传输通道;业务处理单元在进入工作模式后,业务处理单元结合部署的网络协议栈通过传输通道与第二通信装置交互数据。由于在业务处理单元进入工作模式前,无线通信单元打通传输通道,从而业务处理单元在进入工作模块后,可以直接使用已经建立好的传输通道与第二通信装置之间交互数据。与业务处理单元进入工作模式后再触发打洞流程相比,避免浪费时间资源,数据传输的及时性得到保障。

Description

一种通信方法及装置 技术领域
本申请涉及通信技术领域,尤其涉及一种通信方法及装置。
背景技术
目前采用电池供电的拍摄设备中一般包括相机(camera)芯片、还有Wi-Fi芯片。其中camera芯片,负责音视频的采集、编码以及存储等。Wi-Fi芯片负责无线网络数据的收发。为了减少电池的消耗,Camera芯片在拍摄设备待机状态下,一般处于下电状态,Wi-Fi芯片一般处于工作状态。当拍摄设备由待机状态变为工作状态时,Camera芯片处于上电状态,即工作状态。
为了提高拍摄设备与终端设备之间的传输效率,可以在拍摄设备与终端设备建立点对点(peer to peer,P2P)通道。但是在创建P2P通道时,是在业务处理单元上电之后,才能启动执行P2P打洞流程,而P2P打洞流程较繁琐。业务处理单元只有在打洞成功后才能与终端设备进行数据传输。从而会影响传输数据的及时性。
发明内容
本申请实施例提供了一种通信方法及装置,用于解决由于建立通信通道不及时对数据传输及时性产生影响的问题。
第一方面,本申请实施例提供一种通信方法,应用于采用电池供电的第一通信装置中,所述第一通信装置包括业务处理单元以及无线通信单元,所述方法包括:在所述业务处理单元进入工作模式之前,所述无线通信单元与第二通信装置建立传输通道;所述业务处理单元在进入工作模式后,所述业务处理单元通过所述传输通道与第二通信装置交互数据,比如向所述第二通信装置发送待发送的第一网络数据包。
通过上述方案,业务处理单元进入工作模式前,无线通信单元打通传输通道,从而业务处理单元在进入工作模块后,可以直接使用(或者说继承)已经建立好的传输通道与第二通信装置之间交互数据。与业务处理单元进入工作模式后再触发打洞流程相比,避免浪费时间资源,数据传输的及时性得到保障。
示例性的,第一通信装置可以是终端设备,第二通信装置可以是终端设备或者服务器。
比如,第二通信装置为终端设备时,第一通信装置与第二通信装置之间的传输通道可以是直连的传输通道。
在一种可能的设计中,第二通信装置为服务器的情况下,第一通信装置与第二通信装置创建传输通道(也可以称为通信连接),比如可以是消息队列遥测传输协议(message queuing telemetry transport,MQTT)、受限应用协议(constrained application protocol,CoAP)连接,或者传输控制协议(transmission control protocol,TCP)连接等。
在一种可能的设计中,第二通信装置为终端设备,第一通信装置与第二通信装置之间的传输通道可以是直连的传输通道。传输通道为点对点P2P通道;无线通信单元与第二通信装置建立传输通道,具体可以采用如下方式实现:上述无线通信单元通过P2P打洞方式,与第二通信装置建立P2P通道。
在一种可能的设计中,在业务处理单元进入工作模式后,通过传输通道向第二通信装置发送待发送的第一网络数据包前,该方法还包括:业务处理单元向无线通信单元发送占用通知,占用通知用于指示业务处理单元占用传输通道;无线通信单元在接收到占用通知之后,暂停使用传输通道向第二通信装置发送无线通信单元产生的网络数据包。
上述设计,在业务处理单元占用传输通道时,无线通信单元不再占用通道。降低无线通信单元传输数据对业务处理单元传输的业务数据的影响,从而降低业务数据的传输时延。
在一种可能的设计中,无线通信单元暂停使用传输通道向第二通信装置发送无线通信单元产生的网络数据包,包括:无线通信单元将用于通过传输通道与第二通信装置通信的端口分配给业务处理单元。
通过上述设计,无线通信单元将端口让出给业务处理单元使用,简单易实现。
在一种可能的设计中,在业务处理单元进入工作模式后,该方法还包括:无线通信单元将存储的映射关系中的第二映射关系修改为第一映射关系;或者,无线通信单元在存储的映射关系中增加第一映射关系;第一映射关系为第一参数信息与业务处理单元的标识的关联关系,第一映射关系用于确定携带第一参数信息的通信数据包由业务处理单元处理,第二映射关系为第二参数信息与无线通信单元的标识的关联关系,第二映射关系用于确定携带第二参数信息的网络数据包由无线通信单元处理。
通过上述设计中,业务处理单元进入工作模式,需要使用传输通道,及时修改无线通信单元的转发规则,保障来自第二通信装置的网络数据包的正确分发。
在一种可能的设计中,业务处理单元向无线通信单元发送占用通知后,该方法还包括:在确定业务处理单元不需要与第二通信装置通信时,业务处理单元向无线通信单元发送解除占用通知,解除占用通知用于通知无线通信单元业务处理单元结束使用传输通道;无线通信单元接收解除占用通知之后,无线通信单元继续使用传输通道向第二通信装置发送无线通信单元产生的网络数据包。
上述设计中,业务处理单元在不需要使用通道时,及时通知无线通信单元,提高通道的利用率,减少资源浪费。
在一种可能的设计中,业务处理单元在进入工作模式后,通过传输通道向第二通信装置发送待发送的第一网络数据包,包括:业务处理单元将待发送的业务数据封装为第一格式数据,第一格式数据包括数据类型信息,数据类型信息用于指示业务数据的数据类型;业务处理单元通过第一网络协议栈根据传输通道的通道信息将第一格式数据封装为第一网络数据包,并将第一网络数据包发送给无线通信单元;无线通信单元向第二通信装置发送第一网络数据包。
上述设计中,业务处理单元部署网络协议栈,与第二通信装置独立进行网络数据包的交互。比如音视频流的传输。业务处理单元可以独立进行网络应用的开发,也对业务处理单元的业务部署提供便利。
在一种可能的设计中,上述传输通道的通道信息包括业务处理单元的IP地址、第一通信装置上用于与第二通信装置通信的端口号、协议类型、第二通信装置的IP地址或第二通信装置的端口号中的一项或多项。
在一种可能的设计中,上述业务处理单元的IP地址与无线通信单元的IP地址相同。从而无需进行地址转换,因此可以避免地址转换导致的数据传输时延增加,从而提高了数据的传输效率。
在一种可能的设计中,无线通信单元向第二通信装置发送第一网络数据包,包括:无线通信单元将第一网络数据包的源地址由业务处理单元的地址信息转换为无线通信单元的地址信息后,并向第二通信装置发送经过地址转换的第一网络数据包。
在一种可能的设计中,业务处理单元在进入工作模式后,还包括:无线通信单元接收第二通信装置通过传输通道发送的第二网络数据包,第二网络数据包携带第一参数信息;无线通信单元根据第一参数信息以及第一映射关系确定第二网络数据包由业务处理单元处理,并将第二网络数据包发送给业务处理单元;业务处理单元通过第一网络协议栈对第二网络数据包解封装。
在一种可能的设计中,无线通信单元将第二网络数据包发送给业务处理单元,包括:无线通信单元将第二网络数据包的目的地址由无线通信单元的地址信息转换为业务处理单元的地址信息,根据转换后的目的地址将地址转换后的第二网络数据包发送给业务处理单元。
在一种可能的设计中,业务处理单元在进入工作模式前,还包括:无线通信单元通过传输通道接收来自第二通信装置的第三网络数据包,第三网络数据包携带第二参数信息;无线通信单元根据第二参数信息以及第二映射关系确定第三网络数据包由无线通信单元处理时,通过第二网络协议栈对第三网络数据包解封装。
在一种可能的设计中,第一参数信息包括业务处理单元用于与第二通信装置通信的端口号、第二通信装置的IP地址或第二通信装置的端口号中的一项或多项;
第二参数信息包括无线通信单元用于与第二通信装置通信的端口号、第二通信装置的IP地址或第二通信装置的端口号中的一项或多项。
在一种可能的设计中,还包括:无线通信单元通过第二网络协议栈根据传输通道的通道信息将待发送的第一通信信息封装为第四网络数据包,并向第二通信装置发送第四网络数据包,第一通信信息用于与第二通信装置通信。
在一种可能的设计中,第一通信装置与第二通信装置通信采用的协议为传输控制协议TCP,还包括:业务处理单元进入工作模式后,业务处理单元禁止通过传输通道向第二通信装置发送TCP握手请求消息;或者,业务处理单元进入工作模式后,无线通信单元接收到业务处理单元发往第二通信装置的TCP握手请求消息时,向无线通信单元回复TCP握手确认消息。
上述设计中,及时将TCP握手消息进行拦截,可以避免TCP握手所导致的业务数据传输的滞后,进而可以提高数据传输的时效性。
第二方面,本申请实施例提供一种通信装置,该通信装置采用电池供电,该通信装置包括业务处理单元以及无线通信单元;其中,该无线通信单元,用于在业务处理单元进入工作模式之前,与第二通信装置建立传输通道;业务处理单元,用于在业务处理单元进入工作模式后,通过传输通道向第二通信装置发送待发送的第一网络数据包,第二通信装置为终端设备或者服务器。
在一种可能的设计中,第二通信装置为终端设备,传输通道为点对点P2P通道;无线通信单元,具体用于通过P2P打洞方式,与第二通信装置建立P2P通道。
在一种可能的设计中,业务处理单元,还用于在业务处理单元进入工作模式后,通过传输通道向第二通信装置发送待发送的第一网络数据包前,向无线通信单元发送占用通知,占用通知用于指示业务处理单元占用传输通道;无线通信单元,还用于在接收到占用通知 之后,暂停使用传输通道向第二通信装置发送无线通信单元产生的网络数据包。
在一种可能的设计中,无线通信单元,在暂停使用传输通道向第二通信装置发送无线通信单元产生的网络数据包时,具体用于将用于通过传输通道与第二通信装置通信的端口分配给业务处理单元。
在一种可能的设计中,在业务处理单元进入工作模式后,无线通信单元还用于:将存储的映射关系中的第二映射关系修改为第一映射关系;或者,在存储的映射关系中增加第一映射关系;第一映射关系为第一参数信息与业务处理单元的标识的关联关系,第一映射关系用于确定携带第一参数信息的通信数据包由业务处理单元处理,第二映射关系为第二参数信息与无线通信单元的标识的关联关系,第二映射关系用于确定携带第二参数信息的网络数据包由无线通信单元处理。
在一种可能的设计中,业务处理单元,还用于向无线通信单元发送占用通知后,在确定业务处理单元不需要与第二通信装置通信时,向无线通信单元发送解除占用通知,解除占用通知用于通知无线通信单元业务处理单元结束使用传输通道;无线通信单元,还用于接收解除占用通知之后,无线通信单元继续使用传输通道向第二通信装置发送无线通信单元产生的网络数据包。
在一种可能的设计中,业务处理单元在进入工作模式后,通过传输通道向第二通信装置发送待发送的第一网络数据包时,具体用于:将待发送的业务数据封装为第一格式数据,第一格式数据包括数据类型信息,数据类型信息用于指示业务数据的数据类型;通过第一网络协议栈根据传输通道的通道信息将第一格式数据封装为第一网络数据包,并将第一网络数据包发送给无线通信单元;无线通信单元,还用于向第二通信装置发送第一网络数据包。
在一种可能的设计中,传输通道的通道信息包括业务处理单元的IP地址、通信装置上用于与第二通信装置通信的端口号、协议类型、第二通信装置的IP地址或第二通信装置的端口号中的一项或多项。
在一种可能的设计中,业务处理单元的IP地址与无线通信单元的IP地址相同。
在一种可能的设计中,无线通信单元,还用于将第一网络数据包的源地址由业务处理单元的地址信息转换为无线通信单元的地址信息后,并通过传输通道向第二通信装置发送经过地址转换的第一网络数据包。
在一种可能的设计中,业务处理单元在进入工作模式后,还用于通过传输通道接收来自第二通信装置的第二网络数据包,第二网络数据包携带第一参数信息;根据第一参数信息以及第一映射关系确定第二网络数据包由业务处理单元处理,并将第二网络数据包发送给业务处理单元;
业务处理单元,还用于通过第一网络协议栈对第二网络数据包解封装。
在一种可能的设计中,无线通信单元,还用于将第二网络数据包的目的地址由无线通信单元的地址信息转换为业务处理单元的地址信息,根据转换后的目的地址将地址转换后的第二网络数据包发送给业务处理单元。
在一种可能的设计中,业务处理单元在进入工作模式前,还用于:通过传输通道接收来自第二通信装置的第三网络数据包,第三网络数据包携带第二参数信息;无线通信单元,还用于根据第二参数信息以及第二映射关系确定第三网络数据包由无线通信单元处理时,通过第二网络协议栈对第三网络数据包解封装。
在一种可能的设计中,第一参数信息包括业务处理单元用于与第二通信装置通信的端口号、第二通信装置的IP地址或第二通信装置的端口号中的一项或多项;第二参数信息包括无线通信单元用于与第二通信装置通信的端口号、第二通信装置的IP地址或第二通信装置的端口号中的一项或多项。
在一种可能的设计中,无线通信单元,还用于通过第二网络协议栈根据传输通道的通道信息将待发送的第一通信信息封装为第四网络数据包,并向第二通信装置发送第四网络数据包,第一通信信息用于与第二通信装置通信。
在一种可能的设计中,通信装置与第二通信装置通信采用的协议为传输控制协议TCP,业务处理单元进入工作模式后,业务处理单元,还用于禁止通过传输通道向第二通信装置发送TCP握手请求消息;或者,业务处理单元,还用于在进入工作模式后,向第二通信装置发送TCP握手请求消息;无线通信单元,还用于在接收到业务处理单元发往第二通信装置的TCP握手请求消息时,向业务处理单元回复TCP握手确认消息。
第三方面,本申请提供一种通信装置,用于电子设备或电子设备的芯片,包括至少两个处理元件(用于实现业务处理单元功能和无线通信单元功能)和至少一个存储元件,其中至少一个存储元件用于存储程序和数据,至少一个处理元件用于执行前述第一方面或第一方面的任意可能的实现方式中的方法。
第四方面,本申请提供一种通信装置,包括处理器和接口电路,接口电路用于接收来自通信装置之外的其它通信装置的信号并传输至处理器或将来自处理器的信号发送给通信装置之外的其它通信装置,处理器用于实现业务处理单元以及无线通信单元的功能,具体可以通过逻辑电路或执行代码指令用于实现前述第一方面或第一方面的任意可能的实现方式中的方法。
第五方面,本申请提供一种计算机程序产品,该计算机程序产品包括计算机指令,当该计算机指令被执行时,使得前述第一方面或第一方面的任意可能的实现方式中的方法被执行。
第六方面,本申请提供了一种计算机可读存储介质,该计算机存储介质存储有计算机指令,当计算机指令被执行时,使得前述第一方面或第一方面的任意可能的实现方式中的方法被执行。
附图说明
图1为本申请实施例提供的状态转换示意图;
图2为本申请实施例提供的一种可能的电子设备结构示意图;
图3为本申请实施例提供的另一种可能的电子设备结构示意图;
图4为本申请实施例提供的通信连接示意图;
图5为本申请实施例提供的一种通信系统架构示意图;
图6为本申请实施例提供的P2P打洞流程示意图;
图7为本申请实施例提供的一种可能的网络协议栈和P2P功能部署方式示意图;
图8为本申请实施例提供的另一种可能的网络协议栈和P2P功能部署方式示意图;
图9为本申请实施例提供的又一种可能的网络协议栈和P2P功能部署方式示意图;
图10为本申请实施例提供的另一种通信系统架构示意图;
图11为本申请实施例提供的一种通信方法流程示意图;
图12为本申请实施例提供的另一种通信方法流程示意图;
图13A为本申请实施例提供的一种示例性的变种网桥的部署架构示意图;
图13B为本申请实施例提供的另一种示例性的变种网桥的部署架构示意图;
图14为本申请实施例提供的变种网桥部署场景下的通信方法流程示意图;
图15A为本申请实施例提供的一种示例性的NAT部署架构示意图;
图15B为本申请实施例提供的另一种示例性的NAT部署架构示意图;
图16为本申请实施例提供的NAT部署场景下的通信方法流程示意图。
具体实施方式
下面将结合附图对本申请实施例作进一步地详细描述。
本申请实施例可以应用到采用电池供电的第一通信装置中。应当理解,电池供电的通信装置可以包括全部由电池供电的装置,或者部分由电池供电的装置,例如常电与电池混合供电的装置。常电可以是采用电源适配器供电的方式。该第一通信装置能够进行无线通信。无线通信可以包括3G网络、4G网络、5G网络或者未来6G网络,或者可以采用无线保真(wireless fidelity,Wi-Fi)网络通信,或者蓝牙通信等。第一通信装置可以是电池供电的终端设备。电池供电的终端设备可以是电池类照相设备(还可以称为电池类camera设备),比如照相机、摄像机、摄录机等,还可以是能够进行无线通信的电池类终端设备,比如儿童早教机、可穿戴终端设备等。
第一通信装置中包括业务处理单元和无线通信单元。第一通信装置中还可以包括微处理控制单元(microprocessor control unit,MCU)。第一通信装置中还可以包括其它传感器等器件。
业务处理单元,负责业务处理。比如以电池类camera设备为例,负责音视频的采集、编码、存储等,并将编码后的码流数据送给无线通信类芯片进行传输。业务处理单元通常处于非工作状态(下电状态或待机状态,后续以下电状态为例进行说明),根据需要被MCU控制上电或者唤醒进行业务处理。由于第一通信装置采用电池供电,因此,为了节省电量,业务处理单元上电工作时间一般较短。业务处理单元的内存一般为16MB及以上,可供应用使用的内存一般较为宽裕。
MCU:作为主控负责第一通信装置的整体控制,包括对无线通信单元的控制、业务处理单元的上下电控制、其它外设传感器的采集处理等。在第一通信装置待机状态下,MCU一般处于常供电状态。
无线通信单元:主要负责无线网络数据的收发。在第一通信装置处于工作状态下,无线通信芯片一般处于常供电状态。需要说明的是,在第一通信装置中包括MCU芯片的情况下,在第一通信装置处于待机状态下时,无线通信芯片可以与业务处理芯片一样,处于非常供电状态。无线通信单元侧的内存一般为几百KB,可供使用的内存一般在几十KB到几百KB左右。
上面提及了第一通信装置处于工作状态,而除了工作状态以外,第一通信装置还可以处于有待机状态。参见图1所示,第一通信装置处在工作状态时,第一通信装置执行传感器数据的采集、业务的处理、数据传输等。第一通信装置处于上电状态。第一通信装置接收到待机指令后,处于待机状态。在待机状态下,第一通信装置可以负责按键唤醒检测、无线收发唤醒检测、PIR唤醒检测、网络保活等。在待机状态下,为了减少耗电量,业务 处理单元处于下电状态,无线通信单元和/或MCU处于低功耗的工作状态。处于待机状态下的第一通信装置接收到唤醒指令后,进入工作状态。
一种可能的方式中,业务处理单元、无线通信单元、MCU分别部署在不同的芯片中。以电池类camera设备为例,一般可以包括camera芯片、无线通信芯片以及MCU芯片,参见图2所示。camera芯片中可以包括一个或者多个业务处理单元,主要负责处理相机相关的业务。无线通信芯片中可以包括一个或者多个无线通信单元,主要负责无线网络数据的收发。MCU芯片,作为主控,负责camera设备的整体控制,包括对无线通信芯片的控制以及对camera芯片的控制。无线通信芯片和MCU芯片属于常供电部分。
另一种可能的方式中,无线通信单元和MCU部署在同一个芯片中。还以电池类camera设备为例,一般可以包括camera芯片、无线通信芯片。无线通信芯片执行无线通信单元和单片机处理单元的功能。在需要设置多个传感器的情况下,可能无线通信芯片上管脚不足以满足需连接的传感器的数量的要求,也可以在电池类camera设备中增加一个MCU芯片,用于外接传感器,并管理多个传感器。MCU芯片作为一个可选的器件,根据需要确定是否在电池类camera设备中设置。
在又一种可能的方式,无线通信单元、MCU以及业务处理单元也可以均部署在一个芯片中。作为一种示例,MCU的功能也可以合并到无线通信单元中。参见图3所示。上述无线通信单元可以作为常供电部分,进行整个第一通信装置的控制,无线数据的收发,与服务器间的网络保活等。MCU作为一个可选项根据需要添加。在需要设置多个传感器的情况下,芯片的管脚不足以满足需连接的传感器的数量的要求时,增加MCU。
需要说明的是,无线通信单元、MCU以及业务处理单元均可以由处理器来是实现。比如,处理器可以包括中央处理单元(central processing unit,CPU)、图像处理单元(graphics processing unit,GPU)、图像信号处理器(image signal processor,ISP)、数字信号处理器(digital signal processor,DSP)、或神经处理器(neural processing unit,NPU)中一个或者多个。
参见图4所示,业务处理单元和无线通信处理单元之间可以通过硬件互联总线进行连接,硬件互联总线可以包括串行外设接口(Serial Peripheral Interface,SPI)、安全数字输入输出卡(secure digital input and output,SDIO)、或者核间总线等。需要说明的是,核间总线场景,适用于业务处理单元和无线通信单元共存在同一个芯片的情况。业务处理单元和无线通信单元之间通过系统总线直连,并可以直接访问对方的存储单元。
参见图5所示,为一种可能的通信系统架构示意图。通信系统中包括上述第一通信装置,还包括第二通信装置。第二通信装置可以为终端设备,或者是服务器。第二通信装置为终端设备时,终端设备可以是电池类的终端设备,也可以是电源供电的终端设备,比如可以是手机、平板电脑、具有无线通讯功能的可穿戴设备(比如智能手表)等。第二通信装置也可以是车载终端、膝上型计算机(Laptop)等。还应当理解的是,本申请实施例的终端设备还可以台式计算机、智能电视等,对此不作限定。本申请对第二通信装置的供电类型不作具体限定。当然通信系统中还可以包括其它电子设备。本申请实施例中对通信系统中包括的通信装置(第一通信装置和第二通信装置)的数量不作限定。在第二通信装置为终端设备时,通信系统中还可以包括服务器。本申请实施例中涉及的服务器可以是路由器、接入网设备(即基站)或云服务器等。
在一种可能的实施方式中,第二通信装置为服务器的情况下,第一通信装置与第二通信装置创建传输通道,比如可以是消息队列遥测传输协议(message queuing telemetry  transport,MQTT)、受限应用协议(constrained application protocol,CoAP)连接,或者传输控制协议(transmission control protocol,TCP)连接等。
在另一种可能的实施方式中,第二通信装置为终端设备的情况下,比如,第一通信装置为电池类相机设备,第二通信装置为手机。第一通信装置与第二通信装置之间传输音视频码流时,可以通过提供业务服务的服务器进行中转,还可以建立直连的传输通道,比如P2P通道,通过直连的传输通道传输音视频流。直连的传输通道可以是通信装置间建立的直连的网络连接,可以由套接字(socket)连接通道来实现。
针对P2P通道来说,第一通信装置与第二通信装置之间采用打洞的技术建立P2P通道。进而通过建立的P2P通道进行数据交互。后续描述时,以P2P通道为例。P2P通道也可以称为P2P连接、或者简称P2P。
参见图6所示为第一通信装置与第二通信装置打洞流程示意图。图6中以第二通信装置发起打洞请求为例。
S601,第二通信装置向服务器发送第一P2P连接请求。第一P2P连接请求中携带第二通信装置的P2P信息。第二通信装置的P2P信息可以包括第二通信装置的端口号和/或IP地址。
S602,服务器向第一通信装置发送上述第一P2P连接请求。
S603,第一通信装置接收到第一P2P连接请求后,保存第二通信装置的P2P信息,并向服务器发起第二P2P连接请求。第二P2P连接请求携带第一通信装置的P2P信息。第一通信装置的P2P信息可以包括第一通信装置的端口号和/或IP地址。
S604,服务器接收到第二P2P连接请求后,向第二通信装置发送上述第二P2P连接请求。
S605,第二通信装置接收到第一通信装置的P2P信息后,根据第一通信装置的P2P信息向第一通信装置发送第一P2P直连请求。
S606,第一通信装置接收到第二通信装置发送的第一P2P直连请求后,会根据第二通信装置的P2P信息向第二通信装置发起第二P2P直连请求。
从而第一通信装置与第二通信装置之间成功打通P2P通道。
S607,第一通信装置与第二通信装置之间通过P2P通道进行数据交互。
需要说明的是,如上图6仅是示例性的描述两个电子设备之间打洞建立P2P通道的过程,并不具体限定。在实际应用中,电子设备间进行P2P打洞建立P2P通道的过程可以参考但不仅限于规范RFC3489。
第一通信装置与第二通信装置之间进行打洞时发送的P2P信息,需要封装为IP包后再发送。因此,电池供电的第一通信装置中需要部署IP栈(IP Stack)。IP栈也可以称为网络协议栈。用于封装IP包。后续描述时以第一通信装置为电池类camera设备为例。
一种可能的部署架构,参见图7所示。IP栈和P2P功能均部署在业务处理单元上。在该部署方式中,业务处理单元上电之后,才能启动执行P2P打洞流程,而P2P打洞流程较繁琐。业务处理单元只有在打洞成功后才能与第二通信装置进行数据传输。从而会影响第一通信装置端向第二通信装置传输数据的及时性。
另一种可能的部署架构,参见图8所示。IP栈部署在无线通信单元上,而P2P功能部署在业务处理单元上。在该部署方式中,业务处理单元上电之后,才能启动执行P2P打洞流程,而P2P打洞流程较繁琐。业务处理单元只有在打洞成功后才能与第二通信装置进行 数据传输。从而会影响第一通信装置端向第二通信装置传输数据的及时性。
又一种可能的部署架构,参见图9所示,IP栈和P2P功能均部署在无线通信单元。业务处理单元处于上电状态时,采集视频流,并将视频流发送给无线通信单元,从而无线通信单元将接收到的视频流封装为IP包发送给服务设备。
一方面,无线通信单元上的可用内存较少,通常在几十KB到几百KB,不能在无线通信单元上部署对内存要求较大的应用。例如,如果在无线通信单元上部署实时流传输协议(real time streaming protocol,RTSP)业务,业务处理单元直接把一个视频I帧(如150KB)送到无线通信单元,很可能会因内存不足而导致传输失败。另外网络重传功能,比如传输控制协议(transmission control protocol,TCP)重传,P2P重传,均需要较大的内存空间,如果内存空间不足,并出现丢包的情况下,无法获得重传的数据包,导致业务中断。
另一方面,目前音视频相关的网络业务一般部署在业务处理单元上,比如音视频推流、网络对讲业务等,如果网络协议栈部署于无线通信单元上,则重新适配这些网络业务需要花费较大工作量。外,无线通信单元上CPU处理能力较弱,一般情况下CPU频率一般在几十至几百兆范围内。如果RTSP/P2P业务的部分处理转移到无线通信单元,比如,音视频数据流的拆包、数据的加解密、网络重传处理等,会导致无线通信单元上负载较重,进一步加重无线通信单元的处理负担,导致降低无线通信的吞吐量等。
本申请实施例中“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一(项)个”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a、b或c中的至少一项(个),可以表示:a,b,c,a和b,a和c,b和c,或a、b和c,其中a、b、c可以是单个,也可以是多个。另外,需要理解的是,在本申请的描述中,“第一”、“第二”等词汇,仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。在本申请的实施例中涉及的各种数字编号仅为描述方便进行的区分,并不用来限制本申请的实施例的范围。上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定。
基于此,本申请实施例提供一种通信方法及装置,在业务处理单元和无线通信单元均部署网络协议栈,各自负责各自的数据包的封装。由无线通信单元负责进行通道打通,即无线通信单元具备通道打通功能,而业务处理单元部署P2P数据传输功能。在该部署方式下,在业务处理单元进入工作模式之前,由无线通信单元建立第一通信装置与第二通信装置之间的传输通道。在业务处理单元进入工作模式之后,可以继承并使用无线通信单元已经建立的传输通道与第二通信装置之前传输数据。其中,方法和装置是基于同一发明构思的,由于方法及装置解决问题的原理相似,因此装置与方法的实施可以相互参见,重复之处不再赘述。
参见图10所示,为本申请实施例提供的一种通信系统架构示意图。第一通信装置的业务处理单元以及无线通信单元上均部署网络协议栈以及P2P功能。为了便于区分,将无线通信单元上部署的网络协议栈称为第二网络协议栈。将业务处理单元上部署的网络协议栈称为第一网络协议栈。网络协议可以是传输控制协议/网际协议(transmission control protocol/internet protocol,TCP/IP)或者用户数据报协议(user datagram protocol,UDP)等。
参见图11所示,为本申请实施例提供的一种通信方法流程示意图。以P2P通道为例。
S1101,在业务处理单元进入工作模式前,无线通信单元与第二通信装置建立传输通道。
S1102,在业务处理单元进入工作模块后,业务传输单元通过所述传输通道与所述第二通信装置通信。
其中,业务处理单元进入工作模式可以是业务处理单元上电,或者业务处理单元从待机状态被唤醒。
示例性地,业务处理单元进入工作模式后,通过所述传输通道与所述第二通信装置通信之前,业务处理单元可以先接管传输通道(或者继承传输通道)。即在业务处理单元使用传输通道时,无线通信单元不再使用该传输通道。在一种可选的情况中,无线通信单元建立传输通道后,在业务处理单元进入工作模式后,可以通知无线通信单元已经建立与第二通信装置之间的传输通道,从而业务处理单元可以接管传输通道。
业务传输单元接管传输通道,可以通过如下方式来接管传输通道。
一种可能的方式,无线通信单元被动的让出传输通道。
业务处理单元进入工作模式后,可以向无线通信单元发送占用通知,占用通知用于通知所述传输通道被所述业务处理单元占用。进而,无线通信单元在接收到该占用通知后,暂停使用传输通道。具体的,无线通信单元暂停使用传输通道可以是,暂停通过传输通道向第二通信装置发送无线通信单元产生的网络数据包。
作为一种示例,对于第二通信装置通过传输通道发来的业务相关的网络数据包,无线通信单元根据映射关系将其转发给业务处理单元来处理。
针对映射关系的相关说明,后续会详细描述,此处不作赘述。
示例性地,无线通信单元暂停使用传输通道,可以将用于与第二电子通信的端口分配给业务处理单元。
另一种可能的方式,无线通信单元主动的让出传输通道。
业务处理单元在执行唤醒无线通信单元后,可以主动暂停使用传输通道。具体的,暂停使用传输通道向第二通信装置发送无线通信单元产生的网络数据包。
作为一种示例,对于第二通信装置通过传输通道发来的业务相关的网络数据包,无线通信单元根据映射关系可以将其转发给业务处理单元来处理。
在一种可能的实施方式中,业务传输单元接管传输通道,无线通信单元还可以对保存的映射关系进行处理。比如所述无线通信单元将存储的映射关系中的第二映射关系修改为第一映射关系;或者,所述无线通信单元在存储的所述映射关系中增加所述第一映射关系。
所述第一映射关系为第一参数信息与业务处理单元的标识的关联关系,所述第一映射关系用于确定携带所述第一参数信息的通信数据包由所述业务处理单元处理,所述第二映射关系为第二参数信息与无线通信单元的标识的关联关系,所述第二映射关系用于确定携带所述第二参数信息的网络数据包由所述无线通信单元处理。
后续会详细描述映射关系的使用,此处不进行赘述。
在一种可能的实施方式中,业务传输单元通过所述传输通道与所述第二通信装置通信,可以包括:
业务处理单元通过传输通道向第二通信装置发送待发送的网络数据包。示例性地,业务处理单元通过传输数据传输功能将业务处理单元上待发送的业务数据封装为第一格式 数据,第一格式数据携带数据类型信息,数据类型信息用于指示业务数据的数据类型。第一格式数据可以符合第一网络协议栈所采用网络协议的格式。然后业务处理单元通过第一网络协议栈根据传输通道的通道信息将第一格式数据封装为第一网络数据包后,发送给无线通信单元,然后无线通信单元将第一网络数据包发送给第二通信装置。
在业务处理单元进入工作模式后,无线通信单元接收来自第二通信装置的网络数据包,则将其转发给业务处理单元处理。业务处理单元可以通过第一网络协议栈对接收到由无线通信单元转发的网络数据包进行解封装。
传输通道的通道信息可以包括第二通信装置的地址信息。地址信息包括IP地址和/或端口号。通道信息中还可以包括业务处理单元的IP地址、端口号、协议类型中的一项或多项。在本申请实施例中,业务处理单元的IP地址与无线通信单元的IP地址可以相同也可以不同,后续对该部分进行详细说明,此处不进行赘述。
第二通信装置的地址信息,业务处理单元可以通过如下方式获得:
一种示例中,业务处理单元向无线通信单元发送占用通知后,无线通信单元接收到该占用通知,可以将第二通信装置的地址信息发送给业务处理单元。
又一种示例中,无线通信单元完成传输通道的建立后,唤醒业务处理单元后,可以将第二通信装置的地址信息发送给业务处理单元。
再一种示例中,业务处理单元进入工作模式后,可以主动向无线通信单元获取。比如,发送第一获取请求,第一获取请求用于请求第二通信装置的地址信息。
本申请实施例中,业务处理单元接管传输通道之前,由无线通信单元占用传输通道。比如,在业务处理单元处于待机模式时,无线通信单元占用传输通道。业务处理单元处于待机模式,可以是业务处理单元处于下电状态或者业务处理单元处于低功耗的待机状态。低功耗的待机状态上,业务处理单元不执行业务数据包的传输以及处理。
业务处理单元在不需要与第二通信装置通信的情况下,业务处理单元不再占用传输通道,则无线通信单元可以继续使用传输通道。比如,业务处理单元可以在即将下电时,向无线通信单元发送占用解除通知,占用解除通知用于通知无线通信单元业务处理单元不再使用该传输通道。再比如业务处理单元上不存在待发送的业务数据,封装业务数据的网络数据包发送完成,第二通信装置也成功接收,则可以向无线通信单元发送占用解除通知。
无线通信单元在接收到占用解除通知后,无线通信单元可以接管传输通道,从而无线通信单元可以使用传输通道向第二通信装置发送由无线通信单元产生的网络数据包。对于通过第二通信装置通过传输通道发来的网络数据包,无线通信单元对其通过第二网络协议栈进行解封装及处理。
结合上述描述,无论无线通信单元接管传输通道还是业务处理单元接管传输通道,第二通信装置通过传输通道发来的网络数据包先由无线通信单元接收到,由无线通信单元确定该网络数据包分发给无线通信单元处理或者分发给业务处理单元处理。
在无线通信单元建立传输通道后,业务处理单元进入工作模式之前,无线通信单元接管传输通道。无线通信单元上存储有第二映射关系。第二映射关系为用于与第二通信装置通信的第二参数信息与无线通信单元的标识的关联关系。业务处理单元进入工作模式之后,无线通信单元存储有第一映射关系,第一映射关系为用于与第二通信装置通信的第一参数信息与业务处理单元的标识的映射关系。
业务处理单元进入工作模式之后,业务处理单元接管传输通道,无线通信单元还可以 执行如下操作:
比如,无线通信单元在保存的映射关系中增加第一映射关系。还可以执行将保存的映射关系中的第二映射关系删除。再比如,无线通信单元可以将保存的映射关系中的第二映射关系修改为第一映射关系。
用于与第二通信装置通信的第二参数信息,比如可以包括无线通信单元用于与第二通信装置通信的端口号、第二通信装置的IP地址、第二通信装置的端口号中的一项或多项。
用于与第一通信装置通信的第一参数信息,比如可以包括业务处理单元用于与第二通信装置通信的端口号,第二通信装置的IP地址、第二通信装置端口号中的一项或多项。
无线通信单元用于与第二通信装置通信的端口号,以及,业务处理单元用于与第二通信装置通信的端口号可以是相同的,也可以是不同的。
比如,无线通信单元用于与第二通信装置通信的端口号,以及,业务处理单元用于与第二通信装置通信的端口号是相同的,业务处理单元接管传输通道,无线通信单元还可以将用于与第二通信装置通信的端口分配给业务处理单元。例如,无线通信单元将本侧与第二通信装置通信的端口关闭,并将业务处理单元侧与第二通信装置通信的端口打开。从而该用于与第二通信装置通信的端口仅由业务处理单元来使用。示例性地,第一映射关系可以包括该端口号与业务处理单元的标识的关联关系。第二映射关系可以包括该端口号与无线通信单元的标识的关联关系。
无线通信单元用于与第二通信装置通信的端口号,以及,业务处理单元用于与第二通信装置通信的端口号是不相同的,业务处理单元接管传输通道,无线通信单元还可以将无线通信单元用于与第二通信装置通信的端口关闭,将业务处理单元用于与第二通信装置通信的端口打开。
通信系统架构在部署时,一种可能的部署方式是,业务处理单元与无线通信单元可以共用同一个IP地址,比如采用变种网桥的部署方式。变种网桥是一种与网桥的部署方式类似的方式,不同的是,业务处理单元与无线通信单元共用同一个IP地址。如果采用网桥的方式在通信装置中部署业务处理单元和无线通信单元,业务处理单元和无线通信单元的IP地址不同。
在该部署方式下,业务处理单元的标识,可以是业务处理单元的ID;无线通信单元的标识,可以是无线通信单元的ID。另一种可能的部署方式是,业务处理单元与无线通信单元可以采用不同的IP地址,比如采用NAT的部署方式。在该部署方式下,业务处理单元的标识可以包括业务处理单元的ID或者业务处理单元的IP地址中的一项或多项。无线通信单元的标识可以包括无线通信单元的ID或无线通信单元的IP地址中的一项或多项。
无线通信单元通过传输通道接收第二通信装置发送的网络数据包,而网络数据包中携带用于确定由无线通信单元处理或者分发给业务处理单元处理的指示参数。比如,指示参数为第一参数信息时,确定由业务处理单元处理;指示参数为第二参数信息时,确定由无线通信单元处理。从而无线通信单元根据指示参数以及存储的映射关系来确定该网络数据包由业务处理单元处理或者无线通信单元处理。
一种示例中,业务处理单元在进入工作模式后,无线通信单元通过传输通道接收来自第二通信装置的网络数据包1,网络数据包1携带第一参数信息;无线通信单元根据第一参数信息以及第一映射关系确定网络数据包1由业务处理单元处理,并将网络数据包1发送给业务处理单元;业务处理单元通过第一网络协议栈对网络数据包1解封装。
另一种示例中,业务处理单元在进入工作模式前,无线通信单元通过传输通道接收来自第二通信装置的网络数据包2,网络数据包1携带第二参数信息;无线通信单元根据第二参数信息以及第二映射关系确定网络数据包2由无线通信单元处理时,通过第二网络协议栈对第三网络数据包解封装。
映射关系可以采用链表的形式存储,或者采用数组的形式存储,或者采用其它的存储形式,本申请实施例对此不作限定。
下面结合通信系统的部署方式,对本申请提供的方案进行详细说明。
首先,针对业务处理单元与无线通信单元可以共用同一个IP地址的方案进行说明。
参见图12所示,为本申请实施例提供的通信方法流程示意图,以第二通信装置为终端设备,传输通道为P2P通道为例。
S1201,第一通信装置的无线通信单元与第二通信装置之间通过P2P打洞技术,建立P2P通道。具体建立P2P通道的方式可以参见图6所示,此处不再赘述。
以第一通信装置为电池类camera设备,第二通信装置为手机为例,手机在启动用于连接电池类camera设备的应用后,可以通过P2P服务器向电池类camera设备发起P2P连接请求。
无线通信单元向与第二通信装置或者P2P服务器传输的打洞相关的信息可以通过无线通信单元上的第二网络协议栈进行封装或解封装处理。
S1202,第一通信装置的无线通信单元唤醒业务处理单元。业务处理单元进入工作模式。
无线通信单元可以是接收第二通信装置发送的唤醒指令,执行唤醒业务处理单元。还可以是通过本地的唤醒指令来唤醒业务处理单元。还可以是给业务处理单元进行上电,从而唤醒业务处理单元。
S1203,无线通信单元向业务处理单元发送P2P通道的通道信息,并由业务处理单元接管P2P通道。针对业务处理单元接管P2P通道的操作如前所述,此处不再赘述。
S1204,业务处理单元将发送的业务数据封装为第一格式数据。第一格式数据中包括数据类型信息。数据类型信息用于指示业务数据的数据类型。
S1205,业务处理单元通过第一网络协议栈根据P2P通道的通道信息将第一格式数据封装为第一网络数据包。
S1206,业务处理单元将第一网络数据包发送给无线通信单元。
S1207,无线通信单元向第二通信装置发送第一网络数据包。
参见图13A和图13B所示,为本申请实施例提供的两种示例性的变种网桥的部署架构示意图。
第一通信装置的业务处理单元包括第一P2P模块,第一网络协议栈。第一P2P模块用于执行将上述待发送的业务数据封装为第一格式数据。业务处理单元还包括第一处理模块(camera app),第一处理模块用于获得待发送的业务数据。业务处理单元可以不设置物理网络接口卡(network interface card,NIC)。网络接口卡可以简称为网卡。业务处理单元中可以部署虚拟(virtual)网络接口卡(network interface card,NIC)用来作为第一网络协议栈的网卡。第一处理模块可以是用于实现业务的app,比如camera app。虚拟网卡的IP地址与无线网卡驱动的IP地址相同。
第一通信装置的无线通信单元中包括第二P2P模块,第二网络协议栈。第二P2P模块 负责与第二通信装置之间打洞建立P2P通道。第二网络协议栈负责网络数据包的封装以及解封装。无线通信单元还可以包括第二处理模块以及收发模块。收发模块可以是无线射频(radio frequency,RF),用于收发网络数据包。分发模块,用于对接收到的来自第二通信装置的网络数据包进行分发处理,决定接收到的网络数据包由无线通信单元处理或者由业务处理单元处理。分发模块可以与第二网络协议栈合并部署,或者说分发模块可以部署于第二网络协议栈中。无线通信单元中还包括无线网卡驱动。分发模块也可以部署于无线网卡驱动中。分发模块也可以独立部署,本申请对分发模块的部署位置不作具体限定。图13A以分发模块部署于无线网卡驱动中为例。图13B中,以分发模块单独部署为例。第一处理模块可以是无线应用(application,app),比如Wi-Fi app。
所述无线通信单元中还包括虚拟协议栈,用于作为业务处理单元中的第一网络协议栈的代理协议栈。从而使得无线通信单元与业务处理单元发送的网络数据包能够具有相同的IP地址和/或媒体存取控制(media access control,MAC)地址。
业务处理单元与无线通信单元可以采用硬件互联总线相连接。
在网络协议栈(包括第一网络协议栈和第二网络协议栈)采用UDP时,UDP为无连接协议。在业务处理单元接管P2P通道时,可以将用于与第二电子通信的端口分配给业务处理单元。比如无线通信单元与MCU连接的端口分配给业务处理单元。从而来自第二通信装置的网络数据包不会发送给MCU处理,而是转发给业务处理单元处理。
在网络协议栈采用TCP时,业务处理单元上电或者被唤醒后,第一P2P模块会触发执行TCP握手。可以由虚拟网卡负责拦截TCP握手,比如第一P2P模块发送TCP握手请求,虚拟网卡接收到TCP握手请求时,向第一P2P模块发送TCP握手确认。从而业务处理单元禁止通过P2P通道向第二通信装置发送TCP握手消息。另外,还可以由无线通信单元负责拦截TCP握手的相关消息。比如由虚拟协议栈负责拦截TCP握手请求消息,或者由分发模块负责拦截TCP握手请求消息,或者由无线网卡驱动负责拦截TCP握手请求消息。
参见图14所示,为本申请实施例提供的通信方法流程示意图。图14中,结合图11A的部署架构对本申请实施例提供的方案进行说明。其中,S1401-S1410对接收下行数据包的传输及处理进行说明。步骤S1411-S1417对业务处理单元产生的上行数据的处理及传输进行说明。步骤S1418-S1423是对无线通信单元产生的上行数据的处理及传输进行说明。
S1401,收发模块接收来自第二通信装置的网络数据包1。网络数据包1携带指示参数。收发模块将第一网络数据包发送给无线网卡驱动。指示参数用于确定网络数据包1由无线通信单元处理或者由业务处理单元处理。
在业务处理单元进入工作模式后,指示参数为第一参数信息,第一通信装置上的映射关系包括第一映射关系。业务处理单元处于非工作模式时,指示参数为第二参数信息,第一通信装置的映射关系包括第二映射关系。
S1402,无线网卡驱动中的分发模块根据指示参数以及映射关系(第一映射关系或者第二映射关系)确定网络数据包1由无线通信单元处理或者由业务处理单元处理。确定网络数据包1由无线通信单元处理时,执行S1403。
比如,网络数据包1的包头中指示参数为第一参数信息,则由无线通信单元处理。网络数据包1的包头中指示参数为第二参数信息,则由业务处理单元处理。
确定网络数据包1由业务处理单元处理时,执行S1406。分发模块将网络数据包1转发给虚拟协议栈。
S1403,分发模块将网络数据包1转发给第二网络协议栈。
S1404,第二网络协议栈对网络数据包1进行解封装,并将解封装得到的通信信息发给第二P2P模块。通信信息比如为第二通信装置的P2P信息。
S1405,第一P2P模块识别通信信息为P2P信息,保存P2P信息。
S1406,分发模块将网络数据包1转发给虚拟协议栈。
S1407,虚拟协议栈通过硬件互联总线将网络数据包1发送给虚拟网卡。
S1408,虚拟网卡将网络数据包1发送给第一网络协议栈。
S1409,第一网络协议栈对网络数据包1进行解封装,并将解封装得到的业务信息通过第一P2P模块发给第一处理模块。
S1410,第一处理模块,对解封装网络数据包1得到的信息进行处理。
S1411,第一处理模块产生业务数据,比如camera app产生媒体流。媒体流可以是音频流、视频流,或者音视频流。
S1412,第一处理模块发送业务数据给第一P2P模块。
S1413,第一P2P模块将业务数据封装为第一格式数据,并发送给第一网络协议栈。
S1414,第一网络协议栈将第一格式数据封装为网络数据包2。
S1415,第一网络协议栈通过虚拟网卡向无线通信单元发送网络数据包2。
S1416,虚拟协议栈接收来自无线通信单元的网络数据包2,并发送给无线网卡驱动。
S1417,无线网卡驱动向收发模块发送网络数据包2,从而收发模块发出网络数据包2。
S1418,第二P2P模块在待发送的通信信息中封装用于指示为P2P信息的指示信息,并发送给第二网络协议栈。
S1419,第二网络协议栈将包含指示信息的通信信息封装为网络数据包3。
S1420,第二网络协议栈将网络数据包3发送给无线网卡驱动。
S1421,无线网卡驱动将网络数据包3发送给收发模块,从而收发模块发送网络数据包3。
另外,无线通信单元中的资源受限,比如可用内存较少,CPU处理能力较弱。在网络传输质量降低的情况下,针对业务处理单元发来的承载业务数据的网络数据包可能无法及时的处理,而无线通信单元的可用内存不够,因而可能会导致业务处理单元发来的数据包无法及时发送,导致丢包,业务中断。
基于此,本申请提出一种反压机制。在无线通信单元的剩余的内存空间不足时,可以利用业务处理单元侧的内存进行网络包的缓存。
无线通信单元确定剩余的内存空间小于第一阈值时,向业务处理单元发送第一通知,第一通知用于通知业务处理单元暂缓发送网络数据包。如果业务处理单元当前存在的待发送的网络数据包,或者说业务处理单元在向无线通信单元发送网络数据包之前,接收到来自无线通信单元的第一通知,则暂缓发送该网络数据包。
暂缓之后,启动发送网络数据包的时机,可以通过如下任一方式来确定:
第一种可能的方式,无线通信单元根据剩余的内存空间来主动指示业务处理单元继续发送网络数据包。
具体的,无线通信单元向业务处理单元发送第一通知后,确定剩余的内存空间大于第二阈值,向业务处理单元发送第二通知,第二通知用于通知业务处理单元继续发送网络数据包,第二阈值大于第一阈值。从而业务处理单元接收到第二通知后,则向无线通信单元 发送网络数据包。
第二种可能的方式:业务处理单元主动向无线通信单元作尝试性发送。
具体的,业务处理单元在接收到第一通知的时长达到预设时长后,向无线通信单元发送网络数据包。无线通信单元接收到网络数据包后,确定剩余的内存空间大于第二阈值,可以继续针对网络数据包进行处理。如果无线通信单元接收到网络数据包后,确定剩余的内存空间小于第一阈值,可以向业务处理单元发送所述第一通知。
本申请实施例中,通过设置反压机制,在无线通信单元内存不足时,告知业务处理单元暂缓发送,在无线通信单元的内存充足时,比如无线通信单元上的网络数据包发送完成,或者重发包对侧已收到时,业务处理单元上数据包会到达无线通信单元,从而可以解决无线网络由于网络抖动导致的丢包,提高网络发送效率及用户体验。
其次,针对业务处理单元与无线通信单元采用不同IP地址的方案进行说明。
该方案与上述业务处理单元与无线通信单元采用相同IP地址的方案之间的区别在于:
业务处理单元将第一网络数据包发送给无线通信单元后,需要针对第一网络数据包的源地址由业务处理单元的地址信息转换为无线通信单元的地址信息,然后再根据P2P通道的通道信息通过P2P通道向第二通信装置发送第一网络数据包。
下面,结合NAT转换的部署架构,业务处理单元与无线通信单元采用不同的IP地址的方案进行详细说明。
参见图15A和图15B所示为本申请实施例提供的两种示例性的NAT部署架构示意图。第一通信装置的无线通信单元中包括收发模块、第二网络协议栈、第二P2P模块。还可以包括第二处理模块。收发模块可以是无线射频(radio frequency,RF),用于收发网络数据包。第二网络协议栈用于封装数据包。第二网络协议栈还具备分发功能,用于对接收到的来自第二通信装置的网络数据包进行分发处理,决定接收到的网络数据包由无线通信单元处理或者由业务处理单元处理。在一种示例中,第一网络协议栈还具备NAT转换功能,参见图15A。在另一种示例中,NAT转换功能也可以部署于第一网络协议栈之外,由单独的模块来执行。比如参见图15B,无线通信单元中部署NAT模块,可以对业务处理单元发过来的网络数据包进行IP包头处理,更换源IP地址和/或源端口号后再重新发送给第二通信装置。另外对于从外部第二通信装置发过来的网络数据包,可以根据网络数据包中的指示参数和映射关系确定其是发送给业务处理单元或是发送给无线通信单元本身的,如果是发送给业务处理单元的,则从地转换表中找到对应关系,替换目的IP地址及目的端口号后再发给业务处理单元。
电子设备的业务处理单元包括第一网络协议栈、第一P2P模块以及第一处理模块(camera app)。业务处理单元可以不设置物理网卡。业务处理单元中可以部署虚拟网卡用来作为第二网络协议栈的网卡,为了便于区分,将业务处理单元中部署的虚拟网卡称为第一虚拟网卡。第二处理模块可以是用于实现业务的app,比如camera app。第一虚拟网卡的IP地址与无线网卡驱动的IP地址不同。
所述无线通信单元中也部署虚拟网卡,为了便于区分,将无线通信单元中部署的虚拟网卡称为第二虚拟网卡。第二虚拟网卡用于作为第一虚拟网卡的代理网卡。将第二虚拟网卡的注册信息发送给第一网络协议栈中。第二虚拟网卡的注册信息可以包括第二虚拟网卡的IP地址和/或端口号。
业务处理单元与无线通信单元可以采用硬件互联总线相连接。
作为一种示例,第一虚拟网卡的IP地址可以为192.168.1.2,其作为业务处理单元的IP地址。第二虚拟网卡的IP地址可以为192.168.1.1,作为无线通信单元对内的IP地址。无线通信单元对内的IP地址可以用于业务处理单元与无线通信单元之间通信,需要说明的是,这里所说的业务处理单元与无线通信单元之间通信,不包括业务处理单元与业务服务设备之间通信经过无线通信单元的情况。无线网卡驱动的IP地址可以为192.168.0.2,其作为无线通信单元对外网的IP地址。
示例性地,第一虚拟网卡的IP地址可以与第二虚拟网卡的IP地址相同。
参见图16所示,为本申请实施例提供的通信方法流程示意图。图16中,结合图15A的部署架构对本申请实施例提供的方案进行说明。其中,S1601-S1610对下行数据包的接收及处理进行说明。步骤S1611-S1618对业务处理单元产生的上行数据的处理及传输进行说明。步骤S1619-S1623是对无线通信单元产生的上行数据的处理及传输进行说明。
S1601,参见S1401,此处不再赘述。
S1602,第二网络协议栈根据指示参数以及映射关系((第一映射关系或者第二映射关系))确定网络数据包1由无线通信单元处理或者由业务处理单元处理。确定网络数据包1由无线通信单元处理时,执行S1603。
比如,网络数据包1的包头中指示参数为第一参数信息,则由无线通信单元处理。网络数据包1的包头中指示参数为第二参数信息,则由业务处理单元处理。
确定网络数据包1由业务处理单元处理时,执行S1605。
S1603,第二网络协议栈对网络数据包1进行解封装,并将解封装得到的信息发给第二P2P模块。
S1604,第二P2P模块识别通信信息为P2P信息,保存P2P信息。
S1605,第二网络协议栈将网络数据包1的目的地址由无线通信单元的地址信息转换为业务处理单元的地址信息。地址信息包括IP地址和/或端口号。
地址转换前,网络数据包1的目的地址为无线通信单元的地址信息,地址转换后,网络数据包1的目的地址为业务处理单元的地址信息。
比如,地址信息包括IP地址。网络数据包1的目的IP地址为192.168.0.2,转换后的网络数据包的目的IP地址为192.168.1.2。在电子设备中保存有地址转换表,地址转换表中192.168.0.2与192.168.1.2存在映射关系。
比如,地址信息包括IP地址和端口号。网络数据包1的目的IP地址为192.168.0.2,端口号为888。转换后的网络数据包的目的IP地址为192.168.1.2,端口号为666。
S1606,第二网络协议栈将地址转换后的网络数据包1转发给第二虚拟网卡。
S1607,第二虚拟网卡通过硬件互联总线将网络数据包1发送给第一虚拟网卡。
S1608,第一虚拟网卡将网络数据包1发送给第一网络协议栈。
S1609,第一网络协议栈对网络数据包1进行解封装,并将解封装得到的业务信息通过第一P2P模块发给第一处理模块。
第一网络协议栈根据地址转换后的网络数据包1的目的地址来判断是发给业务处理单元处理的数据包,从而发送给第一处理模块进行处理。
S1610,第一处理模块对业务信息进行处理。
S1611,第一P2P模块将第一处理模块产生的业务数据封装为第一格式数据。
第一处理模块产生的业务数据,比如camera app产生媒体流。媒体流可以是音频流、视频流,或者音视频流。
S1612,第一P2P模块发送第一格式数据给第一网络协议栈。
S1613,第一网络协议栈将业务数据封装为网络数据包2。
S1614,第一网络协议栈通过第一虚拟网卡向无线通信单元发送网络数据包2。
S1615,第一虚拟网卡接收来自无线通信单元的网络数据包2,并发送给第二网络协议栈。
S1616,第二网络协议栈将网络数据包2的源地址由无线通信单元的地址信息转换为业务处理单元的地址信息。
S1617,第二网络协议栈将地址转换后的网络数据包2发送给无线网卡驱动。
S1618,无线网卡驱动将地址转换后的网络数据包2发送给收发模块,从而收发模块发出地址转换后的网络数据包2。
S1619,第二处理模块产生通信信息,比如心跳包。
S1620,第二处理模块通过第二P2P模块发送通信信息给第一网络协议栈。
S1621,第二网络协议栈将通信信息封装为网络数据包3。
S1622,第二网络协议栈将网络数据包3发送给无线网卡驱动。
S1623,无线网卡驱动将网络数据包3发送给收发模块,从而收发模块发送网络数据包3。
另外,在无线通信单元既设置对外地址信息,也设置对内地址信息的情况下,无线通信单元可以向业务处理单元发送数据包。比如无线通信单元产生数据包1,数据包1的源IP地址为无线通信单元的对内IP地址,例如192.168.1.1,数据包1的目的IP地址为业务处理单元的IP地址,例如192.168.1.2。业务处理单元接收到该数据包1,可以确定该数据包1是由无线通信单元发来的数据包1,从而对数据包1进行解封装及处理。同样业务处理单元也可以向无线网通信单元发送数据包,比如数据包2,数据包2的源IP地址为业务处理单元的IP地址,数据包2的目的IP地址为无线通信单元的对内IP地址。无线通信单元接收到该数据包2,第二网络协议栈根据目的IP地址确定时发送给无线通信单元处理的数据包,从而转发给第二处理模块处理。
申请实施例中上述NAT方案,通过在业务处理单元和无线通信单元中均设置网络协议栈,并且由无线通信单元负责分发,在无线通信单元处理能力较弱时,能够保证网络业务的处理,并且可以提高无线网络的吞吐量。无线通信单元上部署网络协议栈,在业务处理单元下电的情况下,仍然能够与外部设备进行通信。比如网络保活、远程唤醒等。另外,无线通信单元可以独立进行网络应用的开发,也对低功耗无线通信单元的业务部署提供便利。业务处理单元上部署网络协议栈,在上电后,可以与外部设备独立进行网络数据包的交互。比如音视频流的传输。业务处理单元可以独立进行网络应用的开发,也对业务处理单元的业务部署提供便利。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
显然,本领域的技术人员可以对本申请实施例进行各种改动和变型而不脱离本申请实施例的范围。这样,倘若本申请实施例的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。

Claims (34)

  1. 一种通信方法,其特征在于,应用于采用电池供电的第一通信装置中,所述第一通信装置包括业务处理单元以及无线通信单元,所述方法包括:
    在所述业务处理单元进入工作模式之前,所述无线通信单元与第二通信装置建立传输通道;
    所述业务处理单元在进入工作模式后,所述业务处理单元通过所述传输通道向所述第二通信装置发送待发送的第一网络数据包;
    其中,所述第二通信装置为终端设备或者服务器。
  2. 如权利要求1所述的方法,其特征在于,所述第二通信装置为终端设备,所述传输通道为点对点P2P通道;
    所述无线通信单元与第二通信装置建立传输通道,包括:
    所述无线通信单元通过P2P打洞方式,与所述第二通信装置建立所述P2P通道。
  3. 如权利要求1或2所述的方法,其特征在于,在所述业务处理单元进入工作模式后,通过所述传输通道向所述第二通信装置发送待发送的第一网络数据包前,所述方法还包括:
    所述业务处理单元向所述无线通信单元发送占用通知,所述占用通知用于指示所述业务处理单元占用所述传输通道;
    所述无线通信单元在接收到所述占用通知之后,暂停使用所述传输通道向所述第二通信装置发送所述无线通信单元产生的网络数据包。
  4. 如权利要求3所述的方法,其特征在于,所述无线通信单元暂停使用所述传输通道向所述第二通信装置发送所述无线通信单元产生的网络数据包,包括:
    所述无线通信单元将用于通过所述传输通道与所述第二通信装置通信的端口分配给所述业务处理单元。
  5. 如权利要求1-4任一项所述的方法,其特征在于,在所述业务处理单元进入工作模式后,所述方法还包括:
    所述无线通信单元将存储的映射关系中的第二映射关系修改为第一映射关系;或者,
    所述无线通信单元在存储的所述映射关系中增加所述第一映射关系;
    所述第一映射关系为第一参数信息与业务处理单元的标识的关联关系,所述第一映射关系用于确定携带所述第一参数信息的通信数据包由所述业务处理单元处理,所述第二映射关系为第二参数信息与无线通信单元的标识的关联关系,所述第二映射关系用于确定携带所述第二参数信息的网络数据包由所述无线通信单元处理。
  6. 如权利要求3-5任一项所述的方法,其特征在于,所述业务处理单元向所述无线通信单元发送占用通知后,还包括:
    在确定所述业务处理单元不需要与所述第二通信装置通信时,所述业务处理单元向所述无线通信单元发送解除占用通知,所述解除占用通知用于通知所述无线通信单元所述业务处理单元结束使用所述传输通道;
    所述无线通信单元接收所述解除占用通知之后,所述无线通信单元继续使用所述传输通道向所述第二通信装置发送所述无线通信单元产生的网络数据包。
  7. 如权利要求1-6任一项所述的方法,其特征在于,所述业务处理单元在进入工作模 式后,通过所述传输通道向所述第二通信装置发送待发送的第一网络数据包,包括:
    所述业务处理单元将待发送的业务数据封装为第一格式数据,所述第一格式数据包括数据类型信息,所述数据类型信息用于指示所述业务数据的数据类型;
    所述业务处理单元通过第一网络协议栈根据所述传输通道的通道信息将所述第一格式数据封装为所述第一网络数据包,并将所述第一网络数据包发送给所述无线通信单元;
    所述无线通信单元向所述第二通信装置发送所述第一网络数据包。
  8. 如权利要求7所述的方法,其特征在于,所述传输通道的通道信息包括所述业务处理单元的IP地址、所述第一通信装置上用于与所述第二通信装置通信的端口号、协议类型、所述第二通信装置的IP地址或所述第二通信装置的端口号中的一项或多项。
  9. 如权利要求8所述的方法,其特征在于,所述业务处理单元的IP地址与所述无线通信单元的IP地址相同。
  10. 如权利要求7或8所述的方法,其特征在于,所述无线通信单元通过所述传输通道向所述第二通信装置发送所述第一网络数据包,包括:
    所述无线通信单元将所述第一网络数据包的源地址由所述业务处理单元的地址信息转换为所述无线通信单元的地址信息后,并向所述第二通信装置发送经过地址转换的第一网络数据包。
  11. 如权利要求5-8、10中任一项所述的方法,其特征在于,所述业务处理单元在进入工作模式后,还包括:
    所述无线通信单元接收所述第二通信装置通过所述传输通道发送的第二网络数据包,所述第二网络数据包携带所述第一参数信息;
    所述无线通信单元根据所述第一参数信息以及所述第一映射关系确定所述第二网络数据包由所述业务处理单元处理,并将所述第二网络数据包发送给所述业务处理单元;
    所述业务处理单元通过第一网络协议栈对所述第二网络数据包解封装。
  12. 如权利要求11所述的方法,其特征在于,所述无线通信单元将所述第二网络数据包发送给所述业务处理单元,包括:
    所述无线通信单元将所述第二网络数据包的目的地址由所述无线通信单元的地址信息转换为所述业务处理单元的地址信息,根据转换后的目的地址将地址转换后的第二网络数据包发送给所述业务处理单元。
  13. 如权利要求1至12任一项所述的方法,其特征在于,所述业务处理单元在进入工作模式前,还包括:
    所述无线通信单元接收所述第二通信装置通过所述传输通道发送的第三网络数据包,所述第三网络数据包携带所述第二参数信息;
    所述无线通信单元根据所述第二参数信息以及所述第二映射关系确定所述第三网络数据包由所述无线通信单元处理时,通过第二网络协议栈对所述第三网络数据包解封装。
  14. 如权利要求5-13任一项所述的方法,其特征在于,所述第一参数信息包括业务处理单元用于与所述第二通信装置通信的端口号、所述第二通信装置的IP地址或所述第二通信装置的端口号中的一项或多项;
    所述第二参数信息包括无线通信单元用于与所述第二通信装置通信的端口号、所述第二通信装置的IP地址或所述第二通信装置的端口号中的一项或多项。
  15. 如权利要求1-14任一项所述的方法,其特征在于,还包括:
    所述无线通信单元通过第二网络协议栈根据所述传输通道的通道信息将待发送的第一通信信息封装为第四网络数据包,并向所述第二通信装置发送所述第四网络数据包,所述第一通信信息用于与所述第二通信装置通信。
  16. 如权利要求1-15任一项所述的方法,其特征在于,所述第一通信装置与所述第二通信装置通信采用的协议为传输控制协议TCP,所述方法还包括:
    所述业务处理单元进入工作模式后,所述业务处理单元禁止通过所述传输通道向所述第二通信装置发送TCP握手请求消息;或者,
    所述业务处理单元进入工作模式后,所述无线通信单元接收到所述业务处理单元发往所述第二通信装置的TCP握手请求消息时,向所述业务处理单元回复TCP握手确认消息。
  17. 一种通信装置,其特征在于,所述通信装置采用电池供电,所述通信装置包括业务处理单元以及无线通信单元;
    其中,所述无线通信单元,用于在所述业务处理单元进入工作模式之前,与第二通信装置建立传输通道;
    所述业务处理单元,用于在所述业务处理单元进入工作模式后,通过所述传输通道向所述第二通信装置发送待发送的第一网络数据包;
    其中,所述第二通信装置为终端设备或者服务器。
  18. 如权利要求17所述的装置,其特征在于,所述第二通信装置为终端设备,所述传输通道为点对点P2P通道;
    所述无线通信单元,具体用于通过P2P打洞方式,与所述第二通信装置建立所述P2P通道。
  19. 如权利要求17或18所述的装置,其特征在于,所述业务处理单元,还用于在所述业务处理单元进入工作模式后,通过所述传输通道向所述第二通信装置发送待发送的第一网络数据包前,向所述无线通信单元发送占用通知,所述占用通知用于指示所述业务处理单元占用所述传输通道;
    所述无线通信单元,还用于在接收到所述占用通知之后,暂停使用所述传输通道向所述第二通信装置发送所述无线通信单元产生的网络数据包。
  20. 如权利要求19所述的装置,其特征在于,所述无线通信单元,在暂停使用所述传输通道向所述第二通信装置发送所述无线通信单元产生的网络数据包时,具体用于:
    将用于通过所述传输通道与所述第二通信装置通信的端口分配给所述业务处理单元。
  21. 如权利要求17-20任一项所述的装置,其特征在于,在所述业务处理单元进入工作模式后,所述无线通信单元还用于:
    将存储的映射关系中的第二映射关系修改为第一映射关系;或者,
    在存储的所述映射关系中增加所述第一映射关系;
    所述第一映射关系为第一参数信息与业务处理单元的标识的关联关系,所述第一映射关系用于确定携带所述第一参数信息的通信数据包由所述业务处理单元处理,所述第二映射关系为第二参数信息与无线通信单元的标识的关联关系,所述第二映射关系用于确定携带所述第二参数信息的网络数据包由所述无线通信单元处理。
  22. 如权利要求19-21任一项所述的装置,其特征在于,所述业务处理单元,还用于向所述无线通信单元发送占用通知后,在确定所述业务处理单元不需要与所述第二通信装置通信时,向所述无线通信单元发送解除占用通知,所述解除占用通知用于通知所述无线 通信单元所述业务处理单元结束使用所述传输通道;
    所述无线通信单元,还用于接收所述解除占用通知之后,所述无线通信单元继续使用所述传输通道向所述第二通信装置发送所述无线通信单元产生的网络数据包。
  23. 如权利要求17-22任一项所述的装置,其特征在于,所述业务处理单元在进入工作模式后,通过所述传输通道向所述第二通信装置发送待发送的第一网络数据包时,具体用于:
    将待发送的业务数据封装为第一格式数据,所述第一格式数据包括数据类型信息,所述数据类型信息用于指示所述业务数据的数据类型;
    通过第一网络协议栈根据所述传输通道的通道信息将所述第一格式数据封装为所述第一网络数据包,并将所述第一网络数据包发送给所述无线通信单元;
    所述无线通信单元,还用于向所述第二通信装置发送所述第一网络数据包。
  24. 如权利要求23所述的装置,其特征在于,所述传输通道的通道信息包括所述业务处理单元的IP地址、所述通信装置上用于与所述第二通信装置通信的端口号、协议类型、所述第二通信装置的IP地址或所述第二通信装置的端口号中的一项或多项。
  25. 如权利要求24所述的装置,其特征在于,所述业务处理单元的IP地址与所述无线通信单元的IP地址相同。
  26. 如权利要求23或24所述的装置,其特征在于,所述无线通信单元,还用于将所述第一网络数据包的源地址由所述业务处理单元的地址信息转换为所述无线通信单元的地址信息后,并向所述第二通信装置发送经过地址转换的第一网络数据包。
  27. 如权利要求21-24、26中任一项所述的装置,其特征在于,所述业务处理单元在进入工作模式后,还用于:
    接收所述第二通信装置通过所述传输通道发送的第二网络数据包,所述第二网络数据包携带所述第一参数信息;
    根据所述第一参数信息以及所述第一映射关系确定所述第二网络数据包由所述业务处理单元处理,并将所述第二网络数据包发送给所述业务处理单元;
    所述业务处理单元,还用于通过第一网络协议栈对所述第二网络数据包解封装。
  28. 如权利要求27所述的装置,其特征在于,所述无线通信单元,还用于:
    将所述第二网络数据包的目的地址由所述无线通信单元的地址信息转换为所述业务处理单元的地址信息;
    根据转换后的目的地址将地址转换后的第二网络数据包发送给所述业务处理单元。
  29. 如权利要求17至28任一项所述的装置,其特征在于,所述业务处理单元在进入工作模式前,还用于:
    接收所述第二通信装置通过所述传输通道发送的第三网络数据包,所述第三网络数据包携带所述第二参数信息;
    所述无线通信单元,还用于根据所述第二参数信息以及所述第二映射关系确定所述第三网络数据包由所述无线通信单元处理时,通过第二网络协议栈对所述第三网络数据包解封装。
  30. 如权利要求21-29任一项所述的装置,其特征在于,所述第一参数信息包括业务处理单元用于与所述第二通信装置通信的端口号、所述第二通信装置的IP地址或所述第二通信装置的端口号中的一项或多项;
    所述第二参数信息包括无线通信单元用于与所述第二通信装置通信的端口号、所述第二通信装置的IP地址或所述第二通信装置的端口号中的一项或多项。
  31. 如权利要求17-30任一项所述的装置,其特征在于,所述无线通信单元,还用于通过第二网络协议栈根据所述传输通道的通道信息将待发送的第一通信信息封装为第四网络数据包,并向所述第二通信装置发送所述第四网络数据包,所述第一通信信息用于与所述第二通信装置通信。
  32. 如权利要求17-31任一项所述的装置,其特征在于,所述通信装置与所述第二通信装置通信采用的协议为传输控制协议TCP,所述业务处理单元进入工作模式后,所述业务处理单元,还用于禁止通过所述传输通道向所述第二通信装置发送TCP握手请求消息;
    或者,
    所述业务处理单元,还用于在进入工作模式后,向第二通信装置发送TCP握手请求消息;所述无线通信单元,还用于在接收到所述业务处理单元发往所述第二通信装置的TCP握手请求消息时,向所述业务处理单元回复TCP握手确认消息。
  33. 一种通信装置,其特征在于,包括处理器和接口电路,所述接口电路用于接收来自所述通信装置之外的其它通信装置的信号并传输至所述处理器或将来自所述处理器的信号发送给所述通信装置之外的其它通信装置,所述处理器通过逻辑电路或执行代码指令以实现如权利要求1至16中任一项所述的方法。
  34. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机指令,当所述计算机指令被执行时,使得权利要求1至16中任一项所述的方法被执行。
PCT/CN2020/079791 2020-03-17 2020-03-17 一种通信方法及装置 WO2021184225A1 (zh)

Priority Applications (4)

Application Number Priority Date Filing Date Title
CN202080098569.XA CN115280890A (zh) 2020-03-17 2020-03-17 一种通信方法及装置
PCT/CN2020/079791 WO2021184225A1 (zh) 2020-03-17 2020-03-17 一种通信方法及装置
EP20925835.9A EP4113932A4 (en) 2020-03-17 2020-03-17 COMMUNICATION METHOD AND DEVICE
US17/946,381 US20230017306A1 (en) 2020-03-17 2022-09-16 Communication method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/079791 WO2021184225A1 (zh) 2020-03-17 2020-03-17 一种通信方法及装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/946,381 Continuation US20230017306A1 (en) 2020-03-17 2022-09-16 Communication method and apparatus

Publications (1)

Publication Number Publication Date
WO2021184225A1 true WO2021184225A1 (zh) 2021-09-23

Family

ID=77771627

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/079791 WO2021184225A1 (zh) 2020-03-17 2020-03-17 一种通信方法及装置

Country Status (4)

Country Link
US (1) US20230017306A1 (zh)
EP (1) EP4113932A4 (zh)
CN (1) CN115280890A (zh)
WO (1) WO2021184225A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090802A (zh) * 2022-01-13 2022-02-25 深圳市猿人创新科技有限公司 一种基于嵌入式设备的数据存储及查找方法、装置、设备

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130065627A1 (en) * 2011-09-14 2013-03-14 Samsung Electronics Co. Ltd. Method for using legacy wi-fi and wi-fi p2p simultaneously
CN105847275A (zh) * 2016-04-29 2016-08-10 掌赢信息科技(上海)有限公司 一种数据传输通道建立方法、系统和服务器
CN105871868A (zh) * 2016-04-29 2016-08-17 掌赢信息科技(上海)有限公司 一种数据传输通道建立方法、系统和服务器
CN106027599A (zh) * 2016-04-29 2016-10-12 掌赢信息科技(上海)有限公司 一种数据传输通道建立方法、系统和服务器
CN109495599A (zh) * 2018-11-16 2019-03-19 深圳市网心科技有限公司 数据传输方法和系统、电子装置及计算机可读存储介质
CN109618418A (zh) * 2018-11-09 2019-04-12 珠海全志科技股份有限公司 一种基于移动终端的运动相机联网方法及系统
CN110730203A (zh) * 2019-09-04 2020-01-24 华为技术有限公司 一种p2p通信方法及装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6242241B2 (ja) * 2013-04-26 2017-12-06 キヤノン株式会社 印刷装置、通信装置、及びプログラム
CN105577991A (zh) * 2014-10-11 2016-05-11 青岛鑫益发工贸有限公司 一种基于p2p的摄像机
CN110381251B (zh) * 2016-06-15 2022-03-08 华为技术有限公司 网络摄像机的控制方法、装置及系统

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130065627A1 (en) * 2011-09-14 2013-03-14 Samsung Electronics Co. Ltd. Method for using legacy wi-fi and wi-fi p2p simultaneously
CN105847275A (zh) * 2016-04-29 2016-08-10 掌赢信息科技(上海)有限公司 一种数据传输通道建立方法、系统和服务器
CN105871868A (zh) * 2016-04-29 2016-08-17 掌赢信息科技(上海)有限公司 一种数据传输通道建立方法、系统和服务器
CN106027599A (zh) * 2016-04-29 2016-10-12 掌赢信息科技(上海)有限公司 一种数据传输通道建立方法、系统和服务器
CN109618418A (zh) * 2018-11-09 2019-04-12 珠海全志科技股份有限公司 一种基于移动终端的运动相机联网方法及系统
CN109495599A (zh) * 2018-11-16 2019-03-19 深圳市网心科技有限公司 数据传输方法和系统、电子装置及计算机可读存储介质
CN110730203A (zh) * 2019-09-04 2020-01-24 华为技术有限公司 一种p2p通信方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4113932A4 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090802A (zh) * 2022-01-13 2022-02-25 深圳市猿人创新科技有限公司 一种基于嵌入式设备的数据存储及查找方法、装置、设备

Also Published As

Publication number Publication date
EP4113932A1 (en) 2023-01-04
US20230017306A1 (en) 2023-01-19
EP4113932A4 (en) 2023-04-12
CN115280890A (zh) 2022-11-01

Similar Documents

Publication Publication Date Title
EP3965370A1 (en) Routing rule configuration method and communication apparatus
WO2019205907A1 (zh) 一种基于mqtt消息协议的智能设备通讯平台
US11082851B2 (en) Method and apparatus for processing audio signal by using Bluetooth technology
US11356522B2 (en) Data transmission method, network device, terminal device, and computer readable storage medium
CN106789606B (zh) 一种网络通信系统、其管理方法及通信方法
EP3949468A1 (en) Apparatus, method and computer program for group communication
WO2022143508A1 (zh) 一种近场中传输数据的方法、设备及系统
WO2019157968A1 (zh) 一种通信方法、装置及系统
CN105490957A (zh) 一种负载分担方法及装置
WO2019019486A1 (zh) 下行数据包配置方法及装置
WO2020034861A1 (zh) 通信方法和装置
EP3021555B1 (en) Message processing method and device
WO2015103848A1 (zh) 一种实现Wifi访问网络的方法、系统及终端
CN103200283A (zh) 多中继无线通信系统及该系统空中接口ip化的实现方法
WO2022241990A1 (zh) 一种媒体传输链路管理方法、装置及存储介质
WO2021184225A1 (zh) 一种通信方法及装置
CN107529229A (zh) 数据传输的方法,装置及系统
CN113542244B (zh) 微服务调用方法、装置、服务器和系统
US20230016351A1 (en) Data transmission method and apparatus
TWI699135B (zh) 基於行動邊緣運算用戶資訊之訊務處理及分流的系統與方法
CN109302504B (zh) Ptn中控制信令通道的建立方法、ptn网元及存储介质
WO2022007749A1 (zh) 一种数据传输方法和装置
WO2022001639A1 (zh) 通信方法、移动设备及路由设备
CN106302767A (zh) 一种基于wmmp协议的物联网应用系统
TWI679870B (zh) 一種資訊處理方法及裝置

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: 20925835

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2020925835

Country of ref document: EP

Effective date: 20220927

NENP Non-entry into the national phase

Ref country code: DE