[go: up one dir, main page]

CN105975408A - Data transmission method and device - Google Patents

Data transmission method and device Download PDF

Info

Publication number
CN105975408A
CN105975408A CN201610268304.5A CN201610268304A CN105975408A CN 105975408 A CN105975408 A CN 105975408A CN 201610268304 A CN201610268304 A CN 201610268304A CN 105975408 A CN105975408 A CN 105975408A
Authority
CN
China
Prior art keywords
data transmission
data
mobile terminal
mode
communication
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
CN201610268304.5A
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.)
Omron Shanghai Co Ltd
Original Assignee
Omron Shanghai 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 Omron Shanghai Co Ltd filed Critical Omron Shanghai Co Ltd
Priority to CN201610268304.5A priority Critical patent/CN105975408A/en
Publication of CN105975408A publication Critical patent/CN105975408A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/10Program control for peripheral devices
    • G06F13/102Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/0042Universal serial bus [USB]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Communication Control (AREA)

Abstract

本公开是关于一种数据传输方法及装置。该数据传输方法用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输方法包括:获取所述移动终端的USB设备列表;检测所述USB设备列表中是否包含预定身份标识的PLC设备;在检测到所述PLC设备后获取所述PLC设备的通信端口以及获取所述通信端口的通信节点;打开USB设备,通过获取的所述通信节点进行数据传输。本公开可以实现移动终端与PLC设备之间的数据传输。

The disclosure relates to a data transmission method and device. The data transmission method is used to implement data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal; the data transmission method includes: obtaining a USB device list of the mobile terminal; detecting whether the USB device list is A PLC device containing a predetermined identity; after detecting the PLC device, obtain the communication port of the PLC device and the communication node of the communication port; open the USB device, and perform data transmission through the obtained communication node. The present disclosure can realize data transmission between a mobile terminal and a PLC device.

Description

数据传输方法及装置Data transmission method and device

技术领域technical field

本公开涉及工业控制技术领域,具体而言,涉及一种用于实现移动终端与PLC设备之间的数据传输的数据传输方法及数据传输装置。The present disclosure relates to the technical field of industrial control, in particular, to a data transmission method and a data transmission device for realizing data transmission between a mobile terminal and a PLC device.

背景技术Background technique

随着工业控制技术的发展,PLC(Programmable Logic Controller,可编程逻辑控制器)设备在各个领域的作用越来越重要,应用越来越广泛。PLC设备是一种采用可编程的存储器,通过其内部存储的程序数据,执行逻辑运算、顺序控制、定时、计数与算术操作等面向用户的指令,并通过数字或模拟式输入/输出控制各种类型的机械或生产过程。With the development of industrial control technology, PLC (Programmable Logic Controller, Programmable Logic Controller) devices play an increasingly important role in various fields and are used more and more widely. PLC equipment is a kind of user-oriented instructions such as logical operation, sequence control, timing, counting and arithmetic operation, etc., which use programmable memory through its internal stored program data, and control various Type of machinery or production process.

现有技术中,一部分方案中,需要通过安装有特定的驱动的PC端,并要求PC端上安装有专业的工具,才可能进行PLC设备的程序数据的上传和下载。另一部方案中,可以通过安装于PC端的VNC(VirtualNetwork Computer,虚拟网络计算机)远程控制软件进行PLC设备的程序数据的上传和下载,但该方案还要求上传或下载程序数据的设备必须具备网络功能。In the prior art, in some schemes, it is necessary to install a specific driver on the PC terminal and require professional tools to be installed on the PC terminal to upload and download the program data of the PLC device. In another solution, the program data of the PLC device can be uploaded and downloaded through the VNC (Virtual Network Computer, virtual network computer) remote control software installed on the PC, but this solution also requires that the device that uploads or downloads the program data must have a network Features.

由上可知,现有技术中向PLC设备上传程序数据或者从PLC设备下载程序数据一方面需要PC端,缺乏便携性,另一方面,需要安装特定的驱动以及配置专业的工具,实施不方便。It can be seen from the above that uploading program data to PLC equipment or downloading program data from PLC equipment in the prior art requires a PC terminal on the one hand, which lacks portability. On the other hand, it needs to install specific drivers and configure professional tools, which is inconvenient to implement.

需要说明的是,在上述背景技术部分公开的信息仅用于加强对本公开的背景的理解,因此可以包括不构成对本领域普通技术人员已知的现有技术的信息。It should be noted that the information disclosed in the above background section is only for enhancing the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to those of ordinary skill in the art.

发明内容Contents of the invention

本公开的目的在于提供一种用于实现移动终端与PLC设备之间的数据传输的数据传输方法及数据传输装置,进而至少在一定程度上克服由于相关技术的限制和缺陷而导致的一个或者多个问题。The purpose of the present disclosure is to provide a data transmission method and a data transmission device for realizing data transmission between a mobile terminal and a PLC device, and then at least to a certain extent overcome one or more problems caused by limitations and defects of related technologies question.

本公开的其他特性和优点将通过下面的详细描述变得清晰,或者部分地通过本公开的实践而习得。Other features and advantages of the present disclosure will become apparent from the following detailed description, or in part, be learned by practice of the present disclosure.

根据本公开实施例的第一方面,提供一种数据传输方法,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输方法包括:According to the first aspect of the embodiments of the present disclosure, a data transmission method is provided, which is used to implement data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal; the data transmission method includes:

获取所述移动终端的USB设备列表;Obtain a USB device list of the mobile terminal;

检测所述USB设备列表中是否包含预定身份标识的PLC设备;Detecting whether a PLC device with a predetermined identity is included in the USB device list;

在检测到所述PLC设备后获取所述PLC设备的通信端口以及获取所述通信端口的通信节点;Obtaining the communication port of the PLC device and obtaining the communication node of the communication port after the PLC device is detected;

打开USB设备,通过获取的所述通信节点进行数据传输。Turn on the USB device, and perform data transmission through the obtained communication node.

在本公开的一种示例性实施例中,所述数据传输方法还包括:In an exemplary embodiment of the present disclosure, the data transmission method further includes:

接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式;receiving a transmission mode selection command and entering a data download mode or a data upload mode according to the transmission mode selection command;

进入所述数据下载模式后,获取所述移动终端上的目标文件路径,并且通过获取的所述通信节点将所述PLC设备中的待传输数据下载至所述目标文件路径;After entering the data download mode, obtain the target file path on the mobile terminal, and download the data to be transmitted in the PLC device to the target file path through the obtained communication node;

进入所述数据上传模式后,获取所述移动终端上的待传输数据,并且通过获取的所述通信节点将所述移动终端的待传输数据至上传至所述PLC设备。After entering the data upload mode, obtain the data to be transmitted on the mobile terminal, and upload the data to be transmitted by the mobile terminal to the PLC device through the obtained communication node.

在本公开的一种示例性实施例中,所述移动终端与所述PLC设备之间通过USB数据线以及OTG数据线通信连接。In an exemplary embodiment of the present disclosure, the mobile terminal is communicatively connected to the PLC device through a USB data line and an OTG data line.

根据本公开实施例的第二方面,提供一种数据传输方法,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输方法包括:According to the second aspect of the embodiments of the present disclosure, a data transmission method is provided, which is used to implement data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal; the data transmission method includes:

按照所述移动终端的一端口号创建代表以太网通信协议套接字的DatagramSocket实例;Create a DatagramSocket instance representing the Ethernet communication protocol socket according to a port number of the mobile terminal;

按照目标IP地址创建OutbroadcastAddr实例以向所述PLC设备进行地址广播;Create an OutbroadcastAddr instance according to the target IP address to broadcast the address to the PLC device;

创建DatagramPacket实例,并通过所述DatagramPacket实例从所述DatagramSocket实例发送或者接收数据。Create a DatagramPacket instance, and send or receive data from the DatagramSocket instance through the DatagramPacket instance.

在本公开的一种示例性实施例中,所述数据传输方法还包括:In an exemplary embodiment of the present disclosure, the data transmission method further includes:

接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式;receiving a transmission mode selection command and entering a data download mode or a data upload mode according to the transmission mode selection command;

进入所述数据下载模式后,获取所述移动终端上的目标文件路径,通过所述DatagramPacket实例从所述DatagramSocket实例接收待传输数据并保存至所述目标文件路径;After entering the data download mode, obtain the target file path on the mobile terminal, receive the data to be transmitted from the DatagramSocket instance through the DatagramPacket instance and save it to the target file path;

进入所述数据上传模式后,获取所述移动终端上的待传输数据,通过所述DatagramPacket实例从所述DatagramSocket实例接收将所述移动终端的待传输数据至发送至所述PLC设备。After entering the data upload mode, obtain the data to be transmitted on the mobile terminal, receive and send the data to be transmitted from the mobile terminal to the PLC device through the DatagramPacket instance from the DatagramSocket instance.

在本公开的一种示例性实施例中,所述移动终端与所述PLC设备之间通过OTG数据线、以太网接口以及网线通信连接。In an exemplary embodiment of the present disclosure, the mobile terminal is communicatively connected to the PLC device through an OTG data line, an Ethernet interface, and a network cable.

根据本公开实施例的第三方面,提供一种数据传输方法,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输方法包括:According to a third aspect of an embodiment of the present disclosure, a data transmission method is provided for implementing data transmission between a mobile terminal and a PLC device and applied to the mobile terminal; the data transmission method includes:

判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输;Judging data transmission via USB communication or data transmission via Ethernet;

若判断通过USB通信方式进行数据传输,则执行上述第一方面所述的数据传输方法;If it is judged that the data transmission is carried out by means of USB communication, then execute the data transmission method described in the first aspect above;

若判断通过以太网通信方式进行数据传输,则执行上述第二方面所述的数据传输方法。If it is determined that the data transmission is performed through the Ethernet communication mode, then execute the data transmission method described in the second aspect above.

在本公开的一种示例性实施例中,所述数据传输方法还包括:In an exemplary embodiment of the present disclosure, the data transmission method further includes:

