WO2014026594A1 - Data transmission method and device - Google Patents

Data transmission method and device Download PDF

Info

Publication number
WO2014026594A1
WO2014026594A1 PCT/CN2013/081393 CN2013081393W WO2014026594A1 WO 2014026594 A1 WO2014026594 A1 WO 2014026594A1 CN 2013081393 W CN2013081393 W CN 2013081393W WO 2014026594 A1 WO2014026594 A1 WO 2014026594A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
virtual device
user
wireless communication
function
Prior art date
Application number
PCT/CN2013/081393
Other languages
French (fr)
Chinese (zh)
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 中兴通讯股份有限公司
Publication of WO2014026594A1 publication Critical patent/WO2014026594A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0058Bus-related hardware virtualisation

Definitions

  • a wireless communication module is a common wireless terminal product widely used in products including wireless communication functions such as industrial control, smart home, car, tablet, and the like. Due to its wide range of applications and complex application scenarios, it is necessary to find a universal interface form that enables wireless communication modules to communicate with various operating systems and even single-chip microcomputers.
  • Universal Asynchronous Receiver/Transmitter UART is a universal serial data bus for asynchronous communication. Its interface is simple and easy to operate. It is widely used in various systems and microcontrollers. Therefore, supporting the UART interface is very important for the wireless communication module.
  • the wireless communication module provides users with various functions, such as: AT control, data, diagnosis, Global Position Service (GPS), etc., which requires paralleling multiple functions on a single UART interface.
  • various functions such as: AT control, data, diagnosis, Global Position Service (GPS), etc.
  • GPS Global Position Service
  • multiple combinations of functions need to be dynamically switched to adapt to different scenarios and needs.
  • the host system only contains the UART interface, which requires mounting the functional units that may be used to a single physical UART port.
  • the host has a UART and a universal string. Two serial ports (Universal Serial Bus, USB for short), this time may need to mount the function with high speed requirements to the USB, which involves dynamic switching of the function combination.
  • USB Universal Serial Bus
  • FIG. 1 is a schematic structural diagram of a wireless communication module and a host based on a UART interface according to the related art.
  • a wireless communication module (referred to as a module in FIG. 1) includes a multiplexing (MUX) layer.
  • MUX multiplexing
  • the wireless communication function unit (simplified in Figure 1 is function 1, function 2, function 3).
  • the output data of the wireless communication function unit is directly transmitted to the MUX layer, and is encoded and sent to the user side (ie, the host side), and the user side MUX layer decodes the data to obtain the actual data corresponding to each wireless communication function unit.
  • the data sent by the user side arrives at the wireless communication module, it is first parsed by the MUX layer and then distributed to each wireless communication function unit.
  • each wireless communication function unit and the MUX layer are closely combined, and the function combination is determined when the module is powered on, and the function combination cannot be dynamically changed.
  • a data transmission method including: establishing a virtual device corresponding to each function of a wireless communication module; acquiring a virtual device corresponding to a function combination input by the user, and acquiring the virtual device A data connection is established between the device and the physical UART; data is transmitted using the above data connection.
  • obtaining the virtual device corresponding to the function combination input by the user comprises: receiving a command from the user; parsing the command, acquiring a function combination to be used by the user; and acquiring the virtual device corresponding thereto according to the function combination.
  • the method before acquiring the virtual device corresponding to the functional combination input by the user, the method further includes: mounting the AT service to the physical UART, wherein the AT service is used to parse the AT command from the user.
  • establishing a data connection between the acquired virtual device and the physical UART comprises: mounting the acquired virtual device to the physical UART through a multiplexing layer.
  • establishing a virtual device corresponding to each function of the wireless communication module comprises: establishing a virtual device corresponding to each function; respectively associating each functional unit with a corresponding virtual device.
  • transmitting data by using the data connection comprises: receiving input data of the user, and parsing the input data; determining the target virtual device of the input data and the target functional unit according to the parsing result; and transmitting the input data to the target functional unit by using the data connection.
  • transmitting the data by using the data connection comprises: encapsulating data that needs to be sent to the user, wherein the encapsulated data carries information indicating the virtual device to which the data belongs; and the data is sent to the user by using the data connection.
  • a data transmission apparatus which is applied to a wireless communication module, including: a first establishing module, configured to establish a virtual device corresponding to each function of the wireless communication module; acquiring a module, setting To obtain a virtual device corresponding to the function combination input by the user; a second establishing module, configured to establish a data connection between the acquired virtual device and the physical universal asynchronous receiving/transmitting UART; and a data transmission module configured to transmit by using the data connection data.
  • the obtaining module comprises: a receiving unit configured to receive a command from the user; a parsing unit configured to parse the command; a first obtaining unit configured to acquire a function combination to be used by the user; and a second obtaining unit configured to perform the function according to the function Get the virtual device corresponding to it in combination.
  • the second establishing module comprises: a mounting unit configured to mount the acquired virtual device to the physical UART through the multiplexing layer.
  • a virtual device corresponding to each function of the wireless communication module is established for the UART-based wireless communication module, so that the functions of the plurality of wireless communication modules can be concurrently processed, and the virtual combination corresponding to the function combination required by the user is established.
  • FIG. 1 is a schematic structural diagram of a UART interface-based wireless communication module and a host according to the related art
  • FIG. 2 is a flowchart of a data transmission method according to an embodiment of the present invention
  • FIG. 3 is a flowchart according to an embodiment of the present invention.
  • Figure 4 is a block diagram showing the structure of a data transmission device in accordance with a preferred embodiment of the present invention
  • Figure 5 is a block diagram showing the structure of a data transmission system in accordance with a preferred embodiment of the present invention
  • Flowchart of Wireless Communication Module Initialization
  • Figure 7 is a flow diagram of functional combination dynamic switching in accordance with a preferred embodiment of the present invention.
  • Step S202 establishing a virtual device corresponding to each function of the wireless communication module.
  • Step S204 Acquire a virtual device corresponding to the function combination input by the user, and establish a data connection between the acquired virtual device and the physical UART.
  • Step S206 transmitting data by using the data connection.
  • the traditional UART multiplexing technology cannot dynamically adjust the function combination, which may not satisfy various application scenarios and requirements.
  • obtaining a virtual device corresponding to the function combination input by the user may be implemented by parsing a command from the user, including: receiving a command from the user; parsing the command, acquiring a function combination to be used by the user; acquiring according to the function combination The corresponding virtual device.
  • the corresponding virtual device is determined according to the user's needs (the combination of functions to be used), so that dynamic switching of the function combination according to the user requirement or the application scenario can be implemented.
  • the method before acquiring the virtual device corresponding to the functional combination input by the user, the method further includes: mounting the AT service to the physical UART, wherein the AT service is used to parse the AT command from the user.
  • a data connection is established between the obtained virtual device and the physical UART, and the obtained virtual device corresponding to the function combination to be used by the user can be mounted on the physical UART through the multiplexing layer.
  • establishing a virtual device corresponding to each function of the wireless communication module comprises: establishing a virtual device corresponding to each function; respectively associating each functional unit with a corresponding virtual device.
  • the use of data connections to transmit data includes two aspects: receiving data from the user side and transmitting data to the user side. The following are introduced separately.
  • (1) receiving data from the user side by using the data connection comprising the steps of: receiving the input data of the user, and parsing the input data; determining the target virtual device of the input data and the target functional unit according to the analysis result; inputting the data by using the data connection Send to the target functional unit.
  • the input data is sent to the target virtual device by using a data connection, and then the input virtual data is sent by the target virtual device to its corresponding The target functional unit, thus completing the reception of data.
  • the MUX layer of the wireless communication module parses the user's input to determine which functional unit the data should be processed by.
  • each packet of data is encapsulated by the MUX layer of the wireless communication module, and the data packet includes a header, a trailer, and a check digit.
  • the user determines which virtual device the data belongs to by parsing the packet header.
  • the embodiment of the invention further provides a data transmission device, which is applied to a wireless communication module, and the data transmission device can be used to implement the above data transmission method.
  • the apparatus includes: a first setup module 302, an acquisition module 304, a second setup module 306, and a data transmission module 308.
  • the structure is described in detail below.
  • the first establishing module 302 is configured to establish a virtual device corresponding to each function of the wireless communication module;
  • the obtaining module 304 is connected to the first establishing module 302, and configured to acquire a virtual device corresponding to the functional combination input by the user;
  • the establishing module 306 is connected to the obtaining module 304, and is configured to establish a data connection between the virtual device acquired by the obtaining module 304 and the physical UART.
  • the data transmitting module 308 is connected to the second establishing module 306 for utilizing the second establishing module 306.
  • the established data connection transmits data.
  • the traditional UART multiplexing technology cannot dynamically adjust the function combination, which may not satisfy various application scenarios and requirements.
  • the UART-based wireless communication module by establishing a virtual device corresponding to each function of the wireless communication module, the functions of the plurality of wireless communication modules can be concurrently processed, and the function combination required by the user is established.
  • the dynamic connection of the virtual device to the physical UART realizes dynamic switching of the function combination of the wireless communication module, thereby adapting to different application scenarios. As shown in FIG.
  • the obtaining module 304 includes: a receiving unit 3042, configured to receive a command from a user; a parsing unit 3044, connected to the receiving unit 3042, configured to parse the command received by the receiving unit 3042; and a first obtaining unit 3046, connecting To the parsing unit 3044, it is set to acquire the function combination to be used by the user; the second obtaining unit 3048 is connected to the first obtaining unit 3046, and is configured to acquire the virtual device corresponding thereto according to the function combination acquired by the first obtaining unit 3046.
  • the apparatus further includes: a mounting module, connected to the first establishing module 302, configured to mount the AT service to the physical UART, wherein the AT service is configured to parse the AT command from the user.
  • the second establishing module 306 comprises: a mounting unit configured to mount the acquired virtual device to the physical UART through a multiplexing layer.
  • the first establishing module 302 includes: an establishing unit, configured to establish a virtual device corresponding to each function; and an associating unit, connected to the establishing unit, configured to respectively associate each functional unit with a corresponding virtual device.
  • the data transmission module 308 includes: a receiving unit configured to receive input data of the user; a parsing unit connected to the receiving unit, configured to parse the input data received by the receiving unit; and a determining unit connected to the parsing unit, configured to be configured according to The parsing result of the parsing unit determines the target virtual device of the input data and the target functional unit; the first transmitting unit is connected to the determining unit, and is configured to transmit the input data to the target functional unit determined by the determining unit by using the data connection.
  • the data transmission module 308 includes: a packaging unit configured to encapsulate data to be sent to the user, where the encapsulated data carries information indicating the virtual device to which the data belongs; the second sending unit is connected to the package The unit is configured to send the data encapsulated by the encapsulating unit to the user by using a data connection.
  • a packaging unit configured to encapsulate data to be sent to the user, where the encapsulated data carries information indicating the virtual device to which the data belongs
  • the second sending unit is connected to the package
  • the unit is configured to send the data encapsulated by the encapsulating unit to the user by using a data connection.
  • the data transmission device is applied to a wireless communication module based on a UART interface, and may also be implemented by the following units: a MUX layer multiplexing unit, a virtual device unit, a wireless communication module function unit, and a wireless communication module.
  • Function mount unit a MUX layer multiplexing unit, a virtual device unit, a wireless communication module function unit, and a wireless communication module.
  • the MUX layer multiplexing unit (implementing the function of the data transmission module 308 described above) is configured to parse the data acquired from the physical UART interface and send it to different virtual devices; and is also configured to receive from each virtual device. The incoming data is encoded and sent to the physical UART interface.
  • the virtual device unit (implementing the functions of the first establishing module 302 described above) is configured to establish a plurality of virtual devices and associate the plurality of virtual devices with the plurality of wireless functions.
  • the wireless communication module functional unit is set to provide various wireless module functions.
  • the wireless communication module function mounting unit (implementing the functions of the above obtaining module 304 and the second establishing module 306) is configured to parse the functional combination input by the user and select the virtual device to be used to be mounted on the physical UART interface.
  • the data transmission method that is, the combination of multiple wireless module function concurrent communication and dynamic switching function on the UART port, is as follows: Step 1. When the wireless communication module starts, the AT service is mounted to the physical UART by default. On the interface. Step 2: Establish corresponding multiple virtual devices according to the functions of the wireless communication module. Step 3: Associate the functional unit of the wireless communication module with the established virtual device. Step 4. The user inputs the function combination to be used through the AT command.
  • Step 5 Parse the AT command, dynamically select the virtual device to be used according to the function combination input by the user, and mount the virtual device to the physical UART through the multiplexing layer.
  • Step 6 When transmitting data, the MUX layer encapsulates each packet of data, and the data packet includes a packet header, a packet header, and a check digit. The user determines which virtual device the data belongs to by parsing the data packet header; when receiving the data, the MUX layer determines which functional unit the data should be sent to by processing the user's input.
  • FIG. 5 is a schematic structural diagram of a data transmission system according to a preferred embodiment of the present invention.
  • the system includes a host and a wireless communication module, wherein the wireless communication module includes a MUX layer, a virtual device unit, and a wireless communication module functional unit. And function mount unit.
  • the wireless communication module functional unit is represented by function 1, function 2, and the like.
  • the MUX layer is set to encode and parse data sent or received by the module; the virtual device unit is set to virtualize multiple devices; the wireless communication module functional unit is configured to implement various module functions; and the function mounting unit is configured to mount the virtual device to Physical UART.
  • the MUX layer communicates with the physical UART interface. When the module is powered on, several virtual devices are created according to the supported functions, and the virtual device is associated with the functional unit. When the functional unit combination input by the user is received, the virtual device is established.
  • the data connection between the MUX layers enables dynamic switching of functional combinations.
  • FIG. 6 is a flowchart of initializing a wireless communication module according to a preferred embodiment of the present invention. As shown in FIG. 6, the method includes the following steps:
  • FIG. 7 is a flow chart of functional combination dynamic switching according to a preferred embodiment of the present invention. As shown in FIG. 7, the method includes the following steps: S702: A user inputs an required function combination through an AT command.
  • the module parses the functional combination input by the user.
  • the MUX layer starts to receive or distribute data.
  • the function combination dynamic switching is completed.
  • the function of the 3G module is associated with the virtual device in the existing multiplexing technology, and the function mounting unit is added, and the required virtual device can be mounted on the MUX layer according to the input of the user.
  • the dynamic mounting of the functional combination is realized, which solves the problem that the traditional technology cannot dynamically change the functional combination.
  • the initial function combination is DATA+AT.
  • the foregoing embodiment may be implemented by hardware related to program instructions, and the program may be stored in a readable storage medium, and the program executes the steps corresponding to the foregoing method when executed.
  • the storage medium may be a read only memory (ROM), a random access memory (RAM), a magnetic disk, a compact disk, or the like.
  • a data transmission method and apparatus are provided.
  • a virtual device corresponding to each function of the wireless communication module is established, so that multiple wireless communication module functions can be concurrently processed, that is, multiplexing of multiple wireless module functions is implemented on a single UART interface, and
  • the dynamic combination of the virtual device to the physical UART corresponding to the function combination required by the user realizes dynamic switching of the function combination of the wireless communication module, thereby adapting to different application scenarios.
  • the above modules or steps of the embodiments of the present invention can be implemented by a general computing device, which can be concentrated on a single computing device or distributed in multiple computing devices.
  • the invention is not limited to any specific combination of hardware and software.
  • the above is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

