CN116684996A - Communication control method, communication system, electronic device, and readable storage medium - Google Patents

Communication control method, communication system, electronic device, and readable storage medium Download PDF

Info

Publication number
CN116684996A
CN116684996A CN202310797622.0A CN202310797622A CN116684996A CN 116684996 A CN116684996 A CN 116684996A CN 202310797622 A CN202310797622 A CN 202310797622A CN 116684996 A CN116684996 A CN 116684996A
Authority
CN
China
Prior art keywords
information
communication channel
equipment
channel
data
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202310797622.0A
Other languages
Chinese (zh)
Inventor
杨永贵
张阳阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
BOE Technology Group Co Ltd
Beijing BOE Technology Development Co Ltd
Original Assignee
BOE Technology Group Co Ltd
Beijing BOE Technology Development Co Ltd
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 BOE Technology Group Co Ltd, Beijing BOE Technology Development Co Ltd filed Critical BOE Technology Group Co Ltd
Priority to CN202310797622.0A priority Critical patent/CN116684996A/en
Publication of CN116684996A publication Critical patent/CN116684996A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/03Protocol definition or specification 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/06Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/11Allocation or use of connection identifiers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/02Hierarchically pre-organised networks, e.g. paging networks, cellular networks, WLAN [Wireless Local Area Network] or WLL [Wireless Local Loop]
    • H04W84/10Small scale networks; Flat hierarchical networks
    • H04W84/12WLAN [Wireless Local Area Networks]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/18Self-organising networks, e.g. ad-hoc networks or sensor networks
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention provides a communication control method, a communication system, an electronic device and a readable storage medium. A communication control method applied to a communication system including a first device and a second device, the method comprising: the first device and the second device initiate a communication channel; the first device and the second device exchange device information according to the communication channel; the first device and the second device establish a device group according to the exchanged device information; the first device and the second device exchange data information in the device group. According to the embodiment of the invention, the first equipment and the second equipment exchange equipment information through the communication channel to establish the equipment group for exchanging data information, so that the convenient networking of the first equipment and the second equipment can be realized, the cooperative effect between the equipment can be improved, and the convenience of use can be improved.

Description