接收一通信方式选择指令,根据所述通信方式选择指令判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输。A communication mode selection instruction is received, and according to the communication mode selection instruction, it is determined whether data transmission is performed through USB communication mode or data transmission is performed through Ethernet mode.

根据本公开实施例的第四方面,提供一种数据传输装置,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输装置包括:According to a fourth aspect of the embodiments of the present disclosure, a data transmission device is provided, which is used to implement data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal; the data transmission device includes:

列表获取单元,用于获取所述移动终端的USB设备列表;a list obtaining unit, configured to obtain a list of USB devices of the mobile terminal;

设备检测单元,用于检测所述USB设备列表中是否包含预定身份标识的PLC设备;A device detection unit, configured to detect whether a PLC device with a predetermined identity is included in the USB device list;

通信检测单元,用于在检测到所述PLC设备后获取所述PLC设备的通信端口以及获取所述通信端口的通信节点;a communication detection unit, configured to obtain the communication port of the PLC device and the communication node of the communication port after the PLC device is detected;

数据传输单元,用于打开USB设备,通过获取的所述通信节点进行数据传输。The data transmission unit is configured to open the USB device and perform data transmission through the obtained communication node.

在本公开的一种示例性实施例中,所述数据传输装置还包括:In an exemplary embodiment of the present disclosure, the data transmission device further includes:

传输模式获取单元,用于接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式;A transmission mode acquisition unit, configured to receive a transmission mode selection instruction and enter a data download mode or a data upload mode according to the transmission mode selection instruction;

进入所述数据下载模式后,所述数据传输单元获取所述移动终端上的目标文件路径,并且通过获取的所述通信节点将所述PLC设备中的待传输数据下载至所述目标文件路径;After entering the data download mode, the data transmission unit obtains the target file path on the mobile terminal, and downloads the data to be transmitted in the PLC device to the target file path through the acquired communication node;

进入所述数据上传模式后,所述数据传输单元获取所述移动终端上的待传输数据,并且通过获取的所述通信节点将所述移动终端的待传输数据至上传至所述PLC设备。After entering the data upload mode, the data transmission unit obtains the data to be transmitted on the mobile terminal, and uploads the data to be transmitted by the mobile terminal to the PLC device through the obtained communication node.

在本公开的一种示例性实施例中,所述移动终端与所述PLC设备之间通过USB数据线以及OTG数据线通信连接。In an exemplary embodiment of the present disclosure, the mobile terminal is communicatively connected to the PLC device through a USB data line and an OTG data line.

根据本公开实施例的第五方面,提供一种数据传输装置,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输装置包括:According to a fifth aspect of an embodiment of the present disclosure, a data transmission device is provided, which is used to implement data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal; the data transmission device includes:

套接字创建单元,用于按照所述移动终端的一端口号创建代表以太网通信协议套接字的DatagramSocket实例;A socket creation unit is used to create a DatagramSocket instance representing the Ethernet communication protocol socket according to a port number of the mobile terminal;

地址广播单元,用于按照目标IP地址创建OutbroadcastAddr实例以向所述PLC设备进行地址广播;The address broadcast unit is used to create an OutbroadcastAddr instance according to the target IP address to broadcast the address to the PLC device;

数据传输单元,用于创建DatagramPacket实例,并通过所述DatagramPacket实例从所述DatagramSocket实例发送或者接收数据。The data transmission unit is configured to create a DatagramPacket instance, and send or receive data from the DatagramSocket instance through the DatagramPacket instance.

在本公开的一种示例性实施例中,所述数据传输装置还包括:In an exemplary embodiment of the present disclosure, the data transmission device further includes:

传输模式获取单元,用于接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式;A transmission mode acquisition unit, configured to receive a transmission mode selection instruction and enter a data download mode or a data upload mode according to the transmission mode selection instruction;

进入所述数据下载模式后,所述数据传输单元获取所述移动终端上的目标文件路径,通过所述DatagramPacket实例从所述DatagramSocket实例接收待传输数据并保存至所述目标文件路径;After entering the data download mode, the data transmission unit obtains the target file path on the mobile terminal, receives the data to be transmitted from the DatagramSocket instance through the DatagramPacket instance and saves it to the target file path;

进入所述数据上传模式后,所述数据传输单元获取所述移动终端上的待传输数据,通过所述DatagramPacket实例从所述DatagramSocket实例接收将所述移动终端的待传输数据至发送至所述PLC设备。After entering the data upload mode, the data transmission unit acquires the data to be transmitted on the mobile terminal, receives and sends the data to be transmitted from the mobile terminal to the PLC through the DatagramPacket instance from the DatagramSocket instance equipment.

在本公开的一种示例性实施例中,所述移动终端与所述PLC设备之间通过OTG数据线、以太网接口以及网线通信连接。In an exemplary embodiment of the present disclosure, the mobile terminal is communicatively connected to the PLC device through an OTG data line, an Ethernet interface, and a network cable.

根据本公开实施例的第六方面,提供一种数据传输装置,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输装置包括:According to a sixth aspect of the embodiments of the present disclosure, a data transmission device is provided, which is used to implement data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal; the data transmission device includes:

通信方式判断单元,用于判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输;A communication mode judging unit for judging data transmission via USB communication mode or data transmission via Ethernet mode;

若判断通过USB通信方式进行数据传输,则通过上述第四方面所述的数据传输装置进行数据传输;If it is judged that the data transmission is performed through the USB communication method, then the data transmission is performed through the data transmission device described in the fourth aspect above;

若判断通过以太网通信方式进行数据传输,则通过上述第五方面所述的数据传输装置进行数据传输。If it is judged that the data transmission is performed through the Ethernet communication method, then the data transmission is performed through the data transmission device described in the fifth aspect above.

在本公开的一种示例性实施例中,所述数据传输装置还包括:In an exemplary embodiment of the present disclosure, the data transmission device further includes:

通信方式获取单元,用于接收一通信方式选择指令;a communication mode acquisition unit, configured to receive a communication mode selection instruction;

所述通信方式判断单元根据所述通信方式选择指令判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输。The communication mode judging unit judges data transmission via USB communication mode or data transmission via Ethernet mode according to the communication mode selection instruction.

本公开的一种实施例中的技术方案可以实现移动终端与PLC设备之间的数据传输。相比于现有技术,一方面不需要PC端,借助移动终端的便携性,可以使得PLC设备的数据传输更加方便;另一方面,无需安装特定的驱动以及配置专业的工具,实施方便;再一方面,不必使用VNC类似的远程控制软件,所以不要求移动终端一定具有以太网功能,提升了PLC设备的数据传输方法的适用范围;而且由于是通过有线的USB或者以太网的方法进行通信,更能保证通信的效率以及可靠性。The technical solution in an embodiment of the present disclosure can realize data transmission between a mobile terminal and a PLC device. Compared with the existing technology, on the one hand, no PC terminal is required, and the portability of the mobile terminal can make the data transmission of the PLC device more convenient; on the other hand, there is no need to install specific drivers and configure professional tools, which is convenient for implementation; and On the one hand, there is no need to use VNC-like remote control software, so the mobile terminal is not required to have an Ethernet function, which improves the scope of application of the data transmission method of the PLC device; and because it communicates through wired USB or Ethernet, It can better guarantee the efficiency and reliability of communication.

应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并不能限制本公开。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.

附图说明Description of drawings

此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description serve to explain the principles of the disclosure. Apparently, the drawings in the following description are only some embodiments of the present disclosure, and those skilled in the art can obtain other drawings according to these drawings without creative efforts.

图1示出本公开示例性实施例中移动终端与PLC设备的一种连接方式示意图。Fig. 1 shows a schematic diagram of a connection manner between a mobile terminal and a PLC device in an exemplary embodiment of the present disclosure.

图2示出本公开示例性实施例中一种数据传输方法的流程示意图。Fig. 2 shows a schematic flowchart of a data transmission method in an exemplary embodiment of the present disclosure.

图3示出本公开示例性实施例中一种数据传输方法的流程示意图。Fig. 3 shows a schematic flowchart of a data transmission method in an exemplary embodiment of the present disclosure.

图4示出本公开示例性实施例中一种数据传输方法的流程示意图。Fig. 4 shows a schematic flowchart of a data transmission method in an exemplary embodiment of the present disclosure.

图5示出本公开示例性实施例中移动终端与PLC设备的一种连接方式示意图。Fig. 5 shows a schematic diagram of a connection manner between a mobile terminal and a PLC device in an exemplary embodiment of the present disclosure.

图6示出本公开示例性实施例中一种数据传输方法的流程示意图。Fig. 6 shows a schematic flowchart of a data transmission method in an exemplary embodiment of the present disclosure.

图7示出本公开示例性实施例中一种数据传输方法的流程示意图。Fig. 7 shows a schematic flowchart of a data transmission method in an exemplary embodiment of the present disclosure.

图8示出本公开示例性实施例中一种数据传输方法的流程示意图。Fig. 8 shows a schematic flowchart of a data transmission method in an exemplary embodiment of the present disclosure.

图9示出本公开示例性实施例中一种数据传输方法的流程示意图。Fig. 9 shows a schematic flowchart of a data transmission method in an exemplary embodiment of the present disclosure.

图10示出本公开示例性实施例中一种数据传输方法的流程示意图。Fig. 10 shows a schematic flowchart of a data transmission method in an exemplary embodiment of the present disclosure.

图11示出本公开示例性实施例中一种数据传输装置的方框示意图。Fig. 11 shows a schematic block diagram of a data transmission device in an exemplary embodiment of the present disclosure.

图12示出本公开示例性实施例中一种数据传输装置的方框示意图。Fig. 12 shows a schematic block diagram of a data transmission device in an exemplary embodiment of the present disclosure.

图13示出本公开示例性实施例中一种数据传输装置的方框示意图。Fig. 13 shows a schematic block diagram of a data transmission device in an exemplary embodiment of the present disclosure.

