Embodiment
Embodiments of the invention are described below in detail, the example of the embodiment is shown in the drawings, wherein from beginning to end
Same or similar label represents same or similar element or the element with same or like function.Below with reference to attached
The embodiment of figure description is exemplary, is only used for explaining the present invention, and is not considered as limiting the invention.On the contrary, this
All changes in the range of spirit and intension that the embodiment of invention includes falling into attached claims, modification and equivalent
Thing.
Fig. 1 is the schematic flow sheet for the cloud access method based on wireless communication module that one embodiment of the invention is proposed, should
Cloud access method based on wireless communication module includes:
S101:Wireless communication module receives the first kind message that Cloud Server is sent, and obtains the type of Cloud Server
Information, wherein, wireless communication module is connected with multiple Cloud Servers.
Cloud Server as a kind of hot technology in recent years and development trend, its principle be exactly by resource-sharing with up to
To while reducing cost, the efficiency of IT basic platform resilient expansions is improved.The construction of current Cloud Server is it is intended that vast use
Family provides service on demand.Cloud Server carries a large amount of important operation systems and data, while different household electrical appliance need
Access Cloud Server is to provide the user with related service, therefore Cloud Server access has many demands and challenge.Therefore, have
Necessity realizes that household electrical appliance and multiple Cloud Servers are convenient, efficiently access.
In an embodiment of the present invention, wireless communication module is specially wireless WIFI communication modules.
Wherein, wireless WIFI communication modules support Wi-Fi technology, for household electrical appliance.
Household electrical appliance such as air conditioner, refrigerator, and water heater etc..
For example, user's family Asymmetrical Digital Subscriber Line (Asymmetric Digital Subscriber Line,
ADSL), partial wideband etc., can connect wireless communication module to realize the nothing of mobile terminal by using family expenses Wi-Fi technology
Line is surfed the Net.
Further, for example in an embodiment of the present invention, user can also be by using wireless communication module by household electric
Device is interconnected with corresponding Cloud Server, to realize the resource-sharing of household electrical appliance and Cloud Server.
Fig. 2 is the hardware architecture diagram of wireless communication module in the embodiment of the present invention, and Fig. 2 is using Cloud Server as beautiful cloud
With millet cloud example.
Fig. 2 includes M-Smart SDKs (Software Development Kit, SDK) 21, millet
SDK22, manufacturer bottom SDK23, beautiful cloud 24, and millet cloud 25.Wherein, M-Smart SDK21, which are used to realize, is based on M-
The processing logic of the service logic thread of Smart systems, millet SDK22 is used for the protocol conversion file xm_ for realizing millet cloud 25
Agreement in profile.c, manufacturer bottom SDK23 is used for the bottom hardware logic for realizing wireless communication module, the beautiful He of cloud 24
Millet cloud 25 is used to provide cloud service resource.
Wherein, Cloud Server be a kind of simple efficient, safe and reliable, disposal ability can elastic telescopic calculating service.Cloud
Server is used for the service that integrated service ability is provided to all kinds of Internet users.Cloud Server for example beautiful cloud, Jingdone district cloud, Ah
In cloud, or millet cloud.
Cloud Server has intelligent cloud access, intelligent cloud storage, and the function that intelligent information is pushed.When user is by making
After with wireless communication module, household electrical appliance are interconnected with corresponding Cloud Server, Cloud Server can be by resource supplying to household electric
Device, user can be controlled by the application program of household electrical appliance in mobile terminal to household electrical appliance.
For example, beautiful use of microwave ovens function has Cookbooks resource newly developed, micro-wave oven manufacturer is newly developed by this
Cookbooks resource be stored in the intelligent cloud storage of the cloud of U.S., as user by using wireless communication module by beautiful microwave
After stove is interconnected with beautiful cloud, beautiful cloud can be by the Cookbooks resource supplying newly developed to beautiful micro-wave oven, so that user can
To perform Cookbooks resource newly developed by the beautiful micro-wave oven of the application program controlling of the micro-wave oven of mobile terminal Sino-U.S..
Wherein, message is the data cell of exchange and transmission in network, i.e. the website data block disposably to be sent.Message
The complete data message that will be sent is contained, its cause different in size, length is not limited and length is variable.By constantly by number
Transmitted according to packet, bag, frame is packaged into.
In an embodiment of the present invention, the type information of Cloud Server can such as cloud ID, different cloud ID mark differences
Cloud Server, cloud ID can be arranged in the heading of first kind message, can be the reserved field in heading,
Other fields can be arranged on, the embodiment of the present invention is to this without concrete restriction.
Specifically, as shown in figure 3, being wireless communication module message exchange flow schematic diagram in the embodiment of the present invention.Including:
Serial data receiving or sending thread 31, the service logic thread 32 based on M-Smart systems, network data receiving or sending thread 33, serial ports number
According to transmitting-receiving caching 34, network data transmitting-receiving caching 35, the translation-protocol 36 based on M-Smart systems, Cloud Server 37, Yi Jijia
Electrical appliance 38.
Alternatively, the type information for obtaining Cloud Server is specifically included:Wireless communication module is obtained to be connected with Cloud Server
The Socket link informations connect;And wireless communication module determines type information according to Socket link informations.
Issuing message exchanges flow for example, the network data receiving or sending thread in wireless communication module gets Cloud Server hair
After the first kind message for delivering to household electrical appliance, network data receiving or sending thread creates network transceiving data bag message queue, and will
The industry based on M-Smart systems that first kind message is added in network transceiving data bag message queue, wireless communication module
Business logic thread is corresponding from network transceiving data bag message queue by the function interface of protocol conversion file in Cloud Server SDK
Network data transmitting-receiving caching in obtain first kind message, and obtain the cloud ID in the heading of first kind message.
S102:Wireless communication module calls corresponding translation-protocol according to the type information of Cloud Server.
Wherein, translation-protocol such as Ali cloud ali_sdk.c corresponding with the type information of Cloud Server protocol conversion
It is agreement in file ali_profile.c, the agreement in Jingdone district cloud jd_sdk.c protocol conversion file jd_profile.c, small
Agreement in rice cloud xm_sdk.c protocol conversion file xm_profile.c, and beautiful cloud md_sdk.c protocol conversion are literary
Agreement in part md_profile.c.
S103:First kind message is converted to Second Type message by wireless communication module according to translation-protocol, and by
Two type messages are sent to corresponding household electrical appliance.
For example, wireless communication module is according to the cloud ID in the heading of first kind message, and corresponding translation-protocol,
Protocol conversion is carried out to first kind message, Second Type message is obtained, by Second Type packet storage in cloud access system point
In the serial data transmitting-receiving caching matched somebody with somebody, and trigger service logic of the application affairs readjustment submodule control based on M-Smart systems
Second Type message is issued to household electrical appliance by thread by serial data receiving or sending thread.
Alternatively, being somebody's turn to do the cloud access method based on wireless communication module includes:Wireless communication module receives household electrical appliance hair
The Second Type message sent, and the corresponding destination address of Second Type message is obtained, and correspondence cloud is determined according to destination address
The type information of server;Wireless communication module calls corresponding translation-protocol according to the type information of Cloud Server;And nothing
Second Type message is converted to first kind message by line communication module according to translation-protocol, and by first kind message send to
Corresponding Cloud Server.
In the present embodiment, wireless communication module obtains cloud clothes by receiving the first kind message that Cloud Server is sent
The type information of business device, wherein, wireless communication module is connected with multiple Cloud Servers;Wireless communication module is according to Cloud Server
Type information call corresponding translation-protocol;And wireless communication module is converted to first kind message according to translation-protocol
Second Type message, and Second Type message is sent to corresponding household electrical appliance, household electrical appliance can be made to be taken with corresponding cloud
Business device connection, realizes the access of household electrical appliance and multiple Cloud Servers, effectively cloud access effect of the lifting based on wireless communication module
Really.
Fig. 4 is the schematic flow sheet for the cloud access method based on wireless communication module that another embodiment of the present invention is proposed,
The cloud access method based on wireless communication module includes:
S401:Wireless communication module receives the Second Type message that household electrical appliance are sent, and obtains Second Type message pair
The destination address answered, and according to the type information of destination address determination correspondence Cloud Server.
In an embodiment of the present invention, the corresponding destination address mark Cloud Server of Second Type message, the destination address
In the heading that Second Type message can be arranged on, it can be the reserved field in heading, other words can also be arranged on
Section, the embodiment of the present invention is to this without concrete restriction.
Specifically, as shown in figure 3, reporting message exchanges flow for example, the serial data in wireless communication module receives and dispatches line
Journey is received after the Second Type message that household electrical appliance are sent, and serial data receiving or sending thread creates serial ports transceiving data bag message team
Row, and by Second Type message be added to serial ports transceiving data bag message queue in, in wireless communication module based on M-Smart
The service logic thread of system is by the function interface of protocol conversion file in Cloud Server SDK from serial ports transceiving data bag message
Second Type message is obtained in the corresponding serial data transmitting-receiving caching of queue, and, according in the heading of Second Type message
Destination address determines the type information of corresponding Cloud Server.
S402:Wireless communication module calls corresponding translation-protocol according to the type information of Cloud Server.
Wherein, translation-protocol such as Ali cloud ali_sdk.c corresponding with the type information of Cloud Server protocol conversion
It is agreement in file ali_profile.c, the agreement in Jingdone district cloud jd_sdk.c protocol conversion file jd_profile.c, small
Agreement in rice cloud xm_sdk.c protocol conversion file xm_profile.c, and beautiful cloud md_sdk.c protocol conversion are literary
Agreement in part md_profile.c.
S403:Second Type message is converted to first kind message by wireless communication module according to translation-protocol, and by
One type message is sent to corresponding Cloud Server.
For example, wireless communication module carries out protocol conversion according to corresponding translation-protocol to Second Type message, the is obtained
One type message, by first kind packet storage in the network data transmitting-receiving caching that cloud access system is distributed, and triggers application
Service logic thread of the event call-back submodule control based on M-Smart systems receives and dispatches first kind message by network data
Thread reports to Cloud Server.
In the present embodiment, wireless communication module is by receiving Second Type message and Second Type report that household electrical appliance are sent
The corresponding destination address of text, the type information of correspondence Cloud Server is determined according to destination address;And wireless communication module according to
Second Type message is converted to first kind message by translation-protocol corresponding with the type information of Cloud Server, and by the first kind
Type message is sent to corresponding Cloud Server, and household electrical appliance can be made to corresponding Cloud Server reporting message, household electric is realized
The access of device and multiple Cloud Servers, effectively cloud access effect of the lifting based on wireless communication module.
Fig. 5 is the structural representation for the wireless communication module 50 that another embodiment of the present invention is proposed, the wireless communication module
50 include serial data receiving or sending thread 51, for being communicated with household electrical appliance;Network data receiving or sending thread 52, for being taken with cloud
Business device is communicated;Service logic thread 53, for being disappeared with serial data receiving or sending thread 51, network data receiving or sending thread 52
Breath is exchanged, and is controlled with the message to serial data receiving or sending thread 51 and the transmitting-receiving of network data receiving or sending thread 52;And main line
Journey 54, main thread 54 is used to carry out serial data receiving or sending thread 51, network data receiving or sending thread 52 and service logic thread 53
Control;Application affairs adjust back submodule 55, and main thread 54 adjusts back the control business logic thread 53 of submodule 55 by application affairs;
And application affairs message queue 56, read for receiving event message, and for main thread 54, wherein, event message includes should
With event message and WIFI callback events message;The case distribution of state machine 58 handles submodule 57, for according to event message
Event message is distributed to corresponding state machine 58 by mode attribute, wherein, mode attribute be AP-Mode, STA-Mode, or
Any of System, reads the application affairs message and WIFI callback events message in application affairs message queue 56, matches somebody with somebody
Put the State Transferring mechanism of wireless communication module 50;State machine 58, for controlling nothing according to event message and State Transferring mechanism
The state of line communication module 50 is switched over.
In one embodiment of the invention, wireless communication module 50 include serial data receiving or sending thread 51, for family
Electrical appliance is communicated.
Serial ports is serial line interface, is the expansion interface using serial communication mode.Wherein, serial communication mode refers to one
The communication modes that every data of information are transmitted in order by turn.
Thread is the minimum unit that program performs stream, and the thread of a standard is by Thread Id, and current instruction pointer (PC) is posted
Storage set and storehouse composition.File management or Control on Communication of the thread suitable for server.
For example, when wireless communication module 50 receives the message of household electrical appliance transmission, to the message with serial communication side
Formula is handled, and the message after processing is reported into Cloud Server.
In one embodiment of the invention, wireless communication module 50 also include network data receiving or sending thread 52, for
Cloud Server is communicated.
For example, when wireless communication module 50 receives the message of Cloud Server transmission by network data receiving or sending thread 52
When, the message is handled, the message after processing is issued to household electrical appliance.
In one embodiment of the invention, wireless communication module 50 also includes service logic thread 53, is used for and serial ports
Data transmit-receive thread 51, network data receiving or sending thread 52 carry out message exchange, with to serial data receiving or sending thread 51 and network number
The message received and dispatched according to receiving or sending thread 52 is controlled.
Wherein, the service logic thread 53 in the embodiment of the present invention is the service logic thread 53 based on M-Smart systems.
The service content that M-Smart open systems are specifically provided, M-Smart systems are directed to using third party cloud, using beautiful built-in cloud,
Unclouded three kinds of internet partners open docking form.
Specifically, service logic thread 53 is received and dispatched by M-Smart agreements and serial data receiving or sending thread 51, network data
Thread 52 carries out message exchange.
Alternatively, service logic thread 53 obtains Cloud Server by network data receiving or sending thread 52 and sent to household electrical appliance
First kind message;Service logic thread 53 obtains the type information of Cloud Server, and according to type information by the first kind
Message is converted to Second Type message;Service logic thread 53 by serial data receiving thread by Second Type message send to
Household electrical appliance.
Wherein, message is the data cell of exchange and transmission in network, i.e. the website data block disposably to be sent.Message
The complete data message that will be sent is contained, its cause different in size, length is not limited and length is variable.By constantly by number
Transmitted according to packet, bag, frame is packaged into.
In an embodiment of the present invention, the type information of Cloud Server can such as cloud ID, different cloud ID mark differences
Cloud Server, cloud ID can be arranged in the heading of first kind message, can be the reserved field in heading,
Other fields can be arranged on, the embodiment of the present invention is to this without concrete restriction.
Alternatively, the type information of Cloud Server is obtained, is specifically included:Wireless communication module 50 is obtained and Cloud Server phase
The Socket link informations of connection;And wireless communication module 50 determines type information according to Socket link informations.
Issuing message exchanges flow for example, the network data receiving or sending thread 52 in wireless communication module 50 gets cloud service
Device is sent to the first kind message of household electrical appliance, and network data receiving or sending thread 52 creates network transceiving data bag message team
Row, and first kind message is added to network transceiving data bag message queue, in wireless communication module 50 based on M-Smart
The service logic thread 53 of system is disappeared by the function interface of protocol conversion file in Cloud Server SDK from network transceiving data bag
Cease in the corresponding network data transmitting-receiving caching of queue and obtain first kind message, according to the cloud in the heading of first kind message
ID, carries out protocol conversion to first kind message, Second Type message is obtained, by Second Type packet storage in cloud access system
Distribution serial data transmitting-receiving caching in, and trigger application affairs readjustment submodule 55 control the business based on M-Smart systems
Second Type message is issued to household electrical appliance by logic thread 53 by serial data receiving or sending thread 51.Wherein, Cloud Server SDK
In protocol conversion file for example, Ali's cloud ali_sdk.c protocol conversion file ali_profile.c, Jingdone district cloud jd_
Sdk.c protocol conversion file jd_profile.c, millet cloud xm_sdk.c protocol conversion file xm_profile.c, and
Beautiful cloud md_sdk.c protocol conversion file md_profile.c.
Alternatively, wireless communication module 50 receives the Second Type message that household electrical appliance are sent, and obtains Second Type report
The corresponding destination address of text, and according to the type information of destination address determination correspondence Cloud Server;Wireless communication module 50
Corresponding translation-protocol is called according to the type information of Cloud Server;And wireless communication module 50 according to translation-protocol by Equations of The Second Kind
Type message is converted to first kind message, and first kind message is sent to corresponding Cloud Server.
In an embodiment of the present invention, the corresponding destination address mark Cloud Server of Second Type message, the destination address
In the heading that Second Type message can be arranged on, it can be the reserved field in heading, other words can also be arranged on
Section, the embodiment of the present invention is to this without concrete restriction.
Specifically, reporting message exchanges flow for example, the serial data receiving or sending thread 51 in wireless communication module 50 is received
After the Second Type message that household electrical appliance are sent, serial data receiving or sending thread 51 creates serial ports transceiving data bag message queue, and
By Second Type message be added to serial ports transceiving data bag message queue in, in wireless communication module 50 based on M-Smart systems
The service logic thread 53 of system is by the function interface of protocol conversion file in Cloud Server SDK from serial ports transceiving data bag message
Second Type message is obtained in the corresponding serial data transmitting-receiving caching of queue, according to destination in the heading of Second Type message
The type information of the corresponding Cloud Server in location, carries out protocol conversion to Second Type message, first kind message is obtained, by first
Type message be stored in cloud access system distribution network data transmitting-receiving caching in, and trigger application affairs readjustment submodule 55 control
First kind message is reported to cloud by service logic thread 53 of the system based on M-Smart systems by network data receiving or sending thread 52
Server.
In one embodiment of the invention, wireless communication module 50 also includes main thread 54, and main thread 54 is used for string
Mouth data transmit-receive thread 51, network data receiving or sending thread 52 and service logic thread 53 are controlled.
In one embodiment of the invention, wireless communication module 50 also includes application affairs readjustment submodule 55, main line
Journey 54 adjusts back the control business logic thread 53 of submodule 55 by application affairs.
In one embodiment of the invention, wireless communication module 50 also includes application affairs message queue 56, for connecing
The application affairs message of the generation of service logic thread 53 is received, and is read for main thread 54.
For example, when Cloud Server issuing message, or during household electrical appliance reporting message, the generation correspondence of service logic thread 53
Application affairs message, application affairs message is added in application affairs message queue 56 by service logic thread 53, so that main
Thread 54 read the application affairs message, and trigger application affairs readjustment submodule 55 control the business based on M-Smart systems
First kind message is reported to Cloud Server by logic thread 53 by network data receiving or sending thread 52, or, thing is applied in triggering
Part readjustment submodule 55 controls the service logic thread 53 based on M-Smart systems to receive Second Type message by serial data
Hair line journey 51 is issued to household electrical appliance.
In one embodiment of the invention, wireless communication module 50 also includes the case distribution of state machine 58 processing submodule
57, event message is distributed to corresponding state machine 58 for the mode attribute according to event message, wherein, mode attribute is
Any of AP-Mode, STA-Mode, or System, read the application affairs message in application affairs message queue 56
With WIFI callback events message, the State Transferring mechanism of wireless communication module 50 is configured.
In one embodiment of the invention, wireless communication module 50 also includes state machine 58, for according to event message
The state for controlling wireless communication module 50 with State Transferring mechanism is switched over.
Alternatively, main thread 54 is used to be managed the state machine 58 of wireless communication module 50.
Main thread 54 is used to be managed the state machine 58 of wireless communication module 50, specifically includes:Wireless communication module
50 receive event message;Event message is distributed to by corresponding state machine 58 according to the mode attribute of event message, wherein, pattern
Attribute is AP-Mode, STA-Mode, or any of System;According to event message and the shape of corresponding state machine 58
The state of state transformation mechanism control wireless communication module 50 is switched over.
Alternatively, the flow embodiment that main thread 54 is managed to the state machine 58 of wireless communication module 50 refers to Fig. 6
With Fig. 7 embodiments.
In one embodiment of the invention, wireless communication module 50 also includes first serial reception data-message queue
59, first serial receives the message that data-message queue 59 is used to receive the transmission of serial data receiving or sending thread 51, and message is carried
Supply service logic thread 53 is read out;First serial data receiver caching 510, first serial data receiver caching 510 connects
The data of the transmission of serial data receiving or sending thread 51 are received and cached, and serve data to service logic thread 53 and are read out;The
Two serial ports receive data-message queue 511, and second serial receives data-message queue 511 and sent out for receiving service logic thread 53
The message sent, and provide messages to serial data receiving or sending thread 51 and be read out;And second serial data receiver caching
512, second serial data receiver caching 512 is used for the data that cache business logic thread 53 is sent, and serves data to string
Mouth data transmit-receive thread 51 is read out.
Specifically, during household electrical appliance reporting message, the serial data receiving or sending thread in wireless communication module 50
51 receive after the Second Type message that household electrical appliance are sent, and serial data receiving or sending thread 51 creates first serial and receives data-message
Queue 59, and Second Type message is received in data-message queue 59 added to first serial, in wireless communication module 50
Service logic thread 53 based on M-Smart systems is by the function interface of protocol conversion file in Cloud Server SDK from first
Serial ports receives in the corresponding first serial data receiver caching 510 of data-message queue 59 and obtains Second Type message, according to the
The type information of the corresponding Cloud Server of destination address in the heading of two type messages, carries out agreement to Second Type message and turns
Change, obtain first kind message.
Further, during Cloud Server issuing message, in wireless communication module 50 based on M-Smart systems
Service logic thread 53 is by the function interface of protocol conversion file in Cloud Server SDK from network transceiving data bag message queue
First kind message is obtained in corresponding network data transmitting-receiving caching, the cloud ID in the heading of first kind message is right
First kind message carries out protocol conversion, obtains Second Type message, and Second Type packet storage is distributed in cloud access system
Second serial receive in the corresponding second serial data receiver caching 512 of data-message queue 511, and trigger application affairs and return
Tune module 55 controls the service logic thread 53 based on M-Smart systems that Second Type message is received and dispatched into line by serial data
Journey 51 is issued to household electrical appliance.
Alternatively, it is read in the data of first serial data receiver caching 510 and second serial data receiver caching 512
Afterwards, data are deleted in first serial data receiver caching 510 and second serial data receiver caching 512.
In one embodiment of the invention, wireless communication module 50 also includes first network reception data-message queue
513, first network, which receives data-message queue 513, is used for the message that receiving network data receiving or sending thread 52 is sent, and by message
It is supplied to service logic thread 53 to be read out;First network data receiver caching 514, first network data receiver caching 514
The data that simultaneously buffer network data transmit-receive thread 52 is sent are received, and serve data to service logic thread 53 and are read out;
Second network receives data-message queue 515, and the second network, which receives data-message queue 515, to be used to receive service logic thread 53
The message of transmission, and provide messages to network data receiving or sending thread 52 and be read out;And the second network data order caching
516, the data that the second network data order caching 516 is received and cache business logic thread 53 is sent, and serve data to
Network data receiving or sending thread 52 is read out.
Specifically, during household electrical appliance reporting message, first kind message is passed through by service logic thread 53
Two networks receive data-message queue 515 and are stored in the second network data order caching 516 of cloud access system distribution, and touch
Hair application affairs readjustment submodule 55 controls the service logic thread 53 based on M-Smart systems that first kind message is passed through into net
Network data transmit-receive thread 52 reports to Cloud Server.
Further, during Cloud Server issuing message, the first network in wireless communication module 50 receives data
Message queue 513 gets Cloud Server and sent by network data receiving or sending thread 52 to the first kind message of household electrical appliance
Afterwards, network data receiving or sending thread 52 creates first network data receiver caching 514, and first kind message is added into the first net
Network data receiver caching 514, and serve data to service logic thread 53 and be read out, so that based on M-Smart systems
Second Type message is issued to household electrical appliance by service logic thread 53 by serial data receiving or sending thread 51.
Alternatively, it is read in the data of first network data receiver caching 514 and the second network data order caching 516
Afterwards, data are deleted in first network data receiver caching 514 and the second network data order caching 516.
In one embodiment of the invention, wireless communication module 50 also includes WIFI event call-backs submodule 517, is used for
WIFI callback events are received, and after WIFI callback events are received, WIFI callback events are added to application affairs message
Queue 56.
Wherein, WIFI callback events are produced by application program.Application program is specially the application in wireless communication module 50
Program.
For example, after WIFI event call-backs submodule 517 receives WIFI callback events, WIFI callback events are added
To application affairs message queue 56, read for main thread 54.
In the present embodiment, disappeared by service logic thread with serial data receiving or sending thread, network data receiving or sending thread
Breath is exchanged, and is controlled with the message to serial data receiving or sending thread and the transmitting-receiving of network data receiving or sending thread, main thread is to serial ports
Data transmit-receive thread, network data receiving or sending thread and service logic thread are controlled, and can realize the cooperation fortune of multiple threads
OK, the thread scheduling effect effectively in lifting Cloud Server access procedure, is easy to the work(of later stage wireless communication module hardware system
Can extension.Event message is distributed to by corresponding state machine by the mode attribute according to event message, wherein, mode attribute is
Any of AP-Mode, STA-Mode, or System, and according to event message and the State Transferring of corresponding state machine
The state of mechanism control wireless communication module is switched over, and can realize three kinds of state machines in the wireless communication module of household electrical appliance
Cooperating operation, effectively lifting wireless communication module condition managing effect.
Fig. 6 is the method that the main thread that another embodiment of the present invention is proposed is managed to the state machine of wireless communication module
Schematic flow sheet, the method that the main thread is managed to the state machine of wireless communication module includes:
S601:Wireless communication module receives event message.
In an embodiment of the present invention, wireless communication module is specially wireless WIFI communication modules.
Wherein, wireless WIFI communication modules support Wi-Fi technology, for household electrical appliance.
Household electrical appliance such as air conditioner, refrigerator, and water heater etc..
For example, user's family Asymmetrical Digital Subscriber Line (Asymmetric Digital Subscriber Line,
ADSL), partial wideband etc., can connect wireless communication module to realize the nothing of mobile terminal by using family expenses Wi-Fi technology
Line is surfed the Net.Further, user can also be interconnected household electrical appliance with corresponding Cloud Server by using wireless communication module, with
Realize the resource-sharing of household electrical appliance and Cloud Server.
Wireless communication module in current household electrical appliance is used typically as receiving terminal, i.e., must rely on another network and carry
Network connection is provided to household electrical appliance for device (for example, cable network).However, user may want to utilize radio communication
The scope that module increase network signal is covered;Or, it is also possible to think while making wireless communication module that cable network is transformed into nothing
Gauze network;Or, it is also possible to want to make wireless communication module as wireless base station (AP), interconnect electronic installation.It is related
The wireless communication module in household electrical appliance in technology is typically only capable to provide one of which network morphology or function.
Alternatively, event message includes application affairs message and WIFI callback events message, and wireless communication module receives thing
Part message, including:Application affairs message queue receives the application affairs message of service logic thread generation;WIFI event call-backs
Module receives WIFI callback events message, and after WIFI callback events message is received, WIFI callback events message is added
Add to application affairs message queue.
Wherein, application affairs message adjusts back submodule by application affairs by the main thread in wireless communication module and controls industry
Business logic thread generation, WIFI callback events message is produced by application program.
Specifically, the event that application affairs message can actively produce for the upper layer application of wireless communication module, for example, nothing
Line communication module cancels ap mode, then can produce AF_EVT_AP_STOP application affairs message.
The event that WIFI callback events message can be fed back for the WIFI bottoms of wireless communication module, for example, radio communication
The ap mode of module is opened successfully, then can produce AF_EVT_AP_STARTED_SUCCESS WIFI callback events message.
Alternatively, before wireless communication module reception event message, in addition to:Configure the State Transferring of wireless communication module
Mechanism.
S602:Event message is distributed to by corresponding state machine according to the mode attribute of event message, wherein, mode attribute
Any of for AP-Mode, STA-Mode, or System.
Specifically, event message is distributed according to the mode attribute of event message by state machine events distribution processor submodule
Any of to corresponding state machine, wherein, mode attribute is AP-Mode, STA-Mode, or System.
Wireless communication module supports focus (Access Point, AP) mode of operation AP-Mode, AP-Mode to apply in nothing
The addition of line local area network member-ship equipment (i.e. client), i.e. network downstream there is provided wirelessly set up WLAN WLAN,
Suitable WLAN central apparatus.Wireless communication module can also support workstation mode STA-Mode, it is understood that be some
A work station in grid is client.When the WIFI chips of a wireless communication module provide STA-Mode functions, nothing
Line communication module can be just connected among an other network.AP-Mode is supplied to mobile terminal etc. to connect, and STA-Mode is used
In the data uplink service for providing network.In addition, the grid state of system where wireless communication module, i.e. radio communication mold
Block network connection state in systems with network user, can be described by system state dependency, correspondence by
System state machines carry out the handover management between system mode.
Wherein, state machine includes AP-Mode state machines, STA-Mode state machines, and System state machines, mode attribute
AP-Mode corresponding A P-Mode state machines, mode attribute STA-Mode correspondence STA-Mode state machines, and mode attribute
System correspondence System state machines.
S603:The state for controlling wireless communication module according to the State Transferring mechanism of event message and corresponding state machine is entered
Row switching.
Wherein, the state of wireless communication module include AP-Mode state machines in set up in AP, AP operation in, Yi Jikong
In connection in not busy three kinds of states, STA-Mode state machines, connect and idle three kinds of states;In System state machines
Network is not set up, network has been set up and initializes three kinds of states.
Alternatively, the state of wireless communication module is controlled according to the State Transferring mechanism of event message and corresponding state machine
Switch over, including:If the mode attribute of event message is AP-Mode, AP-Mode state machines according to event message and
The state of the State Transferring mechanism control wireless communication module of AP-Mode state machines in setting up AP, it is in AP operations and idle
Switched between three kinds of states;If the mode attribute of event message is STA-Mode, STA-Mode state machines are according to thing
Part message and the State Transferring mechanism of STA-Mode state machines control wireless communication module state in this connection, connected, with
And switched between idle three kinds of states;If the mode attribute of event message be System, System state machines according to
The state of the State Transferring mechanism control wireless communication module of event message and System state machines is not set up in network, network
Switched between three kinds of states of foundation and initialization.
In the present embodiment, event message is distributed to by corresponding state machine by the mode attribute according to event message, its
In, mode attribute is AP-Mode, STA-Mode, or any of System, and according to event message and corresponding state
The state of the State Transferring mechanism control wireless communication module of machine is switched over, and can realize three kinds of states in wireless communication module
The condition managing effect of the cooperating operation of machine, effectively lifting wireless communication module.
Fig. 7 is the method that the main thread that another embodiment of the present invention is proposed is managed to the state machine of wireless communication module
Schematic flow sheet, the method that the main thread is managed to the state machine of wireless communication module includes:
S701:Configure the State Transferring mechanism of wireless communication module.
Wireless communication module is specially wireless WIFI communication modules.
Wherein, wireless WIFI communication modules support Wi-Fi technology, for household electrical appliance.
Specifically, by state machine events distribution processor submodule by AP-Mode state machines, STA-Mode state machines, with
And the status attribute superposition of System state machines, to configure the State Transferring mechanism of wireless communication module.
Wherein, the status attribute of state machine is used for the state for identifying wireless communication module.
By this step, the plug-in in wireless communication module can be made to call the status attribute configured, made wireless
Communication module can be switched between different states, realize the cooperating operation of three kinds of state machines in wireless communication module.
S702:Application affairs message queue receives the application affairs message of service logic thread generation.
Wherein, application affairs message adjusts back submodule by application affairs by the main thread in wireless communication module and controls industry
Business logic thread generation.
Specifically, the event that application affairs message can actively produce for the upper layer application of wireless communication module, for example, nothing
Line communication module cancels ap mode, then can produce AF_EVT_AP_STOP application affairs message.
S703:WIFI event call-backs submodule receives WIFI callback events message, and disappears receiving WIFI callback events
After breath, WIFI callback events message is added to application affairs message queue.
The event that WIFI callback events message can be fed back for the WIFI bottoms of wireless communication module, for example, radio communication
The ap mode of module is opened successfully, then can produce AF_EVT_AP_STARTED_SUCCESS WIFI callback events message.
S704:Read the application affairs message and WIFI callback events message in application affairs message queue.
Specifically, read by the main thread in wireless communication module by state machine events distribution processor submodule and apply thing
Application affairs message and WIFI callback events message in part message queue.
S705:Event message is distributed to by corresponding state machine according to the mode attribute of event message, wherein, mode attribute
Any of for AP-Mode, STA-Mode, or System.
Specifically, event message is distributed according to the mode attribute of event message by state machine events distribution processor submodule
Any of to corresponding state machine, wherein, mode attribute is AP-Mode, STA-Mode, or System.
Wireless communication module supports focus (Access Point, AP) mode of operation AP-Mode, AP-Mode to apply in nothing
The addition of line local area network member-ship equipment (i.e. client), i.e. network downstream there is provided wirelessly set up WLAN WLAN,
Suitable WLAN central apparatus.Wireless communication module can also support workstation mode STA-Mode, it is understood that be some
A work station in grid is client.When the WIFI chips of a wireless communication module provide STA-Mode functions, nothing
Line communication module can be just connected among an other network.AP-Mode is supplied to mobile terminal etc. to connect, and STA-Mode is used
In the data uplink service for providing network.In addition, the grid state of system where wireless communication module, i.e. radio communication mold
Block network connection state in systems with network user, can be described by system state dependency, correspondence by
System state machines carry out the handover management between system mode.
Wherein, state machine includes AP-Mode state machines, STA-Mode state machines, and System state machines, mode attribute
AP-Mode corresponding A P-Mode state machines, mode attribute STA-Mode correspondence STA-Mode state machines, and mode attribute
System correspondence System state machines.
Condition managing is carried out respectively by the way that event message is distributed into corresponding state machine, it is hard in wireless communication module bottom
The logicality of code structure can be strengthened in terms of part realization, the complexity of code development is reduced, be easy to later stage wireless communication module
The Function Extension of hardware system.
S706:Switched over according to the state of event message and State Transferring mechanism control wireless communication module.
Specifically, as shown in figure 8, being radio communication mold bulk state switching schematic diagram in the embodiment of the present invention, wherein, bag
Include:AP-Mode state machines 81, STA-Mode state machines 82, System state machines 83, state machine events distribution processor submodule
84th, application affairs message queue 85, AP-Mode state machine states switching flow 86, STA-Mode state machine state switching flows
87, and System state machine states switching flow 88.
Wireless communication module can be controlled according to the content of event message and the State Transferring mechanism of corresponding state machine
State is switched over.
For example, as shown in figure 8, wireless communication module cancellation ap mode, then can produce AF_EVT_AP_STOP application affairs
Message, the content of the AF_EVT_AP_STOP application affairs message is cancels ap mode, when wireless communication module is in AP operations
In state, and the main thread of wireless communication module is when reading the AF_EVT_AP_STOP application affairs message, AP-Mode shapes
State machine controls wireless communication module to switch to idle state by the operating states of AP.
In the present embodiment, by configuring the State Transferring mechanism of wireless communication module, it can make in wireless communication module
Plug-in calls the status attribute configured, wireless communication module is switched between different states, passes through basis
Event message is distributed to corresponding state machine by the mode attribute of event message, wherein, mode attribute is AP-Mode, STA-
Any of Mode, or System, and controlled wirelessly according to the State Transferring mechanism of event message and corresponding state machine
The state of communication module is switched over, and can be realized the cooperating operation of three kinds of state machines in wireless communication module, effectively be lifted nothing
The condition managing effect of line communication module.Condition managing is carried out respectively by the way that event message is distributed into corresponding state machine,
The logicality of code structure can be strengthened in terms of the realization of wireless communication module bottom hardware, the complexity of code development is reduced, just
In the Function Extension of later stage wireless communication module hardware system.
Fig. 9 is the structural representation for the cloud access system based on wireless communication module 91 that another embodiment of the present invention is proposed
Figure, the cloud access system 90 based on wireless communication module 91 of being somebody's turn to do includes wireless communication module 91, passes through the phase of wireless communication module 91
The Cloud Server 92 and household electrical appliance 93 of mutual communication, wherein, wireless communication module 91 includes:Serial data receiving or sending thread, is used
Communicated in household electrical appliance 93;Network data receiving or sending thread, for being communicated with Cloud Server 92;Service logic line
Journey, for carrying out message exchange with serial data receiving or sending thread, network data receiving or sending thread, with to serial data receiving or sending thread and
The message of network data receiving or sending thread transmitting-receiving is controlled;And main thread, main thread is for serial data receiving or sending thread, net
Network data transmit-receive thread and service logic thread are controlled;Application affairs adjust back submodule, and main thread is returned by application affairs
Tune module control traffic logic thread;And application affairs message queue, read for receiving event message, and for main thread
Take, wherein, event message includes application affairs message and WIFI callback events message;State machine events distribution processor submodule,
Event message is distributed to corresponding state machine for the mode attribute according to event message, wherein, mode attribute is AP-
Any of Mode, STA-Mode, or System, read the application affairs message and WIFI in application affairs message queue
Callback events message, configures the State Transferring mechanism of wireless communication module 91;State machine, for being turned according to event message and state
The state for changing mechanism control wireless communication module 91 is switched over.
Cloud Server 92 as a kind of hot technology in recent years and development trend, its principle be exactly by resource-sharing with
Reach while reduce cost, improve the efficiency of IT basic platform resilient expansions.The construction of current Cloud Server 92 is it is intended that wide
Large user provides service on demand.Cloud Server 92 carries a large amount of important operation systems and data, while different household electrics
Device 93 needs access Cloud Server 92 to provide the user with related service, thus the access of Cloud Server 92 exist many demands and
Challenge.
In one embodiment of the invention, being somebody's turn to do the cloud access system based on wireless communication module 91 includes radio communication mold
Block 91.
Wherein, the implementation of wireless communication module 91 such as Fig. 5 embodiments, will not be repeated here.
In one embodiment of the invention, being somebody's turn to do the cloud access system based on wireless communication module 91 is also included by wireless
Cloud Server 92 and household electrical appliance 93 that communication module 91 is in communication with each other.
Wherein, Cloud Server 92 be a kind of simple efficient, safe and reliable, disposal ability can elastic telescopic calculating service.
Cloud Server 92 is used for the service that integrated service ability is provided to all kinds of Internet users.The Cloud Server 92 such as cloud of U.S., capital
Eastern cloud, A Liyun, or millet cloud.
Cloud Server 92 has intelligent cloud access, intelligent cloud storage, and the function that intelligent information is pushed.When user passes through
After using wireless communication module 91, household electrical appliance 93 are interconnected with corresponding Cloud Server 92, Cloud Server 92 can push away resource
Household electrical appliance 93 are delivered to, user can be controlled by the application program of household electrical appliance in mobile terminal 93 to household electrical appliance 93
System.
For example, beautiful use of microwave ovens function has Cookbooks resource newly developed, micro-wave oven manufacturer is newly developed by this
Cookbooks resource be stored in the intelligent cloud storage of the cloud of U.S., when user will be beautiful micro- by using wireless communication module 91
After ripple stove is interconnected with beautiful cloud, beautiful cloud can be by the Cookbooks resource supplying newly developed to beautiful micro-wave oven, so that user
Cookbooks resource newly developed can be performed by the beautiful micro-wave oven of the application program controlling of the micro-wave oven of mobile terminal Sino-U.S..
Household electrical appliance 93 refer to the various Electrical and Electronic utensils used in family and similar site.Household electrical appliance 93 are for example
Television set, refrigerator, or air conditioner etc..
With the continuous progress and user's growth in the living standard of smart home technology, the increasing energy of household electrical appliance 93
Enough to realize intelligent operating, user can install the application program of household electrical appliance 93 in the terminal, pass through application program control
Household electrical appliance 93 processed are operated, and user can also be taken household electrical appliance 93 with corresponding cloud by using wireless communication module 91
Business device 92 is interconnected.
Specifically, user can pass through the household electrical appliance 93 of the operation system needed in acquisition Cloud Server 92 and data
Wireless communication module 91 accesses corresponding Cloud Server 92, to realize the shared of resource in Cloud Server 92.
For example, it is desired to it is beautiful air conditioner to obtain the household electrical appliance 93 of operation system in Cloud Server 92 and data, it is beautiful
Air conditioner need to share the resource of agreement matching from beautiful Cloud Server 92, therefore, beautiful air conditioner is passed through into channel radio
Letter module 91 accesses the cloud of U.S., with realize the air conditioner of U.S. with beautiful cloud resource it is shared, or, can also be by beautiful air-conditioning
Device accesses millet cloud by wireless communication module 91, and resource is shared in the air conditioner and millet cloud to realize U.S..
In the present embodiment, disappeared by service logic thread with serial data receiving or sending thread, network data receiving or sending thread
Breath is exchanged, and is controlled with the message to serial data receiving or sending thread and the transmitting-receiving of network data receiving or sending thread, main thread is to serial ports
Data transmit-receive thread, network data receiving or sending thread and service logic thread are controlled, and can realize the cooperation fortune of multiple threads
OK, the thread scheduling effect effectively in lifting Cloud Server access procedure, is easy to the work(of later stage wireless communication module hardware system
Can extension.Event message is distributed to by corresponding state machine by the mode attribute according to event message, wherein, mode attribute is
Any of AP-Mode, STA-Mode, or System, and according to event message and the State Transferring of corresponding state machine
The state of mechanism control wireless communication module is switched over, and can realize three kinds of state machines in the wireless communication module of household electrical appliance
Cooperating operation, effectively lifting wireless communication module condition managing effect.
It should be noted that in the description of the invention, term " first ", " second " etc. are only used for describing purpose, without
It is understood that to indicate or imply relative importance.In addition, in the description of the invention, unless otherwise indicated, the implication of " multiple "
It is two or more.
Any process described otherwise above or method description are construed as in flow chart or herein, represent to include
Module, fragment or the portion of the code of one or more executable instructions for the step of realizing specific logical function or process
Point, and the scope of the preferred embodiment of the present invention includes other realization, wherein can not be by shown or discussion suitable
Sequence, including according to involved function by it is basic simultaneously in the way of or in the opposite order, carry out perform function, this should be of the invention
Embodiment person of ordinary skill in the field understood.
It should be appreciated that each several part of the present invention can be realized with hardware, software, firmware or combinations thereof.Above-mentioned
In embodiment, the software that multiple steps or method can in memory and by suitable instruction execution system be performed with storage
Or firmware is realized.If, and in another embodiment, can be with well known in the art for example, realized with hardware
Any one of row technology or their combination are realized:With the logic gates for realizing logic function to data-signal
Discrete logic, the application specific integrated circuit with suitable combinational logic gate circuit, programmable gate array (PGA), scene
Programmable gate array (FPGA) etc..
Those skilled in the art are appreciated that to realize all or part of step that above-described embodiment method is carried
Rapid to can be by program to instruct the hardware of correlation to complete, described program can be stored in a kind of computer-readable storage medium
In matter, the program upon execution, including one or a combination set of the step of embodiment of the method.
In addition, each functional unit in each embodiment of the invention can be integrated in a processing module, can also
That unit is individually physically present, can also two or more units be integrated in a module.Above-mentioned integrated mould
Block can both be realized in the form of hardware, it would however also be possible to employ the form of software function module is realized.The integrated module is such as
Fruit is realized using in the form of software function module and as independent production marketing or in use, can also be stored in a computer
In read/write memory medium.
Storage medium mentioned above can be read-only storage, disk or CD etc..
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show
The description of example " or " some examples " etc. means to combine specific features, structure, material or the spy that the embodiment or example are described
Point is contained at least one embodiment of the present invention or example.In this manual, to the schematic representation of above-mentioned term not
Necessarily refer to identical embodiment or example.Moreover, specific features, structure, material or the feature of description can be any
One or more embodiments or example in combine in an appropriate manner.
Although embodiments of the invention have been shown and described above, it is to be understood that above-described embodiment is example
Property, it is impossible to limitation of the present invention is interpreted as, one of ordinary skill in the art within the scope of the invention can be to above-mentioned
Embodiment is changed, changed, replacing and modification.