Communication control method, communication system, electronic device, and readable storage medium
Technical Field
The embodiment of the invention relates to the technical field of communication, in particular to a communication control method, a communication system, electronic equipment and a readable storage medium.
Background
With the continuous development of intelligent terminal technology, more and more intelligent devices are developed, different devices often have different advantages and disadvantages, and due to the inconvenience of interconnection among the devices, the respective advantages are often not fully integrated, so that better services are provided for users. Taking a large-size integrated machine and a mobile phone as an example, the integrated machine can provide a better video picture based on a large screen, but in the integrated machine, a remote controller is utilized to select pinyin letters and the like one by one for character input, so that the input operation is inconvenient, and the file management operation is also complicated; the mobile phone has convenient and efficient character input such as handwriting and voice, can make up for the defects of the integrated machine, but the screen of the mobile phone is usually smaller, so that file previewing by multiple people is not facilitated, and the large screen can be met. At present, the communication modes of the terminal equipment are various, and different communication modes are widely used, so that interaction among different terminal equipment is difficult, and the advantages of different terminal equipment are difficult to develop.
Disclosure of Invention
The embodiment of the invention provides a communication control method, a communication system, electronic equipment and a readable storage medium, so as to improve interaction effects among different terminal equipment.
To solve the above problems, the present invention is achieved as follows:
in a first aspect, an embodiment of the present invention provides a communication control method, which is applied to a communication system, where the communication system includes a first device and a second device, and the method includes:
the first device and the second device initiate a communication channel;
the first device and the second device exchange device information according to the communication channel;
the first device and the second device establish a device group according to the exchanged device information;
the first device and the second device exchange data information in the device group.
In some embodiments, where the communication channel comprises a wireless local area network WIFI channel, the initiating the communication channel comprises:
initializing WIFI service, and starting a user datagram protocol UDP service end to send broadcast information and starting a broadcast receipt receiving service;
in the case where the communication channel includes a universal serial bus USB channel, the enabling communication channel includes:
initializing USB service and entering a Host mode to wait for a control request;
in the case where the communication channel includes a bluetooth channel, the initiating communication channel includes:
And initializing Bluetooth service, starting the general attribute configuration file Gatt host service, and sending advertisement information.
In some embodiments, after the first device and the second device initiate a communication channel, the method further comprises:
the first equipment and the second equipment collect local information and peripheral equipment information respectively;
wherein the local information is collected in a communication channel initialization stage, and the local information comprises one or more of the following: the WIFI service set identifier ssid, WIFI physical address mac, internet Protocol (IP) address, bluetooth name, bluetooth mac, USB manufacturer name and mac address;
the peripheral device includes one or more of the following:
the WIFI ssad and the WIFI mac of the peripheral equipment are obtained through the WIFI scanning function;
bluetooth name, bluetooth mac and universal unique identification code UUID of Bluetooth service of peripheral equipment obtained through Bluetooth scanning;
and sending a connection control code through the USB channel to obtain a connection host name.
In some embodiments, the first device and the second device exchange device information according to the communication channel, comprising:
the first device and the second device serve as discovery ends, initiate connection and discover peripheral devices; and
The first device and the second device receive an information protocol as discovered ends.
In some embodiments, the local device includes a USB channel in the communication channel, and the initiating the connection and discovering the peripheral device includes:
when the peripheral equipment is peripheral USB equipment, the Host enters a Host mode;
the local machine sends a control request to the connected peripheral USB equipment through a An Zhuokai source accessory AOA protocol;
establishing a Host channel with the peripheral USB equipment under the condition that the peripheral USB equipment supports an AOA protocol;
and under the condition that the peripheral USB equipment does not support the AOA protocol, the local machine enters a slave mode.
In some embodiments, the local device includes a WIFI channel in the communication channel, and the initiating the connection and discovering the peripheral device includes:
under the condition that the peripheral equipment is constrained application protocol (CoAP) WIFI equipment, local information is sent to the peripheral equipment, and a CoAP channel of the WIFI is established;
and under the condition that the peripheral equipment is non-CoAP WIFI equipment, the local machine starts UDP multicast/broadcast service, and under the condition that drawing aiming at the UDP multicast/broadcast service is received, local information is sent to the peripheral equipment, and UDP and/or TCP channels of the WIFI are established.
In some embodiments, the local device includes a bluetooth channel in the communication channel, and the initiating the connection and discovering the peripheral device includes:
establishing a Gatt protocol slave terminal to search a Bluetooth host terminal in peripheral equipment;
under the condition that a Bluetooth host end is searched, establishing a Gatt channel with the Bluetooth host end;
under the condition that the Bluetooth host end is not searched, a Gatt protocol host end is established, advertisement information is sent, and a serial port configuration SPP server end is started to serve as the Bluetooth host end to wait for searching.
In some embodiments, in a case where the first device and the second device are connected through a first communication channel and a second communication channel, and the first device needs to send a target file to the second device, the method further includes:
the first device reads a first data block of a file stream of the target file and sends the first data block to the second device through the first communication channel;
the first device reads a second data block of the file stream of the target file and sends the second data block to the second device through the first communication channel;
the second device receives the first data block and the second data block, and creates a file stream to write the first data block and the second data block;
Wherein data in the first communication channel and the second communication channel are transmitted in parallel.
In some embodiments, in a case where the first device and the second device are connected through a first communication channel and a third communication channel, and the first device needs to send a target file to the second device, the method further includes:
the first device reads the data blocks of the file stream of the target file and sends the data blocks to the second device through the first communication channel;
the first device sends target data to the second device through the third communication channel, wherein the target data comprises message data and/or command data;
wherein data in the first communication channel and the third communication channel are transmitted in parallel.
In some embodiments, the communication system further comprises a third device communicatively coupled to the first device;
in the case that the third device needs to send target data information to the second device, the method further includes:
the third device sends the target data information to the first device, wherein the target data information carries initial device information and target device information, the initial device information of the target data information comprises communication channel information and device type information of the third device, and the target device information of the target data information comprises communication channel information and device type information of the second device;
And the first equipment sends the target data information to the second equipment according to the target data information.
In some embodiments, the method further comprises:
the second device generates receipt information according to the initial device information carried in the target data information, wherein the destination device information of the receipt information comprises communication channel information and device type information of the third device;
the second device sends the receipt information to the first device;
and the first device forwards the receipt information to the third device according to the destination device information of the receipt information.
In some embodiments, the first device and/or the second device comprises one or more of:
the service starting module is used for initializing the communication channel and starting the communication channel;
the scheduling management module is used for starting equipment networking registration, starting application networking registration, starting equipment distribution and controlling communication channel switching;
and the information management module is used for managing the local information and the collected information of the peripheral equipment.
In a second aspect, an embodiment of the present invention provides a communication control method, which is applied to a first device in a communication system, where the communication system includes the first device and a second device, and the method includes:
Starting a communication channel;
exchanging device information with a second device according to the communication channel;
establishing a device group with the second device according to the exchanged device information;
exchanging data information with the second device in the device group.
In a third aspect, an embodiment of the present invention provides a communication system, including a first device and a second device, where the first device and the second device are configured to:
starting a communication channel;
exchanging equipment information according to the communication channel;
establishing a device group according to the exchanged device information;
data information is exchanged in the device group.
In a fourth aspect, an embodiment of the present invention further provides an electronic device, including: a memory, a processor, and a program stored on the memory and executable on the processor; the processor is configured to read a program in the memory to implement the steps in the method according to the foregoing first aspect.
In a fifth aspect, embodiments of the present invention further provide a readable storage medium storing a program, which when executed by a processor implements the steps of the method according to the first aspect.
According to the embodiment of the invention, the first equipment and the second equipment exchange equipment information through the communication channel to establish the equipment group for exchanging data information, so that the convenient networking of the first equipment and the second equipment can be realized, the cooperative effect between the equipment can be improved, and the convenience of use can be improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort to a person of ordinary skill in the art.
Fig. 1 is a schematic flow chart of a communication control method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of an apparatus according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a communication principle of a device according to an embodiment of the present invention;
fig. 4 is a schematic diagram of device networking provided in an embodiment of the present invention;
FIG. 5 is a schematic diagram of data transmission in an embodiment of the invention;
FIG. 6 is a schematic diagram of yet another data transmission in an embodiment of the present invention;
FIG. 7 is a schematic diagram of yet another data transmission in accordance with an embodiment of the present invention;
FIG. 8A is a schematic diagram of an application scenario in an embodiment of the present invention;
FIG. 8B is a schematic diagram of yet another data transmission in accordance with an embodiment of the present invention;
FIG. 9 is a schematic diagram of a data structure in an embodiment of the invention;
FIG. 10 is a schematic flow chart of data transmission in the embodiment of the invention;
Fig. 11 is a schematic structural diagram of an electronic device according to the embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The terms "first," "second," and the like in embodiments of the present application are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus. Furthermore, the use of "and/or" in the present application means at least one of the connected objects, such as a and/or B and/or C, means 7 cases including a alone a, B alone, C alone, and both a and B, both B and C, both a and C, and both A, B and C.
The embodiment of the application provides a communication control method.
The communication control method is applied to a communication system, the communication system comprises a first device and a second device, the first device and the second device can be terminal devices such as a large-size integrated machine, a mobile phone, a tablet personal computer, a Personal Computer (PC) and the like, and the specific types of the first device and the second device are not particularly limited in the embodiment.
As shown in fig. 1, in one embodiment, the method includes:
step 101: the first device and the second device initiate a communication channel.
In the technical solution of this embodiment, the first device and the second device both provide a communication channel, so as to implement data transmission between different devices. The data channels refer to different communication modes, such as a Universal Serial Bus (USB) channel, a bluetooth channel, a wireless local area network (WIFI) channel, and the like, and may also be communication channels such as Near Field Communication (NFC) and serial ports.
In some of these embodiments, where the communication channel comprises a WIFI channel, this step 101 comprises:
Initializing WIFI service, and starting a user datagram protocol UDP service end to send broadcast information and starting a broadcast receipt receiving service;
in the case where the communication channel includes a USB channel, the enabling the communication channel includes:
initializing USB service and entering a Host mode to wait for a control request;
in the case where the communication channel includes a bluetooth channel, the initiating communication channel includes:
and initializing Bluetooth service, starting Gatt host service, and sending advertisement information.
It should be noted that in this embodiment, the number of devices in the communication system may be more, and the plurality of devices may be connected by networking in a similar manner, and in this embodiment, only the first device and the second device are described as an example.
As shown in fig. 2, WIFI may implement data transmission based on a UDP (User Datagram Protocol ) protocol and TCP (Transmission Control Protocol, transmission control protocol), where the two are mainly different in that the UDP protocol supports one-to-many or many-to-one data transmission, while the TCP protocol only supports one-to-one data transmission, and the WIFI channel is responsible for setting up a network server and a client, which may be exemplified by using the UDP protocol to issue and receive broadcast messages, implement device discovery, and may be used for file and information transceiving by using the TCP protocol, and may also set up a CoAP (Costrained Application Protocal, constraint application protocol) protocol for low power devices (generally, internet of things devices), and implement transmission, reception and subscription of files and messages.
The Bluetooth channel can provide SPP (Serial Port Profile, serial port configuration) and Gatt (Generic Attribute Profile, general attribute configuration file) protocols, is responsible for the establishment of a slave and a host of the Bluetooth Gatt protocol, performs service function distribution and search, realizes device discovery, reads and writes simple messages, and establishes a server and a client of the Bluetooth SPP protocol, thereby realizing file and information transceiving.
The USB channel provides an AOA (Android Open Accessory Protocol, an Zhuokai source Accessory) protocol and is responsible for constructing and realizing file and information transceiving of an access (slave) and a Host.
As shown in fig. 2, in the technical solution of this embodiment, in order to conveniently and quickly implement communication connection between the first device and the second device, a networking core needs to be set in the device. The networking core of the embodiment mainly comprises a service starting module, a scheduling management module and an information management module.
The service starting module is mainly used for initializing each communication channel, starting the communication channel service of the equipment, monitoring the equipment, discovering the equipment and the like.
The dispatching management module is mainly used for realizing the functions of equipment networking registration, application networking registration, equipment distribution and channel switching.
The networking registration is mainly used for realizing the interactive processing function of identifying the information of the channels such as WIFI, bluetooth, USB and the like and permitting to join the networking.
The application networking registration is mainly used for realizing functions such as a distributed input method, a distributed file manager, a distributed information display application and the like, and the permission authentication using the distributed core function.
The equipment allocation is mainly used for realizing the selection and the scheduling of the equipment registered by networking before the transmission of information and files so as to optimize the completion of tasks. The channel switching is used for automatically adjusting channels according to different transmission types in the classified communication of WIFI, bluetooth and USB channels according to requirements, and task completion is guaranteed.
The information management module is mainly responsible for information collection, fusion, access and update, and more particularly, the information management module can realize networking registration of equipment and networking registration applied in the equipment by fusing equipment information.
Step 102: the first device and the second device exchange device information according to the communication channel.
After the first device and the second device start the communication channel, the first device and the second device need to complete the automatic networking.
In this embodiment, the device that needs networking starts the service, and then starts scheduling management and information management to implement information collection of the local device and the peripheral device.
After the communication channel is started, starting scheduling management, specifically, starting networking registration, starting application networking registration, starting equipment distribution and starting channel switching. Next, information of the local and peripheral devices is collected.
In some of these embodiments, the step of information gathering includes:
the first equipment and the second equipment collect local information and peripheral equipment information respectively;
as shown in fig. 3, the local information is collected during the initialization phase of the communication channel, and the local information includes one or more of the following: WIFI ssid (Service Set Identifier, service set identification), WIFI mac (physical address), IP address (Internet Protocol ), bluetooth name, bluetooth mac, USB vendor name, mac address;
the peripheral device includes one or more of the following:
the WIFI ssad and the WIFI mac of the peripheral equipment are obtained through the WIFI scanning function;
bluetooth name, bluetooth mac and universal unique identification code UUID (Universally Unique Identifier, universal unique identification code) of the peripheral equipment obtained through Bluetooth scanning;
And sending a connection control code through the USB channel to obtain a connection host name.
More specifically, in one embodiment, the information collected by each device may be presented in the following manner: { deviceID (device number), IP, WIFI-ssid, WIFI-mac, bt-name, bt-mac, WIFI-state, bt-state, usb-state, app-info }.
The deviceID is the device number of the device, bt is the abbreviation of Bluetooth, bluetooth is referred to, WIFI-state and bt-state are referred to as WIFI state and Bluetooth state respectively, and app-info is the application state of the device.
The intra-group information for each device group may be presented in the following manner: { first device information, second device information, … }.
The relay information may be presented in the following manner: { Start device name: x1, channel type: x2, information: x3} { destination device name: y1, channel type: y2}.
The discovery information includes { device ID, channel type, channel status }; the hardware information comprises { WIFI information, bluetooth information and Usb information }; the connection information includes { channel type, channel state }; the peripheral equipment information comprises { Bluetooth name, bluetooth mac, WIFI name, WIFI mac }; the hotspot information includes { hotspot name, hotspot password, hotspot IP }.
It will be appreciated that the format of the information and the content of the information may be adjusted according to the need in the implementation, which is not further limited in this embodiment.
In some of these embodiments, the first device and the second device exchange device information according to the communication channel, including:
the first device and the second device serve as discovery ends, initiate connection and discover peripheral devices; and
the first device and the second device receive an information protocol as discovered ends.
As shown in fig. 4, as the first device and the second device to be networked, both the discovered end and the discovered end are in the networking process. Discovery may be achieved or discovered in different ways when networking is performed over different communication channels.
The operation of the device as a discovery terminal will be further described.
In some embodiments, the local device includes a USB channel in the communication channel, and the initiating the connection and discovering the peripheral device includes:
when the peripheral equipment is peripheral USB equipment, the Host enters a Host mode;
the local machine sends a control request to the connected peripheral USB equipment through an AOA protocol;
establishing a Host channel with the peripheral USB equipment under the condition that the peripheral USB equipment supports an AOA protocol;
And under the condition that the peripheral USB equipment does not support the AOA protocol, the local machine enters a slave mode.
If the USB channel is accessed, specifically, a USB interface is inserted, the host enters host mode, and sends a control request to the connected peripheral USB device through the AOA protocol, so as to determine whether the peripheral USB device supports the Android Accessory protocol.
If the peripheral USB equipment supports the protocol, a non-zero number can be returned to represent the protocol version supported by the peripheral USB equipment, connection is opened, access manufacturer information is obtained, port information is read and written, local information is sent, and a USB Host channel between the local and the peripheral USB equipment is established.
If the peripheral USB device does not support the protocol, returning to zero, and entering an Access (slave) mode by the peripheral USB device.
In some embodiments, the local device includes a WIFI channel in the communication channel, and the initiating the connection and discovering the peripheral device includes:
under the condition that the peripheral equipment is CoAP WIFI equipment, local information is sent to the peripheral equipment, and a CoAP channel of the WIFI is established;
and under the condition that the peripheral equipment is non-CoAP WIFI equipment, the local machine starts UDP multicast/broadcast service, and under the condition that drawing aiming at the UDP multicast/broadcast service is received, local information is sent to the peripheral equipment, and UDP and/or TCP channels of the WIFI are established.
In this embodiment, if the device is used as a hotspot, UDP multicast is started, a server is established, and a discovery information protocol is sent. Multicast refers to a one-to-many transmission scheme, where a transmitting end transmits data into one group. The local machine is in a multicast mode, and can efficiently send as many packets as possible to different, possibly even unknown devices.
If the local machine is not used as a hot spot, starting UDP broadcasting, establishing a server and sending a discovery information protocol. Here, broadcasting refers to a communication mode of "one-to-all" between hosts, and a broadcaster can send information to all devices in a network.
If the local receives the receipt of the UDP transmission discovery protocol, the client is established, the local information is transmitted, and UDP and TCP channels of the WIFI are established.
If the local is low-power-consumption equipment, a CoAP protocol client is built, a CoAP protocol server is connected, local information is sent, and a WIFI CoAP channel is built.
CoAP is established on the UDP protocol, and a binary encapsulation protocol packet is adopted, so that the CoAP simulates the HTTP protocol (Hyper Text Transfer Protocol ) in terms of user visibility, and is beneficial to use, and the connection establishment method is the same as UDP, a server is established through an IP address and a port, and a client is connected with the server through the port to establish connection.
In some embodiments, the local device includes a bluetooth channel in the communication channel, and the initiating the connection and discovering the peripheral device includes:
establishing a Gatt protocol slave terminal to search a Bluetooth host terminal in peripheral equipment;
under the condition that a Bluetooth host end is searched, establishing a Gatt channel with the Bluetooth host end;
under the condition that the Bluetooth host end is not searched, a Gatt protocol host end is established, advertisement information is sent, and a serial port configuration SPP server end is started to serve as the Bluetooth host end to wait for searching.
If the host can be searched, the host can obtain the Bluetooth name of the host, manufacturer data and service UUID, and an information read-write Bluetooth Gatt channel is established.
The local machine can start the client of the SPP protocol according to the searched Bluetooth name, connect with the server, send the local information and establish the Bluetooth SPP channel, and can be understood that the server does not actively disconnect, waits for other clients to connect, and the client actively searches for the server and establishes connection with the server.
If the host is not searched by the host, a Gatt protocol host end is established, advertisement information including Bluetooth names, manufacturer data and service UUIDs is sent, the slave is waited for searching, and specifically, a server end of an SPP protocol can be started, and the client is waited for searching.
The local device receives a discovery information protocol if it is a discovered terminal, and typically, the discovery information protocol is sent in a broadcast information manner to indicate the characteristics of the device itself, so that other similar devices can find the discovered terminal based on the broadcast information and start a discovery service.
If the local machine is a USB device and a USB interface is inserted, the local machine enters an Access mode.
Specifically, if the local machine receives a control request sent by the USB device connected with the AOA protocol, the receipt sends the supported protocol version, confirms the connection, sends the information of the Access manufacturer, reads and writes the port information, establishes a USB Access channel, and receives the discovery information.
And if the local machine does not receive the USB equipment (equipment connected with the USB line) connected with the AOA protocol, sending a control request, and entering a Host mode.
The process is similar to the working process that the local USB device is used as the discovery end, and the description is omitted here.
If the local machine is the WIFI equipment with the WIFI module, a network server is established and information is ready to be received. If the local receives the information of the UDP transmission discovery protocol, the receipt transmits the local information, establishes a client, and establishes UDP and TCP channels of the WIFI.
If the local is a low-power-consumption device, a CoAP protocol client is built, a CoAP protocol server is connected, local information is sent, and a WIFI CoAP channel is built.
If the local machine is a Bluetooth device with a Bluetooth module, the local machine can establish a Gatt protocol host end.
Next, the local machine issues advertisement information including information of bluetooth name, vendor data, service UUID, etc. to wait for the slave machine to search. Specifically, a server of the SPP protocol may be started, waiting for a client to search; the local machine can update the local machine and the information in the group according to the received information and the condition of establishing the channel.
It should be understood that, in this embodiment, the local device, the slave device, the host device, and the peripheral device may refer to devices that need to be added to the device group, such as the first device and the second device, to implement automatic networking, and when implementing, the first device and the second device may be added to the device group in different manners, such as the host device, the slave device, and the peripheral device, so as to improve the networking efficiency.
Step 103: the first device and the second device establish a device group according to the exchanged device information.
In this embodiment, the networking core of each device starts a channel service, issues local information, acquires peripheral device information from different channels, merges the local information and the peripheral information, updates built intra-group information of the device group according to channel state changes, shares the intra-group information, and completes the construction of the distributed framework.
After connection is established based on the communication channel, each device can add channel information into shared intra-group information, when the name of the communication channel changes or the connection state changes, the changed information can be updated to the latest state to correct old information in the device group, so that the intra-group devices form a virtual group, the intra-group information is shared, and the establishment of the distributed framework is completed.
In implementation, one or more communication channels may be used as needed, for example, if the first device supports a WIFI channel and a USB channel, and the second device supports a WIFI channel and a bluetooth channel, data transmission may be implemented only through the WIFI channel; if the first equipment and the second equipment both support the WIFI channel and the USB channel, data transmission can be performed through the WIFI channel and the USB channel at the same time, and the integrity of the data channel is guaranteed.
As shown in fig. 3, each device can complete the establishment of a device group and complete the fusion of multi-channel information, in this embodiment, the fusion of multi-channel information refers to that the response piece information acquired by UDP broadcast, gatt advertisement information and USB control command are all different, but are all networking information, and are uniformly converted into networking information, and the networking information is fused in an information management module, including different communication protocols and different transmission channels, but the fusion of protocol packets of a formulated standard is then sent.
Step 104: the first device and the second device exchange data information in the device group.
After the networking convergence is completed, the first device and the second device can exchange data information such as files, information, stream communication and the like.
In this embodiment, the first device and the second device may perform direct transmission of information, that is, realize transmission of data such as a file and information through a certain communication channel therein.
In some embodiments, if the size of the file to be transmitted is larger, the transmission efficiency may be improved by parallel transmission.
In some embodiments, in a case where the first device and the second device are connected through a first communication channel and a second communication channel, and the first device needs to send a target file to the second device, the method further includes:
the first device reads a first data block of a file stream of the target file and sends the first data block to the second device through the first communication channel;
the first device reads a second data block of the file stream of the target file and sends the second data block to the second device through the first communication channel;
The second device receives the first data block and the second data block, and creates a file stream to write the first data block and the second data block;
wherein data in the first communication channel and the second communication channel are transmitted in parallel.
As shown in fig. 5, in this embodiment, the first device and the second device have completed networking and have WIFI, bluetooth, and USB channels.
When the method is implemented, the first device reads the file stream, reads the first data block of the data with the Buf1 size and sends the data through the USB channel, reads the second data block with the Buf2 size and sends the data through the WIFI channel, reads the third data block with the Buf3 size and sends the data through the Bluetooth channel, and all the data channels send the corresponding data blocks to the second device in parallel.
The second device receives the first data block with the Buf1 size through the USB channel, the second data block with the Buf2 size through the WIFI channel, the third data block with the Buf3 size through the Bluetooth channel, and the second device creates a file stream and writes data.
And then, the first equipment and the second equipment circularly process according to the process, namely, the first equipment continuously reads the first data block through the USB channel and sends the first data block to the second equipment, the second data block is continuously read through the WIFI channel and sent to the second equipment, the third data block is continuously read through the Bluetooth channel and sent to the second equipment, and the second equipment continuously circularly writes until the file transmission is completed.
In this way, by simultaneously performing data transmission using a plurality of communication channels, the data transmission speed can be increased.
In another embodiment, the corresponding communication channel is selected for data transmission according to the data type.
In some embodiments, in a case where the first device and the second device are connected through a first communication channel and a third communication channel, and the first device needs to send a target file to the second device, the method further includes:
the first device reads the data blocks of the file stream of the target file and sends the data blocks to the second device through the first communication channel;
the first device sends target data to the second device through the third communication channel, wherein the target data comprises message data and/or command data;
wherein data in the first communication channel and the third communication channel are transmitted in parallel.
As shown in fig. 6, in an exemplary embodiment, the first device reads the file stream, and the first data block with the read Buf size is sent to the second device through the USB channel, and the read message data is sent to the second device through the WIFI channel, and the read command data is sent to the second device through the bluetooth channel, where the above sending processes are also performed in parallel. The second device receives the data through the corresponding communication channel and then executes corresponding processing outflow.
As shown in fig. 7, in some embodiments, the two modes may be combined with each other, i.e. data transmission, command execution, message splitting may be performed using different types of communication channels and parallel channels as needed, which are not further defined and described herein.
In some of these embodiments, in the case where the number of devices is plural, and where there is no direct communication channel between two devices, data transfer between the two devices may be achieved by way of transfer.
In some of these embodiments, the communication system further comprises a third device communicatively coupled to the first device;
in the case that the third device needs to send target data information to the second device, the method further includes:
the third device sends the target data information to the first device, wherein the target data information carries initial device information and target device information, the initial device information of the target data information comprises communication channel information and device type information of the third device, and the target device information of the target data information comprises communication channel information and device type information of the second device;
And the first equipment sends the target data information to the second equipment according to the target data information.
As shown in fig. 8A and 8B, in this embodiment, the first device is a tablet computer, the second device is a large-sized integrated machine, the third device is a mobile phone, and the three devices are already networked, where the large-sized integrated machine device and the tablet computer have established USB connection, and the mobile phone and the tablet computer have established WIFI or bluetooth connection.
If the mobile phone is expected to send information to the large-size integrated machine, the mobile phone connection information is searched for the channel information of the large-size integrated machine, and if the available through channel information is obtained, the equipment and the channel can be switched by referring to the mode, and the information is sent.
In this embodiment, the mobile phone and the large-sized integrated machine are not directly connected through the communication channel, that is, no available through channel information is obtained, so that a transit channel search is performed, and a heterogeneous communication flow is started.
Specifically, in this embodiment, WIFI and bluetooth channels are searched in the channel information of the mobile phone, the connection device is a tablet computer, and a USB channel exists between the tablet computer and the large-size integrated machine is searched in the group information.
The mobile phone sends target data information to be transferred, including the name and the channel type of the initial equipment and the name and the channel type of the target equipment to the tablet personal computer. When the scheduling management module is automatically selected by the system, the initial equipment name and the channel type can be processed by equipment allocation and channel switching according to equipment conditions and channel conditions, and the destination equipment name and the channel type can be given to the tablet personal computer. In one embodiment, the format of the initiator information carried by the target data information is { initiator name: cell phone, channel type: WIFI }, the format of the carried destination device information is { destination device name: large-size all-in-one, channel type: USB }.
In some of these embodiments, in order to ensure reliability and stability of data transmission when the target data information is streamed between different devices, a generic data transmission protocol may be set.
In one embodiment of the invention, the data transfer protocol is defined in the following manner.
And the local equipment encapsulates the original data into transmission data according to a certain protocol rule, transmits the transmission data to other equipment through a networking channel, receives the transmission data by the other equipment, and unpacks the transmission data according to the protocol rule to obtain the original data.
As shown in fig. 9, in this embodiment, the definition and composition of the overall protocol packet are as follows:
the initiator (2 bytes) uses 0x7b 0x5b as the initiator of the protocol packet, i.e., "{ [".
Packet length (2 bytes), packet length = initiator occupied byte + packet length occupied byte + message type occupied byte + data length occupied byte + data stream number occupied byte + data occupied byte + check code occupied byte + terminator occupied byte.
Through the packet length, the broken packets and the sticky packets can be effectively processed, and the integrity of data is ensured. The received data length is longer than the packet length, which indicates that the data packet is incomplete, the broken packet is needed to be spliced after the next reading, the received data length is longer than the packet length, which indicates that the data packet is sticky, and after the actual data is read, the rest part is cached to wait for the next splicing.
Message type (2 bytes) including 0x01 message, 0x02 file, 0x03 command.
Data type (2 bytes) including 0x01 text, 0x02 binary, 0x03 json.
Data length (2 bytes), data length=data type occupied byte+data length occupied byte+data stream number occupied byte+data occupied byte.
And the number of the data stream (2 bytes), the accumulated integer number, and no packet re-package and packet loss are ensured.
The data (dynamic bytes) are different in packet format, and the multi-packet and single-packet are different according to the type of data.
Check code (2 bytes), check code = packet long byte + message type byte + data length byte + data concatenation number byte + data byte takes two bytes.
The terminator (2 bytes) uses 0x5d 0x7d as the initiator of the protocol packet, i.e. "].
Further, as shown in table 1, the transmission protocol composition is different due to different message types.
Table 1: transmitting information protocol group
Referring to table 1, the composition of the transmission information protocol is as follows:
message type (1 Byte), byte0:0x01.
Data type (1 Byte), byte1: including 3 types, 0x01 text, 0x02 binary, 0x03 json.
Data length (2 bytes), byte2-Byte3: data type occupied byte, data length occupied byte, data stream number occupied byte and data occupied byte.
Data stream number (2 bytes), byte4-Byte5: =accumulated integer number.
Data (N-6 bytes), byte6-ByteN: the original data portion.
In single packet form, byte6-Byte7: information content length L; byte 8-Byt8+L: information content.
In the case of the multi-pack form,
Pack 1: byte6-Byte7: information content length L; byte 8-Byt8+H: information content 1;
package 2 Byte 6-Byt6+H: information content 2;
……;
n+1th packet Byte 6-Byt6+ (L-n H): information content n+1.
Referring to table 2, the transmit file protocol consists of:
table 2: transmitting file protocol
Message type (1 Byte), byte0:0x02.
Data type (1 Byte), byte1: including 3 types, 0x01 text, 0x02 binary, 0x03 json.
Data length (2 bytes), byte2-Byte3: data type occupied byte, data length occupied byte, data stream number occupied byte and data occupied byte.
Data stream number (2 bytes), byte4-Byte5: =accumulated integer number.
Data (N-6 bytes), byte6-ByteN: the original data portion.
In single packet form, byte6: a file name length M; byte 7-Byt7+M: a file name; byt7+M+1-Byt7+M+2: file content length L; byt7+M+2+1-Byt7+M+2+1+L: file content.
In the case of the multi-pack form,
pack 1: byte6: a file name length M; byte 7-Byt7+M: a file name; byt7+M+1-Byt7+M+2: file content length L; byt7+M+2+1-Byt7+M+2+1+H: file content 1;
package 2 Byte 6-Byt6+H: file content 2;
N+1th packet Byte 6-Byt6+ (L-n H): file content n+1.
As shown in table 3, the send command protocol consists of:
table 3: transmission command protocol
Message type (1 Byte), byte0:0x03.
Data type (1 Byte), byte1: including 3 types, 0x01 text, 0x02 binary, 0x03 json.
Data length (2 bytes), byte2-Byte3: data type occupied byte, data length occupied byte, data stream number occupied byte and data occupied byte.
Data stream number (2 bytes), byte4-Byte5: =accumulated integer number.
Data (N-6 bytes), byte6-ByteN: only single packet form: byte6: a command type; byte7: command parameter length M; byte 8-Byt8+M: command parameters; byte8+M+1: command content length L; byt8+M+1+1-Byt8+M+1+1+L: command content.
As shown in tables 4 and 5, the command information protocol composition is as follows:
table 4: command information protocol 1
Table 5: command information protocol 2
Command type (1 Byte), byte0: representative values are 0x00 to 0x0C.
Command parameters (1 Byte), byte1: depending on the different types of commands.
Command length (2 bytes), byte2-Byte3: =command content occupies bytes.
Command content (N-4 bytes), byte4-Byte N: depending on the different types of commands. As shown in tables 6 and 7, the command receipt protocol consists of:
Table 6: command receipt protocol 1
Table 7: command response piece protocol 2
Command type (1 Byte), byte0: representative values are 0x80 to 0x8C.
Command parameters (1 Byte), byte1: depending on the different types of commands.
Command length (2 bytes), byte2-Byte3: =command content occupies bytes.
Command content (N-4 bytes), byte4-Byte N: failure 0x00 x0001 (error code, status code), success 0x01.
As shown in table 8, the status code, error code protocol is defined as follows:
table 8: state code, error code protocol definition
Status code (2 bytes), receipt information generated during execution of the command protocol.
Error code (2 bytes), receipt information returned after the end of the command protocol execution.
In this way, in the embodiment of the invention, the communication networking framework of the multi-channel and multi-system formed by a plurality of devices can enable the stable intercommunication of data between different devices and between systems according to the custom protocol by providing the general custom protocol, so that the cooperative work, the advantage sharing and the information sharing of each device are realized, the problems of sticking and subpackaging of the data in the information packet transmission are effectively avoided through the protocol rule, and the stability and the rapidity of the data transmission are ensured.
Compared with the prior art, the embodiment enables the multi-channel and multi-system networking function to be possible through the self-defined networking discovery and discovered protocol; through self-defining heterogeneous communication transmission protocol, indirect intercommunication can be realized between devices which cannot communicate directly and also through intra-group communication; different channels jointly complete the same function through a custom parallel communication transmission protocol; through the parting communication transmission and the hybrid communication transmission protocol, the respective advantages among the devices are fully exerted, and the service experience is improved.
The tablet computer receives the transfer information, and according to the name of the target device and the type of the channel, the device and the channel need to be switched, and it is to be understood that the tablet computer serving as the transfer device may be connected with a plurality of devices, and the tablet computer can determine that data need to be transmitted to the large-size integrated machine according to the transfer information, then can allocate and switch the corresponding communication channel through the scheduling management module, and then send target data information needing to be transferred to the large-size integrated machine.
In some of these embodiments, the method further comprises:
the second device generates receipt information according to the initial device information carried in the target data information, wherein the destination device information of the receipt information comprises communication channel information and device type information of the third device;
The second device sends the receipt information to the first device;
and the first device forwards the receipt information to the third device according to the destination device information of the receipt information.
After the large-size all-in-one machine receives the target data information, the large-size all-in-one machine can determine that the large-size all-in-one machine is a target end according to the target equipment information carried in the target data information, the large-size all-in-one machine receives the information and replaces the initial equipment name and the channel type in the target data information with the target equipment name and the channel type, and replaces the target equipment name and the channel type with the initial equipment name and the channel type, namely { the initial equipment name: large-size all-in-one, channel type: USB }, { destination device name: cell phone, channel type: WIFI }, and adding receipt success information and forwarding to the tablet computer;
after receiving receipt information sent by the large-size integrated machine, the tablet computer switches equipment and channels according to the name of the target equipment and the type of the channels and sends the receipt information to the mobile phone according to a similar process.
And the mobile phone equipment receives the receipt information, determines the receipt information to be a destination terminal, receives the information, confirms that the receipt information is the receipt information which is successfully sent, and completes the sending of the target data information.
As shown in fig. 11, the data flow of the present embodiment can be summarized as follows.
When the method is implemented, firstly, each device installs a networking core framework, networking is completed, then, a sending thread is started, and sending content is loaded. Next, the intra-group devices and transmission channels to which the file needs to be transmitted are selected.
In this embodiment, the wired channel is preferentially selected, that is, whether the USB is connected is first determined, and if the USB is connected, the USB channel is selected to enter a transmission stage for transmitting information or files.
If the USB is not connected, judging whether the WIFI channel is connected, and if the WIFI is connected, judging the type of the sent content. If the transmitted content is information, establishing a UDP unicast channel, and entering a transmitting stage; if the transmission content is a file, a TCP channel is established, and the transmission stage is entered.
If the WIFI channel is not connected, judging whether the Bluetooth channel is connected, if the Bluetooth channel is connected, establishing a Bluetooth sending channel, and entering a sending stage.
If the Bluetooth channel is not connected, the networking is abnormal, the flow of the receipt sending result is directly entered, and the sending abnormality is fed back.
In the transmitting stage, the transmitting end transmits information or files, and the receiving end receives data such as information or files.
In the receiving stage, judging the type of the received content; if the information is the information, directly receiving, and entering a transmission ending flow after success; if the file is the file, analyzing the file length and the file name, establishing a flow channel, circularly receiving, and entering a transmission ending flow after success.
And in the process of ending the transmission, whether the data is successfully received or not needs to be judged, a transmission result is returned to the transmitting end, and the thread is ended.
The embodiment of the invention provides a communication control method which is applied to first equipment in a communication system, wherein the communication system comprises the first equipment and second equipment, and the method comprises the following steps:
starting a communication channel;
exchanging device information with a second device according to the communication channel;
establishing a device group with the second device according to the exchanged device information;
exchanging data information with the second device in the device group.
In some embodiments, where the communication channel comprises a wireless local area network WIFI channel, the initiating the communication channel comprises:
initializing WIFI service, and starting a user datagram protocol UDP service end to send broadcast information and starting a broadcast receipt receiving service;
in the case where the communication channel includes a universal serial bus USB channel, the enabling communication channel includes:
Initializing USB service and entering a Host mode to wait for a control request;
in the case where the communication channel includes a bluetooth channel, the initiating communication channel includes:
and initializing Bluetooth service, starting the general attribute configuration file Gatt host service, and sending advertisement information.
In some embodiments, after the first device and the second device initiate a communication channel, the method further comprises:
collecting local information and peripheral equipment information;
wherein the local information is collected in a communication channel initialization stage, and the local information comprises one or more of the following: the WIFI service set identifier ssid, WIFI physical address mac, internet Protocol (IP) address, bluetooth name, bluetooth mac, USB manufacturer name and mac address;
the peripheral device includes one or more of the following:
the WIFI ssad and the WIFI mac of the peripheral equipment are obtained through the WIFI scanning function;
bluetooth name, bluetooth mac and universal unique identification code UUID of Bluetooth service of peripheral equipment obtained through Bluetooth scanning;
and sending a connection control code through the USB channel to obtain a connection host name.
In some embodiments, exchanging device information with a second device according to the communication channel includes:
As a discovery end, initiating connection and discovering peripheral equipment; and
as the discovered end receives the information protocol.
In some embodiments, the local device includes a USB channel in the communication channel, and the initiating the connection and discovering the peripheral device includes:
when the peripheral equipment is peripheral USB equipment, the Host enters a Host mode;
the local machine sends a control request to the connected peripheral USB equipment through a An Zhuokai source accessory AOA protocol;
establishing a Host channel with the peripheral USB equipment under the condition that the peripheral USB equipment supports an AOA protocol;
and under the condition that the peripheral USB equipment does not support the AOA protocol, the local machine enters a slave mode.
In some embodiments, the local device includes a WIFI channel in the communication channel, and the initiating the connection and discovering the peripheral device includes:
under the condition that the peripheral equipment is constrained application protocol (CoAP) WIFI equipment, local information is sent to the peripheral equipment, and a CoAP channel of the WIFI is established;
and under the condition that the peripheral equipment is non-CoAP WIFI equipment, the local machine starts UDP multicast/broadcast service, and under the condition that drawing aiming at the UDP multicast/broadcast service is received, local information is sent to the peripheral equipment, and UDP and/or TCP channels of the WIFI are established.
In some embodiments, the local device includes a bluetooth channel in the communication channel, and the initiating the connection and discovering the peripheral device includes:
establishing a Gatt protocol slave terminal to search a Bluetooth host terminal in peripheral equipment;
under the condition that a Bluetooth host end is searched, establishing a Gatt channel with the Bluetooth host end;
under the condition that the Bluetooth host end is not searched, a Gatt protocol host end is established, advertisement information is sent, and a serial port configuration SPP server end is started to serve as the Bluetooth host end to wait for searching.
In some embodiments, in a case where the first device and the second device are connected through a first communication channel and a second communication channel, and the first device needs to send a target file to the second device, the method further includes:
reading a first data block of a file stream of the target file, and sending the first data block to the second device through the first communication channel;
reading a second data block of the file stream of the target file, and sending the second data block to the second device through the first communication channel;
wherein data in the first communication channel and the second communication channel are transmitted in parallel.
In some embodiments, in a case where the first device and the second device are connected through a first communication channel and a third communication channel, and the first device needs to send a target file to the second device, the method further includes:
reading a data block of a file stream of the target file, and sending the data block to the second device through the first communication channel;
transmitting target data to the second device through the third communication channel, wherein the target data comprises message data and/or command data;
wherein data in the first communication channel and the third communication channel are transmitted in parallel.
In some embodiments, the communication system further comprises a third device, wherein the communication channel the third device has is different from the communication channel the second device has;
in the case that the third device needs to send target data information to the second device, the method further includes:
receiving the target data information sent by the third device, wherein the target data information carries initial device information and target device information, the initial device information of the target data information comprises communication channel information and device type information of the third device, and the target device information of the target data information comprises communication channel information and device type information of the second device;
Switching a communication channel according to the destination equipment information of the target data information;
and sending the target data information to the second equipment according to the switched communication channel.
In some embodiments, the method further comprises:
receiving receipt information generated and sent by the second device according to the initial device information carried in the target data information, wherein the target device information of the receipt information comprises communication channel information and device type information of the third device;
and forwarding the receipt information to the third device according to the destination device information of the receipt information.
The embodiment of the invention also provides electronic equipment. Referring to fig. 11, an electronic device may include a processor 1101, a memory 1102, and a program 11021 stored on the memory 1102 and executable on the processor 1101.
Any of the steps of the method embodiments described above and the same advantages achieved when the program 11021 is executed by the processor 1101 are not described herein.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of implementing the methods of the embodiments described above may be implemented by hardware associated with program instructions, where the program may be stored on a readable medium.
The embodiment of the invention also provides a readable storage medium, on which a computer program is stored, where the computer program can implement any step in the above method embodiment when executed by a processor, and can achieve the same technical effect, and for avoiding repetition, a detailed description is omitted here.
Such as Read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic or optical disk, etc.
It should be noted that, it should be understood that the above division of each module is merely a division of a logic function, and may be fully or partially integrated into one physical entity or may be physically separated. And these modules may all be implemented in software in the form of calls by the processing element; or can be realized in hardware; the method can also be realized in a form of calling software by a processing element, and the method can be realized in a form of hardware by a part of modules. For example, the determining module may be a processing element that is set up separately, may be implemented in a chip of the above apparatus, or may be stored in a memory of the above apparatus in the form of program code, and may be called by a processing element of the above apparatus and execute the functions of the determining module. The implementation of the other modules is similar. In addition, all or part of the modules can be integrated together or can be independently implemented. The processing element described herein may be an integrated circuit having signal processing capabilities. In implementation, each step of the above method or each module above may be implemented by an integrated logic circuit of hardware in a processor element or an instruction in a software form.
For example, each module, unit, sub-unit, or sub-module may be one or more integrated circuits configured to implement the above methods, e.g.: one or more specific integrated circuits (Application Specific Integrated Circuit, ASIC), or one or more microprocessors (digital signal processor, DSP), or one or more field programmable gate arrays (Field Programmable Gate Array, FPGA), or the like. For another example, when a module above is implemented in the form of a processing element scheduler code, the processing element may be a general purpose processor, such as a central processing unit (Central Processing Unit, CPU) or other processor that may invoke the program code. For another example, the modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
While the foregoing is directed to the preferred embodiments of the present invention, it will be appreciated by those skilled in the art that various modifications and adaptations can be made without departing from the principles of the present invention, and such modifications and adaptations are intended to be comprehended within the scope of the present invention.