Disclosed are a data transmission method and device. The method comprises: establishing virtual devices corresponding to functions of a wireless communication module; obtaining a virtual device corresponding to a function combination input by a user, and establishing a data connection between the obtained virtual device and a physical UART; transmitting data by using the data connection. In the present invention, for a UART-based wireless communication module, virtual devices respectively corresponding to functions of the wireless communication module are established, so that multiple functions of the wireless communication module can undergo concurrent processing; further, a dynamic connection from a virtual device corresponding to a function combination required to be used by a user to a physical UART is established, so as to realize dynamic switching of function combinations of the wireless communication module, thereby achieving suitability in different application scenarios.

Description

数据传输方法及装置  Data transmission method and device
技术领域 本发明涉及通信领域, 具体而言, 涉及一种数据传输方法及装置。 背景技术 无线通讯模块是一种常见的无线终端产品, 广泛用于工业控制、智能家居、 车载、 平板电脑等包含无线通讯功能的产品中。 由于其使用范围广泛、 应用场景复杂, 需要 寻找一种通用的接口形式,能够使得无线通讯模块和各种操作系统甚至是单片机连通。 通用异步接收 /发送 (Universal Asynchronous Receiver/Transmitter, 简称为 UART) 是一种通用串行数据总线, 用于异步通信, 其接口形式简单, 操作方便, 被广泛地使 用在各种系统和单片机中, 因此支持 UART接口对于无线通讯模块是十分重要的。 无线通讯模块向用户提供了多种功能, 例如: AT控制、 数据、 诊断、 全球定位服 务 (Global Position Service, 简称为 GPS) 等, 这就需要在单 UART接口上并行多个 功能。 同时, 由于使用场景的多样性, 需要动态的切换多个功能组合来适应不同的场 景和需求。 例如, 在某些应用场景下, 主机系统仅包含 UART接口, 这就需要将可能 使用到的功能单元都挂载到单一的物理 UART口上, 但是在另外一些应用场景中, 主 机具有 UART和通用串行总线 (Universal Serial Bus, 简称为 USB) 两个接口, 这时 候可能需要将对速率要求高的功能挂载到 USB上, 这就涉及到功能组合的动态切换。 但是, 传统的 UART复用技术不能动态地调整功能组合单元, 只具有一种功能组 合, 功能组合无法根据需要进行改变, 不能同时满足多种应用场景和需求。 图 1是根据相关技术的基于 UART接口的无线通讯模块与主机的结构示意图, 如 图 1所示, 无线通讯模块 (图 1中简称为模块) 包括多路复用 (Multiplexing, 简称为 MUX) 层和无线通讯功能单元 (图 1中简单表示为功能 1、 功能 2、 功能 3 )。 无线通 讯功能单元的输出数据直接传送到 MUX层, 经编码后发送到用户侧 (即主机侧), 用 户侧 MUX层解码数据得到各无线通讯功能单元对应的实际数据。 用户侧发送的数据 到达无线通讯模块后首先经过 MUX层解析, 然后分发给各个无线通讯功能单元。 在 图 1所示的示意图中, 各无线通讯功能单元和 MUX层紧密结合, 功能组合在模块上 电的时候确定, 无法动态改变功能组合。 发明内容 本发明实施例提供了一种数据传输方法及装置, 以至少解决相关技术中, 传统的 UART复用技术无法动态地调整功能组合,导致不能满足多种应用场景和需求的问题。 根据本发明实施例的一个方面, 提供了一种数据传输方法, 包括: 建立与无线通 讯模块各个功能相对应的虚拟设备; 获取与用户输入的功能组合相对应的虚拟设备, 并在获取的虚拟设备与物理 UART之间建立数据连接; 利用上述数据连接传输数据。 优选地, 获取与用户输入的功能组合相对应的虚拟设备包括: 接收到来自用户的 命令; 解析命令, 获取用户要使用的功能组合; 根据功能组合获取与其对应的虚拟设 备。 优选地,在获取与用户输入的功能组合相对应的虚拟设备之前, 上述方法还包括: 将 AT服务挂载到物理 UART上, 其中, AT服务用于解析来自用户的 AT命令。 优选地, 在获取的虚拟设备与物理 UART之间建立数据连接包括: 将获取的虚拟 设备通过多路复用层挂载到物理 UART上。 优选地, 建立与无线通讯模块各个功能相对应的虚拟设备包括: 建立与各个功能 相对应的虚拟设备; 分别将各个功能单元与其对应的虚拟设备进行关联。 优选地, 利用数据连接传输数据包括: 接收到用户的输入数据, 并解析输入数据; 根据解析结果确定输入数据的目标虚拟设备以及目标功能单元; 利用数据连接将输入 数据发送到目标功能单元。 优选地, 利用数据连接传输数据包括: 对需要发送给用户的数据进行封装, 其中, 封装后的数据携带有用于指示数据所属的虚拟设备的信息; 利用数据连接将数据发送 给用户。 根据本发明实施例的另一方面,提供了一种数据传输装置,应用于无线通讯模块, 包括: 第一建立模块, 设置为建立与无线通讯模块各个功能相对应的虚拟设备; 获取 模块, 设置为获取与用户输入的功能组合相对应的虚拟设备; 第二建立模块, 设置为 在获取的虚拟设备与物理通用异步接收 /发送 UART之间建立数据连接; 数据传输模 块, 设置为利用数据连接传输数据。 优选地, 获取模块包括: 接收单元, 设置为接收来自用户的命令; 解析单元, 设 置为解析命令; 第一获取单元, 设置为获取用户要使用的功能组合; 第二获取单元, 设置为根据功能组合获取与其对应的虚拟设备。 优选地, 第二建立模块包括: 挂载单元, 设置为将获取的虚拟设备通过多路复用 层挂载到物理 UART上。 通过本发明实施例, 针对基于 UART的无线通讯模块, 建立与无线通讯模块各个 功能分别对应的虚拟设备, 使得多个无线通讯模块功能可以并发处理, 并且通过建立 用户需要使用的功能组合对应的虚拟设备到物理 UART的动态连接, 实现了无线通讯 模块功能组合的动态切换, 从而适应不同的应用场景。 附图说明 此处所说明的附图用来提供对本发明实施例的进一步理解,构成本申请的一部分, 本发明的示意性实施例及其说明用于解释本发明, 并不构成对本发明的不当限定。 在 附图中- 图 1是根据相关技术的基于 UART接口的无线通讯模块与主机的结构示意图; 图 2是根据本发明实施例的数据传输方法的流程图; 图 3是根据本发明实施例的数据传输装置的结构框图; 图 4是根据本发明优选实施例的数据传输装置的结构框图; 图 5是根据本发明优选实施例的数据传输系统的结构示意图; 图 6是根据本发明优选实施例的无线通讯模块初始化的流程图; 图 7是根据本发明优选实施例的功能组合动态切换的流程图。 具体实施方式 需要说明的是, 在不冲突的情况下, 本申请中的实施例及实施例中的特征可以相 互组合。 下面将参考附图并结合实施例来详细说明本发明。 本发明实施例提供了一种数据传输方法, 图 2是根据本发明实施例的数据传输方 法的流程图, 如图 2所示, 包括如下的步骤 S202至步骤 S206。 步骤 S202, 建立与无线通讯模块各个功能相对应的虚拟设备。 步骤 S204, 获取与用户输入的功能组合相对应的虚拟设备, 并在获取的虚拟设备 与物理 UART之间建立数据连接。 步骤 S206, 利用该数据连接传输数据。 相关技术中, 传统的 UART复用技术无法动态地调整功能组合, 导致不能满足多 种应用场景和需求。 本发明实施例中, 针对基于 UART的无线通讯模块, 通过建立与 无线通讯模块各个功能分别对应的虚拟设备, 使得多个无线通讯模块功能可以并发处 理,并且通过建立用户需要使用的功能组合对应的虚拟设备到物理 UART的动态连接, 实现了无线通讯模块功能组合的动态切换, 从而适应不同的应用场景。 步骤 S204中,获取与用户输入的功能组合相对应的虚拟设备可以通过解析来自用 户的命令实现, 包括: 接收到来自用户的命令; 解析命令, 获取用户要使用的功能组 合; 根据功能组合获取与其对应的虚拟设备。 本优选实施例中, 根据用户的需求 (要 使用的功能组合),确定对应的虚拟设备, 从而可以实现根据用户需求或者应用场景进 行功能组合的动态切换。 优选地,在获取与用户输入的功能组合相对应的虚拟设备之前, 上述方法还包括: 将 AT服务挂载到物理 UART上, 其中, AT服务用于解析来自用户的 AT命令。 在获取的虚拟设备与物理 UART之间建立数据连接, 可以将获取的与用户要使用 的功能组合对应的虚拟设备通过多路复用层挂载到物理 UART上。 优选地, 建立与无线通讯模块各个功能相对应的虚拟设备包括: 建立与各个功能 相对应的虚拟设备; 分别将各个功能单元与其对应的虚拟设备进行关联。 利用数据连接传输数据包括两个方面: 接收来自用户侧的数据、 向用户侧发送数 据。 下面分别加以介绍。 TECHNICAL FIELD The present invention relates to the field of communications, and in particular to a data transmission method and apparatus. BACKGROUND OF THE INVENTION A wireless communication module is a common wireless terminal product widely used in products including wireless communication functions such as industrial control, smart home, car, tablet, and the like. Due to its wide range of applications and complex application scenarios, it is necessary to find a universal interface form that enables wireless communication modules to communicate with various operating systems and even single-chip microcomputers. Universal Asynchronous Receiver/Transmitter (UART) is a universal serial data bus for asynchronous communication. Its interface is simple and easy to operate. It is widely used in various systems and microcontrollers. Therefore, supporting the UART interface is very important for the wireless communication module. The wireless communication module provides users with various functions, such as: AT control, data, diagnosis, Global Position Service (GPS), etc., which requires paralleling multiple functions on a single UART interface. At the same time, due to the diversity of usage scenarios, multiple combinations of functions need to be dynamically switched to adapt to different scenarios and needs. For example, in some application scenarios, the host system only contains the UART interface, which requires mounting the functional units that may be used to a single physical UART port. However, in other application scenarios, the host has a UART and a universal string. Two serial ports (Universal Serial Bus, USB for short), this time may need to mount the function with high speed requirements to the USB, which involves dynamic switching of the function combination. However, the traditional UART multiplexing technology cannot dynamically adjust the function combination unit, and only has one function combination. The function combination cannot be changed as needed, and cannot simultaneously satisfy multiple application scenarios and requirements. 1 is a schematic structural diagram of a wireless communication module and a host based on a UART interface according to the related art. As shown in FIG. 1, a wireless communication module (referred to as a module in FIG. 1) includes a multiplexing (MUX) layer. And the wireless communication function unit (simplified in Figure 1 is function 1, function 2, function 3). The output data of the wireless communication function unit is directly transmitted to the MUX layer, and is encoded and sent to the user side (ie, the host side), and the user side MUX layer decodes the data to obtain the actual data corresponding to each wireless communication function unit. After the data sent by the user side arrives at the wireless communication module, it is first parsed by the MUX layer and then distributed to each wireless communication function unit. In the schematic diagram shown in FIG. 1, each wireless communication function unit and the MUX layer are closely combined, and the function combination is determined when the module is powered on, and the function combination cannot be dynamically changed. SUMMARY OF THE INVENTION The embodiments of the present invention provide a data transmission method and apparatus, so as to at least solve the related art, the traditional UART multiplexing technology cannot dynamically adjust the function combination, resulting in failure to meet various application scenarios and requirements. According to an aspect of the embodiments of the present invention, a data transmission method is provided, including: establishing a virtual device corresponding to each function of a wireless communication module; acquiring a virtual device corresponding to a function combination input by the user, and acquiring the virtual device A data connection is established between the device and the physical UART; data is transmitted using the above data connection. Preferably, obtaining the virtual device corresponding to the function combination input by the user comprises: receiving a command from the user; parsing the command, acquiring a function combination to be used by the user; and acquiring the virtual device corresponding thereto according to the function combination. Preferably, before acquiring the virtual device corresponding to the functional combination input by the user, the method further includes: mounting the AT service to the physical UART, wherein the AT service is used to parse the AT command from the user. Preferably, establishing a data connection between the acquired virtual device and the physical UART comprises: mounting the acquired virtual device to the physical UART through a multiplexing layer. Preferably, establishing a virtual device corresponding to each function of the wireless communication module comprises: establishing a virtual device corresponding to each function; respectively associating each functional unit with a corresponding virtual device. Preferably, transmitting data by using the data connection comprises: receiving input data of the user, and parsing the input data; determining the target virtual device of the input data and the target functional unit according to the parsing result; and transmitting the input data to the target functional unit by using the data connection. Preferably, transmitting the data by using the data connection comprises: encapsulating data that needs to be sent to the user, wherein the encapsulated data carries information indicating the virtual device to which the data belongs; and the data is sent to the user by using the data connection. According to another aspect of the present invention, a data transmission apparatus is provided, which is applied to a wireless communication module, including: a first establishing module, configured to establish a virtual device corresponding to each function of the wireless communication module; acquiring a module, setting To obtain a virtual device corresponding to the function combination input by the user; a second establishing module, configured to establish a data connection between the acquired virtual device and the physical universal asynchronous receiving/transmitting UART; and a data transmission module configured to transmit by using the data connection data. Preferably, the obtaining module comprises: a receiving unit configured to receive a command from the user; a parsing unit configured to parse the command; a first obtaining unit configured to acquire a function combination to be used by the user; and a second obtaining unit configured to perform the function according to the function Get the virtual device corresponding to it in combination. Preferably, the second establishing module comprises: a mounting unit configured to mount the acquired virtual device to the physical UART through the multiplexing layer. According to the embodiment of the present invention, a virtual device corresponding to each function of the wireless communication module is established for the UART-based wireless communication module, so that the functions of the plurality of wireless communication modules can be concurrently processed, and the virtual combination corresponding to the function combination required by the user is established. The dynamic connection of the device to the physical UART realizes dynamic switching of the function combination of the wireless communication module, thereby adapting to different application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings, which are set to illustrate,,,,,, . 1 is a schematic structural diagram of a UART interface-based wireless communication module and a host according to the related art; FIG. 2 is a flowchart of a data transmission method according to an embodiment of the present invention; FIG. 3 is a flowchart according to an embodiment of the present invention. Figure 4 is a block diagram showing the structure of a data transmission device in accordance with a preferred embodiment of the present invention; Figure 5 is a block diagram showing the structure of a data transmission system in accordance with a preferred embodiment of the present invention; Flowchart of Wireless Communication Module Initialization; Figure 7 is a flow diagram of functional combination dynamic switching in accordance with a preferred embodiment of the present invention. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS It should be noted that the embodiments in the present application and the features in the embodiments may be combined with each other without conflict. The invention will be described in detail below with reference to the drawings in conjunction with the embodiments. The embodiment of the present invention provides a data transmission method. FIG. 2 is a flowchart of a data transmission method according to an embodiment of the present invention. As shown in FIG. 2, the following steps S202 to S206 are included. Step S202, establishing a virtual device corresponding to each function of the wireless communication module. Step S204: Acquire a virtual device corresponding to the function combination input by the user, and establish a data connection between the acquired virtual device and the physical UART. Step S206, transmitting data by using the data connection. In the related art, the traditional UART multiplexing technology cannot dynamically adjust the function combination, which may not satisfy various application scenarios and requirements. In the embodiment of the present invention, for the UART-based wireless communication module, by establishing a virtual device corresponding to each function of the wireless communication module, the functions of the plurality of wireless communication modules can be concurrently processed, and the function combination required by the user is established. The dynamic connection of the virtual device to the physical UART realizes dynamic switching of the function combination of the wireless communication module, thereby adapting to different application scenarios. In step S204, obtaining a virtual device corresponding to the function combination input by the user may be implemented by parsing a command from the user, including: receiving a command from the user; parsing the command, acquiring a function combination to be used by the user; acquiring according to the function combination The corresponding virtual device. In the preferred embodiment, the corresponding virtual device is determined according to the user's needs (the combination of functions to be used), so that dynamic switching of the function combination according to the user requirement or the application scenario can be implemented. Preferably, before acquiring the virtual device corresponding to the functional combination input by the user, the method further includes: mounting the AT service to the physical UART, wherein the AT service is used to parse the AT command from the user. A data connection is established between the obtained virtual device and the physical UART, and the obtained virtual device corresponding to the function combination to be used by the user can be mounted on the physical UART through the multiplexing layer. Preferably, establishing a virtual device corresponding to each function of the wireless communication module comprises: establishing a virtual device corresponding to each function; respectively associating each functional unit with a corresponding virtual device. The use of data connections to transmit data includes two aspects: receiving data from the user side and transmitting data to the user side. The following are introduced separately.
( 1 ) 利用数据连接接收来自用户侧的数据, 包括如下步骤: 接收到用户的输入数据, 并解析输入数据; 根据解析结果确定输入数据的目标虚 拟设备以及目标功能单元; 利用数据连接将输入数据发送到目标功能单元。 本优选实 施例中, 根据输入数据确定目标虚拟设备以及对应的目标功能单元后, 利用数据连接 将该输入数据发送到目标虚拟设备, 然后由目标虚拟设备发送该输入数据到其对应的 目标功能单元, 从而完成了数据的接收。 在实际应用中, 由无线通讯模块的 MUX层 解析用户的输入来确定该数据应该由哪个功能单元进行处理。 (1) receiving data from the user side by using the data connection, comprising the steps of: receiving the input data of the user, and parsing the input data; determining the target virtual device of the input data and the target functional unit according to the analysis result; inputting the data by using the data connection Send to the target functional unit. In the preferred embodiment, after the target virtual device and the corresponding target functional unit are determined according to the input data, the input data is sent to the target virtual device by using a data connection, and then the input virtual data is sent by the target virtual device to its corresponding The target functional unit, thus completing the reception of data. In practical applications, the MUX layer of the wireless communication module parses the user's input to determine which functional unit the data should be processed by.
(2) 利用数据连接向用户侧发送数据, 包括如下步骤: 对需要发送给用户的数据进行封装, 其中, 封装后的数据携带有用于指示该数据 所属的虚拟设备的信息; 利用数据连接将上述数据发送给用户。 在实际应用中, 由无 线通讯模块的 MUX层对每一包数据进行封装, 数据包包括包头、 包尾和校验位。 用 户接收到该数据后, 通过解析数据包头确定数据属于哪个虚拟设备。 本发明实施例还提供了一种数据传输装置, 应用于无线通讯模块, 该数据传输装 置可以用于实现上述数据传输方法。 图 3是根据本发明实施例的数据传输装置的结构 框图, 如图 3所示, 该装置包括: 第一建立模块 302、 获取模块 304、 第二建立模块 306和数据传输模块 308。 下面对其结构进行详细介绍。 第一建立模块 302, 设置为建立与无线通讯模块各个功能相对应的虚拟设备; 获 取模块 304,连接至第一建立模块 302, 设置为获取与用户输入的功能组合相对应的虚 拟设备; 第二建立模块 306, 连接至获取模块 304, 设置为在获取模块 304获取的虚拟 设备与物理 UART之间建立数据连接; 数据传输模块 308, 连接至第二建立模块 306, 用于利用第二建立模块 306建立的数据连接传输数据。 相关技术中, 传统的 UART复用技术无法动态地调整功能组合, 导致不能满足多 种应用场景和需求。 本发明实施例中, 针对基于 UART的无线通讯模块, 通过建立与 无线通讯模块各个功能分别对应的虚拟设备, 使得多个无线通讯模块功能可以并发处 理,并且通过建立用户需要使用的功能组合对应的虚拟设备到物理 UART的动态连接, 实现了无线通讯模块功能组合的动态切换, 从而适应不同的应用场景。 如图 4所示, 获取模块 304包括: 接收单元 3042, 设置为接收来自用户的命令; 解析单元 3044, 连接至接收单元 3042, 设置为解析接收单元 3042接收的命令; 第一 获取单元 3046, 连接至解析单元 3044, 设置为获取用户要使用的功能组合; 第二获取 单元 3048, 连接至第一获取单元 3046, 设置为根据第一获取单元 3046获取的功能组 合获取与其对应的虚拟设备。 优选地, 上述装置还包括: 挂载模块, 连接至第一建立模块 302, 设置为将 AT服 务挂载到物理 UART上, 其中, AT服务设置为解析来自用户的 AT命令。 优选地, 第二建立模块 306包括: 挂载单元, 设置为将获取的虚拟设备通过多路 复用层挂载到物理 UART上。 优选地, 第一建立模块 302包括: 建立单元, 设置为建立与各个功能相对应的虚 拟设备; 关联单元, 连接至建立单元, 设置为分别将各个功能单元与其对应的虚拟设 备进行关联。 优选地, 数据传输模块 308包括: 接收单元, 设置为接收到用户的输入数据; 解 析单元, 连接至接收单元, 设置为解析接收单元接收的输入数据; 确定单元, 连接至 解析单元, 设置为根据解析单元的解析结果确定输入数据的目标虚拟设备以及目标功 能单元; 第一发送单元, 连接至确定单元, 设置为利用数据连接将输入数据发送到确 定单元确定的目标功能单元。 优选地, 数据传输模块 308包括: 封装单元, 设置为对需要发送给用户的数据进 行封装, 其中, 封装后的数据携带有用于指示数据所属的虚拟设备的信息; 第二发送 单元, 连接至封装单元, 设置为利用数据连接将封装单元封装的数据发送给用户。 需要说明的是, 装置实施例中描述的数据传输装置对应于上述的方法实施例, 其 具体的实现过程可以结合方法实施例中的详细说明进行理解。 为了使本发明实施例的技术方案和实现方法更加清楚, 下面将结合优选的实施例 对其实现过程进行详细描述。 在一个优选实施例中, 上述数据传输装置, 应用于基于 UART接口的无线通讯模 块, 也可以采用如下单元实现: MUX层多路复用单元、虚拟设备单元、无线通讯模块 功能单元、 无线通讯模块功能挂载单元。 其中, MUX层多路复用单元 (实现了上述数据传输模块 308的功能), 设置为解 析从物理 UART接口上获取的数据, 发送到不同的虚拟设备上; 还用于对从各虚拟设 备接收到的数据进行编码并发送到物理 UART接口上。 虚拟设备单元(实现了上述第一建立模块 302的功能),设置为建立多个虚拟设备, 并将多个虚拟设备和多个无线功能进行关联。 无线通讯模块功能单元, 设置为提供各种无线模块功能。 无线通讯模块功能挂载单元 (实现了上述获取模块 304和第二建立模块 306的功 能), 设置为解析用户输入的功能组合并选择要使用的虚拟设备挂载到物理 UART接 口上。 在一个优选实施例中, 上述数据传输方法, 即 UART口上多个无线模块功能并发 通讯和动态切换功能组合的流程, 如下: 步骤 1、 无线通讯模块启动时, 默认将 AT服务挂载到物理 UART接口上。 步骤 2、 根据无线通讯模块具有的功能, 建立对应的多个虚拟设备。 步骤 3、 将无线通讯模块的功能单元与所建立的虚拟设备分别进行关联。 步骤 4、 用户通过 AT命令输入要使用的功能组合。 步骤 5、解析 AT命令, 根据用户输入的功能组合动态选择要使用的虚拟设备, 并 将上述虚拟设备通过多路复用层挂载到物理 UART上。 步骤 6、 发送数据时, MUX层对每一包数据进行封装, 数据包包括包头、 包尾和 校验位。用户通过解析数据包头确定数据属于哪个虚拟设备; 接收数据时, MUX层通 过解析用户的输入来确定该数据应该发送给哪个功能单元进行处理。 由此可见, 通过在物理 UART接口基础上建立多个虚拟设备的方法, 解决了多个 无线通讯模块功能并发处理的问题, 通过虚拟设备到物理 UART的动态挂载实现了无 线通讯模块功能组合的动态切换。 图 5是根据本发明优选实施例的数据传输系统的结构示意图, 如图 5所示, 该系 统包括主机和无线通讯模块, 其中, 无线通讯模块包括 MUX层、 虚拟设备单元、 无 线通讯模块功能单元和功能挂载单元。 图 5中以功能 1、 功能 2等表示无线通讯模块 功能单元。 (2) transmitting data to the user side by using the data connection, including the following steps: encapsulating data that needs to be sent to the user, where the encapsulated data carries information indicating the virtual device to which the data belongs; The data is sent to the user. In practical applications, each packet of data is encapsulated by the MUX layer of the wireless communication module, and the data packet includes a header, a trailer, and a check digit. After receiving the data, the user determines which virtual device the data belongs to by parsing the packet header. The embodiment of the invention further provides a data transmission device, which is applied to a wireless communication module, and the data transmission device can be used to implement the above data transmission method. FIG. 3 is a structural block diagram of a data transmission apparatus according to an embodiment of the present invention. As shown in FIG. 3, the apparatus includes: a first setup module 302, an acquisition module 304, a second setup module 306, and a data transmission module 308. The structure is described in detail below. The first establishing module 302 is configured to establish a virtual device corresponding to each function of the wireless communication module; the obtaining module 304 is connected to the first establishing module 302, and configured to acquire a virtual device corresponding to the functional combination input by the user; The establishing module 306 is connected to the obtaining module 304, and is configured to establish a data connection between the virtual device acquired by the obtaining module 304 and the physical UART. The data transmitting module 308 is connected to the second establishing module 306 for utilizing the second establishing module 306. The established data connection transmits data. In the related art, the traditional UART multiplexing technology cannot dynamically adjust the function combination, which may not satisfy various application scenarios and requirements. In the embodiment of the present invention, for the UART-based wireless communication module, by establishing a virtual device corresponding to each function of the wireless communication module, the functions of the plurality of wireless communication modules can be concurrently processed, and the function combination required by the user is established. The dynamic connection of the virtual device to the physical UART realizes dynamic switching of the function combination of the wireless communication module, thereby adapting to different application scenarios. As shown in FIG. 4, the obtaining module 304 includes: a receiving unit 3042, configured to receive a command from a user; a parsing unit 3044, connected to the receiving unit 3042, configured to parse the command received by the receiving unit 3042; and a first obtaining unit 3046, connecting To the parsing unit 3044, it is set to acquire the function combination to be used by the user; the second obtaining unit 3048 is connected to the first obtaining unit 3046, and is configured to acquire the virtual device corresponding thereto according to the function combination acquired by the first obtaining unit 3046. Preferably, the apparatus further includes: a mounting module, connected to the first establishing module 302, configured to mount the AT service to the physical UART, wherein the AT service is configured to parse the AT command from the user. Preferably, the second establishing module 306 comprises: a mounting unit configured to mount the acquired virtual device to the physical UART through a multiplexing layer. Preferably, the first establishing module 302 includes: an establishing unit, configured to establish a virtual device corresponding to each function; and an associating unit, connected to the establishing unit, configured to respectively associate each functional unit with a corresponding virtual device. Preferably, the data transmission module 308 includes: a receiving unit configured to receive input data of the user; a parsing unit connected to the receiving unit, configured to parse the input data received by the receiving unit; and a determining unit connected to the parsing unit, configured to be configured according to The parsing result of the parsing unit determines the target virtual device of the input data and the target functional unit; the first transmitting unit is connected to the determining unit, and is configured to transmit the input data to the target functional unit determined by the determining unit by using the data connection. Preferably, the data transmission module 308 includes: a packaging unit configured to encapsulate data to be sent to the user, where the encapsulated data carries information indicating the virtual device to which the data belongs; the second sending unit is connected to the package The unit is configured to send the data encapsulated by the encapsulating unit to the user by using a data connection. It should be noted that the data transmission device described in the device embodiment corresponds to the foregoing method embodiment, and the specific implementation process can be understood in conjunction with the detailed description in the method embodiment. In order to make the technical solutions and implementation methods of the embodiments of the present invention clearer, the implementation process will be described in detail below in conjunction with the preferred embodiments. In a preferred embodiment, the data transmission device is applied to a wireless communication module based on a UART interface, and may also be implemented by the following units: a MUX layer multiplexing unit, a virtual device unit, a wireless communication module function unit, and a wireless communication module. Function mount unit. The MUX layer multiplexing unit (implementing the function of the data transmission module 308 described above) is configured to parse the data acquired from the physical UART interface and send it to different virtual devices; and is also configured to receive from each virtual device. The incoming data is encoded and sent to the physical UART interface. The virtual device unit (implementing the functions of the first establishing module 302 described above) is configured to establish a plurality of virtual devices and associate the plurality of virtual devices with the plurality of wireless functions. The wireless communication module functional unit is set to provide various wireless module functions. The wireless communication module function mounting unit (implementing the functions of the above obtaining module 304 and the second establishing module 306) is configured to parse the functional combination input by the user and select the virtual device to be used to be mounted on the physical UART interface. In a preferred embodiment, the data transmission method, that is, the combination of multiple wireless module function concurrent communication and dynamic switching function on the UART port, is as follows: Step 1. When the wireless communication module starts, the AT service is mounted to the physical UART by default. On the interface. Step 2: Establish corresponding multiple virtual devices according to the functions of the wireless communication module. Step 3: Associate the functional unit of the wireless communication module with the established virtual device. Step 4. The user inputs the function combination to be used through the AT command. Step 5: Parse the AT command, dynamically select the virtual device to be used according to the function combination input by the user, and mount the virtual device to the physical UART through the multiplexing layer. Step 6. When transmitting data, the MUX layer encapsulates each packet of data, and the data packet includes a packet header, a packet header, and a check digit. The user determines which virtual device the data belongs to by parsing the data packet header; when receiving the data, the MUX layer determines which functional unit the data should be sent to by processing the user's input. It can be seen that the method of establishing multiple virtual devices based on the physical UART interface solves the problem of concurrent processing of multiple wireless communication modules, and realizes the functional combination of the wireless communication modules through the dynamic mounting of the virtual device to the physical UART. Dynamic switching. 5 is a schematic structural diagram of a data transmission system according to a preferred embodiment of the present invention. As shown in FIG. 5, the system includes a host and a wireless communication module, wherein the wireless communication module includes a MUX layer, a virtual device unit, and a wireless communication module functional unit. And function mount unit. In Fig. 5, the wireless communication module functional unit is represented by function 1, function 2, and the like.
MUX层设置为编码、解析模块发送或接收到的数据;虚拟设备单元设置为虚拟出 多个设备; 无线通讯模块功能单元设置为实现各种模块功能; 功能挂载单元设置为挂 载虚拟设备到物理的 UART上。 MUX层和物理 UART接口进行通讯, 在模块上电的时候根据所支持的功能创建 若干个虚拟设备, 并将虚拟设备和功能单元关联, 当接收到用户输入的功能单元组合 时, 建立虚拟设备到 MUX层之间的数据连接, 实现功能组合的动态切换。 图 6是根据本发明优选实施例的无线通讯模块初始化的流程图, 如图 6所示, 包 括如下步骤: The MUX layer is set to encode and parse data sent or received by the module; the virtual device unit is set to virtualize multiple devices; the wireless communication module functional unit is configured to implement various module functions; and the function mounting unit is configured to mount the virtual device to Physical UART. The MUX layer communicates with the physical UART interface. When the module is powered on, several virtual devices are created according to the supported functions, and the virtual device is associated with the functional unit. When the functional unit combination input by the user is received, the virtual device is established. The data connection between the MUX layers enables dynamic switching of functional combinations. FIG. 6 is a flowchart of initializing a wireless communication module according to a preferred embodiment of the present invention. As shown in FIG. 6, the method includes the following steps:
S602, 模块上电启动。 S602, the module is powered on.
S604, 根据模块具有的功能创建若干个与功能对应的虚拟设备。 S606, 初始化模块的功能。 S604. Create a plurality of virtual devices corresponding to the functions according to the functions of the module. S606, the function of the initialization module.
S608, 挂载 AT服务到物理的 UART上。 S610, 模块初始化完成。 图 7是根据本发明优选实施例的功能组合动态切换的流程图, 如图 7所示, 包括 如下步骤: S702, 用户通过 AT命令输入所需的功能组合。 S608, mount the AT service to the physical UART. S610, the module initialization is completed. FIG. 7 is a flow chart of functional combination dynamic switching according to a preferred embodiment of the present invention. As shown in FIG. 7, the method includes the following steps: S702: A user inputs an required function combination through an AT command.
S704, 模块解析用户输入的功能组合。 S704, the module parses the functional combination input by the user.
S706, 挂载功能组合到对应的虚拟设备上。 S706: The mounting function is combined to the corresponding virtual device.
S708, 挂载用到的虚拟设备到多路复用 (MUX) 层。 S708, mounting the used virtual device to the multiplex (MUX) layer.
S710, MUX层开始接收或分发数据。 S712, 功能组合动态切换完成。 本发明实施例在现有的多路复用技术上将 3G模块的功能与虚拟设备相关联, 同 时添加功能挂载单元, 可以根据用户的输入将所需要的虚拟设备挂载到 MUX层上, 实现了功能组合的动态挂载, 解决了传统技术无法动态改变功能组合的问题。 比如: 初始化的功能组合为 DATA+AT, 如果想使用 GPS功能, 则可以动态切换功能组合为
Figure imgf000010_0001
需要说明的是, 上述实施例可以通过程序指令相关的硬件来完成, 所述的程序可 以存储于可读取存储介质中, 该程序在执行时执行上述方法对应的步骤。 上述存储介 质可以是只读存储器(Read Only Memory,简称为 ROM) /随机存取器( Random Access Memory, 简称为 RAM)、 磁盘、 光碟等。 需要说明的是, 在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的 计算机系统中执行, 并且, 虽然在流程图中示出了逻辑顺序, 但是在某些情况下, 可 以以不同于此处的顺序执行所示出或描述的步骤。 综上所述, 根据的本发明上述实施例, 提供了一种数据传输方法及装置。 通过本 发明实施例, 建立与无线通讯模块各个功能分别对应的虚拟设备, 使得多个无线通讯 模块功能可以并发处理, 即在单一的 UART接口上实现多个无线模块功能的复用, 并 且通过建立用户需要使用的功能组合对应的虚拟设备到物理 UART的动态连接, 实现 了无线通讯模块功能组合的动态切换, 从而适应不同的应用场景。 显然, 本领域的技术人员应该明白, 上述的本发明实施例的各模块或各步骤可以 用通用的计算装置来实现, 它们可以集中在单个的计算装置上, 或者分布在多个计算 装置所组成的网络上, 可选地, 它们可以用计算装置可执行的程序代码来实现, 从而, 可以将它们存储在存储装置中由计算装置来执行, 或者将它们分别制作成各个集成电 路模块, 或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。 这样, 本 发明不限制于任何特定的硬件和软件结合。 以上所述仅为本发明的优选实施例而已, 并不用于限制本发明, 对于本领域的技 术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则之内, 所作的 任何修改、 等同替换、 改进等, 均应包含在本发明的保护范围之内。
S710, the MUX layer starts to receive or distribute data. S712, the function combination dynamic switching is completed. In the embodiment of the present invention, the function of the 3G module is associated with the virtual device in the existing multiplexing technology, and the function mounting unit is added, and the required virtual device can be mounted on the MUX layer according to the input of the user. The dynamic mounting of the functional combination is realized, which solves the problem that the traditional technology cannot dynamically change the functional combination. For example: The initial function combination is DATA+AT. If you want to use the GPS function, you can dynamically switch the function combination to
Figure imgf000010_0001
It should be noted that the foregoing embodiment may be implemented by hardware related to program instructions, and the program may be stored in a readable storage medium, and the program executes the steps corresponding to the foregoing method when executed. The storage medium may be a read only memory (ROM), a random access memory (RAM), a magnetic disk, a compact disk, or the like. It should be noted that the steps shown in the flowchart of the accompanying drawings may be performed in a computer system such as a set of computer executable instructions, and, although the logical order is shown in the flowchart, in some cases, The steps shown or described may be performed in an order different than that herein. In summary, according to the above embodiment of the present invention, a data transmission method and apparatus are provided. Through the embodiment of the present invention, a virtual device corresponding to each function of the wireless communication module is established, so that multiple wireless communication module functions can be concurrently processed, that is, multiplexing of multiple wireless module functions is implemented on a single UART interface, and The dynamic combination of the virtual device to the physical UART corresponding to the function combination required by the user realizes dynamic switching of the function combination of the wireless communication module, thereby adapting to different application scenarios. Obviously, those skilled in the art should understand that the above modules or steps of the embodiments of the present invention can be implemented by a general computing device, which can be concentrated on a single computing device or distributed in multiple computing devices. Alternatively, they may be implemented by program code executable by the computing device, such that they may be stored in the storage device by the computing device, or they may be separately fabricated into individual integrated circuit modules, or Multiple of these modules or steps are fabricated as a single integrated circuit module. Thus, the invention is not limited to any specific combination of hardware and software. The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and scope of the present invention are intended to be included within the scope of the present invention.

Claims

权 利 要 求 书 Claim
1. 一种数据传输方法, 包括: 1. A method of data transmission, comprising:
建立与无线通讯模块各个功能相对应的虚拟设备;  Establishing a virtual device corresponding to each function of the wireless communication module;
获取与用户输入的功能组合相对应的虚拟设备, 并在获取的虚拟设备与物 理通用异步接收 /发送 UART之间建立数据连接;  Obtaining a virtual device corresponding to a combination of functions input by the user, and establishing a data connection between the acquired virtual device and the physical universal asynchronous receiving/transmitting UART;
利用所述数据连接传输数据。  Data is transmitted using the data connection.
2. 根据权利要求 1所述的方法, 其中, 获取与用户输入的功能组合相对应的虚拟 设备包括- 接收到来自所述用户的命令; 2. The method of claim 1, wherein obtaining a virtual device corresponding to a functional combination input by a user comprises - receiving a command from the user;
解析所述命令, 获取所述用户要使用的功能组合;  Parsing the command to obtain a combination of functions to be used by the user;
根据所述功能组合获取与其对应的虚拟设备。  The virtual device corresponding thereto is obtained according to the function combination.
3. 根据权利要求 2所述的方法, 其中, 在获取与用户输入的功能组合相对应的虚 拟设备之前, 所述方法还包括: The method according to claim 2, wherein, before acquiring the virtual device corresponding to the functional combination input by the user, the method further includes:
将 AT服务挂载到所述物理 UART上, 其中, 所述 AT服务设置为解析来 自所述用户的 AT命令。  An AT service is mounted to the physical UART, wherein the AT service is set to parse an AT command from the user.
4. 根据权利要求 1所述的方法, 其中, 在获取的虚拟设备与物理 UART之间建立 数据连接包括: 4. The method of claim 1, wherein establishing a data connection between the acquired virtual device and the physical UART comprises:
将所述获取的虚拟设备通过多路复用层挂载到所述物理 UART上。  The acquired virtual device is mounted to the physical UART through a multiplexing layer.
5. 根据权利要求 1所述的方法, 其中, 建立与无线通讯模块各个功能相对应的虚 拟设备包括: 5. The method according to claim 1, wherein the establishing a virtual device corresponding to each function of the wireless communication module comprises:
建立与所述各个功能相对应的虚拟设备;  Establishing a virtual device corresponding to each of the functions described;
分别将各个功能单元与其对应的虚拟设备进行关联。  Each functional unit is associated with its corresponding virtual device.
6. 根据权利要求 1至 5中任一项所述的方法, 其中, 利用所述数据连接传输数据 包括: The method according to any one of claims 1 to 5, wherein transmitting data by using the data connection comprises:
接收到所述用户的输入数据, 并解析所述输入数据;  Receiving input data of the user, and parsing the input data;
根据解析结果确定所述输入数据的目标虚拟设备以及目标功能单元; 利用所述数据连接将所述输入数据发送到所述目标功能单元。 Determining, by the parsing result, the target virtual device of the input data and the target functional unit; The input data is sent to the target functional unit using the data connection.
7. 根据权利要求 1至 5中任一项所述的方法, 其中, 利用所述数据连接传输数据 包括: The method according to any one of claims 1 to 5, wherein transmitting data by using the data connection comprises:
对需要发送给所述用户的数据进行封装, 其中, 封装后的数据携带设置为 指示所述数据所属的虚拟设备的信息;  Encapsulating data that needs to be sent to the user, where the encapsulated data carries information that is set to indicate the virtual device to which the data belongs;
利用所述数据连接将所述数据发送给所述用户。  The data is sent to the user using the data connection.
8. 一种数据传输装置, 应用于无线通讯模块, 包括: 8. A data transmission device for use in a wireless communication module, comprising:
第一建立模块, 设置为建立与无线通讯模块各个功能相对应的虚拟设备; 获取模块, 设置为获取与用户输入的功能组合相对应的虚拟设备; 第二建立模块, 设置为在获取的虚拟设备与物理通用异步接收 /发送 UART 之间建立数据连接;  a first establishing module, configured to establish a virtual device corresponding to each function of the wireless communication module; an acquiring module, configured to acquire a virtual device corresponding to a function combination input by the user; and a second establishing module, configured to acquire the virtual device Establish a data connection with the physical universal asynchronous receive/transmit UART;
数据传输模块, 设置为利用所述数据连接传输数据。  A data transmission module is arranged to transmit data using the data connection.
9. 根据权利要求 8所述的装置, 其中, 所述获取模块包括: The device according to claim 8, wherein the obtaining module comprises:
接收单元, 设置为接收来自所述用户的命令;  a receiving unit, configured to receive a command from the user;
解析单元, 设置为解析所述命令;  a parsing unit, configured to parse the command;
第一获取单元, 设置为获取所述用户要使用的功能组合;  a first obtaining unit, configured to acquire a function combination to be used by the user;
第二获取单元, 设置为根据所述功能组合获取与其对应的虚拟设备。  The second obtaining unit is configured to acquire a virtual device corresponding thereto according to the function combination.
10. 根据权利要求 8所述的装置, 其中, 所述第二建立模块包括: The device according to claim 8, wherein the second establishing module comprises:
挂载单元, 设置为将所述获取的虚拟设备通过多路复用层挂载到所述物理 UART上。  A mount unit is configured to mount the fetched virtual device onto the physical UART through a multiplex layer.
PCT/CN2013/081393 2012-08-14 2013-08-13 Data transmission method and device WO2014026594A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201210288630.4 2012-08-14
CN201210288630.4A CN102857967B (en) 2012-08-14 2012-08-14 Data transmission method and device

