CN112153071B - Message sending method, device, gateway and storage medium - Google Patents

Message sending method, device, gateway and storage medium Download PDF

Info

Publication number
CN112153071B
CN112153071B CN202011061266.9A CN202011061266A CN112153071B CN 112153071 B CN112153071 B CN 112153071B CN 202011061266 A CN202011061266 A CN 202011061266A CN 112153071 B CN112153071 B CN 112153071B
Authority
CN
China
Prior art keywords
program
protocol conversion
message
target
protocol
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.)
Active
Application number
CN202011061266.9A
Other languages
Chinese (zh)
Other versions
CN112153071A (en
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.)
Shenzhen Tencent Computer Systems Co Ltd
Guangzhou Metro Group Co Ltd
Original Assignee
Shenzhen Tencent Computer Systems Co Ltd
Guangzhou Metro Group 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 Shenzhen Tencent Computer Systems Co Ltd, Guangzhou Metro Group Co Ltd filed Critical Shenzhen Tencent Computer Systems Co Ltd
Priority to CN202011061266.9A priority Critical patent/CN112153071B/en
Publication of CN112153071A publication Critical patent/CN112153071A/en
Application granted granted Critical
Publication of CN112153071B publication Critical patent/CN112153071B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/08Protocols for interworking; Protocol conversion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/2803Home automation networks
    • H04L12/2816Controlling appliance services of a home automation network by calling their functionalities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/66Arrangements for connecting between networks having differing types of switching systems, e.g. gateways
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/06Message adaptation to terminal or network requirements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computer Security & Cryptography (AREA)
  • Automation & Control Theory (AREA)
  • Computer And Data Communications (AREA)
  • Communication Control (AREA)

Abstract

The embodiment of the application discloses a message sending method, a message sending device, a gateway and a storage medium, and belongs to the technical field of computers. The method is applied to a gateway, the gateway comprises a main program and a plurality of protocol conversion programs, and the method comprises the following steps: receiving a first message sent by a cloud server through a main program, and determining a target protocol conversion program corresponding to a first target equipment identifier from a plurality of protocol conversion programs; sending the first message to a target protocol conversion program; determining a target interface protocol corresponding to the first target equipment identifier through a target protocol conversion program; according to the target interface protocol, the first message is converted to obtain a second message meeting the target interface protocol; and sending the second message to the first target equipment. Through the API in the gateway, the interaction between the cloud server and the equipment is realized in a protocol conversion mode, and the interface protocol of the cloud server is not required to be adapted to the interface protocol of the equipment, so that the access rate of the cloud server is improved.

Description