Claims (16)

1. A communication control method, characterized by being applied to a communication system including a first device and a second device, the method comprising:
The first device and the second device initiate a communication channel;
the first device and the second device exchange device information according to the communication channel;
the first device and the second device establish a device group according to the exchanged device information;
the first device and the second device exchange data information in the device group.
2. The communication control method according to claim 1, wherein in the case where the communication channel includes a wireless local area network WIFI channel, the starting the communication channel includes:
initializing WIFI service, and starting a user datagram protocol UDP service end to send broadcast information and starting a broadcast receipt receiving service;
in the case where the communication channel includes a universal serial bus USB channel, the enabling communication channel includes:
initializing USB service and entering a Host mode to wait for a control request;
in the case where the communication channel includes a bluetooth channel, the initiating communication channel includes:
and initializing Bluetooth service, starting the general attribute configuration file Gatt host service, and sending advertisement information.
3. The communication control method according to claim 1, wherein after the first device and the second device start the communication channel, the method further comprises:
The first equipment and the second equipment collect local information and peripheral equipment information respectively;
wherein the local information is collected in a communication channel initialization stage, and the local information comprises one or more of the following: the WIFI service set identifier ssid, WIFI physical address mac, internet Protocol (IP) address, bluetooth name, bluetooth mac, USB manufacturer name and mac address;
the peripheral device includes one or more of the following:
the WIFI ssad and the WIFI mac of the peripheral equipment are obtained through the WIFI scanning function;
bluetooth name, bluetooth mac and universal unique identification code UUID of Bluetooth service of peripheral equipment obtained through Bluetooth scanning;
and sending a connection control code through the USB channel to obtain a connection host name.
4. The communication control method according to claim 1, wherein the first device and the second device exchange device information according to the communication channel, comprising:
the first device and the second device serve as discovery ends, initiate connection and discover peripheral devices; and
the first device and the second device receive an information protocol as discovered ends.
5. The communication control method according to claim 4, wherein the local device includes a USB channel in the communication channel, and the initiating the connection and the discovering the peripheral device include:
When the peripheral equipment is peripheral USB equipment, the Host enters a Host mode;
the local machine sends a control request to the connected peripheral USB equipment through a An Zhuokai source accessory AOA protocol;
establishing a Host channel with the peripheral USB equipment under the condition that the peripheral USB equipment supports an AOA protocol;
and under the condition that the peripheral USB equipment does not support the AOA protocol, the local machine enters a slave mode.
6. The communication control method according to claim 4, wherein the local communication channel includes a WIFI channel, and the initiating the connection and discovering the peripheral device includes:
under the condition that the peripheral equipment is constrained application protocol (CoAP) WIFI equipment, local information is sent to the peripheral equipment, and a CoAP channel of the WIFI is established;
and under the condition that the peripheral equipment is non-CoAP WIFI equipment, the local machine starts UDP multicast/broadcast service, and under the condition that drawing aiming at the UDP multicast/broadcast service is received, local information is sent to the peripheral equipment, and UDP and/or TCP channels of the WIFI are established.
7. The communication control method according to claim 4, wherein the local device includes a bluetooth channel in the communication channel, and the initiating the connection and the discovering the peripheral device include:
Establishing a Gatt protocol slave terminal to search a Bluetooth host terminal in peripheral equipment;
under the condition that a Bluetooth host end is searched, establishing a Gatt channel with the Bluetooth host end;
under the condition that the Bluetooth host end is not searched, a Gatt protocol host end is established, advertisement information is sent, and a serial port configuration SPP server end is started to serve as the Bluetooth host end to wait for searching.
8. The communication control method according to claim 1, wherein in a case where the first device and the second device are connected through a first communication channel and a second communication channel, and the first device needs to send a target file to the second device, the method further comprises:
the first device reads a first data block of a file stream of the target file and sends the first data block to the second device through the first communication channel;
the first device reads a second data block of the file stream of the target file and sends the second data block to the second device through the first communication channel;
the second device receives the first data block and the second data block, and creates a file stream to write the first data block and the second data block;
Wherein data in the first communication channel and the second communication channel are transmitted in parallel.
9. The communication control method according to claim 1 or 8, wherein in a case where the first device and the second device are connected through a first communication channel and a third communication channel, and the first device needs to send a target file to the second device, the method further comprises:
the first device reads the data blocks of the file stream of the target file and sends the data blocks to the second device through the first communication channel;
the first device sends target data to the second device through the third communication channel, wherein the target data comprises message data and/or command data;
wherein data in the first communication channel and the third communication channel are transmitted in parallel.
10. The communication control method according to claim 1, wherein the communication system further includes a third device communicatively connected to the first device;
in the case that the third device needs to send target data information to the second device, the method further includes:
The third device sends the target data information to the first device, wherein the target data information carries initial device information and target device information, the initial device information of the target data information comprises communication channel information and device type information of the third device, and the target device information of the target data information comprises communication channel information and device type information of the second device;
and the first equipment sends the target data information to the second equipment according to the target data information.
11. The communication control method according to claim 1, characterized in that the method further comprises:
the second device generates receipt information according to the initial device information carried in the target data information, wherein the destination device information of the receipt information comprises communication channel information and device type information of the third device;
the second device sends the receipt information to the first device;
and the first device forwards the receipt information to the third device according to the destination device information of the receipt information.
12. The communication control method according to any one of claims 1 to 8, wherein the first device and/or the second device comprises one or more of:
The service starting module is used for initializing the communication channel and starting the communication channel;
the scheduling management module is used for starting equipment networking registration, starting application networking registration, starting equipment distribution and controlling communication channel switching;
and the information management module is used for managing the local information and the collected information of the peripheral equipment.
13. A communication control method applied to a first device in a communication system including the first device and a second device, the method comprising:
starting a communication channel;
exchanging device information with a second device according to the communication channel;
establishing a device group with the second device according to the exchanged device information;
exchanging data information with the second device in the device group.
14. A communication system comprising a first device and a second device, the first device and the second device configured to:
starting a communication channel;
exchanging equipment information according to the communication channel;
establishing a device group according to the exchanged device information;
data information is exchanged in the device group.
15. An electronic device, comprising: a memory, a processor, and a program stored on the memory and executable on the processor; -characterized in that the processor is adapted to read a program in a memory for implementing the steps in the communication control method according to any one of claims 1 to 12;
Or to implement the steps in the communication control method as claimed in claim 13.
16. A readable storage medium storing a program, wherein the program when executed by a processor implements the steps in the communication control method according to any one of claims 1 to 12;
or to implement the steps in the communication control method as claimed in claim 13.
CN202310797622.0A 2023-06-30 2023-06-30 Communication control method, communication system, electronic device, and readable storage medium Pending CN116684996A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310797622.0A CN116684996A (en) 2023-06-30 2023-06-30 Communication control method, communication system, electronic device, and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310797622.0A CN116684996A (en) 2023-06-30 2023-06-30 Communication control method, communication system, electronic device, and readable storage medium