图14示出本公开示例性实施例中一种应用上述数据传输方法或数据传输装置的移动终端的方框示意图。Fig. 14 shows a schematic block diagram of a mobile terminal applying the above data transmission method or data transmission device in an exemplary embodiment of the present disclosure.

具体实施方式detailed description

现在将参考附图更全面地描述示例实施方式。然而,示例实施方式能够以多种形式实施,且不应被理解为限于在此阐述的范例;相反,提供这些实施方式使得本公开将更加全面和完整,并将示例实施方式的构思全面地传达给本领域的技术人员。所描述的特征、结构或特性可以以任何合适的方式结合在一个或更多实施方式中。在下面的描述中,提供许多具体细节从而给出对本公开的实施方式的充分理解。然而,本领域技术人员将意识到,可以实践本公开的技术方案而省略所述特定细节中的一个或更多,或者可以采用其它的方法、组元、装置、步骤等。在其它情况下,不详细示出或描述公知技术方案以避免喧宾夺主而使得本公开的各方面变得模糊。Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided in order to give a thorough understanding of embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details being omitted, or other methods, components, devices, steps, etc. may be adopted. In other instances, well-known technical solutions have not been shown or described in detail to avoid obscuring aspects of the present disclosure.

此外,附图仅为本公开的示意性图解,并非一定是按比例绘制。图中相同的附图标记表示相同或类似的部分,因而将省略对它们的重复描述。附图中所示的一些方框图是功能实体,不一定必须与物理或逻辑上独立的实体相对应。可以采用软件形式来实现这些功能实体,或在一个或多个硬件模块或集成电路中实现这些功能实体,或在不同网络和/或处理器装置和/或微控制器装置中实现这些功能实体。Furthermore, the drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus repeated descriptions thereof will be omitted. Some of the block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different network and/or processor means and/or microcontroller means.

本示例实施方式中首先提供了一种数据传输方法,可以用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端。本示例实施方式中,所述移动终端例如可以为手机、平板电脑以及PDA等。本示例实施方式中的所述数据传输方法可以通过安装在所述移动终端的应用程序(APP)实现。In this exemplary embodiment, a data transmission method is firstly provided, which can be used to implement data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal. In this example implementation manner, the mobile terminal may be, for example, a mobile phone, a tablet computer, and a PDA. The data transmission method in this example embodiment can be realized by an application program (APP) installed on the mobile terminal.

参考图1中所示,本示例实施方式中所述移动终端与所述PLC设备之间可以通过USB数据线以及OTG数据线通信连接。由于现有PLC设备使用有线USB的方法传输是最主要的传输方式,而移动终端通常也具有USB接口,因此可以通过USB数据线以及OTG数据线实现两者的通信连接。Referring to FIG. 1 , in this exemplary embodiment, the mobile terminal and the PLC device may be connected through a USB data line and an OTG data line. Since the existing PLC equipment uses wired USB transmission as the most important transmission method, and the mobile terminal usually also has a USB interface, the communication connection between the two can be realized through the USB data line and the OTG data line.

本示例实施方式中,将以Android操作系统的手机为例进行详细说明。参考图2中所示,所述数据传输方法可以包括下述步骤:In this example implementation manner, a mobile phone with an Android operating system will be taken as an example for detailed description. Referring to Fig. 2, the data transmission method may include the following steps:

S11.获取所述移动终端的USB设备列表。S11. Obtain a USB device list of the mobile terminal.

参考图3中所示,在移动终端启动应用程序后,会首先声明UsbManager对象。UsbManager对象负责管理USB设备的类,可以通过相应代码中获得此对象的一个实例。在该类中,可以通过例如“getDeviceList()”获得所述移动终端的USB设备列表。Referring to Fig. 3, after the mobile terminal starts the application program, the UsbManager object will be declared first. The UsbManager object is responsible for managing the class of USB devices, and an instance of this object can be obtained through the corresponding code. In this class, the USB device list of the mobile terminal can be obtained through, for example, "getDeviceList()".

S12.检测所述USB设备列表中是否包含预定身份标识的PLC设备。S12. Detect whether the USB device list contains a PLC device with a predetermined identity.

本示例实施方式中所述PLC设备的身份标识可以包括供应商ID(VID)和产品识别码(PID);根据USB规范的规定,所有USB设备都有供应商VID和PID,因此可以通过VID和PID来区别不同的设备。通过迭代器DeviceIterator可以顺序循环比较所述USB设备列表中的各设备的身份标识,当找到包含预定身份标识的PLC设备时,可以连接到该PLC设备,但未找到包含预定身份标识的PLC设备时,则返回没有所要连接的设备。The identity mark of the PLC device described in this example embodiment can include a supplier ID (VID) and a product identification code (PID); PID to distinguish different devices. Through the iterator DeviceIterator, the identities of the devices in the USB device list can be sequentially and cyclically compared. When a PLC device containing a predetermined identity is found, it can be connected to the PLC device, but when no PLC device containing a predetermined identity is found , it returns that there is no device to connect to.

S13.在检测到所述PLC设备后获取所述PLC设备的通信端口以及获取所述通信端口的通信节点。S13. Obtain a communication port of the PLC device and a communication node of the communication port after the PLC device is detected.

所述PLC设备包含一个或多个通信端口(Interface),每个通信端口又包含一个或多个通信节点(Endpoint)用来与所述移动终端进行数据传输。本示例实施方式中,例如可以通过“getInterfaceCount()”返回所述PLC设备的通信端口数量,并通过“getInterface(int index)”获取所述PLC设备一个的通信端口,以及通过“getEndpointCount()”获取此通信端口的节点数量,并通过“getEndpoint(int index)”获取此通信端口的一个通信节点。此外,一般通信节点Endpoint是分为InEndpoint和OutEndpoint,获取何种通信节点可以根据具体设备而定。The PLC device includes one or more communication ports (Interface), and each communication port includes one or more communication nodes (Endpoint) for data transmission with the mobile terminal. In this example implementation, for example, the number of communication ports of the PLC device can be returned through "getInterfaceCount()", and one communication port of the PLC device can be obtained through "getInterface(int index)", and the number of communication ports of the PLC device can be obtained through "getEndpointCount()" Get the number of nodes of this communication port, and get a communication node of this communication port through "getEndpoint(int index)". In addition, the general communication node Endpoint is divided into InEndpoint and OutEndpoint, and which communication node to obtain can be determined according to specific devices.

S14.打开USB设备,通过获取的所述通信节点进行数据传输。S14. Turn on the USB device, and perform data transmission through the obtained communication node.

继续参考图3中所示,判断是否有接入所述PLC设备的权限,例如,可以通过“hasPermission(UsbDevice device)”判断上述应用程序是否有接入所述PCL设备的权限;在判断没有接入的权限时,则需要获取接入所述PLC设备的权限。在判断有接入的权限时,则可以通过例如“openDevice(UsbDevice device)”打开所述PLC设备,以便向所述PLC设备发送数据或者从所述PLC设备接收数据。本示例实施方式中,可以通过便于进行大量数据传输的BulkTransfer方式进行数据传输。Continue referring to shown in Fig. 3, judge whether to have the authority of accessing described PLC device, for example, can judge whether above-mentioned application program has the authority of accessing described PCL device by "hasPermission(UsbDevice device)"; When accessing the access authority, it is necessary to acquire the authority to access the PLC device. When it is judged that there is an access right, the PLC device can be opened by, for example, "openDevice (UsbDevice device)", so as to send data to the PLC device or receive data from the PLC device. In this exemplary embodiment, data transmission can be performed by means of BulkTransfer which is convenient for large amount of data transmission.

进一步的,所述本示例实施方式中所述数据传输方法还可以包括:Further, the data transmission method described in this example embodiment may also include:

S10.接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式。例如,参考图4中所示,通过安装于所述移动终端的上述应用程序可以用于供用户选择进行数据上传或者进行数据下载。S10. Receive a transmission mode selection instruction and enter a data download mode or a data upload mode according to the transmission mode selection instruction. For example, as shown in FIG. 4 , the above-mentioned application program installed on the mobile terminal can be used for the user to choose to perform data upload or data download.

进入所述数据下载模式后,用户可以设定从所述PLC设备下载的程序数据将要保存的路径(即下述目标文件路径),所述应用程序还可以判断所述目标文件路径是否已经存在与待传输程序数据重名的文件。在判断所述目标文件路径没有与待传输程序数据重名的文件后,通过上述步骤S11~步骤S13建立所述移动终端与所述PLC设备之间的通信连接,并获取所述目标文件路径,根据所述步骤S14以及打包的所述PLC设备的上传/下载协议通过获取的所述通信节点按照Android USBBulkTransfer方式,从所述PLC设备中获取待传输数据,并下载保存至所述目标文件路径。After entering the data download mode, the user can set the path (i.e. the following target file path) to be saved from the program data downloaded from the PLC device, and the application program can also judge whether the target file path already exists or not. The file with the same name as the program data to be transferred. After judging that the target file path does not have a file with the same name as the program data to be transmitted, establish a communication connection between the mobile terminal and the PLC device through the above steps S11 to S13, and obtain the target file path, According to the step S14 and the upload/download protocol of the packaged PLC device, the communication node obtained through the Android USBBulkTransfer method obtains the data to be transmitted from the PLC device, and downloads and saves it to the target file path.

此外,继续参考图4中所示,在下载待传输程序数据之前,还可以判断用户连接的机型是否有误,并且在判断用户连接的机型正确时,才进行数据传输。在数据传输完成之后,可以通过声音或者文字等方式提醒用户待传输程序数据已经传输完毕。In addition, continuing to refer to FIG. 4 , before downloading the program data to be transmitted, it is also possible to determine whether the model connected by the user is wrong, and only perform data transmission when it is determined that the model connected by the user is correct. After the data transmission is completed, the user may be reminded that the program data to be transmitted has been transmitted through sound or text.

进入所述数据上传模式后,用户可以选择所述移动终端上的待传输数据的存放路径,所述应用程序还可以对所述移动终端上的待传输数据进行校验,以判断待传输数据是否被破坏以及防止数据传输不完整。在判断待传输数据校验通过后,通过上述步骤S11~步骤S13建立所述移动终端与所述PLC设备之间的通信连接,并获取所述待传输数据的存放路径,从所述待传输数据的存放路径获取待传输数据,根据所述步骤S14以及打包的所述PLC设备的上传/下载协议通过获取的所述通信节点按照Android USB Bulk方式上传至所述PLC设备。当所述待传输数据的存放路径存在多个待传输数据时,本示例实施方式中还可以通过循环上述传输过程,逐个进行数据传输。After entering the data upload mode, the user can select the storage path of the data to be transmitted on the mobile terminal, and the application program can also check the data to be transmitted on the mobile terminal to determine whether the data to be transmitted be corrupted and prevent incomplete data transmission. After judging that the data to be transmitted has passed the verification, establish the communication connection between the mobile terminal and the PLC device through the above steps S11 to S13, and obtain the storage path of the data to be transmitted, from the data to be transmitted The storage path obtains the data to be transmitted, and according to the step S14 and the upload/download protocol of the packaged PLC device, uploads to the PLC device through the obtained communication node according to the Android USB Bulk method. When there are multiple pieces of data to be transmitted in the storage path of the data to be transmitted, in this exemplary embodiment, the above transmission process may be cycled to transmit data one by one.

此外,继续参考图4中所示,在上传待传输程序数据之前,还可以判断用户连接的机型是否有误,并且在判断用户连接的机型正确时,才进行数据传输。在数据传输完成之后,可以通过声音或者文字等方式提醒用户待传输程序数据已经传输完毕。In addition, continuing to refer to FIG. 4 , before uploading the program data to be transmitted, it is also possible to determine whether the model connected by the user is wrong, and only when it is judged that the model connected by the user is correct, the data transmission is performed. After the data transmission is completed, the user may be reminded that the program data to be transmitted has been transmitted through sound or text.

参考图5中所示,本示例实施方式中所述移动终端与所述PLC设备之间可以通过OTG数据线、以太网(Ethernet)接口以及网线通信连接。由于现有PLC设备一般具有以太网接口,而移动终端通常具有USB接口,因此可以通过OTG数据线、以太网接口(如RJ45转接口)以及网线(如RJ45线)实现两者的通信连接。Referring to FIG. 5 , in this example implementation, the mobile terminal and the PLC device may be connected through an OTG data cable, an Ethernet (Ethernet) interface, and a network cable. Since the existing PLC equipment generally has an Ethernet interface, and the mobile terminal usually has a USB interface, the communication connection between the two can be realized through an OTG data line, an Ethernet interface (such as an RJ45 interface) and a network cable (such as an RJ45 line).

进一步的,本示例实施方式中还提供了另一种数据传输方式。本示例实施方式中,将以Android操作系统的手机为例进行详细说明。参考图6中所示,所述数据传输方法可以包括下述步骤:Further, another data transmission manner is provided in this example implementation manner. In this example implementation manner, a mobile phone with an Android operating system will be taken as an example for detailed description. Referring to Fig. 6, the data transmission method may include the following steps:

S21.按照所述移动终端的一端口号创建代表以太网通信协议套接字的DatagramSocket实例。S21. Create a DatagramSocket instance representing an Ethernet communication protocol socket according to a port number of the mobile terminal.

参考图7中所示,首先添加Android操作系统的API库(Library),声明以太网通信协议套接字Socket所需要的变量以及声明应用程序使用的线程并启动线程。在启动线程后,按照所述移动终端的一端口号创建代表以太网通信协议套接字的DatagramSocket实例。例如,可以是通过“DatagramSocket(int prot)”创建一个DatagramSocket实例并绑定到所述移动终端默认IP地址以及指定的端口号;或者,也可以是通过“DatagramSocket(int port,InetAddress laddr)”创建一个DatagramSocket实例并绑定到指定IP的地址以及指定的端口号等。As shown in FIG. 7 , first add the API library (Library) of the Android operating system, declare the variables required by the Ethernet communication protocol socket Socket and declare the threads used by the application program and start the threads. After the thread is started, a DatagramSocket instance representing the Ethernet communication protocol socket is created according to a port number of the mobile terminal. For example, a DatagramSocket instance may be created through "DatagramSocket(int prot)" and bound to the default IP address of the mobile terminal and a specified port number; or, it may be created through "DatagramSocket(int port, InetAddress laddr)" A DatagramSocket instance is bound to the specified IP address, specified port number, etc.

S22.按照目标IP地址创建OutbroadcastAddr实例以向所述PLC设备进行地址广播。S22. Create an OutbroadcastAddr instance according to the target IP address to perform address broadcast to the PLC device.

本示例实施方式中,在所述移动终端与所述PLC设备进行数据传输之前不需要建立通信连接,所述应用程序需要创建OutbroadcastAddr实例向所述PLC设备进行地址广播,以便于在进行数据传输时所述PLC设备与所述移动终端之间接收或者发送数据。In this example embodiment, before the mobile terminal and the PLC device perform data transmission, no communication connection needs to be established, and the application program needs to create an OutbroadcastAddr instance to broadcast the address to the PLC device, so that when data transmission is performed Data is received or sent between the PLC device and the mobile terminal.

S23.创建DatagramPacket实例。S23. Create a DatagramPacket instance.

DatagramPacket实例代表的是数据包,DatagramSocket实例接收和发送的数据都是通过DatagramPacket实例来完成。例如,本示例实施方式中可以通过“DatagramPacket(byte[]buf,int length,InetAddress addr,int port)”等构造器创建一个DatagramPacket实例,并给出接收数据的字节数组及其长度。在创建所述DatagramPacket实例之后,可以打开以太网连接的权限,进行握手命令,并在握手成功后建立所述移动终端与所述PLC设备之间的通信连接。The DatagramPacket instance represents the data packet, and the data received and sent by the DatagramSocket instance is completed through the DatagramPacket instance. For example, in this exemplary embodiment, a DatagramPacket instance can be created through constructors such as "DatagramPacket(byte[]buf, int length, InetAddress addr, int port)", and the byte array and length of the received data can be given. After the DatagramPacket instance is created, the permission of the Ethernet connection can be opened, a handshake command can be performed, and a communication connection between the mobile terminal and the PLC device can be established after the handshake is successful.

S24.通过所述DatagramPacket实例从所述DatagramSocket实例发送或者接收数据。S24. Send or receive data from the DatagramSocket instance through the DatagramPacket instance.

在创建所述DatagramPacket实例之后,本示例实施方式中例如可以通过“receive(DatagramPacket p)”从所述DatagramSocket实例中接收数据包;以及可以通过“send(DatagramPacket p)”以该DatagramSocket实例向外发送数据包等。After creating the DatagramPacket instance, in this example implementation, for example, the data packet can be received from the DatagramSocket instance through "receive(DatagramPacket p)"; packets etc.

进一步的,所述本示例实施方式中所述数据传输方法还可以包括:Further, the data transmission method described in this example embodiment may also include:

S20.接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式。例如,参考图8中所示,通过安装于所述移动终端的上述应用程序可以用于供用户选择进行数据上传或者进行数据下载。S20. Receive a transmission mode selection instruction and enter a data download mode or a data upload mode according to the transmission mode selection instruction. For example, as shown in FIG. 8 , the above-mentioned application program installed on the mobile terminal can be used for the user to choose to perform data upload or data download.

进入所述数据下载模式后,用户可以设定从所述PLC设备下载的程序数据将要保存的路径(即下述目标文件路径),所述应用程序还可以判断所述目标文件路径是否已经存在与待传输程序数据重名的文件。在判断所述目标文件路径没有与待传输程序数据重名的文件后,通过上述步骤S21~步骤S23建立所述移动终端与所述PLC设备之间的通信连接,并获取所述目标文件路径,根据所述步骤S24以及打包的所述PLC设备的上传/下载协议通过所述DatagramPacket实例以及所述DatagramSocket实例按照Android Ethernet流方式,从所述PLC设备中获取待传输数据,并下载保存至所述目标文件路径。After entering the data download mode, the user can set the path (i.e. the following target file path) to be saved from the program data downloaded from the PLC device, and the application program can also judge whether the target file path already exists or not. The file with the same name as the program data to be transferred. After judging that the target file path does not have a file with the same name as the program data to be transmitted, establish a communication connection between the mobile terminal and the PLC device through the above steps S21 to S23, and obtain the target file path, According to the step S24 and the upload/download protocol of the packaged PLC device, the data to be transmitted is obtained from the PLC device through the DatagramPacket instance and the DatagramSocket instance according to the Android Ethernet flow mode, and downloaded and saved to the target file path.

此外,继续参考图8中所示,在下载待传输程序数据之前,还可以判断用户连接的机型是否有误,并且在判断用户连接的机型正确时,才进行数据传输。在数据传输完成之后,可以通过声音或者文字等方式提醒用户待传输程序数据已经传输完毕。In addition, as shown in FIG. 8 , before downloading the program data to be transmitted, it is also possible to determine whether the model connected by the user is wrong, and only when it is determined that the model connected by the user is correct, the data transmission is performed. After the data transmission is completed, the user may be reminded that the program data to be transmitted has been transmitted through sound or text.

进入所述数据上传模式后,用户可以选择所述移动终端上的待传输数据的存放路径,所述应用程序还可以对所述移动终端上的待传输数据进行校验,以判断待传输数据是否被破坏以及防止数据传输不完整。在判断待传输数据校验通过后,通过上述步骤S21~步骤S23建立所述移动终端与所述PLC设备之间的通信连接,并获取所述待传输数据的存放路径,从所述待传输数据的存放路径获取待传输数据,根据所述步骤S24以及打包的所述PLC设备的上传/下载协议通过所述DatagramPacket实例以及所述DatagramSocket实例按照AndroidEthernet流的方式上传至所述PLC设备。当所述待传输数据的存放路径存在多个待传输数据时,本示例实施方式中还可以通过循环上述传输过程,逐个进行数据传输。After entering the data upload mode, the user can select the storage path of the data to be transmitted on the mobile terminal, and the application program can also check the data to be transmitted on the mobile terminal to determine whether the data to be transmitted be corrupted and prevent incomplete data transmission. After judging that the data to be transmitted has passed the verification, establish the communication connection between the mobile terminal and the PLC device through the above steps S21 to S23, and obtain the storage path of the data to be transmitted, from the data to be transmitted The storage path obtains the data to be transmitted, and according to the step S24 and the upload/download protocol of the packaged PLC device, uploads to the PLC device through the DatagramPacket instance and the DatagramSocket instance according to the AndroidEthernet flow mode. When there are multiple pieces of data to be transmitted in the storage path of the data to be transmitted, in this exemplary embodiment, the above transmission process may be cycled to transmit data one by one.

此外,继续参考图8中所示,在上传待传输程序数据之前,还可以判断用户连接的机型是否有误,并且在判断用户连接的机型正确时,才进行数据传输。在数据传输完成之后,可以通过声音或者文字等方式提醒用户待传输程序数据已经传输完毕。In addition, as shown in FIG. 8 , before uploading the program data to be transmitted, it is also possible to determine whether the model connected by the user is wrong, and only when it is determined that the model connected by the user is correct, the data transmission is performed. After the data transmission is completed, the user may be reminded that the program data to be transmitted has been transmitted through sound or text.

进一步的,本示例实施方式中还提供了另一种数据传输方式,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端。参考图9中所示,所述数据传输方式可以包括:Further, another data transmission manner is provided in this example embodiment, which is used to implement data transmission between the mobile terminal and the PLC device and is applied to the mobile terminal. Referring to what is shown in FIG. 9, the data transmission method may include:

S31.判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输。S31. Determine whether data transmission is performed through USB communication mode or data transmission is performed through Ethernet mode.

例如,参考图10中所示,通过安装于所述移动终端的上述应用程序可以用于供用户选择通过USB通信方式进行数据传输或者通过以太网方式进行数据传输,所述应用程序可以据此判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输。但在本公开的其他示例性实施例中,也可以由应用程序进行自动判断,本示例实施方式中对此不做特殊限定。此外,在图10中,是先选择通信方式,再选择数据传输模式;但在本公开的其他示例性实施例中,也可以是先选择数据传输模式,再选择通信方式,这同样属于本公开的保护范围。For example, as shown in FIG. 10 , the above-mentioned application program installed in the mobile terminal can be used for the user to select data transmission through USB communication mode or data transmission through Ethernet mode, and the application program can judge accordingly Data transmission via USB communication or data transmission via Ethernet. However, in other exemplary embodiments of the present disclosure, the automatic judgment may also be performed by an application program, which is not specifically limited in this exemplary embodiment. In addition, in FIG. 10, the communication mode is selected first, and then the data transmission mode is selected; however, in other exemplary embodiments of the present disclosure, the data transmission mode may be selected first, and then the communication mode is selected, which also belongs to the present disclosure scope of protection.

S32.若判断通过USB通信方式进行数据传输,则执行图2~4所述的数据传输方法。由于图2~4所述的数据传输方法已经进行了详细描述,因此此处不再赘述。S32. If it is determined that the data transmission is performed through the USB communication method, execute the data transmission method described in FIGS. 2-4. Since the data transmission methods described in FIGS. 2 to 4 have been described in detail, they will not be repeated here.

S33.若判断通过以太网通信方式进行数据传输,则执行图6~8所述的数据传输方法。由于图6~8所述的数据传输方法已经进行了详细描述,因此此处不再赘述。S33. If it is determined that the data transmission is performed through the Ethernet communication mode, execute the data transmission method described in FIGS. 6-8. Since the data transmission methods described in FIGS. 6 to 8 have been described in detail, they will not be repeated here.

通过所述步骤S31至S32可以使得所述数据传输方法适应更多的需求,使用户可以自由选择可用的或者方便实施的方式进行数据传输。Through the steps S31 to S32, the data transmission method can be adapted to more requirements, so that the user can freely choose an available or convenient way for data transmission.

进一步的,本示例实施方式中还提供了一种数据传输装置,可以用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端。参考图11中所示,所述数据传输装置1可以包括列表获取单元11、设备检测单元12、通信检测单元13以及数据传输单元14。其中:Further, this example embodiment also provides a data transmission device, which can be used to implement data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal. Referring to FIG. 11 , the data transmission device 1 may include a list acquisition unit 11 , a device detection unit 12 , a communication detection unit 13 and a data transmission unit 14 . in:

列表获取单元11可以用于获取所述移动终端的USB设备列表。The list acquiring unit 11 can be used to acquire the USB device list of the mobile terminal.

设备检测单元12可以用于检测所述USB设备列表中是否包含预定身份标识的PLC设备。The device detection unit 12 may be used to detect whether the USB device list contains a PLC device with a predetermined identity.

通信检测单元13可以用于在检测到所述PLC设备后获取所述PLC设备的通信端口以及获取所述通信端口的通信节点。The communication detection unit 13 may be configured to obtain the communication port of the PLC device and the communication node of the communication port after the PLC device is detected.

数据传输单元14可以用于打开USB设备,通过获取的所述通信节点进行数据传输。The data transmission unit 14 can be used to open the USB device, and perform data transmission through the obtained communication node.

继续参考图11中所示,本示例性实施例中所述数据传输装置还可以包括传输模式获取单元10。其中:Continuing to refer to what is shown in FIG. 11 , the data transmission device in this exemplary embodiment may further include a transmission mode acquisition unit 10 . in:

传输模式获取单元10可以用于接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式。The transmission mode acquiring unit 10 may be configured to receive a transmission mode selection instruction and enter a data download mode or a data upload mode according to the transmission mode selection instruction.

进入所述数据下载模式后,所述数据传输单元14获取所述移动终端上的目标文件路径,并且通过获取的所述通信节点将所述PLC设备中的待传输数据下载至所述目标文件路径。After entering the data download mode, the data transmission unit 14 obtains the target file path on the mobile terminal, and downloads the data to be transmitted in the PLC device to the target file path through the acquired communication node .

进入所述数据上传模式后,所述数据传输单元14获取所述移动终端上的待传输数据,并且通过获取的所述通信节点将所述移动终端的待传输数据至上传至所述PLC设备。After entering the data upload mode, the data transmission unit 14 acquires the data to be transmitted on the mobile terminal, and uploads the data to be transmitted by the mobile terminal to the PLC device through the obtained communication node.

本示例性实施例中,所述移动终端与所述PLC设备之间可以通过USB数据线以及OTG数据线通信连接。In this exemplary embodiment, the mobile terminal and the PLC device may be communicatively connected via a USB data line and an OTG data line.

进一步的,本示例实施方式中还提供了另一种数据传输装置,可以用于实现移动终端与PLC设备之间的数据传输且应可以用于所述移动终端。参考图12中所示,所述数据传输装置2可以包括套接字创建单元21、地址广播单元22以及数据传输单元23。其中:Further, another data transmission device is provided in this example embodiment, which can be used to implement data transmission between a mobile terminal and a PLC device and should be applicable to the mobile terminal. Referring to FIG. 12 , the data transmission device 2 may include a socket creation unit 21 , an address broadcast unit 22 and a data transmission unit 23 . in:

套接字创建单元21可以用于按照所述移动终端的一端口号创建代表以太网通信协议套接字的DatagramSocket实例。The socket creation unit 21 may be used to create a DatagramSocket instance representing a socket of the Ethernet communication protocol according to a port number of the mobile terminal.

地址广播单元22可以用于按照目标IP地址创建OutbroadcastAddr实例以向所述PLC设备进行地址广播。The address broadcast unit 22 may be used to create an OutbroadcastAddr instance according to the target IP address to perform address broadcast to the PLC device.

数据传输单元23可以用于创建DatagramPacket实例,并通过所述DatagramPacket实例从所述DatagramSocket实例发送或者接收数据。The data transmission unit 23 may be used to create a DatagramPacket instance, and send or receive data from the DatagramSocket instance through the DatagramPacket instance.

继续参考图12中所示,本示例性实施例中所述数据传输装置还可以包括传输模式获取单元20。其中:Continuing to refer to what is shown in FIG. 12 , the data transmission device in this exemplary embodiment may further include a transmission mode acquisition unit 20 . in:

传输模式获取单元20可以用于接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式。The transmission mode acquiring unit 20 may be configured to receive a transmission mode selection instruction and enter a data download mode or a data upload mode according to the transmission mode selection instruction.

进入所述数据下载模式后,所述数据传输单元20可以获取所述移动终端上的目标文件路径,并且通过所述DatagramPacket实例从所述DatagramSocket实例接收待传输数据并保存至所述目标文件路径。After entering the data download mode, the data transmission unit 20 can obtain the target file path on the mobile terminal, and receive the data to be transmitted from the DatagramSocket instance through the DatagramPacket instance and save it to the target file path.

进入所述数据上传模式后,所述数据传输单元20可以获取所述移动终端上的待传输数据,并且通过所述DatagramPacket实例从所述DatagramSocket实例接收将所述移动终端的待传输数据至发送至所述PLC设备。After entering the data upload mode, the data transmission unit 20 can obtain the data to be transmitted on the mobile terminal, and receive the data to be transmitted from the DatagramSocket instance through the DatagramPacket instance and send the data to be transmitted by the mobile terminal to The PLC device.

本示例性实施例中,所述移动终端与所述PLC设备之间通过OTG数据线、以太网接口以及网线通信连接。In this exemplary embodiment, the mobile terminal is connected to the PLC device through an OTG data cable, an Ethernet interface, and a network cable.

进一步的,本示例实施方式中还提供了再一种数据传输装置,可以用于实现移动终端与PLC设备之间的数据传输且应可以用于所述移动终端。参考图13中所示,本示例实施方式中所述数据传输装置3可以包括通信方式判断单元31以图11所示的数据传输装置1和图12中所示的数据传输装置2。其中:Further, another data transmission device is provided in this example embodiment, which can be used to implement data transmission between a mobile terminal and a PLC device and should be applicable to the mobile terminal. Referring to FIG. 13 , the data transmission device 3 in this exemplary embodiment may include a communication mode judging unit 31 and the data transmission device 1 shown in FIG. 11 and the data transmission device 2 shown in FIG. 12 . in:

通信方式判断单元31可以用于判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输。若判断通过USB通信方式进行数据传输,则通过图11中的数据传输装置1进行数据传输。若判断通过以太网通信方式进行数据传输,则通过图12中的数据传输装置2进行数据传输。The communication mode judging unit 31 can be used for judging whether data transmission is performed through USB communication mode or data transmission is performed through Ethernet mode. If it is determined that the data transmission is performed through the USB communication method, then the data transmission is performed through the data transmission device 1 in FIG. 11 . If it is judged that the data transmission is performed through the Ethernet communication method, the data transmission is performed through the data transmission device 2 in FIG. 12 .

继续参考图13中所示,本示例性实施例中,所述数据传输装置还可以包括通信方式获取单元30。其中:Continuing to refer to FIG. 13 , in this exemplary embodiment, the data transmission device may further include a communication method acquiring unit 30 . in:

通信方式获取单元30可以用于接收一通信方式选择指令。所述通信方式判断单元31根据所述通信方式选择指令判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输。The communication mode acquisition unit 30 may be configured to receive a communication mode selection instruction. The communication mode judging unit 31 judges data transmission via USB communication mode or data transmission via Ethernet mode according to the communication mode selection instruction.

上述数据传输装置中各模块/单元的具体细节已经在对应的数据传输方法中进行了详细的描述,因此此处不再赘述。The specific details of each module/unit in the above data transmission device have been described in detail in the corresponding data transmission method, so details will not be repeated here.

需要说明的是,在上述示例性实施例中,是以Android操作系统的手机为例进行说明,但本领域技术人员容易理解的是,本示例实施方式中的技术方案同样可以适用于平板电脑等其他移动终端,也不局限于Android操作系统,例如同样可以适用于IOS或者其他操作系统。而且,上述示例性实施例中,是以传输程序数据为例进行说明,但在本公开的其他示例性实施例中,也可以是传输监控数据等其他数据,本示例实施方式中对此不做特殊限定。另外,上述示例性实施例中是以UDP通信方式为例进行说明,但基于同样的发明构思实现的TCP、WIFI等连接方式的数据传输方式,同样属于本公开的保护范围。It should be noted that, in the above exemplary embodiment, a mobile phone with an Android operating system is used as an example for illustration, but those skilled in the art can easily understand that the technical solution in this exemplary embodiment can also be applied to tablet computers, etc. Other mobile terminals are not limited to the Android operating system, for example, can also be applied to IOS or other operating systems. Moreover, in the above exemplary embodiments, the transmission of program data is taken as an example for illustration, but in other exemplary embodiments of the present disclosure, other data such as monitoring data may also be transmitted, which is not done in this exemplary embodiment. Special limited. In addition, in the above exemplary embodiments, the UDP communication method is taken as an example for illustration, but the data transmission methods of TCP, WIFI and other connection methods implemented based on the same inventive concept also belong to the protection scope of the present disclosure.

综上所述,本示例实施方式中的技术方案可以实现移动终端与PLC设备之间的数据传输。相比于现有技术,一方面不需要PC端,借助移动终端的便携性,可以使得PLC设备的数据传输更加方便;另一方面,无需安装特定的驱动以及配置专业的工具,实施方便;再一方面,不必使用VNC类似的远程控制软件,所以不要求移动终端一定具有以太网功能,提升了PLC设备的数据传输方法的适用范围;而且由于是通过有线的USB或者以太网的方法进行通信,更能保证通信的效率以及可靠性。To sum up, the technical solution in this exemplary embodiment can realize data transmission between the mobile terminal and the PLC device. Compared with the existing technology, on the one hand, no PC terminal is required, and the portability of the mobile terminal can make the data transmission of the PLC device more convenient; on the other hand, there is no need to install specific drivers and configure professional tools, which is convenient for implementation; and On the one hand, there is no need to use VNC-like remote control software, so the mobile terminal is not required to have an Ethernet function, which improves the scope of application of the data transmission method of the PLC device; and because it communicates through wired USB or Ethernet, It can better guarantee the efficiency and reliability of communication.

应当注意,尽管在上文详细描述中提及了用于动作执行的设备的若干模块或者单元,但是这种划分并非强制性的。实际上,根据本公开的实施方式,上文描述的两个或更多模块或者单元的特征和功能可以在一个模块或者单元中具体化。反之,上文描述的一个模块或者单元的特征和功能可以进一步划分为由多个模块或者单元来具体化。It should be noted that although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. Actually, according to the embodiment of the present disclosure, the features and functions of two or more modules or units described above may be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided to be embodied by a plurality of modules or units.

此外,尽管在附图中以特定顺序描述了本公开中方法的各个步骤,但是,这并非要求或者暗示必须按照该特定顺序来执行这些步骤,或是必须执行全部所示的步骤才能实现期望的结果。附加的或备选的,可以省略某些步骤,将多个步骤合并为一个步骤执行,以及/或者将一个步骤分解为多个步骤执行等。In addition, although steps of the methods of the present disclosure are depicted in the drawings in a particular order, there is no requirement or implication that the steps must be performed in that particular order, or that all illustrated steps must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step for execution, and/or one step may be decomposed into multiple steps for execution, etc.

参照图14,应用上述数据传输方案的移动终端300可以包括以下一个或多个组件:处理组件302,存储器304,电源组件306,多媒体组件308,音频组件310,输入/输出(I/O)的接口312,传感器组件314,以及通信组件316。Referring to Fig. 14, the mobile terminal 300 that applies above-mentioned data transmission scheme can comprise following one or more components: processing component 302, memory 304, power component 306, multimedia component 308, audio component 310, input/output (I/O) interface 312 , sensor component 314 , and communication component 316 .

处理组件302通常控制移动终端300的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件302可以包括一个或多个处理器320来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件302可以包括一个或多个模块,便于处理组件302和其他组件之间的交互。例如,处理组件302可以包括多媒体模块,以方便多媒体组件304和处理组件302之间的交互。The processing component 302 generally controls the overall operations of the mobile terminal 300, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 302 may include one or more processors 320 to execute instructions to complete all or part of the steps of the above method. Additionally, processing component 302 may include one or more modules that facilitate interaction between processing component 302 and other components. For example, processing component 302 may include a multimedia module to facilitate interaction between multimedia component 304 and processing component 302 .

存储器304被配置为存储各种类型的数据以支持在移动终端300的操作。这些数据的示例包括用于在移动终端300上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器304可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。The memory 304 is configured to store various types of data to support operations at the mobile terminal 300 . Examples of such data include instructions for any application or method operating on the mobile terminal 300, contact data, phonebook data, messages, pictures, videos, and the like. The memory 304 can be implemented by any type of volatile or non-volatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.

电源组件306为移动终端300的各种组件提供电力。电源组件306可以包括电源管理系统,一个或多个电源,及其他与为移动终端300生成、管理和分配电力相关联的组件。The power supply component 306 provides power to various components of the mobile terminal 300 . Power components 306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for mobile terminal 300 .

多媒体组件308包括在所述移动终端300和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件308包括一个前置摄像头和/或后置摄像头。当移动终端300处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。The multimedia component 308 includes a screen providing an output interface between the mobile terminal 300 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a boundary of a touch or swipe action, but also detect duration and pressure associated with the touch or swipe action. In some embodiments, the multimedia component 308 includes a front camera and/or a rear camera. When the mobile terminal 300 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have focal length and optical zoom capability.

音频组件310被配置为输出和/或输入音频信号。例如,音频组件310包括一个麦克风(MIC),当移动终端300处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器304或经由通信组件316发送。在一些实施例中,音频组件310还包括一个扬声器,用于输出音频信号。The audio component 310 is configured to output and/or input audio signals. For example, the audio component 310 includes a microphone (MIC), which is configured to receive an external audio signal when the mobile terminal 300 is in operation modes, such as a call mode, a recording mode and a voice recognition mode. Received audio signals may be further stored in memory 304 or sent via communication component 316 . In some embodiments, the audio component 310 also includes a speaker for outputting audio signals.

I/O接口312为处理组件302和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 312 provides an interface between the processing component 302 and a peripheral interface module, which may be a keyboard, a click wheel, a button, and the like. These buttons may include, but are not limited to: a home button, volume buttons, start button, and lock button.

传感器组件314包括一个或多个传感器,用于为移动终端300提供各个方面的状态评估。例如,传感器组件314可以检测到移动终端300的打开/关闭状态,组件的相对定位,例如所述组件为移动终端300的显示器和小键盘,传感器组件314还可以检测移动终端300或移动终端300一个组件的位置改变,用户与移动终端300接触的存在或不存在,移动终端300方位或加速/减速和移动终端300的温度变化。传感器组件314可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件314还可以包括光传感器,如CMOS或CCD图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件314还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。The sensor component 314 includes one or more sensors for providing various aspects of status assessment for the mobile terminal 300 . For example, the sensor component 314 can detect the open/close state of the mobile terminal 300, the relative positioning of components, such as the display and the keypad of the mobile terminal 300, the sensor component 314 can also detect the mobile terminal 300 or a mobile terminal 300 Changes in the positions of components, presence or absence of user contact with the mobile terminal 300 , orientation or acceleration/deceleration of the mobile terminal 300 and temperature changes of the mobile terminal 300 . The sensor assembly 314 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. Sensor assembly 314 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor component 314 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor or a temperature sensor.

通信组件316被配置为便于移动终端300和其他设备之间有线或无线方式的通信。移动终端300可以接入基于通信标准的无线网络,如WiFi,2G或3G,或它们的组合。在一个示例性实施例中,通信组件316经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件316还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。The communication component 316 is configured to facilitate wired or wireless communication between the mobile terminal 300 and other devices. The mobile terminal 300 can access a wireless network based on communication standards, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 316 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 316 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology and other technologies.

在示例性实施例中,移动终端300可以被一个或多个应用专用集成电路(ASIC)、数字信号处理器(DSP)、数字信号处理设备(DSPD)、可编程逻辑器件(PLD)、现场可编程门阵列(FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, the mobile terminal 300 may be powered by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable A programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic component implementation for performing the methods described above.

在示例性实施例中,还提供了一种包括指令的非临时性计算机可读存储介质,例如包括指令的存储器304,上述指令可由移动终端300的处理器320执行以完成本示例实施方式中的上述技术方案。例如,所述非临时性计算机可读存储介质可以是ROM、随机存取存储器(RAM)、CD-ROM、磁带、软盘和光数据存储设备等。In an exemplary embodiment, there is also provided a non-transitory computer-readable storage medium including instructions, such as a memory 304 including instructions, and the above instructions can be executed by the processor 320 of the mobile terminal 300 to complete the steps in this exemplary embodiment. The above-mentioned technical scheme. For example, the non-transitory computer readable storage medium may be ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like.

本领域技术人员在考虑说明书及实践这里公开的发明后,将容易想到本公开的其它实施方案。本申请旨在涵盖本公开的任何变型、用途或者适应性变化,这些变型、用途或者适应性变化遵循本公开的一般性原理并包括本公开未公开的本技术领域中的公知常识或惯用技术手段。说明书和实施例仅被视为示例性的,本公开的真正范围和精神由所附的权利要求指出。Other embodiments of the present disclosure will be readily apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, and these modifications, uses or adaptations follow the general principles of the present disclosure and include common knowledge or conventional technical means in the technical field not disclosed in the present disclosure . The specification and examples are to be considered exemplary only, with the true scope and spirit of the disclosure indicated by the appended claims.

Claims (16)

1.一种数据传输方法,其特征在于,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输方法包括:1. a data transmission method, is characterized in that, is used for realizing the data transmission between mobile terminal and PLC equipment and is applied to described mobile terminal; Described data transmission method comprises: 获取所述移动终端的USB设备列表;Obtain a USB device list of the mobile terminal; 检测所述USB设备列表中是否包含预定身份标识的PLC设备;Detecting whether a PLC device with a predetermined identity is included in the USB device list; 在检测到所述PLC设备后获取所述PLC设备的通信端口以及获取所述通信端口的通信节点;Obtaining the communication port of the PLC device and obtaining the communication node of the communication port after the PLC device is detected; 打开USB设备,通过获取的所述通信节点进行数据传输。Turn on the USB device, and perform data transmission through the obtained communication node. 2.根据权利要求1所述的数据传输方法,其特征在于,所述数据传输方法还包括:2. The data transmission method according to claim 1, wherein the data transmission method further comprises: 接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式;receiving a transmission mode selection command and entering a data download mode or a data upload mode according to the transmission mode selection command; 进入所述数据下载模式后,获取所述移动终端上的目标文件路径,并且通过获取的所述通信节点将所述PLC设备中的待传输数据下载至所述目标文件路径;After entering the data download mode, obtain the target file path on the mobile terminal, and download the data to be transmitted in the PLC device to the target file path through the obtained communication node; 进入所述数据上传模式后,获取所述移动终端上的待传输数据,并且通过获取的所述通信节点将所述移动终端的待传输数据至上传至所述PLC设备。After entering the data upload mode, obtain the data to be transmitted on the mobile terminal, and upload the data to be transmitted by the mobile terminal to the PLC device through the obtained communication node. 3.根据权利要求1或2所述的数据传输方法,其特征在于,所述移动终端与所述PLC设备之间通过USB数据线以及OTG数据线通信连接。3. The data transmission method according to claim 1 or 2, characterized in that, the mobile terminal and the PLC device are communicatively connected via a USB data line and an OTG data line. 4.一种数据传输方法,其特征在于,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输方法包括:4. A data transmission method, characterized in that, is used to realize data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal; the data transmission method comprises: 按照所述移动终端的一端口号创建代表以太网通信协议套接字的DatagramSocket实例;Create a DatagramSocket instance representing the Ethernet communication protocol socket according to a port number of the mobile terminal; 按照目标IP地址创建OutbroadcastAddr实例以向所述PLC设备进行地址广播;Create an OutbroadcastAddr instance according to the target IP address to broadcast the address to the PLC device; 创建DatagramPacket实例,并通过所述DatagramPacket实例从所述DatagramSocket实例发送或者接收数据。Create a DatagramPacket instance, and send or receive data from the DatagramSocket instance through the DatagramPacket instance. 5.根据权利要求4所述的数据传输方法,其特征在于,所述数据传输方法还包括:5. The data transmission method according to claim 4, wherein the data transmission method further comprises: 接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式;receiving a transmission mode selection command and entering a data download mode or a data upload mode according to the transmission mode selection command; 进入所述数据下载模式后,获取所述移动终端上的目标文件路径,通过所述DatagramPacket实例从所述DatagramSocket实例接收待传输数据并保存至所述目标文件路径;After entering the data download mode, obtain the target file path on the mobile terminal, receive the data to be transmitted from the DatagramSocket instance through the DatagramPacket instance and save it to the target file path; 进入所述数据上传模式后,获取所述移动终端上的待传输数据,通过所述DatagramPacket实例从所述DatagramSocket实例接收将所述移动终端的待传输数据至发送至所述PLC设备。After entering the data upload mode, obtain the data to be transmitted on the mobile terminal, receive and send the data to be transmitted from the mobile terminal to the PLC device through the DatagramPacket instance from the DatagramSocket instance. 6.根据权利要求4或5所述的数据传输方法,其特征在于,所述移动终端与所述PLC设备之间通过OTG数据线、以太网接口以及网线通信连接。6. The data transmission method according to claim 4 or 5, wherein the mobile terminal is connected to the PLC device through an OTG data line, an Ethernet interface and a network cable for communication. 7.一种数据传输方法,其特征在于,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输方法包括:7. A data transmission method, characterized in that, is used to realize data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal; the data transmission method comprises: 判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输;Judging data transmission via USB communication or data transmission via Ethernet; 若判断通过USB通信方式进行数据传输,则执行根据权利要求1~3任意一项所述的数据传输方法;If it is judged that data transmission is carried out by means of USB communication, then perform the data transmission method according to any one of claims 1 to 3; 若判断通过以太网通信方式进行数据传输,则执行根据权利要求4~6任意一项所述的数据传输方法。If it is determined that the data transmission is performed through the Ethernet communication mode, the data transmission method according to any one of claims 4-6 is executed. 8.根据权利要求7所述的数据传输方法,其特征在于,所述数据传输方法还包括:8. The data transmission method according to claim 7, wherein the data transmission method further comprises: 接收一通信方式选择指令,根据所述通信方式选择指令判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输。A communication mode selection instruction is received, and according to the communication mode selection instruction, it is determined whether data transmission is performed through USB communication mode or data transmission is performed through Ethernet mode. 9.一种数据传输装置,其特征在于,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输装置包括:9. A data transmission device, characterized in that, is used to realize data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal; the data transmission device includes: 列表获取单元,用于获取所述移动终端的USB设备列表;a list obtaining unit, configured to obtain a list of USB devices of the mobile terminal; 设备检测单元,用于检测所述USB设备列表中是否包含预定身份标识的PLC设备;A device detection unit, configured to detect whether a PLC device with a predetermined identity is included in the USB device list; 通信检测单元,用于在检测到所述PLC设备后获取所述PLC设备的通信端口以及获取所述通信端口的通信节点;a communication detection unit, configured to obtain the communication port of the PLC device and the communication node of the communication port after the PLC device is detected; 数据传输单元,用于打开USB设备,通过获取的所述通信节点进行数据传输。The data transmission unit is configured to open the USB device and perform data transmission through the obtained communication node. 10.根据权利要求9所述的数据传输装置,其特征在于,所述数据传输装置还包括:10. The data transmission device according to claim 9, wherein the data transmission device further comprises: 传输模式获取单元,用于接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式;A transmission mode acquisition unit, configured to receive a transmission mode selection instruction and enter a data download mode or a data upload mode according to the transmission mode selection instruction; 进入所述数据下载模式后,所述数据传输单元获取所述移动终端上的目标文件路径,并且通过获取的所述通信节点将所述PLC设备中的待传输数据下载至所述目标文件路径;After entering the data download mode, the data transmission unit obtains the target file path on the mobile terminal, and downloads the data to be transmitted in the PLC device to the target file path through the obtained communication node; 进入所述数据上传模式后,所述数据传输单元获取所述移动终端上的待传输数据,并且通过获取的所述通信节点将所述移动终端的待传输数据至上传至所述PLC设备。After entering the data upload mode, the data transmission unit obtains the data to be transmitted on the mobile terminal, and uploads the data to be transmitted by the mobile terminal to the PLC device through the obtained communication node. 11.根据权利要求9或10所述的数据传输装置,其特征在于,所述移动终端与所述PLC设备之间通过USB数据线以及OTG数据线通信连接。11. The data transmission device according to claim 9 or 10, characterized in that, the mobile terminal and the PLC device are communicatively connected via a USB data line and an OTG data line. 12.一种数据传输装置,其特征在于,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输装置包括:12. A data transmission device, characterized in that, is used to realize data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal; the data transmission device includes: 套接字创建单元,用于按照所述移动终端的一端口号创建代表以太网通信协议套接字的DatagramSocket实例;A socket creation unit is used to create a DatagramSocket instance representing the Ethernet communication protocol socket according to a port number of the mobile terminal; 地址广播单元,用于按照目标IP地址创建OutbroadcastAddr实例以向所述PLC设备进行地址广播;The address broadcast unit is used to create an OutbroadcastAddr instance according to the target IP address to broadcast the address to the PLC device; 数据传输单元,用于创建DatagramPacket实例,并通过所述DatagramPacket实例从所述DatagramSocket实例发送或者接收数据。The data transmission unit is configured to create a DatagramPacket instance, and send or receive data from the DatagramSocket instance through the DatagramPacket instance. 13.根据权利要求11或12所述的数据传输装置,其特征在于,所述数据传输装置还包括:13. The data transmission device according to claim 11 or 12, wherein the data transmission device further comprises: 传输模式获取单元,用于接收一传输模式选择指令并根据所述传输模式选择指令进入数据下载模式或者数据上传模式;A transmission mode acquisition unit, configured to receive a transmission mode selection instruction and enter a data download mode or a data upload mode according to the transmission mode selection instruction; 进入所述数据下载模式后,所述数据传输单元获取所述移动终端上的目标文件路径,通过所述DatagramPacket实例从所述DatagramSocket实例接收待传输数据并保存至所述目标文件路径;After entering the data download mode, the data transmission unit obtains the target file path on the mobile terminal, receives the data to be transmitted from the DatagramSocket instance through the DatagramPacket instance and saves it to the target file path; 进入所述数据上传模式后,所述数据传输单元获取所述移动终端上的待传输数据,通过所述DatagramPacket实例从所述DatagramSocket实例接收将所述移动终端的待传输数据至发送至所述PLC设备。After entering the data upload mode, the data transmission unit acquires the data to be transmitted on the mobile terminal, receives and sends the data to be transmitted from the mobile terminal to the PLC through the DatagramPacket instance from the DatagramSocket instance equipment. 14.根据权利要求12或13所述的数据传输装置,其特征在于,所述移动终端与所述PLC设备之间通过OTG数据线、以太网接口以及网线通信连接。14. The data transmission device according to claim 12 or 13, wherein the mobile terminal is connected to the PLC device through an OTG data line, an Ethernet interface and a network cable. 15.一种数据传输装置,其特征在于,用于实现移动终端与PLC设备之间的数据传输且应用于所述移动终端;所述数据传输装置包括:15. A data transmission device, characterized in that, is used to realize data transmission between a mobile terminal and a PLC device and is applied to the mobile terminal; the data transmission device includes: 通信方式判断单元,用于判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输;A communication mode judging unit for judging data transmission via USB communication mode or data transmission via Ethernet mode; 若判断通过USB通信方式进行数据传输,则通过权利要求9~11任意一项所述的数据传输装置进行数据传输;If it is judged that the data transmission is performed by means of USB communication, then the data transmission is performed by the data transmission device described in any one of claims 9 to 11; 若判断通过以太网通信方式进行数据传输,则通过权利要求12~14任意一项所述的数据传输装置进行数据传输。If it is judged that the data transmission is performed by means of Ethernet communication, the data transmission is performed by the data transmission device described in any one of claims 12-14. 16.根据权利要求15所述的数据传输装置,其特征在于,所述数据传输装置还包括:16. The data transmission device according to claim 15, wherein the data transmission device further comprises: 通信方式获取单元,用于接收一通信方式选择指令;a communication mode acquisition unit, configured to receive a communication mode selection instruction; 所述通信方式判断单元根据所述通信方式选择指令判断通过USB通信方式进行数据传输或者通过以太网方式进行数据传输。The communication mode judging unit judges data transmission via USB communication mode or data transmission via Ethernet mode according to the communication mode selection instruction.
CN201610268304.5A 2016-04-27 2016-04-27 Data transmission method and device Pending CN105975408A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610268304.5A CN105975408A (en) 2016-04-27 2016-04-27 Data transmission method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610268304.5A CN105975408A (en) 2016-04-27 2016-04-27 Data transmission method and device

Publications (1)

Publication Number Publication Date
CN105975408A true CN105975408A (en) 2016-09-28

Family

ID=56993398

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610268304.5A Pending CN105975408A (en) 2016-04-27 2016-04-27 Data transmission method and device

Country Status (1)

Country Link
CN (1) CN105975408A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106618594A (en) * 2016-11-10 2017-05-10 深圳市元征软件开发有限公司 Blood glucose data acquiring method and mobile terminal
WO2018058922A1 (en) * 2016-09-30 2018-04-05 中兴通讯股份有限公司 Signal transmission method and device
CN108319354A (en) * 2018-01-05 2018-07-24 青岛海信移动通信技术股份有限公司 To connect the method and device of USB camera power supply on mobile terminals
CN108763111A (en) * 2018-06-04 2018-11-06 Oppo(重庆)智能科技有限公司 Module unit driving method, module group drive device and computer readable storage medium
CN109413191A (en) * 2018-11-07 2019-03-01 深圳市网心科技有限公司 Data transmission method, electronic equipment and storage medium
CN112000374A (en) * 2020-07-13 2020-11-27 深圳市智微智能软件开发有限公司 USB touch screen replacing method, device, equipment and medium applied to android system
WO2024016810A1 (en) * 2022-07-21 2024-01-25 飞天诚信科技股份有限公司 Method and apparatus for implementing otg communication without plugging, terminal device, and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010027500A1 (en) * 2000-03-09 2001-10-04 International Business Machines Corporation Data transmission system, data transmission terminal, controller and interface method
CN102654766A (en) * 2012-04-18 2012-09-05 华中科技大学 Wireless remote PLC (Programmable Logic Controller) monitoring system and application thereof
CN103716072A (en) * 2013-12-20 2014-04-09 天地融科技股份有限公司 Bluetooth device connection method, master bluetooth device and slave bluetooth device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010027500A1 (en) * 2000-03-09 2001-10-04 International Business Machines Corporation Data transmission system, data transmission terminal, controller and interface method
CN102654766A (en) * 2012-04-18 2012-09-05 华中科技大学 Wireless remote PLC (Programmable Logic Controller) monitoring system and application thereof
CN103716072A (en) * 2013-12-20 2014-04-09 天地融科技股份有限公司 Bluetooth device connection method, master bluetooth device and slave bluetooth device

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
ELLIOTTE RUSTY HARROLD著,朱涛江 等译: "《JAVA网络编程(第三版)》", 30 November 2005, 中国电力出版社 *
席天翔 等: ""基于移动终端的液位测量系统的设计与实现"", 《自动化与仪表》 *
张璞 等: "《解析JAVA程序设计(第2版)》", 31 December 2013, 清华大学出版社 *
敖伟智 等: ""基于智能移动终端与PLC的配方打叶计量系统设计"", 《科技创新(上旬刊)》 *
齐继阳 等: ""基于安卓移动设备的嵌入式监控系统设计方法"", 《自动化与仪表》 *

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018058922A1 (en) * 2016-09-30 2018-04-05 中兴通讯股份有限公司 Signal transmission method and device
CN107889263A (en) * 2016-09-30 2018-04-06 中兴通讯股份有限公司 A signal transmission method and device
US11224031B2 (en) 2016-09-30 2022-01-11 Xi'an Zhongxing New Software Co., Ltd Signal transmission method and device
CN107889263B (en) * 2016-09-30 2022-09-13 中兴通讯股份有限公司 Data transmitting method, data receiving method, device, equipment and storage medium
US12069662B2 (en) 2016-09-30 2024-08-20 Zte Corporation Signal transmission method and device
CN106618594A (en) * 2016-11-10 2017-05-10 深圳市元征软件开发有限公司 Blood glucose data acquiring method and mobile terminal
CN108319354A (en) * 2018-01-05 2018-07-24 青岛海信移动通信技术股份有限公司 To connect the method and device of USB camera power supply on mobile terminals
CN108763111A (en) * 2018-06-04 2018-11-06 Oppo(重庆)智能科技有限公司 Module unit driving method, module group drive device and computer readable storage medium
CN109413191A (en) * 2018-11-07 2019-03-01 深圳市网心科技有限公司 Data transmission method, electronic equipment and storage medium
CN112000374A (en) * 2020-07-13 2020-11-27 深圳市智微智能软件开发有限公司 USB touch screen replacing method, device, equipment and medium applied to android system
CN112000374B (en) * 2020-07-13 2024-01-02 深圳市智微智能软件开发有限公司 USB touch screen replacement method, device, equipment and medium applied to android system
WO2024016810A1 (en) * 2022-07-21 2024-01-25 飞天诚信科技股份有限公司 Method and apparatus for implementing otg communication without plugging, terminal device, and medium

Similar Documents

Publication Publication Date Title
CN105975408A (en) Data transmission method and device
RU2663481C2 (en) Method and device for installing connectable module of intelligent device
EP3032412B1 (en) Method and device for upgrading firmware
CN107562500B (en) Debugging device, method and equipment
KR101704957B1 (en) Data transfer method, apparatus, apparatus, program and recording medium
CN104038536A (en) Plug-in communication method and device
CN104199677A (en) System reinstalling method and device and corresponding device
EP3866014A1 (en) Data processing method, data processing device, terminal and smart device
CN103984664A (en) Cloud space access method, device and system
CN105677513A (en) Method and device for restoring backup data
CN106571892A (en) Data processing method and device
CN105391832A (en) Hardware information detection system used for detecting hardware state of smartphone
CN105187671A (en) Recording method and device
CN107197088B (en) Screenshot method and device based on android mobile device
KR102028944B1 (en) Methods, devices, systems, programs and storage media for accessing a plurality of servers of smart home appliances
CN105117354A (en) Firmware programming method, apparatus and system
CN105530129A (en) Router reset method and device
CN205318371U (en) Hardware test equipment towards ampere tall and erect system
CN111031124A (en) Home equipment networking deployment method and device, electronic equipment and storage medium
CN106533841A (en) Method, apparatus and system for testing protocol consistency of user identification module cards
CN106547705A (en) USB (universal serial bus) operating mode control method and device
CN106611112A (en) Application program safe processing method, device and equipment
CN115408695A (en) Attack detection method and device, storage medium and electronic equipment
CN105846223A (en) USB interface plug and USB interface plug control method and device
CN106612149A (en) Radio frequency circuit test method, device, system and mobile terminal

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20160928

WD01 Invention patent application deemed withdrawn after publication