Publications (1)

Publication Number Publication Date
WO2014026594A1 true WO2014026594A1 (en) 2014-02-20

Family

ID=47404078

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2013/081393 WO2014026594A1 (en) 2012-08-14 2013-08-13 Data transmission method and device

Country Status (2)

Country Link
CN (1) CN102857967B (en)
WO (1) WO2014026594A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105718415A (en) * 2016-01-19 2016-06-29 江苏飞尚安全监测咨询有限公司 Framing detection algorithm for receiving of universal asynchronous receiver transmitter (UART) of single chip microcomputer

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102857967B (en) * 2012-08-14 2018-04-03 深圳市中兴物联科技有限公司 Data transmission method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101470688A (en) * 2007-12-28 2009-07-01 希姆通信息技术(上海)有限公司 Method for implementing multi-function by single-terminal serial port
CN201774527U (en) * 2010-03-26 2011-03-23 武汉工程大学 Wireless transceiving module connected with USB interface and based on virtual COM interface
CN102857967A (en) * 2012-08-14 2013-01-02 中兴通讯股份有限公司 Data transmitting method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE19733906C2 (en) * 1997-08-05 1999-09-30 Siemens Ag Method for automatic address assignment, bus system for automatic address assignment and communication participants that can be used in the bus system or in the context of the method
CN101309121B (en) * 2007-05-18 2013-01-23 希姆通信息技术(上海)有限公司 Method of realizing MUX protocol without need of adding drive of kernel under Linux platform
CN101527735B (en) * 2009-04-07 2012-01-11 上海许继电气有限公司 Multi-serial port data communication card equipment based on CPCI bus and method thereof

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101470688A (en) * 2007-12-28 2009-07-01 希姆通信息技术(上海)有限公司 Method for implementing multi-function by single-terminal serial port
CN201774527U (en) * 2010-03-26 2011-03-23 武汉工程大学 Wireless transceiving module connected with USB interface and based on virtual COM interface
CN102857967A (en) * 2012-08-14 2013-01-02 中兴通讯股份有限公司 Data transmitting method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105718415A (en) * 2016-01-19 2016-06-29 江苏飞尚安全监测咨询有限公司 Framing detection algorithm for receiving of universal asynchronous receiver transmitter (UART) of single chip microcomputer

Also Published As

Publication number Publication date
CN102857967B (en) 2018-04-03
CN102857967A (en) 2013-01-02

Similar Documents

Publication Publication Date Title
US9286249B2 (en) USB device communication method, device and system wherein a human interface device (HID) descriptor and report are added to a driver of USB device
US8892723B2 (en) Method and apparatus for enabling communication between iSCSI devices and SAS devices
US9201826B2 (en) Extensible WSE hub to support a multi-hop tree of USB hubs or peripherals over a wireless link
WO2016187813A1 (en) Data transmission method and device for photoelectric hybrid network
US8798541B1 (en) System and method for socket backed host controller interface emulation for virtual bluetooth adapter
US20080005395A1 (en) Adapter to convert USB device into WUSB device
EP2270673B1 (en) Dual modem device and controlling method thereof
CN101834796B (en) Double-controller communication system and method
JP6526238B2 (en) Operating system and method for realizing the function of a Bluetooth (registered trademark) slave facility using an embedded operating system
EP3489836B1 (en) Data processing method and system, peripheral component interconnect express device and host
CN115811536B (en) Automobile central gateway system based on multi-core heterogeneous and implementation method
CN113645258A (en) Data transmission method and device, storage medium, processor and electronic equipment
JP2021508996A (en) Data transmission method, transmitter, and receiver
KR20110110199A (en) Communication protocol for sharing memory resources between components of a device
CN111479336A (en) Software framework and development platform of WI-FI chipset
WO2014026594A1 (en) Data transmission method and device
US9078282B2 (en) Method and apparatus for implementing network device function of wireless communication terminal
CN210129207U (en) Interactive intelligent tablet
TW201240396A (en) Electronic apparatus and method for sharing Ethernet circuit between plurality of ports
TWI345711B (en)
CN114079675B (en) Message processing method, device, terminal equipment and mobile broadband internet surfing equipment
WO2015013920A1 (en) Data forwarding method, device and system
JP2011242822A5 (en)
CN103269319A (en) Method, device and system for data transmission
JP3221236U (en) Communication system comprising a plurality of communication protocols, and integrated communication device

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 13829951

Country of ref document: EP

Kind code of ref document: A1