Publications (1)

Publication Number Publication Date
CN116684996A true CN116684996A (en) 2023-09-01

Family

ID=87785573

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310797622.0A Pending CN116684996A (en) 2023-06-30 2023-06-30 Communication control method, communication system, electronic device, and readable storage medium

Country Status (1)

Country Link
CN (1) CN116684996A (en)

Similar Documents

Publication Publication Date Title
US20220060416A1 (en) Routing Rule Management Method and Communications Apparatus
CN113411215B (en) Time-sensitive network centralized user configuration method and system based on OPC UA
CN105100137B (en) A kind of method and electronic equipment of service discovery
WO2019062836A1 (en) Network slice management method, and device for same
EP2996430A1 (en) Method and terminal for content synchronization among terminals
CN110121902B (en) Communication establishment method and terminal
CN106210049B (en) Cluster communication method and system based on message queue
KR102037256B1 (en) Apparatus and method for connecting service reflected in user intent
JP2014501057A (en) Method and apparatus for sharing internet connection based on automatic configuration of network interface
WO2019134595A1 (en) Configuration system, client device, embedded device configuration method, and storage medium
WO2023005410A1 (en) Information synchronization method and system, storage medium, and electronic device
US10177973B2 (en) Communication apparatus, communication method, and communication system
CN112187486A (en) Interaction method between intelligent devices and intelligent devices
WO2017161866A1 (en) Network connection method and device
CN116684996A (en) Communication control method, communication system, electronic device, and readable storage medium
KR101921275B1 (en) Method and system of file transfer using device-to-device communication technique in messenger
CN115883572A (en) Peripheral sharing method and device
WO2021147109A1 (en) Information transmission method and related device
JP2013172275A (en) Communication device and communication method for the same
JP2020088712A (en) Communication device and control method thereof
CN113079039B (en) Method and system for multi-host network distribution, communication host and storage medium
WO2016082067A1 (en) Resource sharing method and terminal
EP4207708A1 (en) Method for establishing session and network device
CN113420001B (en) Data sharing method and edge computing device
WO2024078501A1 (en) Communication method and apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination