CN104580196A - Communication method and device - Google Patents

Communication method and device Download PDF

Info

Publication number
CN104580196A
CN104580196A CN201410852876.9A CN201410852876A CN104580196A CN 104580196 A CN104580196 A CN 104580196A CN 201410852876 A CN201410852876 A CN 201410852876A CN 104580196 A CN104580196 A CN 104580196A
Authority
CN
China
Prior art keywords
message
service
processing module
communication
communication device
Prior art date
Application number
CN201410852876.9A
Other languages
Chinese (zh)
Other versions
CN104580196B (en
Inventor
马天元
马炜镔
刘朝
綦振
周远
姚秀萍
文大军
田野
Original Assignee
深圳市兰丁科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市兰丁科技有限公司 filed Critical 深圳市兰丁科技有限公司
Priority to CN201410852876.9A priority Critical patent/CN104580196B/en
Publication of CN104580196A publication Critical patent/CN104580196A/en
Application granted granted Critical
Publication of CN104580196B publication Critical patent/CN104580196B/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network-specific arrangements or communication protocols supporting networked applications
    • H04L67/28Network-specific arrangements or communication protocols supporting networked applications for the provision of proxy services, e.g. intermediate processing or storage in the network
    • H04L67/2833Network-specific arrangements or communication protocols supporting networked applications for the provision of proxy services, e.g. intermediate processing or storage in the network for grouping or aggregating service requests, e.g. for unified processing of service requests

Abstract

The invention discloses a communication method and device. The communication method comprises the steps that an input/output port module of a first communication device receives a message from a second communication device; the input/output port module outputs the message to a service request processing module of the first communication device; the service request processing module determines a service provider of the received message; if the service request processing module determines that the message provider is the first communication device, the received message is output to a first logic processing module of the first communication device, the first logic processing module calls a corresponding service to process the received message according to the service requested by the received message, and a processing result is fed back to the second communication device. By means of the communication method and device, the reusability of a communication system can be effectively improved.

Description

_种通信方法和通信装置 _ Method of communication and a communication apparatus

技术领域 FIELD

[0001] 本发明涉及通信技术领域,具体涉及一种通信方法和通信装置。 [0001] The present invention relates to communication technologies, and particularly relates to a communication method and a communication apparatus.

背景技术 Background technique

[0002] 模拟测试方案能够帮助我们检测智能硬件(例如:智能插座、智能指环、智能情景灯等)的稳定性。 [0002] Simulation Test solutions intelligent hardware can help us to detect (e.g.: smart socket, intelligent ring, intelligent scene lights, etc.) stability. 目前,当需要检验支撑智能硬件的云服务时,需要开发模拟器模拟大量智能硬件与云服务通信的场景,通过这种方法来检验云服务是否能够提供功能完善,性能合格的服务。 Currently, when you need to check hardware support intelligent cloud services need to be developed simulator simulates a large number of hardware and intelligent scene cloud communication services, cloud services to test whether this method can provide a comprehensive, qualified service performance.

[0003] 目前,对智能硬件的测试采用输入输出接口(1/0, Input/Output)通信和业务强耦合的方案,因此,当通信协议改变(或者业务逻辑改变)时,需要开发者重新开发一套新的模拟测试方案。 [0003] Currently, the use of intelligent hardware test input and output interface (1/0, Input / Output) communication scheme and operations of the strong coupling, therefore, when the communication protocol is changed (or the changing business logic), developers need to redevelop a new simulation test program. 由于每一款智能硬件,根据自身软硬件特性以及服务需求,可能采用不同的通信协议(例如传输控制协议(TCP,Transmission Control Protocol)、用户数据报协议(UDP,User Datagram Protocol))和不同的业务逻辑,这使得现有方案中,在每生产一款智能硬件时,就需要重新开发一套模拟测试方案,而无法复用原有的模拟测试方案,从而导致开发难度大、开发周期长等问题存在。 Because each an intelligent hardware, according to their hardware and software characteristics and service requirements, may use different communication protocols (e.g., Transmission Control Protocol (TCP, Transmission Control Protocol), User Datagram Protocol (UDP, User Datagram Protocol)) and different business logic, which makes the existing scheme, when each producing a smart hardware, you need to develop a simulation test program, and can not reuse existing analog testing program, resulting in development is difficult, and long development cycle there is a problem.

发明内容 SUMMARY

[0004] 本发明提供一种通信方法和通信装置,用于提高通信系统的复用性。 [0004] The present invention provides a communication method and a communication apparatus, a communication system for increasing the reusability.

[0005] 本发明一方面提供一种通信方法,包括: [0005] In one aspect the present invention provides a communication method, comprising:

[0006] 第一通信装置的输入输出接口模块接收来自第二通信装置的消息; [0006] The input and output interface module of the first communication device receives a message from a second communication device;

[0007] 上述输入输出接口模块向上述第一通信装置的服务请求处理模块输出上述消息; [0007] The input and output interface module requests the service processing module to the first communication means to output the message;

[0008] 上述服务请求处理模块确定接收的上述消息的服务提供者; [0008] The service request processing module determines the above-described message received service provider;

[0009] 若上述服务请求处理模块确定接收的上述消息的服务提供者为上述第一通信装置,则:向上述第一通信装置的第一逻辑处理模块输出接收的上述消息,上述第一逻辑处理模块根据接收的上述消息请求的服务,调用相应服务对接收的上述消息进行处理,将处理结果返回给上述第二通信装置。 [0009] When the above-described service provider service request processing module determines that the received message is the first communication device, then: the above-described message processing module receiving a first logic output of the first communication apparatus to said first logic processing according to the module receiving the request service message, call the appropriate service message received by the above-described processing, returns the processing result to said second communication device.

[0010] 本发明另一方面提供一种通信装置,包括: [0010] In another aspect the present invention provides a communication apparatus, comprising:

[0011] 输入输出接口模块、服务请求处理模块和第一逻辑处理模块。 [0011] The input and output interface module, the service request processing module and a first logic processing module.

[0012] 上述输入输出接口模块用于接收来自另一通信装置的消息,并向上述服务请求处理模块输出接收的上述消息; [0012] The input-output interface means for receiving a message from another communication apparatus, and for requesting the message processing module receives the output of the services;

[0013] 上述服务请求处理模块用于:确定接收的上述消息的服务提供者;当上述服务请求处理模块确定接收的上述消息的服务提供者为上述通信装置时,向上述第一逻辑处理模块输出接收的上述消息; [0013] The service request processing means for: determining a service provider received the above message; service provider when the above-described message processing module determines that the received service request to the communication means to the first output of the logic processing module receiving the message;

[0014] 上述第一逻辑处理模块用于:根据接收的上述消息请求的服务,调用相应服务对接收的上述消息进行处理,将处理结果返回给上述另一通信装置。 [0014] The first logic processing module is configured to: based on the received request message service, a corresponding service invocation message received by the above-described processing, returns the processing result to said another communication device.

[0015] 由上可见,本发明中通信装置包括:1/0模块、服务请求处理模块和第一逻辑处理模块三个模块,其中,I/O模块属于I/O层,服务请求处理模块和第一逻辑处理模块属于业务层,通过将通信装置的通信过程模块化处理,使得I/O层与业务层完全分开,即在I/O层部分不涉及到业务层,在业务层不涉及到I/O层,当通信协议改变(或者业务逻辑改变) 时,只需修改I/O层部分(或业务层部分)即可满足通信协议改变(或者业务逻辑改变) 后的通信需要,有效提高了通信系统的复用性,实现了通信系统的高复用、低耦合的效果。 [0015] seen from the above, according to the present invention, the communication device comprising: a 1/0 module, the service request processing module and the first logic processing module of three modules, wherein, I / O modules belonging to I / O layer, and a service request processing module belonging to a first service logic processing module layer, the communication process by the communication modular processing apparatus, so that the I / O layer and the business layer completely separate, i.e., the I / O layer portion not related to the business layer, not involved in the business layer communication requires I / O layer, when the communication protocol is changed (or the changing business logic), simply modify the I / O layer portion (or business layer portion) can be changed to meet the communication protocols (or business logic change) after, improve reusability of a communication system, a high effect is achieved multiplexing communication system, low coupling.

附图说明 BRIEF DESCRIPTION

[0016] 为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。 [0016] In order to more clearly illustrate the technical solutions in the embodiments or the prior art embodiment of the present invention, briefly introduced hereinafter, embodiments are described below in the accompanying drawings or described in the prior art needed to be used in describing the embodiments the drawings are only some embodiments of the present invention, those of ordinary skill in the art is concerned, without any creative effort, and can obtain other drawings based on these drawings.

[0017] 图1为本发明提供的一种通信方法一个实施例流程示意图; [0017] FIG 1 A communication method of the present invention provides a schematic view of an exemplary process;

[0018] 图2为本发明提供的一种通信架构实施例示意图; A schematic diagram of [0018] FIG. 2 provides a communication architecture of the embodiment of the present invention;

[0019] 图3为本发明提供的一种通信装置一个实施例结构示意图; [0019] FIG 3 A communication apparatus of the present invention provides a schematic structural embodiment;

[0020]图4为本发明提供的一种通信装置另一个实施例结构示意图。 [0020] FIG. 4 is a schematic diagram of another embodiment of the structure of the present invention to provide a communication apparatus.

具体实施方式 Detailed ways

[0021] 为使得本发明的发明目的、特征、优点能够更加的明显和易懂,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而非全部实施例。 [0021] The object of the present invention such that the invention, features, and advantages more comprehensible, the present invention in conjunction with the accompanying drawings in the following embodiments, the technical solutions in the embodiments of the present invention will be clearly and completely described, clearly , the described embodiments are merely part of embodiments of the present invention, but not all embodiments. 基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。 Based on the embodiments of the present invention, all other embodiments of ordinary skill in the art without any creative effort shall fall within the scope of the present invention.

[0022] 下面对本发明实施例中的一种通信方法进行描述,请参阅图1,本发明实施例中的通信方法,包括: [0022] Next, a communication method in the embodiment of the present invention will be described, referring to FIG 1, a communication method in the embodiment of the present invention, comprising:

[0023] 101、第一通信装置的I/O模块接收来自第二通信装置的消息; [0023] 101, I first communication device / O module receives a message from a second communication device;

[0024] 本发明实施例中,可以根据具体的通信协议(例如TCP、UDP等)需求来实现第一通信装置的I/O模块。 Embodiment [0024] of the present invention, depending on the particular communication protocol (e.g., TCP, UDP, etc.) needs to implement I / O module of the first communication device.

[0025] 若第一通信装置的I/O模块为TCP模块,则步骤101具体为:第一通信装置的I/O 模块接收来自第二通信装置的TCP消息。 [0025] When the first communication device I / O module TCP module, step 101 specifically is: I / O module of the first communication means receives the second message from the TCP communication device.

[0026] 若第一通信装置的I/O模块为UDP模块,则步骤101具体为:第一通信装置的I/O 模块接收来自第二通信装置的UDP消息。 [0026] When the I / O module to the first communication device UDP module, step 101 specifically is: I / O module of the first communication device receives a UDP message from the second communication device.

[0027] 102、上述I/O模块向上述第一通信装置的服务请求处理模块输出上述消息。 [0027] 102 the I / O request processing module outputs the message to the service module of the first communication device.

[0028] 103、上述服务请求处理模块确定接收的上述消息的服务提供者; [0028] 103, the processing module determines said service request message received above the service provider;

[0029] 本发明实施例中,消息的服务提供者主要分为两种,一种为第一通信装置本身,一种为除第一通信装置以为的其它通信装置。 [0029] The embodiments of the present invention, the service provider information is divided into two, one for a first communication device itself, one for the other communication devices except that the first communication device.

[0030] 可选地,当上述第一通信装置主动向其它通信装置发送请求服务的消息时,记录上述请求服务的消息的消息标识(例如通用唯一识别码(UUID,Universally Unique Identifier)),其中,基于同一服务的所有交互消息的消息标识一致,例如,对于第一通信装置主动向某一通信装置发送的消息(为便于描述,将该通信装置描述为消息A),以及该某一通信装置基于该第一通信装置发送的消息进行处理后,向该第一通信装置返回的消息(为便于描述,将该通信装置描述为消息B),消息A和消息B中的消息标识一致。 [0030] Alternatively, when the first communication device sends a message requesting a service to another communication apparatus, the recording of the message to the request service message identification (e.g., universal unique identifier (UUID, Universally Unique Identifier)), wherein , based on the same message all the service interaction message identifier coincides, for example, unsolicited messages sent to a certain communication device to the first communication means (for ease of description, the communication device is described as message a), and a communication device after processing based on the first communication device transmits a message, the message is returned to the first communication means (for ease of description, the communication device is described as message B), consistent messages a and B in the message identification message. 则在步骤103中,上述服务请求处理模块判断本地是否存在接收的上述消息的消息标识记录,若存在,则确定接收的上述消息的服务提供者为上述第二通信装置,若不存在,则确定接收的上述消息的服务提供者为上述第一通信装置。 Then in step 103 the service request identifies the message processing module determines whether recording of the received message exists locally, if exists, it is determined that the service provider received the above message is the second communication means, if present, is determined service provider received the above message to the first communication means.

[0031] 当然,本发明实施例中,上述服务请求处理模块也可以通过其它方式确定接收的上述消息的服务提供者,此处不作限定。 [0031] Of course, embodiments of the present invention, said service request processing module may also determine the news service provider received by other means, is not limited herein.

[0032] 104、若上述服务请求处理模块确定接收的上述消息的服务提供者为上述第一通信装置,则,向上述第一通信装置的第一逻辑处理模块输出接收的上述消息。 [0032] 104, if the service request processing module determines the above-described service provider received the above message to the first communication device, outputting the received message to the first logic processing module of the first communication means.

[0033] 105、上述第一逻辑处理模块根据接收的上述消息请求的服务,调用相应服务对接收的上述消息进行处理,将处理结果返回给上述第二通信装置; [0033] 105, the first logic processing module based on the received request message service, a corresponding service invocation message received by the above-described processing, returns the processing result to said second communication device;

[0034] 本发明实施例中,上述第一逻辑处理模块用于处理由第一通信装置提供服务的业务逻辑。 Embodiment [0034] of the present invention, the above-described first logic processing module for processing the business logic services provided by the first communication device. 具体地,在通信系统初始化时,上述第一逻辑处理模块对自己所管理的第一通信装置提供的所有服务进行扫描,理解自身所管理的所有服务(例如在智能硬件模拟测试场景中,上述第一逻辑处理模块所管理的服务可以为第一通信装置的开关状态、电量、温度等状态的查询服务),以便在上述服务请求处理模块将接收到的消息输入到上述第一逻辑处理模块时,上述第一逻辑处理模块调用相应服务对接收的消息进行处理,将处理结果返回给上述第二通信装置。 Specifically, when the communication system is initialized, the first logic processing module of the first communication means they manage all services provided by scanning understood that all services managed by itself (e.g. in an intelligent hardware simulation test scenarios, the first a logic processing module may be managed by the service state of the switching state of the first communication means, power, temperature, etc. queries), in order to request said service processing module in the received message input to said first logic processing module, said first service logic processing module corresponding to the received call message is processed, the processing result is returned to the second communication device.

[0035] 可选地,上述第一通信装置还包括:第二逻辑处理模块。 [0035] Alternatively, the first communication apparatus further comprises: a second logic processing module. 上述第二逻辑处理模块用于处理由除第一通信装置以外的其它装置提供服务的业务逻辑。 Said second logic processing module for processing the business logic services provided by other means other than the first communication device. 具体地,在通信系统初始化时,上述第二逻辑处理模块对自己所管理的所有服务进行扫描,理解自身所管理的所有服务(例如在智能硬件模拟测试场景中,上述第二逻辑处理模块所管理的服务可以为由第一通信装置主动发起的例如上传电量、登陆等服务)。 Specifically, when the communication system is initialized, the second logic processing module for all the services they manage scan understood that all services managed by itself (e.g. in an intelligent hardware simulation test scenarios, the second logic processing module management the service by the first communication device can initiate the upload capacity, landing and other services, for example). 当在步骤103中,若上述服务请求处理模块确定接收的上述消息的服务提供者为上述第二通信装置,则:向上述第一通信装置的第二逻辑处理模块输出接收的上述消息,上述第二逻辑处理模块根据接收的上述消息请求的服务,调用相应服务对接收的上述消息进行处理。 When in step 103, the service provider if said service request processing module determines the received message to the second communication device, then: the output of the second message received by the logic processing module to the first communication device, the first two logic processing module based on the received request message service, a corresponding service invocation message received on the above-described process.

[0036] 可选地,本发明实施例中上述第一通信装置与上述第二通信装置交互的消息格式可以如表1所示: [0036] Alternatively, the above-described embodiments of the present invention the above-described first communication device interacting with the second communication device message format may be as shown in Table 1:

[0037] 表1 [0037] TABLE 1

[0038] [0038]

Figure CN104580196AD00061

[0039] 由表1可见,消息包含Header (即消息头)和Body (即消息体)两个部分,Body 用于承载消息内容;Header包含:MessageID (即报文ID)、Module (即功能)、Action (即操作动作)、SendTo (即消息发送对象)和Bodylen (即消息长度)五个属性。 [0039] From Table 1, the message comprises two parts Header (i.e., message header) and Body (i.e., the message body), Body for carrying message content; Header comprising: MessageID (i.e., the packet ID), Module (i.e., features) , action (operation i.e. operation), SendTo (i.e., message transmission target) and Bodylen (i.e., message length) five properties. 这五个属性中,MessageID是一个8字节的数据单元,用字符串表示为32个16进制字符,任意一个服务请求,都具备一个全局唯一的ID信息,因此,本发明实施例提及的消息标识可以为MessageID ;Module是一个长度不限的字符串,根据产品功能进行区分;Action用于指示需要执行的操作;SendTo用于指示消息的发送对象;Bodylen为预留字段,描述Body在传输层中的数据段的长度。 Five attributes, the MessageID is an 8-byte data unit, representing a 32-character hexadecimal string, any one of the service request are provided with a globally unique ID information, and therefore, embodiments of the present invention mentioned embodiment the message identifier may be MessageID; Module is not limited to a length of string, differentiated according to the product features; is used to indicate the Action to be performed; the SendTo indication message for transmitting the object; Bodylen is a reserved field, described in the Body length of the data segment in the transport layer. 进一步,本发明实施例中的消息在TCP传输阶段或UDP传输阶段采用轻量级数据交换格式(JSON,JavaScript Object Notation),以解决传统使用可扩展标记语言(即XML)或其他的数据解析方式时比较重型,在数据解析时需要消耗大量的性能的问题。 Further, embodiments of the present invention using lightweight data-interchange message format (JSON, JavaScript Object Notation) in the TCP or UDP transport stage transmission phase, in order to solve the conventional use extensible markup language (i.e., XML), or other data analytically relatively heavy when, at the time of data analysis problems need to consume a large amount of performance.

[0040] 需要说明的是,本发明实施例中的第一通信装置具体为客户端、第二通信装置具体为服务器;或者,本发明实施例中的第一通信装置具体为服务器、第二通信装置具体为客户端。 [0040] Incidentally, the first communication device in the embodiment of the present invention is specifically for the client, the second communication device in particular a server; or, the first communication device in the embodiment of the present invention, particularly for the server, the second communication specifically for the client device.

[0041] 需要说明的是,本发明实施例中的通信方法可以应用于智能硬件(例如:智能插座、智能指环、智能情景灯等)的模拟测试场景中,或者,也可以用于其它通信场景中,此处不作限定。 [0041] Incidentally, a communication method in the embodiment of the present invention may be applied to an intelligent hardware: Simulation test scenarios (e.g. smart socket, intelligent ring, intelligent scene lights, etc.) or, alternatively, may also be used for other communication scenarios in not limited herein.

[0042] 由上可见,本发明中通信装置包括:1/0模块、服务请求处理模块和第一逻辑处理模块三个模块,其中,1/0模块属于1/0层,服务请求处理模块和第一逻辑处理模块属于业务层,通过将通信装置的通信过程模块化处理,使得1/0层与业务层完全分开,即在1/0层部分不涉及到业务层,在业务层不涉及到1/0层,当通信协议改变(或者业务逻辑改变) 时,只需修改1/0层部分(或业务层部分)即可满足通信协议改变(或者业务逻辑改变) 后的通信需要,有效提高了通信系统的复用性,实现了通信系统的高复用、低耦合的效果。 [0042] seen from the above, according to the present invention, the communication device comprising: a 1/0 module, the service request processing module and the first logic processing module of three modules, wherein, 1/0 1/0 layer module belongs, and the service request processing module belonging to a first service logic processing module layer, the communication process by the communication modular processing apparatus, so that the 1/0 layer and the business layer completely separate, i.e., not related to the service layer 1/0 layer portion, is not involved in the business layer 1/0 layer, when the communication protocol is changed (or the changing business logic), only modified portions of layer 1/0 (or business layer portion) to the communication needs to change the communication protocol (or change the business logic), improve reusability of a communication system, a high effect is achieved multiplexing communication system, low coupling.

[0043] 下面以一具体应用场景对本发明实施例中的通信方法进行描述,如图2所示的通信架构示意图,第一通信装置分为1/0层和业务层,1/0层由1/0模块实现,业务层由服务请求处理模块、第一逻辑处理模块和第二逻辑处理模块实现,其中,第一逻辑处理模块用于处理由第一通信装置提供服务的业务逻辑,如图2所示的controller-ι〜controller-n 为第一逻辑处理模块管理的服务(例如在智能硬件模拟测试场景中,controller-1〜 controller-n可以为第一通信装置的开关状态、电量、温度等状态的查询服务),第二逻辑处理模块用于处理由除第一通信装置以外的其它装置提供服务的业务逻辑,如图2所示的controller-Ι〜controller-m为第二逻辑处理模块管理的服务(例如在智能硬件模拟测试场景中,controller-Ι〜controller-m可以为由第一通信装置主动发起的例如上传电量、登陆等 [0043] Next, a specific application scenario to a communication method in the embodiment of the present invention will be described, a schematic diagram of the communication architecture shown in Figure 2, the first communication device and service layers into 1/0, 1/0 layer is made of a I / O module implemented by the service layer service request processing module, a first logic processing module and a second logic module for processing, wherein the first logic processing module for processing the business logic services provided by the first communication means, as shown in FIG 2 controller-ι~controller-n as shown in a first service logic processing module manager (e.g., in an intelligent hardware simulation test scenario, controller-1~ controller-n may switch the first communication device status, power, temperature, etc. status queries), the second logic processing module for processing the business logic services provided by other means other than the first communication device, controller-Ι~controller-m as shown in FIG. 2 is a second logic processing module manager service (e.g. intelligent hardware simulation test scenario, controller-Ι~controller-m by the first communication device may initiate the uploading electricity e.g., landing, etc. 务)。 Service). 当第一通信装置主动发起请求时,向需要提供服务的其它通信装置发送请求服务的消息,并在第一通信装置本地记录该消息的UUID,当第一通信装置的1/0模块接收到消息时,将该消息输出给服务请求处理模块进行分流处理,服务请求处理模块将该消息中的UUID与本地记录的UUID进行比较,以判断本地是否存在该消息的UUID记录,若存在,则服务请求处理模块将该消息输出到第二逻辑处理模块,第二逻辑处理模块根据该消息请求的服务,调用相应的controller对该消息进行处理。 When the first communication apparatus initiate a request, to provide the required message service transmission request other communication devices and services, and the UUID of the message recorded in the first local communication means, when the first communication device 1/0 module receives the message when outputting the message to the service request processing module diversion process, the service request processing module and the UUID UUID locally recorded message are compared to determine whether the message is recorded UUID exists locally, if exists, the service request the processing module outputs the message to the second logic processing module, a second logic processing module of the message service request, invokes the appropriate controller processes the message. 若不存在,则服务请求处理模块将该消息输出到第一逻辑处理模块,第一逻辑处理模块根据该消息请求的服务,调用相应的controller对该消息进行处理,并将处理结果返回给该消息的发送端。 If not, the service request processing module outputting the message to the first logic processing module, a first logic processing module based on the service request message, the corresponding call controller processes the message and returns the processing result to the message the sender.

[0044] 举例说明:第一通信装置为服务器,第二通信装置为插座,插座向服务器发起上传电量的请求消息,并在插座本地记录该请求消息的UUID。 [0044] Example: a first communication device is a server, the second communication device is a receptacle, the receptacle power initiation request message uploaded to the server, and locally recording the receptacle UUID request message. 服务器通过1/0模块接收到该请求消息后,输出给服务器的服务请求处理模块,由于该请求消息为插座主动发起,因此服务器本地没有记录该请求消息的UUID,服务器的服务请求处理模块将该请求消息的UUID 与服务器本地记录的UUID进行比较,发现服务器本地没有记录该请求消息的UUID,因此, 确定该请求消息的服务提供者为服务器,则服务器将该请求消息输出到服务器的第一逻辑处理模块,第一逻辑处理模块根据该请求消息确定该请求消息请求的是上传电量的服务, 调用上传电量的controller对该请求消息进行处理,并将包含处理结果的反馈消息返回给插座。 When the server receives the request message through the 1/0 module output to the server processing module of the service request, since the request message to initiate the socket, so the local server does not record the UUID request message, the server the service request processing module first logic UUID UUID request message to the server recorded locally compared, the local discovery server UUID no record of the request message, therefore, determines the service provider of the request message to the server, the server outputs the request message to the server the processing module, the processing module determines a first logic according to the request message is the request message requesting to upload electricity service, the call controller electricity upload request message is processed and a feedback message containing the processing result is returned to the receptacle.

[0045] 插座的I/O模块接收到该反馈消息后,将该反馈消息输出到插座的服务请求处理模块,由于该反馈消息与该请求消息为基于同一服务的交互消息,因此,该反馈消息中的UUID与该请求消息中的UUID -致,插座的服务请求处理模块将该反馈消息的UUID与插座本地记录的UUID进行比较,发现插座本地记录有该反馈消息的UUID,因此,确定该反馈消息的服务提供者为服务器,则服务器将该反馈消息输出到插座的第二逻辑处理模块,第二逻辑处理模块根据该反馈消息确定该反馈消息为请求上传电量的服务,调用之前请求上传电量的controller对该反馈消息进行处理。 [0045] The socket I / O modules after receiving the feedback message, the feedback message is output to the service request processing module socket, since this feedback message with the request message is a message-based interactive services of the same, and therefore, the feedback message UUID in the request message UUID - induced socket service request processing module and the socket UUID UUID locally recorded feedback messages were compared, the UUID socket local feedback message is recorded, and therefore, determines that the feedback message to the service provider server, the server outputs the feedback message to the second logic processing module socket, the second logic processing module determines that a feedback message according to the feedback message is a request to upload service charge, before the call request to upload electricity controller for processing the feedback message.

[0046] 本发明实施例还提供一种通信装置,如图3所示,本发明实施例中的通信装置300 包括: [0046] Embodiments of the present invention further provides a communication apparatus 3, the communication device 300 in the embodiment of the present invention embodiment includes:

[0047] 输入输出接口模块301、服务请求处理模块302和第一逻辑处理模块303。 [0047] The input and output interface module 301, the service request processing module 302 and the first logic processing module 303.

[0048] 输入输出接口模块301用于接收来自另一通信装置的消息,并向服务请求处理模块302输出接收的上述消息; [0048] The input and output interface module 301 for receiving a message from another communication apparatus, and the service request processing module 302 outputs the received message;

[0049] 服务请求处理模块302用于:确定接收的上述消息的服务提供者;当服务请求处理模块302确定接收的上述消息的服务提供者为上述通信装置时,向第一逻辑处理模块303输出接收的上述消息; [0049] The service request processing module 302 is configured to: determine service provider received the above message; if the service request processing module 302 determines the service provider received the above message is the communication means, the output of the first logic processing module 303 receiving the message;

[0050] 第一逻辑处理模块303用于:根据接收的上述消息请求的服务,调用相应服务对接收的上述消息进行处理,将处理结果返回给上述另一通信装置。 [0050] The first logic module 303 for processing: According to the received request message service, a corresponding service invocation message received by the above-described processing, returns the processing result to said another communication device.

[0051] 可选地,在图3所示实施例的基础上,如图4所示,本发明实施例中的通信装置300 还包括:第二逻辑处理模块304。 [0051] Alternatively, on the basis of the embodiment shown on FIG. 3, 4, the embodiment of the present invention, the communication device 300 in the embodiment further includes: a second logic processing module 304. 服务请求处理模块302还用于:当服务请求处理模块302 确定接收的上述消息的服务提供者为上述另一通信装置时,向第二逻辑处理模块304输出接收的上述消息; Service request processing module 302 is further configured to: when the service request processing module 302 determines the news service provider received the above message to the other communication apparatus, receiving a second logic output of the processing module 304;

[0052] 可选地,在图3或图4所示的通信装置的基础上,本发明实施例中的通信装置还包括:记录模块,用于当上述通信装置主动向其它通信装置发送请求服务的消息时,记录上述请求服务的消息的消息标识,其中,基于同一服务的所有交互消息的消息标识一致。 [0052] Alternatively, on the basis of the communication apparatus shown in FIG. 3 or FIG. 4, the present invention is a communication device in the embodiment further includes: a recording module, configured to, when the communication apparatus sends a request to the other communication service apparatus when the message, record message identification message requesting the service, wherein, based on all the message service interaction message coincides same identification. 服务请求处理模块302具体用于:判断本地是否存在接收的上述消息的消息标识记录,若存在,则确定接收的上述消息的服务提供者为上述另一通信装置;若不存在,则确定接收的上述消息的服务提供者为上述通信装置。 Service request processing module 302 is specifically configured to: determining a message identifying whether recording of the received message exists locally, if exists, it is determined that the above-described message received service provider to said other communication device; if not, it is determined that the received the news service provider to the communication device.

[0053] 可选地,输入输出接口模块301为TCP接口模块,输入输出接口模块301具体用于:接收来自另一通信装置的TCP消息。 [0053] Alternatively, the input-output interface module TCP interface module 301, input and output interface module 301 is configured to: receive TCP message from another communication apparatus. 或者,输入输出接口模块301为UDP接口模块,输入输出接口模块301具体用于:接收来自另一通信装置的UDP消息。 Alternatively, the input and output interface module to the UDP interface module 301, input and output interface module 301 is configured to: receive UDP message from another communication apparatus. 具体地,本发明实施例中可以根据具体的通信协议需求来实现输入输出接口模块301。 In particular, embodiments may be implemented input and output interface module 301 according to a specific embodiment of the present invention is a communication protocol requirements.

[0054] 需要说明的是,本发明实施例中的通信装置可以应用于智能硬件(例如:智能插座、智能指环、智能情景灯等)的模拟测试场景中,或者,也可以用于其它通信场景中,此处不作限定。 [0054] Incidentally, the communication apparatus in the embodiment of the present invention may be applied to an intelligent hardware (e.g.: smart socket, intelligent ring, intelligent scene lights, etc.) analog test scenario, or may be other communication scenarios in not limited herein.

[0055] 需要说明的是,本发明实施例中的通信装置具体为客户端、则上述另一通信装置具体为服务器;或者,本发明实施例中的通信装置具体为服务器、则上述第二通信装置具体为客户端。 [0055] Incidentally, the communication apparatus in the embodiment of the present invention is specifically for the client, then the other communication device in particular a server; or, a communication apparatus in the embodiment of the present invention is particularly server, the second communication specifically for the client device. 应理解,本发明实施例中的通信装置可以如上述方法实施例中的第一通信装置, 可以用于实现上述方法实施例中的全部技术方案,其具体实现过程可参照上述方法实施例中的相关描述,此处不再赘述。 It should be understood, the communication apparatus may be a first communication device in the embodiment as above-described method, a method may be used to achieve all of the above technical solutions in the embodiments of the present invention embodiment, a specific implementation process may be the method described above with reference to the embodiment of related description is not repeated here.

[0056] 由上可见,本发明中通信装置包括:输入输出接口模块、服务请求处理模块和第一逻辑处理模块三个模块,其中,输入输出接口模块属于I/O层,服务请求处理模块和第一逻辑处理模块属于业务层,通过将通信装置的通信过程模块化处理,使得I/O层与业务层完全分开,即在I/O层部分不涉及到业务层,在业务层不涉及到I/O层,当通信协议改变(或者业务逻辑改变)时,只需修改I/O层部分(或业务层部分)即可满足通信协议改变(或者业务逻辑改变)后的通信需要,有效提高了通信系统的复用性,实现了通信系统的高复用、 低耦合的效果。 [0056] seen from the above, the present invention is a communication apparatus comprising: input-output interface module, the service request processing module and the first logic processing module of three modules, which belong to the input-output interface module I / O level, the service request processing module, and belonging to a first service logic processing module layer, the communication process by the communication modular processing apparatus, so that the I / O layer and the business layer completely separate, i.e., the I / O layer portion not related to the business layer, not involved in the business layer communication requires I / O layer, when the communication protocol is changed (or the changing business logic), simply modify the I / O layer portion (or business layer portion) can be changed to meet the communication protocols (or business logic change) after, improve reusability of a communication system, a high effect is achieved multiplexing communication system, low coupling.

[0057] 在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。 [0057] In several embodiments provided herein present embodiment, it should be understood that the apparatus and methods disclosed may be implemented in other manners. 例如,以上所描述的装置实施例仅仅是示意性的,例如,上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。 For example, the described apparatus embodiments are merely illustrative of, for example, division of the above units is merely logical function division, there may be other division in actual implementation, for example, a plurality of units or components may be combined or integrated into another system, or some features may be ignored or not performed. 另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。 Another point, displayed or coupling or direct coupling or communication between interconnected in question may be through some interface, device, or indirect coupling or communication connection unit, may be electrical, mechanical, or other forms.

[0058] 需要说明的是,对于前述的各方法实施例,为了简便描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其它顺序或者同时进行。 [0058] Incidentally, for the embodiment of the foregoing method, for simplicity of description, it is described as a series combination of actions, those skilled in the art should understand that the present invention is not described in the operation sequence It limited since according to the present invention, some steps may be performed simultaneously or in another order. 其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定都是本发明所必须的。 Secondly, those skilled in the art should also understand that the embodiments are described in the specification are exemplary embodiments, and the modules involved in the operation are not necessarily required by the present invention.

[0059] 在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。 [0059] In the above embodiment, the description of the various embodiments have different emphases, certain embodiments not detailed in part, reference may be related to other embodiments of the described embodiments.

[0060] 以上为对本发明所提供的一种通信方法和通信装置的描述,对于本领域的一般技术人员,依据本发明实施例的思想,在具体实施方式及应用范围上均会有改变之处,综上, 本说明书内容不应理解为对本发明的限制。 [0060] The above is a description of a communication method and a communication apparatus of the present invention is provided, those of ordinary skill in the art, according to idea of ​​an embodiment of the present invention, in the embodiments and application scopes modification that , in summary, the present specification shall not be construed as limiting the present invention.

Claims (10)

1. 一种通信方法,其特征在于,包括: 第一通信装置的输入输出接口模块接收来自第二通信装置的消息; 所述输入输出接口模块向所述第一通信装置的服务请求处理模块输出所述消息; 所述服务请求处理模块确定接收的所述消息的服务提供者; 若所述服务请求处理模块确定接收的所述消息的服务提供者为所述第一通信装置, 贝IJ :向所述第一通信装置的第一逻辑处理模块输出接收的所述消息,所述第一逻辑处理模块根据接收的所述消息请求的服务,调用相应服务对接收的所述消息进行处理,将处理结果返回给所述第二通信装置。 1. A communication method, characterized by comprising: a first input-output interface module of the communication device receiving a message from the second communication device; the input and output interface module to the service request processing module outputs the first communication device the message; service provider of the service request processing module determines the message received; service provider if the service request processing module determines the received message to the first communication device, Tony IJ: to the first output of the first logic processing module of the communication device receives a message, the first logic processing module receives a request message according to the service, the corresponding service invocation message is received the process, the process result is returned to the second communication device.
2. 根据权利要求1所述的通信方法,其特征在于,所述第一通信装置还包括:第二逻辑处理模块; 所述服务请求处理模块确定接收的所述消息的服务提供者,之后包括: 若所述服务请求处理模块确定接收的所述消息的服务提供者为所述第二通信装置, 贝IJ :向所述第一通信装置的第二逻辑处理模块输出接收的所述消息,所述第二逻辑处理模块根据接收的所述消息请求的服务,调用相应服务对接收的所述消息进行处理。 2. The communication method according to claim 1, wherein said first communication device further comprises: a second logic processing module; the service request processing module determines the service provider receives the message, then including : the service provider if the service request processing module determines that the received message to said second communication apparatus IJ shell: the message to the second output of the logic processing module receives said first communication device, the said second logic processing module according to the received request message service, call the appropriate service to process the received message.
3. 根据权利要求2所述的通信方法,其特征在于,所述通信方法还包括: 当所述第一通信装置主动向其它通信装置发送请求服务的消息时,记录所述请求服务的消息的消息标识,其中,基于同一服务的所有交互消息的消息标识一致; 所述服务请求处理模块确定接收的所述消息的服务提供者,包括: 所述服务请求处理模块判断本地是否存在接收的所述消息的消息标识记录; 若存在,则确定接收的所述消息的服务提供者为所述第二通信装置; 若不存在,则确定接收的所述消息的服务提供者为所述第一通信装置。 The communication method of claim 2, wherein said communication method further comprising: first communication means when said active message service sends a request to another communication device, recording a message of the requested service message identifier, which identifies the same message all interactive messages based on the same service; the service request processing module determines the service provider receives the message, comprising: a service request processing module determines whether there is received by the local message identifies the record of the message; service provider, if present, it is determined that the received message for said second communication device; if not, the service provider then determines the received message is the first communication device .
4. 根据权利要求3所述的通信方法,其特征在于,所述消息标识具体为所述消息中的通用唯一识别码; 所述记录所述请求服务的消息的消息标识具体为: 记录所述请求服务的消息的通用唯一识别码。 The communication method according to claim 3, wherein the message identifies said particular message universally unique identifier; the request message service message identifying the particular recording: the recording universally unique identifier of the service request message.
5. 根据权利要求1至4任一项所述的通信方法,其特征在于,所述第一通信装置的输入输出接口模块为传输控制协议接口模块或用户数据报协议接口模块。 The communication method according to one of claims 1-4, characterized in that the input and output interface module of the first communication device interface module for the transmission control protocol or user datagram protocol interface module.
6. -种通信装置,其特征在于,包括: 输入输出接口模块、服务请求处理模块和第一逻辑处理模块。 6. - kind of communication apparatus, characterized by comprising: an input and output interface module, the service request processing module and a first logic processing module. 所述输入输出接口模块用于接收来自另一通信装置的消息,并向所述服务请求处理模块输出接收的所述消息; 所述服务请求处理模块用于:确定接收的所述消息的服务提供者;当所述服务请求处理模块确定接收的所述消息的服务提供者为所述通信装置时,向所述第一逻辑处理模块输出接收的所述消息; 所述第一逻辑处理模块用于:根据接收的所述消息请求的服务,调用相应服务对接收的所述消息进行处理,将处理结果返回给所述另一通信装置。 The input and output interface means for receiving a message from another communication device, the service request to the processing module outputs the received message; the service request processing means for: receiving the message to determine service provided person; service provider when the service request processing module determines that the message is the communication means, receiving the output of the first logic processing module to said message; said first logic processing module : according to the received request message service, the message calls the appropriate service processes the received, returns the processing result to the other communication device.
7. 根据权利要求6所述的通信装置,其特征在于,所述通信装置还包括:第二逻辑处理丰吴块; 所述服务请求处理模块还用于:当所述服务请求处理模块确定接收的所述消息的服务提供者为所述另一通信装置时,向所述第二逻辑处理模块输出接收的所述消息; 所述第二逻辑处理模块用于:根据接收的所述消息请求的服务,调用相应服务对接收的所述消息进行处理。 The communication apparatus according to claim 6, wherein said communication means further comprises: a second logic block processing Feng Wu; the service request processing module is further configured to: when the service request processing module determines that the received when the other communication device of the service provider for the message, to receive the output of said second logic processing module of the message; the second logic processing module is configured to: according to the request message received service, call the appropriate service to process the received message.
8. 根据权利要求7所述的通信装置,其特征在于,所述通信装置还包括: 记录模块,用于当所述通信装置主动向其它通信装置发送请求服务的消息时,记录所述请求服务的消息的消息标识,其中,基于同一服务的所有交互消息的消息标识一致; 所述服务请求处理模块具体用于:判断本地是否存在接收的所述消息的消息标识记录,若存在,则确定接收的所述消息的服务提供者为所述另一通信装置;若不存在,则确定接收的所述消息的服务提供者为所述通信装置。 The communication apparatus according to claim 7, characterized in that said communication apparatus further comprising: a recording module, configured to, when the communication apparatus sends a message requesting a service to another communication apparatus, the recording request service identifying message message, wherein the message consistent with the identification of all interactive messages based on the same service; the service request processing module is configured to: determining a message identifying whether the recording of the received message exists locally, if exists, determine that the reception the message service provider for the other communication device; if not, the service provider then determines the received message to the communication device.
9. 根据权利要求8所述的通信装置,其特征在于, 所述消息标识具体为所述消息中的通用唯一识别码; 所述记录模块,用于当所述通信装置主动向其它通信装置发送请求服务的消息时,记录所述请求服务的消息的通用唯一识别码。 Sends the recording apparatus to another communication module for, when said communication apparatus; 9. The communication apparatus according to claim 8, wherein the message identifies said particular message Universally Unique Identifier service request message, the recording of the universal unique identifier of the service request message.
10. 根据权利要求6至8任一项所述的通信装置,其特征在于,所述通信装置的输入输出接口模块为传输控制协议接口模块或用户数据报协议接口模块。 The communication apparatus according to any one of claims 6-8, characterized in that the input and output interface module of the communication device interface module for the transmission control protocol or user datagram protocol interface module.
CN201410852876.9A 2014-12-31 2014-12-31 A communication method and a communication apparatus CN104580196B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410852876.9A CN104580196B (en) 2014-12-31 2014-12-31 A communication method and a communication apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410852876.9A CN104580196B (en) 2014-12-31 2014-12-31 A communication method and a communication apparatus

Publications (2)

Publication Number Publication Date
CN104580196A true CN104580196A (en) 2015-04-29
CN104580196B CN104580196B (en) 2018-02-16

Family

ID=53095377

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410852876.9A CN104580196B (en) 2014-12-31 2014-12-31 A communication method and a communication apparatus

Country Status (1)

Country Link
CN (1) CN104580196B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1870562A (en) * 2005-05-23 2006-11-29 国际商业机器公司 Dynamic web service calling method, system and web service agent
CN101686253A (en) * 2008-09-23 2010-03-31 华为技术有限公司 Service selecting method, device and system thereof
CN102123158A (en) * 2011-04-11 2011-07-13 深圳市同洲软件有限公司 Method and system for realizing network data processing
US20130174233A1 (en) * 2004-04-15 2013-07-04 Conor P. Cahill Service provider invocation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130174233A1 (en) * 2004-04-15 2013-07-04 Conor P. Cahill Service provider invocation
CN1870562A (en) * 2005-05-23 2006-11-29 国际商业机器公司 Dynamic web service calling method, system and web service agent
CN101686253A (en) * 2008-09-23 2010-03-31 华为技术有限公司 Service selecting method, device and system thereof
CN102123158A (en) * 2011-04-11 2011-07-13 深圳市同洲软件有限公司 Method and system for realizing network data processing

Also Published As

Publication number Publication date
CN104580196B (en) 2018-02-16

Similar Documents

Publication Publication Date Title
CN104737519B (en) Universal Network Controller for a software-defined network (Sdn) systems and devices
Chang et al. Bringing the cloud to the edge
CN102638460B (en) Method of communication between home gateway, server and cloud both
CN100471139C (en) System and method for network test
CN104348873A (en) Virtual network element automatic loading method and system and virtual machine IP (Internet Protocol) address acquisition method and system
US20180083853A9 (en) Synthetic client
CN103702238B (en) The multi-screen video sharing method and a terminal server
CN102291467B (en) Communication platform and method suitable for private cloud environment
US9088477B2 (en) Distributed fabric management protocol
CN104010039B (en) One kind multi-radar remote monitoring system and method based WebSocket
CN101902757A (en) Method and system for supporting consistency testing
CN105024855B (en) Distributed cluster management system and method
CN102231686B (en) A system and method for automated testing of network security devices to achieve
Hornsby et al. μXMPP: Lightweight implementation for low power operating system Contiki
CN101772920A (en) Method and apparatus for discovering universal plug and play device using resource information
CN102789432A (en) USB (universal serial bus) equipment drive method and system
CN104601665B (en) Things kind of perception device system and method for real-time simulation of the cloud
US20160269252A1 (en) System and method for performing a service discovery for virtual networks
CN103546572B (en) One kind of storage networking system and method Cloudy
CN101242302A (en) Data synchronization method, device and system
CN102137007B (en) Method and system for generating network topology as well as coordinator
CN105429780A (en) Virtualized network service business automatic generation and dynamic monitoring method
CN103414626A (en) Message processing method and device based on network virtualization
CN103685385A (en) Method, system and device for file synchronization
CN103701661B (en) A method for implementing and monitoring the system nodes

Legal Events

Date Code Title Description
C06 Publication
C10 Entry into substantive examination
GR01
CP03