Message sending method, device, gateway and storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a message sending method, a message sending device, a gateway and a storage medium.
Background
In the use process of the electronic device, the communication between the electronic device and the cloud server is usually realized through a gateway. For example, the electronic device uploads a message to the cloud server through the gateway, or the cloud server issues a message to the electronic device through the gateway.
With the development of internet technology, the types of electronic devices are more and more, and interface protocols supported by different electronic devices may be different. Under the condition that the interface protocol of the electronic equipment is matched with the interface protocol of the cloud server, the gateway can forward messages, and communication between the electronic equipment and the cloud server is achieved. However, when the interface protocol of the electronic device is not adapted to the interface protocol of the cloud server, the message cannot be forwarded through the gateway.
Disclosure of Invention
The embodiment of the application provides a message sending method, a message sending device, a gateway and a storage medium, and can improve the adaptability of the gateway. The technical scheme is as follows:
in one aspect, a message sending method is provided, which is applied to a gateway, where the gateway includes a main program and a plurality of protocol conversion programs, and the method includes:
receiving a first message issued by a cloud server through the main program, wherein the first message carries a first target device identifier;
determining a target protocol conversion program corresponding to the first target equipment identifier from the plurality of protocol conversion programs through the main program; sending the first message to the target protocol conversion program;
determining a target interface protocol corresponding to the first target equipment identifier through the target protocol conversion program; according to the target interface protocol, the first message is converted to obtain a second message meeting the target interface protocol; and sending the second message to the first target equipment.
In another aspect, a message sending apparatus applied to a gateway, the gateway including a main program and a plurality of protocol conversion programs, the apparatus includes:
the first receiving module is used for receiving a first message issued by the cloud server through the main program, wherein the first message carries a first target device identifier;
a first running module, configured to determine, through the main program and from the multiple protocol conversion programs, a target protocol conversion program corresponding to the first target device identifier; sending the first message to the target protocol conversion program;
the second running module is used for determining a target interface protocol corresponding to the first target equipment identifier through the target protocol conversion program; according to the target interface protocol, the first message is converted to obtain a second message meeting the target interface protocol; and sending the second message to the first target equipment.
In one possible implementation, the first execution module includes:
and the first issuing unit is used for issuing the first message to the target protocol conversion program according to the program address of the target protocol conversion program.
In another possible implementation manner, the main program is configured with a second correspondence between a protocol conversion program and a program address, and the apparatus further includes:
and the first determining module is used for determining the program address of the target protocol conversion program according to the second corresponding relation.
In another possible implementation manner, the first issuing unit is configured to invoke a message issuing interface according to the program address of the target protocol conversion program, and issue the first message to the target protocol conversion program.
In another possible implementation manner, a third corresponding relationship between a device identifier and an interface protocol is configured in the target protocol conversion program, and the second operation module includes:
and a second determining unit, configured to determine, according to the third correspondence, a target interface protocol corresponding to the first target device identifier.
In another possible implementation manner, the second operation module includes:
and the second issuing unit is used for issuing the second message to the first target equipment according to the equipment address of the first target equipment.
In another possible implementation manner, a fourth corresponding relationship between a device identifier and a device address is configured in the target protocol conversion program, and the apparatus further includes:
and the second determining module is used for determining the equipment address of the first target equipment according to the fourth corresponding relation.
In another possible implementation manner, the apparatus further includes:
a second receiving module, configured to receive, through any one of the multiple protocol conversion programs, a third message uploaded by a second target device, where the third message carries a second target device identifier;
the second operation module is further configured to perform conversion processing on the third message according to a reference interface protocol through the protocol conversion program to obtain a fourth message meeting the reference interface protocol, where the reference interface protocol is an interface protocol corresponding to the cloud server; uploading the fourth message to the main program;
the first operation module is further configured to receive, through the main program, the fourth message uploaded by the protocol conversion program, and upload the fourth message to the cloud server.
In another possible implementation manner, the first operation module includes:
and the uploading unit is used for calling a message uploading interface and uploading the fourth message to the main program.
In another possible implementation manner, a first corresponding relationship between the device identifier and the protocol conversion program and a second corresponding relationship between the protocol conversion program and the program address are configured in the main program; the device further comprises:
a third determining module, configured to determine, in response to configuring an updated protocol conversion program in the gateway, an apparatus identifier corresponding to the protocol conversion program and a program address of the protocol conversion program;
and the updating module is used for respectively updating the first corresponding relation and the second corresponding relation according to the protocol conversion program, the corresponding equipment identification and the program address of the protocol conversion program.
In another aspect, a gateway is provided, which includes a processor and a memory, where at least one program code is stored in the memory, and the at least one program code is loaded and executed by the processor to implement the operations performed in the message sending method according to the above aspect.
In another aspect, a computer-readable storage medium is provided, in which at least one program code is stored, the at least one program code being loaded and executed by a processor to implement the operations performed in the message sending method according to the above aspect.
In yet another aspect, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer program code, the computer program code being stored in a computer readable storage medium. The processor of the gateway reads the computer program code from the computer readable storage medium, and executes the computer program code, so that the gateway implements the operations performed in the message sending method according to the above aspect.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
the protocol conversion program in the gateway provided by the embodiment of the application can perform protocol conversion on the message sent to the equipment by the cloud server, so that the converted message meets the interface protocol corresponding to the equipment, interaction between the cloud server and the equipment is realized, the interface protocol of the cloud server and the interface protocol of the equipment are not required to be adapted, and the flexibility is improved. Moreover, the protocol conversion programs are not affected with each other, and corresponding devices are managed respectively, so that the devices supporting multiple interface protocols can be accessed into the cloud server, interaction between the cloud server and the multiple devices is realized, and the access rate of the cloud server is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic diagram of an implementation environment provided by an embodiment of the present application;
fig. 2 is a schematic structural diagram of a gateway provided in an embodiment of the present application;
fig. 3 is a flowchart of a message sending method according to an embodiment of the present application;
fig. 4 is a flowchart of a message sending method according to an embodiment of the present application;
fig. 5 is a flowchart of a gateway boot process according to an embodiment of the present application;
fig. 6 is a flowchart illustrating a method for issuing a message to a device by a cloud server according to an embodiment of the present application;
fig. 7 is a flowchart illustrating that a device uploads a message to a cloud server according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a message sending apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a message sending apparatus according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a terminal according to an embodiment of the present application;
fig. 11 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The terms "first," "second," "third," "fourth," and the like as used herein may be used herein to describe various concepts, but these concepts are not limited by these terms unless otherwise specified. These terms are only used to distinguish one concept from another. For example, a first correspondence may be referred to as a second correspondence, and similarly, a second correspondence may be referred to as a first correspondence, without departing from the scope of the present application.
As used herein, the terms "at least one," "a plurality," "each," "any," at least one of which includes one, two, or more than two, and a plurality of which includes two or more than two, each of which refers to each of the corresponding plurality, and any of which refers to any of the plurality. For example, the plurality of protocol conversion programs includes 3 protocol conversion programs, each of which refers to each of the 3 protocol conversion programs, and any one of the 3 protocol conversion programs may be a first protocol conversion program, a second protocol conversion program, or a third protocol conversion program.
Cloud technology refers to a hosting technology for unifying series of resources such as hardware, software, and network in a wide area network or a local area network to realize calculation, storage, processing, and sharing of data.
Cloud technology (Cloud technology) is based on a general term of network technology, information technology, integration technology, management platform technology, application technology and the like applied in a Cloud computing business model, can form a resource pool, is used as required, and is flexible and convenient. Cloud computing technology will become an important support. Background services of technical network systems require a large amount of computing and storage resources, such as video websites, picture-like websites and more portal websites. With the high development and application of the internet industry, each article may have its own identification mark and needs to be transmitted to a background system for logic processing, data in different levels are processed separately, and various industrial data need strong system background support and can only be realized through cloud computing.
The Internet of Things (The Internet of Things, IOT for short) is used for collecting any object or process needing to be connected or interacted in real time and collecting various required information such as sound, light, heat, electricity, mechanics, chemistry, biology and position through various devices and technologies such as various information sensors, radio frequency identification technologies, global positioning systems, infrared sensors and laser scanners, and realizing The ubiquitous connection of objects and people through various possible network accesses, and realizing The intelligent sensing, identification and management of The objects and The processes. The internet of things is an information bearer based on the internet, a traditional telecommunication network and the like, and all common physical objects which can be independently addressed form an interconnected network.
The Cloud IOT aims to connect information sensed by sensing equipment in the traditional Internet of things and received instructions into the Internet, so that networking is really realized, and mass data storage and operation are realized through a Cloud computing technology. According to the method and the device, the cloud technology, the Internet of things and the cloud Internet of things are utilized, interaction between the cloud server and the electronic equipment can be achieved, namely the cloud server issues the information to the electronic equipment, or the electronic equipment uploads the information to the cloud server.
Fig. 1 is a schematic structural diagram of an implementation environment provided in an embodiment of the present application, and as shown in fig. 1, the implementation environment includes a cloud server 101, a gateway 102, and a plurality of electronic devices 103. Through the gateway 102, the cloud server 101 establishes communication connections with the plurality of electronic devices 103, respectively.
Optionally, the cloud server 101 is an independent physical server, or a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, cloud storage, a web service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content Delivery Network), a big data and artificial intelligence platform, and the like. Optionally, the electronic device 103 is a terminal or a server. Optionally, the terminal is a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto.
Optionally, the cloud server 101 is configured to manage a plurality of electronic devices 103, for example, the cloud server 101 issues a message to the electronic device 103, or the cloud server 101 stores a message uploaded by the electronic device 103.
The gateway 102 is configured to establish communication connection between the cloud server 101 and the plurality of electronic devices 103, and implement interaction between the cloud server 101 and the plurality of electronic devices 103. For example, a message sent by the cloud server 101 is forwarded to the electronic device 103 through the gateway 102, or a message uploaded by the electronic device 103 is uploaded to the cloud server 101.
As shown in fig. 1, in the embodiment of the present application, the gateway 102 includes a main program 121 and a plurality of protocol conversion programs 122.
The main program 121 is configured to establish a communication connection with a cloud server, and can receive a message sent by the cloud server or upload a message to the cloud server.
And the protocol conversion program 122 is used for establishing communication connection with the electronic equipment and converting the message. For example, a message sent by the cloud server is converted into a message meeting an interface protocol corresponding to the electronic device, or a message uploaded by the electronic device is converted into a message meeting an interface protocol corresponding to the cloud server.
In one possible implementation, as shown in FIG. 2, main program 121 includes a message management subroutine 1211 and an interface subroutine 1212.
The message management subprogram 1211 is configured to receive a message sent by the cloud server, and send the message to the protocol conversion program; or receiving the message uploaded by the protocol conversion program, and uploading the message uploaded by the protocol conversion program to the cloud server.
The interface subprogram 1212 is used for providing an interface, such as a message uploading interface, a message issuing interface, etc., through which the main program and the protocol conversion program can interact. For example, the main program receives the message uploaded by the protocol converter through the interface provided by the interface subprogram, or the main program issues the message to the protocol converter.
Optionally, as shown in fig. 2, the main program 121 further includes a cloud communication sub-program 1213, a conversion program management sub-program 1214 and a device management sub-program 1215.
The cloud communication subprogram 1213 is used to establish a communication connection between the main program and the cloud server. Through the communication connection, the main program can receive messages sent by the cloud server or upload messages to the cloud server.
The conversion program management subroutine 1214 stores the startup parameters of the protocol conversion program and is capable of starting the protocol conversion program. For example, when the gateway is started, a main program is started, and a plurality of protocol conversion programs are started by the conversion program management subprogram.
The device management subroutine 1215 is used to manage the accessed electronic device list and record the status of each electronic device. For example, the electronic device list stores device identifiers of electronic devices accessing the cloud server. And recording whether the electronic equipment is in an online state or an abnormal state.
In one possible implementation, as shown in fig. 2, the protocol conversion routine 122 includes a communication sub-routine 1221, a protocol conversion sub-routine 1222, and a logic processing sub-routine 1223.
The communication sub-program 1221 is configured to establish a communication connection between the electronic device and the protocol conversion program. Through the established communication connection, the protocol conversion program can issue messages to the electronic equipment or receive messages uploaded by the electronic equipment.
The protocol conversion subroutine 1222 is for converting messages. For example, the message forwarded by the main program is converted into a message meeting an interface protocol corresponding to the electronic device, or the message uploaded by the electronic device is converted into a message meeting an interface protocol corresponding to the cloud server.
The logic processing subroutine 1223 is used to process various logic instructions. For example, data of the electronic device is acquired at regular time, or data uploaded by the electronic device is stored.
The method provided by the embodiment of the application can be used for various scenes.
For example, in a subway electronic device management scenario:
the subway comprises various types of electronic equipment, such as an automatic door lock, an alarm system, vehicle management equipment, voice reminding equipment and the like, and the plurality of electronic equipment are accessed to the same cloud server through the gateway provided by the embodiment of the application.
For another example, in the smart home scene:
the intelligent household equipment management system comprises a cloud server, a plurality of intelligent household equipment management units and a plurality of intelligent household equipment management units, wherein the cloud server is used for sending messages to the intelligent household equipment management units, the intelligent household equipment management units are used for managing the intelligent household equipment management units, and the intelligent household equipment management units are used for managing the intelligent household equipment management units.
Fig. 3 is a flowchart of a message sending method provided in an embodiment of the present application, and is applied to a gateway, as shown in fig. 3, the method includes:
301. and receiving a first message sent by the cloud server through the main program.
In the embodiment of the present application, the gateway includes a main program and a plurality of protocol conversion programs, that is, the main program and the plurality of protocol conversion programs are run in the gateway.
The first message carries a first target device identifier, and the first target device indicated by the first target device identifier is a device which has accessed the cloud server. In the embodiment of the application, the device identifiers corresponding to different devices are different. And enabling the main program to acquire that the cloud server issues the first message to the first target device through the first target device identifier carried by the first message.
302. Determining a target protocol conversion program corresponding to a first target equipment identifier from a plurality of protocol conversion programs through a main program; and sending the first message to a target protocol conversion program.
In the embodiment of the present application, different protocol conversion programs correspond to different devices, for example, a first protocol conversion program manages the device 1, the device 2, and the device 3, and a second protocol conversion program manages the device 4, the device 5, and the device 6. Therefore, after the main program receives the first message, the target protocol conversion program corresponding to the first target device identifier is determined according to the first target device identifier carried by the first message, and the first message is sent to the corresponding target protocol conversion program, so that the subsequent target protocol conversion program can send the first message to the corresponding device.
303. Determining a target interface protocol corresponding to the first target equipment identifier through a target protocol conversion program; according to the target interface protocol, the first message is converted to obtain a second message meeting the target interface protocol; and sending the second message to the first target equipment.
Because the interface protocol of the cloud server may be different from the interface protocol of the first target device, in order to implement message interaction between the cloud server and the first target device, the first message is converted by the target protocol conversion program to obtain a second message meeting the target interface protocol, so that the first target device can identify the second message after the target protocol conversion program issues the first message to the first target device.
The protocol conversion program in the gateway provided by the embodiment of the application can perform protocol conversion on the message sent to the equipment by the cloud server, so that the converted message meets the interface protocol corresponding to the equipment, interaction between the cloud server and the equipment is realized, the interface protocol of the cloud server and the interface protocol of the equipment are not required to be adapted, and the flexibility is improved. Moreover, the protocol conversion programs are not affected, and the corresponding devices are managed respectively, so that the devices supporting various interface protocols can be accessed into the cloud server, the interaction between the cloud server and various devices is realized, and the access rate of the cloud server is improved.
Fig. 4 is a flowchart of a message sending method provided in an embodiment of the present application, and is applied to a gateway, and as shown in fig. 4, the method includes:
401. and receiving a first message sent by the cloud server through the main program, wherein the first message carries a first target device identifier.
In the embodiment of the application, a main program and a plurality of protocol conversion programs in a gateway establish communication connection with a cloud server through the main program, establish communication connection with equipment through the protocol conversion programs, when the cloud server issues a message to the equipment, the protocol conversion programs in the gateway convert an interactive message so that the converted message meets an interface protocol of the equipment, and when the equipment uploads the message to the cloud server, the protocol conversion programs in the gateway convert the interactive message so that the converted message meets the interface protocol of the cloud server, so that interaction between the cloud server and the equipment is realized. For example, the cloud server issues a message to the electronic device, or the electronic device uploads a message to the cloud server.
Optionally, the first message is used to instruct the first target device to perform a corresponding operation. For example, the first message may be used to instruct the first target device to boot up, or the first message may be used to instruct the first target device to return to the device's status.
In one possible implementation, the main program includes a message management sub-program, and step 401 includes: and receiving a first message sent by the cloud server through the message management subprogram.
Optionally, the main program further includes a cloud communication subprogram, through the cloud communication subprogram, a communication connection is established between the main program and the cloud server, and based on the established communication connection, a first message sent by the cloud server is received. Optionally, the communication connection is a link established according to a communication protocol of the cloud server. For example, the communication connection established between the main program and the cloud server is established through an ethernet protocol.
402. And determining a target protocol conversion program corresponding to the first target equipment identifier through the main program according to the first corresponding relation.
In this embodiment of the application, because different protocol conversion programs correspond to different devices, a first corresponding relationship between a device identifier and a protocol conversion program is configured in the main program, and after the main program receives a first message sent by the cloud server, the protocol conversion program corresponding to the device identifier can be determined through the first corresponding relationship, so that a subsequent main program forwards the first message to a corresponding target protocol conversion program.
After the main program receives a first message sent by the cloud server, a target protocol conversion program corresponding to a first target device identification can be inquired from the first corresponding relation according to the first target device identification carried in the first message.
In one possible implementation manner, in the first correspondence, each protocol conversion program corresponds to at least one device identifier, and the device identifiers corresponding to different protocol conversion programs are different. Each protocol conversion program is corresponding to one or more device identifications, which indicate that the protocol conversion program can interact with one or more devices.
Optionally, the first correspondence is stored in the form of a list. The first corresponding relationship configured by the main program is shown in table 1.
TABLE 1
Figure GDA0003895703830000101
Figure GDA0003895703830000111
In one possible implementation, this step 402 includes: and determining a target protocol conversion program corresponding to the first target equipment identifier according to the first corresponding relation traversed by the first target equipment identifier through the main program.
In one possible implementation manner, the main program includes a message management sub program and a device management sub program, and the device management sub program is configured with a first corresponding relationship, then step 402 includes: and calling a first corresponding relation configured by the equipment management subprogram according to the first target equipment identifier through the message management subprogram, and determining a target protocol conversion program corresponding to the first target equipment identifier.
It should be noted that, in the embodiment of the present application, the target protocol conversion program corresponding to the first target device identifier is determined according to the first corresponding relationship in the main program, and in another embodiment, the step 402 does not need to be executed, and the target protocol conversion program corresponding to the first target device identifier can be determined from the plurality of protocol conversion programs through the main program in other manners.
403. And determining the program address of the target protocol conversion program according to the second corresponding relation through the main program.
The main program is configured with a second corresponding relation between the protocol conversion program and the program address. The program address is used to indicate a storage address of the protocol conversion program. And after determining the target protocol conversion program corresponding to the first equipment identifier, determining a program address corresponding to the target protocol conversion program through the second corresponding relation so that a subsequent main program issues a message to the target protocol conversion program according to the program address.
Optionally, the second correspondence is stored in a form of a list. The main program configures a second corresponding relationship as shown in table 2.
TABLE 2
Protocol conversion program Program address
Protocol conversion program A Program address 1
Protocol conversion program B Program address 2
Protocol conversion program C Program address 3
In one possible implementation, this step 403 includes: and determining the program address of the target protocol conversion program according to the second corresponding relation traversed by the target protocol conversion program through the main program.
In one possible implementation manner, if the main program includes a message management sub program and a device management sub program, and the device management sub program is configured with the second corresponding relationship, step 402 includes: and calling a second corresponding relation configured by the equipment management subprogram according to the target protocol conversion program through the message management subprogram, and determining the program address of the target protocol conversion program.
404. And sending the first message to the target protocol conversion program through the main program according to the program address of the target protocol conversion program.
After the main program determines the program address of the target protocol conversion program, the first message is sent to the target protocol conversion program according to the program address, so that the subsequent target protocol conversion program processes the first message.
In one possible implementation, this step 404 includes: and calling a message issuing interface through the main program according to the program address of the target protocol conversion program, and issuing the first message to the target protocol conversion program.
The message issuing interface is used for interacting with the protocol conversion program. Optionally, the message issuing interface is provided by an interface subprogram in the main program.
Optionally, the target protocol conversion program includes a logic processing subprogram, and the main program includes a message management subprogram, and then the message management subprogram in the main program calls a message issuing interface according to the program address of the target protocol conversion program, and issues the first message to the logic processing subprogram of the target protocol conversion program.
It should be noted that, in the embodiment of the present application, the main program issues the first message to the target protocol conversion program through the determined program address, and in another embodiment, the steps 403 to 404 do not need to be executed, and the main program can issue the first message to the target protocol conversion program in other manners.
405. And determining the target interface protocol corresponding to the first target equipment identifier according to the third corresponding relation by the target protocol conversion program.
After the target protocol conversion program receives the first message, the third corresponding relation is inquired according to the equipment identifier carried by the first message, and the target interface protocol corresponding to the first target equipment identifier is determined.
For example, the target interface protocol is RJ45 (Registered Jack 45, a communication outlet), RS485 (communication Standard 485, a networking communication interface), RS232 (communication Standard 232, a serial communication interface), RS422 (communication Standard 422, a data transmission protocol), KNX (Konnex, an interface protocol), WIFI (wireless network), zigbee (Zigbee protocol), or the like.
In one possible implementation, this step 405 includes: and traversing the third corresponding relation according to the first target equipment identifier carried in the first message by the target protocol conversion program, and determining a target interface protocol corresponding to the first target equipment identifier.
In one possible implementation manner, the target protocol conversion program includes a logic processing sub program, and a third corresponding relationship is configured in the logic processing sub program, then the step 405 includes: and determining the target interface protocol corresponding to the first target equipment identifier according to the third corresponding relation through the logic processing subprogram.
Optionally, a fifth corresponding relationship between the device identifier and the data protocol is further configured in the logic processing subprogram, and the target interface protocol and the target data protocol corresponding to the first target device identifier are determined according to the third corresponding relationship and the fifth corresponding relationship through the logic processing subprogram.
Wherein the data protocol is used to indicate the type, format, etc. of the data. In the embodiment of the present application, the interface protocols corresponding to different devices may be different, and the data protocols corresponding to different devices may also be different. Therefore, the target interface protocol and the target data protocol corresponding to the first target device identifier are determined according to the third corresponding relationship and the fifth corresponding relationship, so that the first message is converted according to the target interface protocol and the target data protocol, and the first target device can receive and identify the second message after conversion.
For example, the data Protocol includes MODBUS (a serial communication Protocol), MODBUS-TCP (a serial communication Protocol), HTTP (hypertext transfer Protocol), TCP (Transmission Control Protocol), BACNET (communication Protocol for smart buildings), MQTT (Message queue Telemetry Transport), coach (The structured Application Protocol), and The like.
It should be noted that, in this embodiment, the target protocol conversion program determines the target interface protocol corresponding to the first target device identifier according to the third corresponding relationship, and in another embodiment, the step 405 does not need to be executed, and the target protocol conversion program can also determine the target interface protocol corresponding to the first target device identifier in other manners.
406. And converting the first message by the target protocol conversion program according to the target interface protocol to obtain a second message meeting the target interface protocol.
And after the target interface protocol determines the target interface protocol, converting the first message according to the target interface protocol to obtain a second message meeting the target protocol, so that the second message is sent to the first target equipment subsequently.
In a possible implementation manner, a fifth corresponding relationship between the device identifier and the data protocol is configured in the main program, and then the step 406 includes: and determining a target data protocol corresponding to the first target equipment identifier through the target protocol conversion program, and converting the first message according to the target interface protocol and the target data protocol to obtain a second message meeting the target interface protocol and the target data protocol.
In one possible implementation, the target protocol conversion program includes a protocol conversion subroutine, and step 406 includes: and converting the first message by the protocol conversion subprogram according to the target interface protocol to obtain a second message meeting the target interface protocol.
407. And determining the device address of the first target device according to the fourth corresponding relation by the target protocol conversion program.
And the target protocol conversion program is configured with a fourth corresponding relation between the equipment identifier and the equipment address, and the equipment address is used for indicating the communication address of the equipment. And querying the fourth corresponding relation through the first device identifier, and determining a device address corresponding to the first target device identifier, namely the device address of the first target device.
In one possible implementation, the target protocol conversion program includes a logic processing subroutine, and the step 407 includes: and determining the device address of the first target device according to the fourth corresponding relation through the logic processing subprogram.
408. And sending the second message to the first target equipment according to the equipment address of the first target equipment by the target protocol conversion program.
And after the equipment address of the first target equipment is determined, the second message is sent to the first target equipment according to the equipment address, so that the first equipment can receive the second message.
In one possible implementation, the target protocol conversion program includes a communication sub-program and a protocol conversion sub-program, and step 408 includes: and establishing communication connection between the target protocol conversion program and the first target equipment through the communication subprogram, and issuing a second message to the first target equipment through the protocol conversion subprogram according to the equipment address of the first target equipment on the basis of the communication connection.
It should be noted that, in the embodiment of the present application, the target protocol conversion program issues the second message to the first target device according to the determined device address, but in another embodiment, the target protocol conversion program may also issue the second message to the first target device in other manners without executing steps 407 to 408.
It should be noted that, in the embodiment of the present application, the description is only given in a process of issuing a message to a first target device by a cloud server, and in another embodiment, a message can be uploaded to the cloud server by a device through a gateway provided in the embodiment of the present application.
In one possible implementation manner, the process of uploading the message to the cloud server by the device comprises the following steps 409-411:
409. and receiving a third message uploaded by the second target device through any one of the plurality of protocol conversion programs.
In the embodiment of the present application, different protocol conversion programs correspond to different devices. And in the starting process of the gateway, the protocol conversion program establishes communication connection with the corresponding equipment, and based on the communication connection, the protocol conversion program can receive the message uploaded by the corresponding equipment.
And the third message carries a second target device identifier. Optionally, the third message is used to indicate a status of the device, or the third message is a login request of the second target device, and the like.
In one possible implementation, the protocol conversion procedure includes a communication sub-procedure and a protocol conversion sub-procedure, and the step 409 includes: and establishing communication connection between the protocol conversion program and the second target equipment through the communication subprogram, and receiving a third message uploaded by the second target equipment through the protocol conversion subprogram based on the communication connection.
410. And converting the third message according to the reference interface protocol through a protocol conversion program to obtain a fourth message meeting the reference interface protocol, and uploading the fourth message to the main program.
The reference interface protocol is an interface protocol corresponding to the cloud server. And after the third message is uploaded by the protocol conversion program, according to a reference interface protocol corresponding to the cloud server, converting the third message to obtain a fourth message meeting the reference interface protocol, and uploading the fourth message to the main program so that the subsequent main program uploads the fourth message to the cloud server.
In one possible implementation, this step 410 includes: and calling a message uploading interface to upload the fourth message to the main program.
The message uploading interface is provided by an interface subprogram in the main program, and through the message uploading interface, the protocol conversion program can upload a fourth message to the main program so that the main program receives the fourth message.
In one possible implementation, the protocol conversion program includes a protocol conversion sub-program and a logic processing sub-program, and step 410 includes: and converting the third message by the protocol conversion subprogram according to the reference interface protocol to obtain a fourth message meeting the reference interface protocol, forwarding the fourth message to the logic processing subprogram, and uploading the fourth message to the main program by the logic processing subprogram.
411. And receiving a fourth message uploaded by the protocol conversion program through the main program, and uploading the fourth message to the cloud server.
After the main program receives the fourth message uploaded by the protocol conversion program, the fourth message is uploaded to the cloud server, and therefore interaction between the equipment and the cloud server is achieved.
In one possible implementation manner, the main program includes a message management sub-program and a cloud communication sub-program, and then step 411 includes: and receiving a fourth message uploaded by the protocol conversion program through the message management subprogram, establishing communication connection between the main program and the cloud server through the cloud communication subprogram, and uploading the fourth message to the cloud server through the message management subprogram based on the communication connection.
Through the gateway provided by the embodiment of the application, the messages uploaded by the equipment corresponding to different interface protocols are converted into a standard interface protocol or data protocol, and the converted messages are uploaded to the cloud server, so that the cloud server can manage in a unified manner.
Through the gateway provided by the embodiment of the application, the protocol conversion is carried out on the message sent by the cloud server, so that the converted message meets the interface protocol of the equipment to be received; or, the protocol conversion is performed on the message uploaded by the device, so that the converted message meets the interface protocol of the cloud server, and therefore the interaction between the cloud server and the device is realized. An Application Programming Interface (API) is provided in the gateway, and the device uploads a message to the gateway through the API in the gateway, so that the gateway uploads the message to the cloud server, or the cloud server issues the message to the gateway through the API in the gateway, so that the gateway issues the message to the device.
In addition, in the embodiment of the application, the gateway comprises a main program and a plurality of protocol conversion programs, and the plurality of devices are accessed to the cloud server through the gateway, so that interaction between the cloud server and the plurality of devices can be realized. In addition, through the gateway provided by the embodiment of the application, an updated protocol conversion program can be configured in the gateway, that is, a new protocol conversion program is added in the gateway, and the device corresponding to the updated protocol conversion program is accessed to the cloud server through the updated gateway, so that the expansion of the device accessed to the cloud server is realized, and thus, multiple devices can be accessed to the same cloud server, so that the internet of everything is realized, and the development of the internet of things is promoted.
In a possible implementation manner, a first corresponding relationship between the device identifier and the protocol conversion program, and a second corresponding relationship between the protocol conversion program and the program address are configured in the main program; the method further comprises the following steps: and respectively updating the first corresponding relation and the second corresponding relation according to the protocol conversion program, the corresponding equipment identification and the program address of the protocol conversion program.
In this embodiment, the gateway includes a main program and a plurality of protocol conversion programs, the plurality of protocol conversion programs are capable of managing devices that have accessed the cloud server, and when a new device is added, an updated protocol conversion program needs to be configured in the gateway, the updated protocol conversion program is used for the added new device, and determines a device identifier corresponding to the updated protocol conversion program and a program address of the protocol conversion program.
Optionally, the updated protocol conversion program is independently developed by a developer according to an interface provided by the main program through an interface protocol document of the new device, the developed protocol conversion program is stored in a code library corresponding to the gateway, the first corresponding relationship and the second corresponding relationship are updated in the main program, the updated protocol conversion program is started through the main program when the gateway is started subsequently, and interaction between the new device and the cloud server can be realized through the updated protocol conversion program and the main program subsequently.
In the embodiment of the application, the gateway is divided into a main program and a protocol package, the main program is mainly in communication connection with the cloud server, communication safety of the cloud server is guaranteed, and different protocol packages can be dynamically loaded to achieve interaction between the cloud server and equipment. The protocol packet is a program packet developed for different interface protocols and data protocols, is used for communicating with devices with various interface protocols or data protocols, performs protocol conversion on messages of different devices to obtain messages with unified interface protocols or data protocols, and then communicates with the cloud service by calling the interface of the main program. For example, interface protocols of devices of different manufacturers may be different, and the gateways provided in the embodiments of the present application can enable devices of different manufacturers to access the same cloud server, thereby implementing intelligent management on devices of multiple manufacturers.
In the embodiment of the present application, the protocol conversion program can be stored in the gateway in the form of a protocol packet, and the main program and the plurality of protocol packets in the gateway are independent. After independently developing through an interface protocol document of the equipment, a developer obtains a protocol package, the protocol includes a plurality of equipment identifications, an interface protocol of each equipment identification, an equipment address of each equipment and an interface protocol of the cloud server, the obtained protocol package is stored in the gateway, a relation between a main program and the protocol package is established through the interface provided by the main program and the interface provided by the protocol package, the protocol package can be started by a subsequent main program, and interaction between the equipment corresponding to the protocol package and the cloud server can be realized through the main program and the protocol package.
In the embodiment of the application, the main program and the protocol conversion program in the gateway are independent, the relationship between the main program and the protocol conversion program is established, the main program and the protocol conversion program are stored in an associated mode, and the main program and the protocol conversion program are automatically adapted when the main program is started, so that the expansibility of the gateway is improved. Through the gateway provided by the embodiment of the application, when the equipment of the cloud server is accessed in an expansion mode, only the updated protocol conversion program needs to be developed, the whole gateway does not need to be developed again, the problem that the program deployment difficulty in the gateway is high is solved, the development difficulty is reduced, the access cost of the equipment to the cloud server is reduced, the time consumption of the whole gateway is reduced, and the access efficiency and the field installation efficiency are improved.
Through the gateway provided by the embodiment of the application, the mode of accessing the electronic equipment to the cloud server becomes simpler, the cost is lower, the equipment access threshold of a developer is reduced, the information isolated island problem of each system in the traditional TOB (business operation mode) industry is effectively solved, the protocol packet can be updated at any time to expand the accessed equipment, and the existing system does not need to be re-developed. In the internet of everything age, the cloud is helped to be on the equipment, basic data is provided for big data, and the development of the internet of things is rapidly promoted.
According to the method provided by the embodiment of the application, the protocol conversion program in the gateway provided by the embodiment of the application can convert the protocol of the message sent to the equipment by the cloud server, so that the converted message meets the interface protocol corresponding to the equipment, interaction between the cloud server and the equipment is realized, the interface protocol of the cloud server is not required to be adapted to the interface protocol of the equipment, and the flexibility is improved. Moreover, the protocol conversion programs are not affected with each other, and corresponding devices are managed respectively, so that the devices supporting multiple interface protocols can be accessed into the cloud server, interaction between the cloud server and the multiple devices is realized, and the access rate of the cloud server is improved.
When the cloud server needs to be accessed with new equipment, the new equipment can be accessed into the cloud server only by configuring a new protocol conversion program, interaction with the cloud server is carried out, and the extension mode is simple.
In addition, because the main program and the protocol conversion program in the gateway are independent, the gateway is configured with the updated protocol conversion program, so that new equipment can be accessed to the cloud server, the expansibility of the gateway is improved, the whole gateway does not need to be redeveloped, the access cost of the equipment to the cloud server is reduced, the time for redevelopment of the whole gateway is reduced, and the access efficiency is improved.
Based on the embodiment, the interaction between the cloud server and the equipment is realized through the started gateway. Fig. 5 shows a gateway boot process, which, as shown in fig. 5, includes:
1. when the gateway is started, the configuration file in the main program is read, and the program addresses of a plurality of protocol conversion programs are determined.
2. The communication connection between the main program and the cloud server is established through the cloud communication subprogram, the message management subprogram is initialized, the interface subprogram in the main program is started, and the equipment management subprogram is initialized.
3. And starting a logic processing subprogram in each protocol conversion program according to the program addresses of the plurality of protocol conversion programs through the main program, and establishing communication connection between each protocol conversion program and the corresponding equipment through the communication subprogram in each protocol conversion program.
Based on the foregoing embodiment, fig. 6 shows a flowchart of issuing a message to a device by a cloud server, and as shown in fig. 6, the flowchart includes:
1. a first communication connection between the cloud server and the main program is established through a cloud communication subprogram in the main program, and a second communication connection between the target protocol conversion program and the first target device is established through a communication subprogram in the target protocol conversion program.
2. The cloud server sends a first message to the message management subprogram in the main program through the first communication connection.
3. Determining a target protocol conversion program corresponding to a first target equipment identifier and a program address of the target protocol conversion program according to the first target equipment identifier carried by the first message through a message management subprogram in the main program, calling a message issuing interface in an interface subprogram, and issuing the first message to a logic processing subprogram in the target protocol conversion program according to the program address.
4. And receiving the first message through a logic processing subprogram in a target protocol conversion program, determining a target interface protocol and a target data protocol corresponding to the first equipment identifier according to the first target equipment identifier, and forwarding the first message, the target interface protocol and the target data protocol to a protocol conversion subprogram in the target protocol conversion program.
5. And converting the first message through the protocol conversion subprogram to obtain a second message meeting the target interface protocol and the target data protocol, and sending the second message to the first target equipment through the second communication connection.
Based on the above embodiments, fig. 7 shows a flowchart of uploading a message to a cloud server by a device, and as shown in fig. 7, the flowchart includes:
1. a first communication connection between the cloud server and the main program is established through a cloud communication subprogram in the main program, and a second communication connection between the target protocol conversion program and a second target device is established through a communication subprogram in the target protocol conversion program.
2. And receiving a third message uploaded by the second target device through a protocol conversion subprogram in the protocol conversion program, converting the third message to obtain a fourth message meeting the reference interface protocol of the cloud server, and forwarding the fourth message to a logic processing subprogram in the protocol conversion program.
3. And calling a message uploading interface provided by an interface subprogram in the main program through the logic processing subprogram, and uploading the fourth message to a message management subprogram in the main program.
4. And uploading the fourth message to the cloud server through the message management subprogram based on the first communication connection.
Fig. 8 is a schematic structural diagram of a message sending apparatus according to an embodiment of the present application, and as shown in fig. 8, the message sending apparatus is applied to a gateway, where the gateway includes a main program and a plurality of protocol conversion programs, and the apparatus includes:
a first receiving module 801, configured to receive, through a main program, a first message sent by a cloud server, where the first message carries a first target device identifier;
a first running module 802, configured to determine, through a main program, a target protocol conversion program corresponding to a first target device identifier from multiple protocol conversion programs; sending the first message to a target protocol conversion program;
a second running module 803, configured to determine, through the target protocol conversion program, a target interface protocol corresponding to the first target device identifier; according to the target interface protocol, the first message is converted to obtain a second message meeting the target interface protocol; and sending the second message to the first target equipment.
In one possible implementation manner, the main program is configured with a first corresponding relationship between the device identifier and the protocol conversion program, as shown in fig. 9, and the first running module 802 includes:
the first determining unit 8201 is configured to determine, according to the first corresponding relationship and through the main program, a target protocol conversion program corresponding to the first target device identifier.
In another possible implementation manner, as shown in fig. 9, the first operation module 802 includes:
and the first issuing unit 8202 is used for issuing the first message to the target protocol conversion program according to the program address of the target protocol conversion program.
In another possible implementation manner, a second corresponding relationship between the protocol conversion program and the program address is configured in the main program, and as shown in fig. 9, the apparatus further includes:
a first determining module 804, configured to determine a program address of the target protocol conversion program according to the second corresponding relationship.
In another possible implementation manner, the first issuing unit 8202 is configured to call the message issuing interface according to the program address of the target protocol conversion program, and issue the first message to the target protocol conversion program.
In another possible implementation manner, a third corresponding relationship between the device identifier and the interface protocol is configured in the target protocol conversion program, as shown in fig. 9, the second running module 803 includes:
a second determining unit 8301, configured to determine, according to the third correspondence, a target interface protocol corresponding to the first target device identifier.
In another possible implementation manner, as shown in fig. 9, the second operation module 803 includes:
the second issuing unit 8302 is configured to issue the second message to the first target device according to the device address of the first target device.
In another possible implementation manner, a fourth corresponding relationship between the device identifier and the device address is configured in the target protocol conversion program, as shown in fig. 9, the apparatus further includes:
a second determining module 805, configured to determine the device address of the first target device according to the fourth correspondence.
In another possible implementation manner, as shown in fig. 9, the apparatus further includes:
a second receiving module 806, configured to receive, through any one of the multiple protocol conversion programs, a third message uploaded by the second target device, where the third message carries a second target device identifier;
the second operation module 803 is further configured to perform conversion processing on the third message according to a reference interface protocol through a protocol conversion program to obtain a fourth message meeting the reference interface protocol, where the reference interface protocol is an interface protocol corresponding to the cloud server; uploading the fourth message to the main program;
the first running module 802 is further configured to receive, through the main program, a fourth message uploaded by the protocol conversion program, and upload the fourth message to the cloud server.
In another possible implementation, as shown in fig. 9, the first operation module 802 includes:
and an upload unit 8203, configured to invoke a message upload interface and upload the fourth message to the main program.
In another possible implementation manner, a first corresponding relationship between the device identifier and the protocol conversion program and a second corresponding relationship between the protocol conversion program and the program address are configured in the main program; as shown in fig. 9, the apparatus further comprises:
a third determining module 807, configured to determine, in response to configuring the updated protocol conversion program in the gateway, the device identifier corresponding to the protocol conversion program and the program address of the protocol conversion program;
the updating module 808 is configured to update the first corresponding relationship and the second corresponding relationship respectively according to the protocol conversion program, the corresponding device identifier, and the program address of the protocol conversion program.
It should be noted that: the message sending apparatus provided in the foregoing embodiment is only illustrated by dividing the functional modules, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the gateway is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the message sending apparatus provided in the foregoing embodiment and the message sending method embodiment belong to the same concept, and specific implementation processes thereof are described in the method embodiment, and are not described herein again.
Fig. 10 shows a block diagram of an electronic device 1000 according to an exemplary embodiment of the present application. The electronic device 1000 may be a portable mobile terminal, such as: a smart phone, a tablet computer, an MP3 player (Moving Picture Experts Group Audio Layer III, motion Picture Experts compression standard Audio Layer 3), an MP4 player (Moving Picture Experts Group Audio Layer IV, motion Picture Experts compression standard Audio Layer 4), a notebook computer, or a desktop computer. The electronic device 1000 may also be referred to by other names such as user equipment, portable terminal, laptop terminal, desktop terminal, and so forth.
The electronic device 1000 includes: a processor 1001 and a memory 1002.
Processor 1001 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and so forth. The processor 1001 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 1001 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also referred to as a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 1001 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content that the display screen needs to display. In some embodiments, the processor 1001 may further include an AI (Artificial Intelligence) processor for processing a calculation operation related to machine learning.
Memory 1002 may include one or more computer-readable storage media, which may be non-transitory. The memory 1002 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in the memory 1002 is used to store at least one program code for execution by the processor 1001 to implement the message sending method provided by the method embodiments herein.
In some embodiments, the electronic device 1000 may further optionally include: a peripheral interface 1003 and at least one peripheral. The processor 1001, memory 1002 and peripheral interface 1003 may be connected by a bus or signal line. Various peripheral devices may be connected to peripheral interface 1003 via a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of radio frequency circuitry 1004, display screen 1005, camera assembly 1006, audio circuitry 1007, and power supply 1009.
The peripheral interface 1003 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 1001 and the memory 1002. In some embodiments, processor 1001, memory 1002, and peripheral interface 1003 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 1001, the memory 1002, and the peripheral interface 1003 may be implemented on separate chips or circuit boards, which are not limited by this embodiment.
The Radio Frequency circuit 1004 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuitry 1004 communicates with communication networks and other communication devices via electromagnetic signals. The radio frequency circuit 1004 converts an electrical signal into an electromagnetic signal to transmit, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 1004 comprises: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuit 1004 may communicate with other terminals via at least one wireless communication protocol. The wireless communication protocol conversion procedure includes but is not limited to: the world wide web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the rf circuit 1004 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 1005 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display screen 1005 is a touch display screen, the display screen 1005 also has the ability to capture touch signals on or over the surface of the display screen 1005. The touch signal may be input to the processor 1001 as a control signal for processing. At this point, the display screen 1005 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display screen 1005 may be one, disposed on the front panel of the electronic device 1000; in other embodiments, the display screens 1005 may be at least two, which are respectively disposed on different surfaces of the electronic device 1000 or in a foldable design; in other embodiments, the display 1005 may be a flexible display disposed on a curved surface or a folded surface of the electronic device 1000. Even more, the display screen 1005 may be arranged in a non-rectangular irregular figure, i.e., a shaped screen. The Display screen 1005 may be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or other materials.
The camera assembly 1006 is used to capture images or video. Optionally, the camera assembly 1006 includes a front camera and a rear camera. The front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, the main camera and the wide-angle camera are fused to realize panoramic shooting and a VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 1006 may also include a flash. The flash lamp can be a single-color temperature flash lamp or a double-color temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
The audio circuit 1007 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 1001 for processing or inputting the electric signals to the radio frequency circuit 1004 for realizing voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the electronic device 1000. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 1001 or the radio frequency circuit 1004 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, the audio circuit 1007 may also include a headphone jack.
The power supply 1009 is used to supply power to the respective components in the electronic device 1000. The power source 1009 may be alternating current, direct current, disposable battery, or rechargeable battery. When the power source 1009 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, the electronic device 1000 also includes one or more sensors 1010. The one or more sensors 1010 include, but are not limited to: acceleration sensor 1011, gyro sensor 1012, pressure sensor 1013, optical sensor 1015, and proximity sensor 1016.
The acceleration sensor 1011 may detect the magnitude of acceleration on three coordinate axes of a coordinate system established with the electronic apparatus 1000. For example, the acceleration sensor 1011 can be used to detect the components of the gravitational acceleration on three coordinate axes. The processor 1001 may control the display screen 1005 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 1011. The acceleration sensor 1011 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 1012 may detect a body direction and a rotation angle of the electronic device 1000, and the gyro sensor 1012 and the acceleration sensor 1011 may cooperate to acquire a 3D motion of the user on the electronic device 1000. From the data collected by the gyro sensor 1012, the processor 1001 may implement the following functions: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization while shooting, game control, and inertial navigation.
The pressure sensor 1013 may be disposed on a side bezel of the electronic device 1000 and/or underneath the display screen 1005. When the pressure sensor 1013 is disposed on a side frame of the electronic device 1000, a user's holding signal of the electronic device 1000 can be detected, and the processor 1001 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 1013. When the pressure sensor 1013 is disposed at a lower layer of the display screen 1005, the processor 1001 controls the operability control on the UI interface according to the pressure operation of the user on the display screen 1005. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The optical sensor 1015 is used to collect the ambient light intensity. In one embodiment, the processor 1001 may control the display brightness of the display screen 1005 according to the ambient light intensity collected by the optical sensor 1015. Specifically, when the ambient light intensity is high, the display brightness of the display screen 1005 is increased; when the ambient light intensity is low, the display brightness of the display screen 1005 is turned down. In another embodiment, the processor 1001 may also dynamically adjust the shooting parameters of the camera assembly 1006 according to the intensity of the ambient light collected by the optical sensor 1015.
A proximity sensor 1016, also referred to as a distance sensor, is disposed on the front panel of the electronic device 1000. The proximity sensor 1016 is used to capture the distance between the user and the front of the electronic device 1000. In one embodiment, the processor 1001 controls the display screen 1005 to switch from the bright screen state to the dark screen state when the proximity sensor 1016 detects that the distance between the user and the front surface of the electronic device 1000 gradually decreases; when the proximity sensor 1016 detects that the distance between the user and the front of the electronic device 1000 gradually becomes larger, the display screen 1005 is controlled by the processor 1001 to switch from the breath-screen state to the bright-screen state.
Those skilled in the art will appreciate that the configuration shown in fig. 10 is not limiting of the electronic device 1000 and may include more or fewer components than shown, or combine certain components, or employ a different arrangement of components.
Fig. 11 is a schematic structural diagram of a server according to an embodiment of the present application, where the server 1100 may have a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 1101 and one or more memories 1102, where at least one program code is stored in the memory 1102, and is loaded by the processors 1101 and executed to implement the methods provided by the foregoing method embodiments. Certainly, the server may further have a wired or wireless network interface, a keyboard, an input/output interface, and other components to facilitate input and output, and the server may further include other components for implementing functions of the device, which are not described herein again.
The server 1100 may be used to perform the steps performed by the gateway in the messaging method described above.
The embodiment of the present application further provides a gateway, where the gateway includes a processor and a memory, where the memory stores at least one program code, and the at least one program code is loaded and executed by the processor to implement the operations executed in the message sending method according to the foregoing embodiment.
The embodiment of the present application further provides a computer-readable storage medium, where at least one program code is stored in the computer-readable storage medium, and the at least one program code is loaded and executed by a processor to implement the operations performed in the message sending method of the foregoing embodiment.
Embodiments of the present application also provide a computer program product or computer program comprising computer program code stored in a computer readable storage medium. The processor of the gateway reads the computer program code from the computer-readable storage medium, and the processor executes the computer program code, so that the gateway realizes the operations performed in the message transmitting method according to the above embodiment.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only an alternative embodiment of the present application and should not be construed as limiting the present application, and any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (12)

