技术问题technical problem
本发明所要解决的技术问题是,提供一种智能家居系统及其通信方法,使服务器可以主动搜索到客户端,从而使网络满足CSC通信模式。
The technical problem to be solved by the present invention is to provide a smart home system and a communication method thereof, so that the server can actively search for the client, so that the network satisfies the CSC communication mode.
技术解决方案Technical solution
本发明是这样实现的:The present invention is implemented as follows:
一种智能家居系统,包括控制终端、接入服务器、设备终端服务器、设备终端及推送服务器;A smart home system includes a control terminal, an access server, a device terminal server, a device terminal, and a push server;
所述控制终端用于发送控制命令;The control terminal is configured to send a control command;
所述接入服务器用于接收所述控制命令,并处理所述控制命令的业务逻辑,并根据处理结果将所述控制命令发送到所述设备终端服务器;The access server is configured to receive the control command, process the service logic of the control command, and send the control command to the device terminal server according to the processing result;
所述设备终端服务器用于将所述控制命令发送到所述设备终端,并将相应的执行结果发送到所述推送服务器;The device terminal server is configured to send the control command to the device terminal, and send a corresponding execution result to the push server;
所述推送服务器用于将所述执行结果发送到所述控制终端。The push server is configured to send the execution result to the control terminal.
进一步地,所述设备终端还用于发送请求;Further, the device terminal is further configured to send a request;
所述设备终端服务器还用于接收所述请求,并处理所述请求的业务逻辑,并根据处理结果将所述请求发送到所述推送服务器;The device terminal server is further configured to receive the request, process the requested service logic, and send the request to the push server according to the processing result;
所述推送服务器还用于将所述请求发送到所述控制终端,并将相应的请求结果返回所述设备终端服务器;The push server is further configured to send the request to the control terminal, and return a corresponding request result to the device terminal server;
所述设备终端服务器还用于将所述请求结果发送到所述设备终端。The device terminal server is further configured to send the request result to the device terminal.
进一步地,所述控制命令或请求以加密数据包的形式传送;所述加密数据包的密钥是根据私有协议生成的动态密钥。Further, the control command or request is transmitted in the form of an encrypted data packet; the key of the encrypted data packet is a dynamic key generated according to a proprietary protocol.
进一步地,所述控制终端为智能手机、平板电脑及智能穿戴设备中的任意一种,所述设备终端为闹钟;Further, the control terminal is any one of a smart phone, a tablet computer, and a smart wearable device, and the device terminal is an alarm clock;
所述控制命令包括定时响铃命令、自定义闹钟铃声命令及音乐播放命令中的任意一个或任意多个;The control command includes any one or any of a timing ringing command, a custom alarm ringing command, and a music playing command;
所述请求为语音通话请求。The request is a voice call request.
进一步地,所述智能家居系统还包括若干文件服务器;Further, the smart home system further includes a plurality of file servers;
所述控制终端还用于向所述接入服务器请求所述若干文件服务器的地址;The control terminal is further configured to request an address of the several file servers from the access server;
所述接入服务器还用于向所述控制终端返回所述若干文件服务器的地址;The access server is further configured to return an address of the plurality of file servers to the control terminal;
所述控制终端还用于根据所述若干文件服务器的地址将需要上传的文件分布上传到所述若干文件服务器;The control terminal is further configured to upload, to the number of file servers, the file distribution that needs to be uploaded according to the addresses of the plurality of file servers;
所述若干文件服务器用于将各自接收到的文件的存储地址信息发送给所述控制终端。The plurality of file servers are configured to send storage address information of the respective received files to the control terminal.
一种智能家居系统的通信方法,所述智能家居系统包括控制终端、接入服务器、设备终端服务器、设备终端及推送服务器;所述通信方法包括如下步骤:A communication method of a smart home system, the smart home system includes a control terminal, an access server, a device terminal server, a device terminal, and a push server; the communication method includes the following steps:
所述控制终端发送控制命令;The control terminal sends a control command;
所述接入服务器接收所述控制命令,并处理所述控制命令的业务逻辑,并根据处理结果将所述控制命令发送到所述设备终端服务器;Receiving, by the access server, the control command, and processing the service logic of the control command, and sending the control command to the device terminal server according to the processing result;
所述设备终端服务器将所述控制命令发送到所述设备终端,并将相应的执行结果发送到所述推送服务器;Sending, by the device terminal server, the control command to the device terminal, and sending a corresponding execution result to the push server;
所述推送服务器将所述执行结果发送到所述控制终端。The push server transmits the execution result to the control terminal.
进一步地,还包括如下步骤:Further, the method further includes the following steps:
所述设备终端还发送请求;The device terminal also sends a request;
所述设备终端服务器还接收所述请求,并处理所述请求的业务逻辑,并根据处理结果将所述请求发送到所述推送服务器;The device terminal server further receives the request, and processes the requested business logic, and sends the request to the push server according to the processing result;
所述推送服务器将所述请求发送到所述控制终端,并将相应的请求结果返回所述设备终端服务器;Sending, by the push server, the request to the control terminal, and returning a corresponding request result to the device terminal server;
所述设备终端服务器还将所述请求结果发送到所述设备终端。The device terminal server also sends the request result to the device terminal.
进一步地,所述控制命令或请求以加密数据包的形式传送;所述加密数据包的密钥是根据私有协议生成的动态密钥。Further, the control command or request is transmitted in the form of an encrypted data packet; the key of the encrypted data packet is a dynamic key generated according to a proprietary protocol.
进一步地,所述控制终端为智能手机、平板电脑及智能穿戴设备中的任意一种,所述设备终端为闹钟;Further, the control terminal is any one of a smart phone, a tablet computer, and a smart wearable device, and the device terminal is an alarm clock;
所述控制命令包括定时响铃命令、自定义闹钟铃声命令及音乐播放命令中的任意一个或任意多个;The control command includes any one or any of a timing ringing command, a custom alarm ringing command, and a music playing command;
所述请求为语音通话请求。The request is a voice call request.
进一步地,所述智能家居系统还包括若干文件服务器;所述通信方法还包括:Further, the smart home system further includes a plurality of file servers; the communication method further includes:
所述控制终端还向所述接入服务器请求所述若干文件服务器的地址;The control terminal further requests an address of the plurality of file servers from the access server;
所述接入服务器还向所述控制终端返回所述若干文件服务器的地址;The access server also returns an address of the plurality of file servers to the control terminal;
所述控制终端还根据所述若干文件服务器的地址将需要上传的文件分布上传到所述若干文件服务器;The control terminal further uploads the file distribution that needs to be uploaded to the plurality of file servers according to the addresses of the plurality of file servers;
所述若干文件服务器将各自接收到的文件的存储地址信息发送给所述控制终端。The plurality of file servers send storage address information of the respective received files to the control terminal.
有益效果Beneficial effect
与现有技术相比,本发明通过将设备终端的执行结果发送到推送服务器,由推送服务器去搜索控制终端,使网络满足了“客户端-服务器-客户端”的CSC通信模式,从而可实现通过一个客户端控制另一个或多个客户端的目的。
Compared with the prior art, the present invention transmits the execution result of the device terminal to the push server, and the push server searches for the control terminal, so that the network satisfies the CSC communication mode of the "client-server-client", thereby realizing Control the purpose of one or more clients through one client.
本发明的实施方式Embodiments of the invention
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。The present invention will be further described in detail below with reference to the accompanying drawings and embodiments.
图1示出了本发明提供的智能家居系统的组成示意图。如图1所示,该智能家居系统包括控制终端1、接入服务器2、设备终端服务器3、设备终端4及推送服务器5。其中控制终端1可以是智能手机、平板电脑、智能穿戴设备等智能终端设备。接入服务器2是控制终端1与设备终端服务器3之间通信的传输通道,用来合理分配设备终端服务器3的资源和平衡负载。设备终端服务器3是接入服务器2分配给设备终端4,用于控制设备终端4的服务器。控制终端1上一般都安装有智能操作系统,比如Android智能操作系统,在这些智能终端设备上安装相应的应用程序后,就可以通过安装的应用程序发送控制命令到相应设备终端4,从而对设备终端4进行控制。而设备终端4同样可以是诸如智能手机、平板电脑、智能穿戴设备等智能终端设备,也可以是无线闹钟等。FIG. 1 is a schematic diagram showing the composition of a smart home system provided by the present invention. As shown in FIG. 1, the smart home system includes a control terminal 1, an access server 2, a device terminal server 3, a device terminal 4, and a push server 5. The control terminal 1 can be a smart terminal device such as a smart phone, a tablet computer, or a smart wearable device. The access server 2 is a transmission channel that controls communication between the terminal 1 and the device terminal server 3, and is used to reasonably allocate resources and balance loads of the device terminal server 3. The device terminal server 3 is a server that the access server 2 assigns to the device terminal 4 for controlling the device terminal 4. The control terminal 1 is generally equipped with a smart operating system, such as an Android smart operating system. After installing the corresponding application program on the smart terminal devices, the installed application can send a control command to the corresponding device terminal 4, thereby The terminal 4 performs control. The device terminal 4 can also be a smart terminal device such as a smart phone, a tablet computer, a smart wearable device, or a wireless alarm clock.
控制终端1可以通过无线或有线的方式接入接入服务器2,无线方式可采用Wi-Fi或蓝牙等,采用无线方式可提高控制终端1的移动便携性。接入服务器2可接收控制命令,并处理控制命令的业务逻辑,并根据处理结果将控制命令发送到设备终端服务器3。设备终端服务器3用于将控制命令发送到设备终端4,并将相应的执行结果发送到推送服务器5。推送服务器5用于将执行结果发送到控制终端1。通过将设备终端4的执行结果发送到推送服务器5,由推送服务器5去搜索控制终端1,使网络满足了“客户端-服务器-客户端”的CSC通信模式,从而可实现通过一个客户端控制另一个或多个客户端的目的。The control terminal 1 can access the access server 2 through wireless or wired mode, and can adopt Wi-Fi or Bluetooth in a wireless manner, and the mobile portability of the control terminal 1 can be improved by using a wireless manner. The access server 2 can receive the control command and process the business logic of the control command, and send the control command to the device terminal server 3 according to the processing result. The device terminal server 3 is for transmitting a control command to the device terminal 4, and transmits a corresponding execution result to the push server 5. The push server 5 is for transmitting the execution result to the control terminal 1. By transmitting the execution result of the device terminal 4 to the push server 5, the push server 5 searches for the control terminal 1 so that the network satisfies the "client-server-client" CSC communication mode, thereby enabling control through one client. The purpose of another or multiple clients.
以下以控制终端1为智能手机,设备终端4为无线闹钟,通过智能手机对无线闹钟进行定时响铃为例,描述上述工作过程。智能手机可采用基于Android或IOS智能操作系统的智能手机,无线闹钟可选择具有Wi-Fi功能的无线闹钟。首先,用户通过安装在智能手机上的闹钟控制程序设置需要闹钟响铃的时间,同时,生成相应的定时响铃命令,并将其发送到接入服务器2。该定时响铃命令就是一条具体的控制命令。接入服务器2接收到该定时响铃命令后,对该定时响铃命令进行业务逻辑处理。不同的控制命令具有不同的业务逻辑,业务逻辑包括该命令的逻辑路径、登录信息等,这些都是包含在控制命令中的,接入服务器2根据该命令的业务逻辑再将该控制命令发送到设备终端服务器3。具体而言,定时响铃命令中包含有发送该命令的控制终端1的识别信息、接收该命令的设备终端4的识别信息,以及相应的登录信息等。设备终端服务器3接收到该定时响铃命令后,再将该定时响铃命令发送到相应的无线闹钟,无线闹钟执行该定时响铃命令。该定时响铃命令的执行结果可由设备终端4发送到推送服务器5。推送服务器5用于将执行结果发送到控制终端1。如果控制终端1不在线或者推送服务器5搜索不到控制终端1时,将该执行结果信息当作离线消息处理。In the following, the control terminal 1 is a smart phone, the device terminal 4 is a wireless alarm clock, and the wireless alarm clock is periodically ringed by the smart phone as an example to describe the above work process. The smartphone can use a smart phone based on Android or IOS smart operating system, and the wireless alarm clock can select a wireless alarm clock with Wi-Fi function. First, the user sets the time required for the alarm to ring through the alarm control program installed on the smartphone, and generates a corresponding timing ringing command and transmits it to the access server 2. The timed ring command is a specific control command. After receiving the timing ringing command, the access server 2 performs business logic processing on the timing ringing command. Different control commands have different business logics, and the business logic includes the logical path of the command, login information, and the like, which are all included in the control command, and the access server 2 sends the control command to the service logic according to the command. Device Terminal Server 3. Specifically, the timing ringing command includes identification information of the control terminal 1 that transmits the command, identification information of the device terminal 4 that receives the command, and corresponding login information and the like. After receiving the timing ringing command, the device terminal server 3 sends the timing ringing command to the corresponding wireless alarm clock, and the wireless alarm clock executes the timing ringing command. The execution result of the timing ringing command can be sent by the device terminal 4 to the push server 5. The push server 5 is for transmitting the execution result to the control terminal 1. If the control terminal 1 is not online or the push server 5 cannot find the control terminal 1, the execution result information is treated as offline message processing.
设备终端4并不局限于接收并执行控制终端1发送的控制命令,还可以主动向控制终端1发送请求。设备终端4发送请求后,设备终端服务器3接收请求,并处理请求的业务逻辑,并根据处理结果将请求发送到推送服务器5。推送服务器5还用于将请求发送到控制终端1,并将相应的请求结果返回设备终端服务器3。设备终端服务器3还用于将请求结果发送到设备终端4。同样以控制终端1为智能手机,设备终端4为无线闹钟,无线闹钟与智能手机进行语音通话为例进行说明,这里无线闹钟发送的请求为与控制终端1进行语音通话的请求。其工作过程与上述通过智能手机对无线闹钟进行定时响铃的工作方式类似,只是请求路径与上述的控制路径不同,这里不再赘述。The device terminal 4 is not limited to receiving and executing the control command transmitted by the control terminal 1, and may also actively send a request to the control terminal 1. After the device terminal 4 sends the request, the device terminal server 3 receives the request and processes the requested service logic, and transmits the request to the push server 5 according to the processing result. The push server 5 is also used to send a request to the control terminal 1 and return the corresponding request result to the device terminal server 3. The device terminal server 3 is also used to transmit the result of the request to the device terminal 4. Similarly, the control terminal 1 is a smart phone, the device terminal 4 is a wireless alarm clock, and the wireless alarm clock and the smart phone perform a voice call as an example. Here, the request sent by the wireless alarm clock is a request for making a voice call with the control terminal 1. The working process is similar to the above method of periodically ringing the wireless alarm clock through the smart phone, except that the request path is different from the above control path, and details are not described herein again.
为保证数据传输的安全性,控制命令或请求以加密数据包的形式传送,加密数据包的密钥是根据私有协议生成的动态密钥。这样,在数据传输过程中就不用担心被截取或伪造,从而保证控制命令或请求的合法性及保密性。To ensure the security of data transmission, control commands or requests are transmitted in the form of encrypted packets, which are dynamic keys generated according to a proprietary protocol. In this way, there is no need to worry about being intercepted or forged during the data transmission process, thereby ensuring the legitimacy and confidentiality of the control command or request.
控制终端1为智能手机、平板电脑及智能穿戴设备中的任意一种,设备终端4为闹钟。控制命令除上述举例的定时响铃命令之外,还可包括自定义闹钟铃声命令及音乐播放命令等。The control terminal 1 is any one of a smart phone, a tablet computer, and a smart wearable device, and the device terminal 4 is an alarm clock. The control command may include a custom alarm ringtone command and a music play command in addition to the above-described timed ringing command.
该智能家居系统还可包括若干文件服务器,用于存储用户上传的文件。这时,控制终端1还用于向接入服务器2请求若干文件服务器的地址,接入服务器2还用于向控制终端1返回若干文件服务器的地址,控制终端1还用于根据若干文件服务器的地址将需要上传的文件分布上传到若干文件服务器,若干文件服务器用于将各自接收到的文件的存储地址信息发送给控制终端1。用户可通过控制终端1访问或下载其存储的文件数据。通过将文件分布到多台文件服务器可以减少文件服务器的读写及网络下载带宽的压力。同样,为保证文件传输过程中的安全性,文件也是通过加密数据包的形式传送的,加密数据包的密钥也是根据私有协议生成的动态密钥。The smart home system may also include a number of file servers for storing user uploaded files. At this time, the control terminal 1 is further configured to request the address of the plurality of file servers from the access server 2, and the access server 2 is further configured to return the addresses of the plurality of file servers to the control terminal 1, and the control terminal 1 is further configured to be used according to the plurality of file servers. The address uploads the file distribution to be uploaded to a plurality of file servers, and the plurality of file servers are configured to send the storage address information of the respective received files to the control terminal 1. The user can access or download the file data stored by the user through the control terminal 1. By distributing files to multiple file servers, you can reduce the pressure on the file server's read and write and network download bandwidth. Similarly, in order to ensure the security of the file transfer process, the file is also transmitted in the form of an encrypted data packet, and the key of the encrypted data packet is also a dynamic key generated according to a proprietary protocol.
基于上述智能家居系统,本发明实施例还提供了一种智能家居系统的通信方法。如图2所示,通信方法包括如下步骤:Based on the smart home system described above, an embodiment of the present invention further provides a communication method of a smart home system. As shown in FIG. 2, the communication method includes the following steps:
步骤S1:控制终端1发送控制命令;Step S1: The control terminal 1 sends a control command;
步骤S2:接入服务器2接收控制命令,并处理控制命令的业务逻辑,并根据处理结果将控制命令发送到设备终端服务器3;Step S2: The access server 2 receives the control command, and processes the business logic of the control command, and sends the control command to the device terminal server 3 according to the processing result;
步骤S3:设备终端服务器3将控制命令发送到设备终端4,并将相应的执行结果发送到推送服务器5;Step S3: the device terminal server 3 sends a control command to the device terminal 4, and sends the corresponding execution result to the push server 5;
步骤S4:推送服务器5将执行结果发送到控制终端1。Step S4: The push server 5 transmits the execution result to the control terminal 1.
进一步地,还包括如下步骤:Further, the method further includes the following steps:
步骤S5:设备终端4还发送请求;Step S5: the device terminal 4 also sends a request;
步骤S6:设备终端服务器3还接收请求,并处理请求的业务逻辑,并根据处理结果将请求发送到推送服务器5;Step S6: the device terminal server 3 also receives the request, and processes the requested business logic, and sends the request to the push server 5 according to the processing result;
步骤S7:推送服务器5将请求发送到控制终端1,并将相应的请求结果返回设备终端服务器3;Step S7: the push server 5 sends the request to the control terminal 1, and returns the corresponding request result to the device terminal server 3;
步骤S8:设备终端服务器3还将请求结果发送到设备终端4。Step S8: The device terminal server 3 also transmits the request result to the device terminal 4.
请求为语音通话请求。控制命令或请求以加密数据包的形式传送,加密数据包的密钥是根据私有协议生成的动态密钥。控制终端1为智能手机、平板电脑及智能穿戴设备中的任意一种,设备终端4为闹钟。控制命令包括定时响铃命令、自定义闹钟铃声命令及音乐播放命令中的任意一个或任意多个。当智能家居系统还包括若干文件服务器时,通信方法还包括:The request is a voice call request. The control command or request is transmitted in the form of an encrypted packet, and the key of the encrypted packet is a dynamic key generated according to a proprietary protocol. The control terminal 1 is any one of a smart phone, a tablet computer, and a smart wearable device, and the device terminal 4 is an alarm clock. The control commands include any one or more of a timed ring command, a custom alarm ring command, and a music play command. When the smart home system further includes a plurality of file servers, the communication method further includes:
步骤S9:述控制终端1还向接入服务器2请求若干文件服务器的地址;Step S9: The control terminal 1 also requests the access server 2 for the addresses of several file servers;
步骤S10:接入服务器2还向控制终端1返回若干文件服务器的地址;Step S10: The access server 2 also returns the addresses of several file servers to the control terminal 1;
步骤S11:控制终端1还根据若干文件服务器的地址将需要上传的文件分布上传到若干文件服务器;Step S11: The control terminal 1 further uploads the file distribution that needs to be uploaded to several file servers according to the addresses of the plurality of file servers;
步骤S12:若干文件服务器将各自接收到的文件的存储地址信息发送给控制终端1。Step S12: The plurality of file servers send the storage address information of the files respectively received to the control terminal 1.
本发明实施例所提供的智能家居系统的通信方法是基于本发明实施例提供的智能家居系统的。其各步骤与智能家居系统的各组成部分的工作原理相互对应,在此不再一一赘述。The communication method of the smart home system provided by the embodiment of the present invention is based on the smart home system provided by the embodiment of the present invention. The steps of each step correspond to the working principles of the various components of the smart home system, and will not be repeated here.
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above is only the preferred embodiment of the present invention, and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection of the present invention. Within the scope.