1. The message sending method is characterized by being applied to a gateway, wherein the gateway comprises a main program and a plurality of protocol conversion programs, and a first corresponding relation between a device identifier and the protocol conversion programs is configured in the main program; the protocol conversion program is used for converting messages and interacting with one or more devices, different protocol conversion programs correspond to different devices, the protocol conversion program is stored in the gateway in the form of a protocol packet, the protocol packet comprises a device identifier and a third corresponding relation between the device identifier and an interface protocol, and the main program and the protocol packet exist independently; the method comprises the following steps:
responding to a new protocol conversion program configured in the gateway, and determining a device identifier included in a protocol packet corresponding to the new protocol conversion program;
updating the first corresponding relation according to the equipment identifier corresponding to the new protocol conversion program;
under the condition that the main program is started, starting the plurality of protocol conversion programs and the new protocol conversion program through the main program;
receiving a first message issued by a cloud server through the main program, wherein the first message carries a first target device identifier;
determining a target protocol conversion program corresponding to the first target equipment identifier from the plurality of protocol conversion programs and the new protocol conversion program according to the first corresponding relation through the main program; sending the first message to the target protocol conversion program;
determining, by the target protocol conversion program, a target interface protocol corresponding to the first target device identifier according to a third correspondence in the target protocol conversion program; according to the target interface protocol, the first message is converted to obtain a second message meeting the target interface protocol; and sending the second message to the first target equipment.
2. The method of claim 1, wherein said sending the first message to the target protocol conversion program comprises:
and sending the first message to the target protocol conversion program according to the program address of the target protocol conversion program.
3. The method according to claim 2, wherein a second mapping relationship between a protocol conversion program and a program address is configured in the main program, and before issuing the first message to the target protocol conversion program according to the program address of the target protocol conversion program, the method further comprises:
and determining the program address of the target protocol conversion program according to the second corresponding relation.
4. The method of claim 2, wherein said issuing the first message to the target protocol conversion program according to the program address of the target protocol conversion program comprises:
and calling a message issuing interface according to the program address of the target protocol conversion program, and issuing the first message to the target protocol conversion program.
5. The method of claim 1, wherein sending the second message to the first target device comprises:
and sending the second message to the first target equipment according to the equipment address of the first target equipment.
6. The method according to claim 5, wherein a fourth correspondence between the device identifier and the device address is configured in the target protocol conversion program, and before the second message is sent to the first target device according to the device address of the first target device, the method further includes:
and determining the equipment address of the first target equipment according to the fourth corresponding relation.
7. The method according to any one of claims 1-6, further comprising:
receiving a third message uploaded by a second target device through any one of the plurality of protocol conversion programs and the new protocol conversion program, wherein the third message carries a second target device identifier;
converting the third message according to a reference interface protocol by the protocol conversion program to obtain a fourth message meeting the reference interface protocol, wherein the reference interface protocol is an interface protocol corresponding to the cloud server; uploading the fourth message to the main program;
and receiving the fourth message uploaded by the protocol conversion program through the main program, and uploading the fourth message to the cloud server.
8. The method of claim 7, wherein uploading the fourth message to the main program comprises:
and calling a message uploading interface to upload the fourth message to the main program.
9. The method according to claim 1, wherein a second mapping relationship between a protocol conversion program and a program address is configured in the main program; the method further comprises the following steps:
determining a program address of a protocol conversion program in response to configuring a new protocol conversion program in the gateway;
and updating the second corresponding relation according to the program address of the protocol conversion program.
10. The message sending device is characterized by being applied to a gateway, wherein the gateway comprises a main program and a plurality of protocol conversion programs, and a first corresponding relation between a device identifier and the protocol conversion programs is configured in the main program; the protocol conversion program is used for converting messages and interacting with one or more devices, different protocol conversion programs correspond to different devices, the protocol conversion program is stored in the gateway in the form of a protocol packet, the protocol packet comprises a device identifier and a third corresponding relation between the device identifier and an interface protocol, and the main program and the protocol packet exist independently; the device comprises:
a third determining module, configured to determine, in response to a new protocol conversion program configured in the gateway, a device identifier included in a protocol packet corresponding to the new protocol conversion program;
the updating module is used for updating the first corresponding relation according to the equipment identifier corresponding to the new protocol conversion program;
means for performing the steps of: under the condition that the main program is started, starting the plurality of protocol conversion programs and the new protocol conversion program through the main program;
the first receiving module is used for receiving a first message issued by the cloud server through the main program, wherein the first message carries a first target device identifier;
a first running module, configured to determine, through the main program and according to the first correspondence, a target protocol conversion program corresponding to the first target device identifier from the multiple protocol conversion programs and the new protocol conversion program; sending the first message to the target protocol conversion program;
a second running module, configured to determine, by the target protocol conversion program, a target interface protocol corresponding to the first target device identifier according to a third correspondence in the target protocol conversion program; according to the target interface protocol, the first message is converted to obtain a second message meeting the target interface protocol; and sending the second message to the first target equipment.
11. A gateway, characterized in that the gateway comprises a processor and a memory, in which at least one program code is stored, which is loaded and executed by the processor to implement the operations executed in the message sending method according to any one of claims 1 to 9.
12. A computer-readable storage medium, having at least one program code stored therein, the at least one program code being loaded into and executed by a processor to perform the operations of the method of any one of claims 1 to 9.
CN202011061266.9A 2020-09-30 2020-09-30 Message sending method, device, gateway and storage medium Active CN112153071B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011061266.9A CN112153071B (en) 2020-09-30 2020-09-30 Message sending method, device, gateway and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011061266.9A CN112153071B (en) 2020-09-30 2020-09-30 Message sending method, device, gateway and storage medium

Publications (2)

Publication Number Publication Date
CN112153071A CN112153071A (en) 2020-12-29
CN112153071B true CN112153071B (en) 2023-03-17

Family

ID=73951486

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011061266.9A Active CN112153071B (en) 2020-09-30 2020-09-30 Message sending method, device, gateway and storage medium

Country Status (1)

Country Link
CN (1) CN112153071B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112671638B (en) * 2021-01-13 2022-10-04 北京方正数码有限公司 Gateway structure for multi-protocol conversion
CN113067811A (en) * 2021-03-17 2021-07-02 北京自如信息科技有限公司 Protocol conversion method, device, system, electronic equipment and storage medium
CN115442572A (en) * 2021-06-04 2022-12-06 西安诺瓦星云科技股份有限公司 Data transmission method and device
CN113422719B (en) * 2021-06-22 2022-08-23 北京博创联动科技有限公司 Configuration system and configuration method of protocol conversion gateway and protocol conversion gateway
CN114501176A (en) * 2021-12-29 2022-05-13 深圳市海浦蒙特科技有限公司 Data acquisition method and device, data acquisition terminal and readable storage medium
CN114513561B (en) * 2022-02-16 2024-10-08 拉扎斯网络科技(上海)有限公司 Information processing method, information processing device, electronic equipment and computer readable storage medium
CN114760340B (en) * 2022-04-28 2024-05-24 深圳市晟瑞科技有限公司 Equipment access method and device, electronic equipment and storage medium
CN115396524A (en) * 2022-08-26 2022-11-25 生迪智慧科技有限公司 Message processing system, method, device and storage medium
CN117938973A (en) * 2022-10-26 2024-04-26 华为技术有限公司 Message processing method and device
CN115834702A (en) * 2022-11-01 2023-03-21 长城汽车股份有限公司 Vehicle cloud communication method and device, storage medium and vehicle-mounted communication equipment
CN115842868A (en) * 2022-11-01 2023-03-24 长城汽车股份有限公司 Interface data conversion method, device, storage medium and vehicle-mounted communication equipment
CN116708579B (en) * 2023-08-04 2024-01-12 浪潮电子信息产业股份有限公司 Data access method, device, electronic equipment and computer readable storage medium
CN117097682B (en) * 2023-10-19 2024-02-06 杭州义益钛迪信息技术有限公司 Equipment access method, device, equipment and storage medium
CN117254987B (en) * 2023-11-15 2024-02-27 网易(杭州)网络有限公司 Communication method, communication device, and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6873620B1 (en) * 1997-12-18 2005-03-29 Solbyung Coveley Communication server including virtual gateway to perform protocol conversion and communication system incorporating the same
CN104660498A (en) * 2015-03-17 2015-05-27 联想(北京)有限公司 Gateway equipment and information processing method
CN105516185A (en) * 2015-12-30 2016-04-20 广东顺德中山大学卡内基梅隆大学国际联合研究院 Multi-protocol gateway equipment
CN111049854A (en) * 2019-12-25 2020-04-21 微民保险代理有限公司 Service request transmission method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102377632B (en) * 2010-08-06 2014-08-20 北京乾唐视联网络科技有限公司 Method and system compatible with Ethernet

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6873620B1 (en) * 1997-12-18 2005-03-29 Solbyung Coveley Communication server including virtual gateway to perform protocol conversion and communication system incorporating the same
CN104660498A (en) * 2015-03-17 2015-05-27 联想(北京)有限公司 Gateway equipment and information processing method
CN105516185A (en) * 2015-12-30 2016-04-20 广东顺德中山大学卡内基梅隆大学国际联合研究院 Multi-protocol gateway equipment
CN111049854A (en) * 2019-12-25 2020-04-21 微民保险代理有限公司 Service request transmission method and device

Also Published As

Publication number Publication date
CN112153071A (en) 2020-12-29

Similar Documents

Publication Publication Date Title
CN112153071B (en) Message sending method, device, gateway and storage medium
CN112256425B (en) Load balancing method and system, computer cluster, information editing method and terminal
CN111614549B (en) Interaction processing method and device, computer equipment and storage medium
CN110213153B (en) Display method, acquisition method, device, terminal and storage medium of unread messages
CN109194972B (en) Live stream acquisition method and device, computer equipment and storage medium
CN113542290B (en) Data access request processing method, device, equipment and readable storage medium
CN109302385A (en) Multimedia resource sharing method, device and storage medium
CN111866140B (en) Fusion management device, management system, service calling method and medium
CN110569220B (en) Game resource file display method and device, terminal and storage medium
CN111159604A (en) Picture resource loading method and device
CN113144622A (en) Node switching method, device, equipment and computer readable storage medium
CN110636144A (en) Data downloading method and device
CN112905328A (en) Task processing method and device and computer readable storage medium
CN110045958B (en) Texture data generation method, device, storage medium and equipment
US12061662B2 (en) Methods, apparatuses and systems for displaying alarm file
CN111682983B (en) Interface display method and device, terminal and server
CN110086814B (en) Data acquisition method and device and storage medium
CN113766043A (en) Method and device for configuring target container, computer equipment and storage medium
CN112612539A (en) Data model unloading method and device, electronic equipment and storage medium
WO2022142884A1 (en) Network data group processing method and apparatus, computer device, and storage medium
CN112995587B (en) Electronic equipment monitoring method, system, computer equipment and storage medium
CN112711636B (en) Data synchronization method, device, equipment and medium
CN114785766A (en) Control method of intelligent equipment, terminal and server
CN111741040B (en) Connection establishing method, address obtaining method, device, equipment and storage medium
CN112612540A (en) Data model configuration method and device, electronic equipment and storage medium

Legal Events

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