Specific embodiment
Embodiments of the invention are described below in detail, the example of the embodiment is shown in the drawings, wherein from start to finish
Same or similar label represents same or similar element or the element with same or like function.Below with reference to attached
It is exemplary to scheme the embodiment of description, is only used for explaining the present invention, and is not considered as limiting the invention.Conversely, this
Inventive embodiment includes all changes fallen into the range of the spiritual and intension of attached claims, modification and is equal to
Thing.
Fig. 1 is the structural representation of the cloud access system based on wireless communication module that one embodiment of the invention is proposed, should
The cloud that cloud access system based on wireless communication module is included wireless communication module 50, is in communication with each other by wireless communication module 50
Server 51 and household electrical appliance 52, wherein, wireless communication module 50 includes:Serial data receiving or sending thread 501, for family expenses
Electrical equipment 52 is communicated;Network data receiving or sending thread 502, for being communicated with Cloud Server 51;Service logic thread 503,
For carrying out message exchange with serial data receiving or sending thread 501, network data receiving or sending thread 502, line is received and dispatched with to serial data
Journey 501 and the message of the transmitting-receiving of network data receiving or sending thread 502 are controlled;Main thread 504, main thread 504 is used for serial ports number
It is controlled according to receiving or sending thread 501, network data receiving or sending thread 502 and service logic thread 503;First serial receives data and disappears
Breath queue 505, first serial receives data-message queue 505 is used to receive the message of the transmission of serial data receiving or sending thread 501, and
Service logic thread 503 is provided messages to be read out;First serial data receiver caching 506, first serial data receiver
Caching 506 is received and caches the data of the transmission of serial data receiving or sending thread 501, and serves data to service logic thread 503
It is read out;Second serial receives data-message queue 507, and second serial receives data-message queue 507 to be used to receive business
The message that logic thread 503 sends, and provide messages to serial data receiving or sending thread 501 and be read out;And second serial
Data receiver caching 508, the data that second serial data receiver caching 508 is received and cache business logic thread 503 sends, and
Serial data receiving or sending thread 501 is served data to be read out.
Cloud Server 51 as a kind of hot technology in recent years and development trend, its principle be exactly by resource-sharing with
While reaching reduces cost, the efficiency of IT basic platform resilient expansions is improved.The construction of current Cloud Server 51 is it is intended that wide
Large user provides service on demand.Cloud Server 51 carries a large amount of important operation systems and data, while different household electrics
Device 52 needs to access Cloud Server 51 to provide the user with related service, thus Cloud Server 51 access exist many demands and
Challenge.
In one embodiment of the invention, the cloud access system that should be based on wireless communication module includes wireless communication module
50。
In an embodiment of the present invention, wireless communication module 50 is specially wireless WIFI communication modules.
Wherein, wireless WIFI communication modules support Wi-Fi technology, for household electrical appliance 52.
Household electrical appliance 52 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 50 to realize mobile terminal by using family expenses Wi-Fi technology
Wireless networking.
Further, for example in an embodiment of the present invention, user can also be by using wireless communication module 50 by family expenses
Electrical equipment 52 is interconnected with corresponding Cloud Server 51, to realize the resource-sharing of household electrical appliance 52 and Cloud Server 51.
Fig. 2 is the hardware architecture diagram of wireless communication module 50 in the embodiment of the present invention, and Fig. 2 is U.S. with Cloud Server 51
Cloud and 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 are used to realize being based on M-
The treatment logic of the service logic thread 503 of Smart systems, millet SDK22 is used to realize the protocol conversion file of millet cloud 25
Agreement in xm_profile.c, manufacturer bottom SDK23 is used to realize the bottom hardware logic of wireless communication module 50, beautiful cloud
24 and millet cloud 25 be used for cloud service resource is provided.
In one embodiment of the invention, should be based on the cloud access system of wireless communication module also includes passing through channel radio
Cloud Server 51 and household electrical appliance 52 that letter module 50 is in communication with each other.
Wherein, Cloud Server 51 be a kind of simple efficient, safe and reliable, disposal ability can elastic telescopic calculating service.
Cloud Server 51 is used to be provided the service of integrated service ability to all kinds of Internet users.Cloud Server 51 for example beautiful cloud, capital
Eastern cloud, A Liyun, or millet cloud.
Cloud Server 51 has intelligent cloud access, intelligent cloud storage, and the function that intelligent information is pushed.When user passes through
After using wireless communication module 50, household electrical appliance 52 are interconnected with corresponding Cloud Server 51, Cloud Server 51 can push away resource
Household electrical appliance 52 are delivered to, user can be controlled by the application program of household electrical appliance in mobile terminal 52 to household electrical appliance 52
System.
For example, the use of microwave ovens function of U.S. has Cookbooks resource newly developed, micro-wave oven manufacturer is newly developed by this
The storage of Cookbooks resource in the intelligent cloud storage of beautiful cloud, when user will be beautiful micro- by using wireless communication module 50
After ripple stove is interconnected with the cloud of U.S., 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 52 refer to the various Electrical and Electronic utensils used in family and similar site.Household electrical appliance 52 are for example
Television set, refrigerator, or air-conditioner etc..
With continuous progressive and user's growth in the living standard, the energy of increasing household electrical appliance 52 of smart home technology
Enough to realize intelligent operating, user can in the terminal install the application program of household electrical appliance 52, by application program control
Household electrical appliance processed 52 are operated, and user can also be taken household electrical appliance 52 with corresponding cloud by using wireless communication module 50
Business device 51 is interconnected.
Specifically, the operation system and the household electrical appliance 52 of data that user will can need to obtain in Cloud Server 51 pass through
Wireless communication module 50 accesses corresponding Cloud Server 51, to realize the shared of resource in Cloud Server 51.
For example, it is desired to it is beautiful air-conditioner to obtain the household electrical appliance 52 of operation system in Cloud Server 51 and data, it is beautiful
Air-conditioner need to share the resource of agreement matching from beautiful Cloud Server 51, therefore, beautiful air-conditioner is passed through into channel radio
Letter module 50 accesses the cloud of U.S., with realizing the air-conditioner of U.S. and the cloud of U.S. resource it is shared, or, it is also possible to by beautiful air-conditioning
Device accesses millet cloud by wireless communication module 50, with air-conditioner and the millet cloud of realizing U.S. resource it is shared.
In one embodiment of the invention, wireless communication module 50 include serial data receiving or sending thread 501, for family
Electrical appliance 52 is communicated.
Serial ports is serial line interface, is using the expansion interface of 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 a thread for standard is posted by Thread Id, current instruction pointer (PC)
Storage set and storehouse are constituted.File management or Control on Communication of the thread suitable for server.
For example, when wireless communication module 50 receives the message of the transmission of household electrical appliance 52, to the message with serial communication
Mode is processed, and the message after treatment is reported into Cloud Server 51.
In one embodiment of the invention, wireless communication module 50 also include network data receiving or sending thread 502, for
Cloud Server 51 is communicated.
For example, when wireless communication module 50 receives the report that Cloud Server 51 sends by network data receiving or sending thread 502
Wen Shi, is processed the message, and the message after treatment is issued into household electrical appliance 52.
In one embodiment of the invention, wireless communication module 50 also include service logic thread 503, for serial ports
Data transmit-receive thread 501, network data receiving or sending thread 502 carry out message exchange, with to serial data receiving or sending thread 501 and network
The message of the transmitting-receiving of data transmit-receive thread 502 is controlled.
Wherein, the service logic thread 503 in the embodiment of the present invention is the service logic thread based on M-Smart systems
503.The service content that M-Smart open systems are specifically provided, M-Smart systems are for using third party cloud, using in U.S.
Build cloud, unclouded three kinds of internet partners and open docking form.
Specifically, service logic thread 503 is received by M-Smart agreements with serial data receiving or sending thread 501, network data
Hair line journey 502 carries out message exchange.
Alternatively, service logic thread 503 obtains Cloud Server 51 and sends to family expenses by network data receiving or sending thread 502
The first kind message of electrical equipment 52;Service logic thread 503 obtains the type information of Cloud Server 51, and will according to type information
First kind message is converted to Second Type message;Service logic thread 503 passes through serial data receiving thread by Second Type
Message is sent to household electrical appliance 52.
Wherein, message is exchange and the data cell transmitted, i.e. the website data block disposably to be sent in network.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 51 can such as cloud ID, different cloud ID marks are not
With Cloud Server 51, cloud ID can be arranged in the heading of first kind message, can be that pre- in heading is write down characters
Section, it is also possible to be arranged on other fields, the embodiment of the present invention does not carry out concrete restriction to this.
Alternatively, the type information of Cloud Server 51 is obtained, is specifically included:Wireless communication module 50 is obtained and Cloud Server
The 51 Socket link informations being connected;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 502 in wireless communication module 50 gets cloud clothes
Business device 51 is sent to the first kind message of household electrical appliance 52, and network data receiving or sending thread 502 creates network transceiving data bag
Message queue, and by first kind message be added to network transceiving data bag message queue, in wireless communication module 50 based on
The service logic thread 503 of M-Smart systems is received by the function interface of protocol conversion file in Cloud Server 51SDK from network
First kind message is obtained in the corresponding network data transmitting-receiving buffer of hair data packet message queue, according to first kind message
Cloud ID in heading, protocol conversion is carried out to first kind message, obtains Second Type message, by Second Type packet storage
In the serial data transmitting-receiving buffer of cloud access system distribution, and the control of application affairs callback module is triggered based on M-Smart
Second Type message is issued to household electrical appliance 52 by the service logic thread 503 of system by serial data receiving or sending thread 501.Its
In, the protocol conversion file in Cloud Server 51SDK is for example, the protocol conversion file ali_ of Ali's cloud ali_sdk.c
Profile.c, the protocol conversion file jd_profile.c of Jingdone district cloud jd_sdk.c, the protocol conversion text of millet cloud xm_sdk.c
Part xm_profile.c, and the cloud md_sdk.c of U.S. protocol conversion file md_profile.c.
Alternatively, wireless communication module 50 receives the Second Type message that household electrical appliance 52 send, and obtains Second Type
The corresponding destination address of message, and the type information of correspondence Cloud Server 51 is determined according to destination address;Wireless communication module
50 call corresponding translation-protocol according to the type information of Cloud Server 51;And wireless communication module 50 will according to translation-protocol
Second Type message is converted to first kind message, and first kind message is sent to corresponding Cloud Server 51.
In an embodiment of the present invention, the corresponding destination address mark Cloud Server 51 of Second Type message, the destination
Location can be arranged in the heading of Second Type message, can be the reserved field in heading, it is also possible to be arranged on other
Field, the embodiment of the present invention does not carry out concrete restriction to this.
Specifically, reporting message exchanges flow for example, the serial data receiving or sending thread 501 in wireless communication module 50 is received
After the Second Type message that household electrical appliance 52 send, serial data receiving or sending thread 501 creates serial ports transceiving data bag message queue,
And by Second Type message added in serial ports transceiving data bag message queue, in wireless communication module 50 based on M-Smart
The service logic thread 503 of system is by the function interface of protocol conversion file in Cloud Server 51SDK from serial ports transceiving data
Second Type message is obtained in the corresponding serial data transmitting-receiving buffer of bag message queue, according to the heading of Second Type message
The type information of the corresponding Cloud Server 51 of middle destination address, protocol conversion is carried out to Second Type message, obtains the first kind
Message, by first kind packet storage in the network data transmitting-receiving buffer that cloud access system is distributed, and triggers application affairs
First kind message is received and dispatched line by callback module service logic thread 503 of the control based on M-Smart systems by network data
Journey 502 reports to Cloud Server 51.
In one embodiment of the invention, wireless communication module 50 also includes main thread 504, and it is right that main thread 504 is used for
Serial data receiving or sending thread 501, network data receiving or sending thread 502 and service logic thread 503 are controlled.
Alternatively, main thread 504 is used to be managed the state machine of wireless communication module 50.
Main thread 504 is used to be managed the state machine of wireless communication module 50, specifically includes:Wireless communication module 50
Receive event message;Event message is distributed to corresponding state machine by the mode attribute according to event message, wherein, mode attribute
It is any one in AP-Mode, STA-Mode, or System;According to event message and the State Transferring of corresponding state machine
The state of mechanism control wireless communication module 50 is switched over.
Alternatively, main thread 504 flow embodiment that the state machine of wireless communication module 50 is managed is referred to Fig. 4 and
Fig. 5 embodiments.
In one embodiment of the invention, wireless communication module 50 also includes that first serial receives data-message queue
505, first serial receives data-message queue 505 is used to receive the message of the transmission of serial data receiving or sending thread 501, and by message
It is supplied to service logic thread 503 to be read out;First serial data receiver caching 506, first serial data receiver caching 506
The data of the transmission of serial data receiving or sending thread 501 are received and cached, and serves data to service logic thread 503 and read
Take;Second serial receives data-message queue 507, and second serial receives data-message queue 507 to be used to receive service logic line
The message that journey 503 sends, and provide messages to serial data receiving or sending thread 501 and be read out;And second serial data connect
Receive caching 508, the data that second serial data receiver caching 508 is received and cache business logic thread 503 sends, and by data
It is supplied to serial data receiving or sending thread 501 to be read out.
Specifically, during the reporting message of household electrical appliance 52, the serial data transmitting-receiving line in wireless communication module 50
After journey 501 receives the Second Type message that household electrical appliance 52 send, serial data receiving or sending thread 501 creates first serial and receives number
According to message queue 505, and Second Type message is added in first serial reception data-message queue 505, radio communication mold
The function that the service logic thread 503 based on M-Smart systems in block 50 passes through protocol conversion file in Cloud Server 51SDK
Interface obtains Second Type in receiving the corresponding first serial data receiver caching 506 of data-message queue 505 from first serial
Message, the type information of the corresponding Cloud Server 51 of destination address in the heading according to Second Type message, to Second Type
Message carries out protocol conversion, obtains first kind message.
Further, during the issuing message of Cloud Server 51, in wireless communication module 50 based on M-Smart systems
Service logic thread 503 disappeared from network transceiving data bag by the function interface of protocol conversion file in Cloud Server 51SDK
First kind message, the cloud in heading according to first kind message are obtained in the corresponding network data transmitting-receiving caching of breath queue
ID, protocol conversion is carried out to first kind message, obtains Second Type message, by Second Type packet storage in cloud access system
The second serial of distribution is received in the corresponding second serial data receiver caching 508 of data-message queue 507, and is triggered and applied thing
Part callback module service logic thread 503 of the control based on M-Smart systems receives and dispatches Second Type message by serial data
Thread 501 is issued to household electrical appliance 52.
Alternatively, the data in first serial data receiver caching 506 and second serial data receiver caching 508 are read
Afterwards, data are deleted in first serial data receiver caching 506 and second serial data receiver caching 508.
In one embodiment of the invention, wireless communication module 50 also includes Conversion Protocol Data storehouse 509, for storing
The corresponding translation-protocol of Cloud Server 51.
In an embodiment of the present invention, the conversion association based on M-Smart systems is specifically included in Conversion Protocol Data storehouse 509
View.
For example, agreement in the protocol conversion file ali_profile.c of Ali's cloud ali_sdk.c, Jingdone district cloud jd_
The protocol conversion file xm_ of agreement, millet cloud xm_sdk.c in the protocol conversion file jd_profile.c of sdk.c
Agreement in profile.c, and U.S. cloud md_sdk.c protocol conversion file md_profile.c in agreement.
In one embodiment of the invention, wireless communication module 50 also includes that first network receives data-message queue
5010, first network receives data-message queue 5010 is used for the message that receiving network data receiving or sending thread 502 sends, and will disappear
Breath is supplied to service logic thread 503 to be read out;First network data receiver caching 5011, first network data receiver caching
5011 receive and data that buffer network data transmit-receive thread 502 sends, and serve data to service logic thread 503 and carry out
Read;Second network receives data-message queue 5012, and the second network receives data-message queue 5012 and patrolled for receiving business
The message that thread 503 sends is collected, and provides messages to network data receiving or sending thread 502 and be read out;And the second network number
According to order caching 5013, the second network data order caching 5013 receives the data that simultaneously cache business logic thread 503 sends, and
Network data receiving or sending thread 502 is served data to be read out.
Specifically, during the reporting message of household electrical appliance 52, service logic thread 503 passes through first kind message
Second network receives data-message queue 5012 and stores in the second network data order caching 5013 of cloud access system distribution,
And trigger the control of application affairs callback module and passed through first kind message based on the service logic thread 503 of M-Smart systems
Network data receiving or sending thread 502 reports to Cloud Server 51.
Further, during the issuing message of Cloud Server 51, the first network in wireless communication module 50 receives number
Cloud Server 51 is got according to message queue 5010 to be sent to the first kind of household electrical appliance 52 by network data receiving or sending thread 502
After type message, network data receiving or sending thread 502 creates first network data receiver caching 5011, and first kind message is added
5011 are cached to first network data receiver, and serves data to service logic thread 503 and be read out, so as to be based on M-
Second Type message is issued to household electrical appliance by the service logic thread 503 of Smart systems by serial data receiving or sending thread 501
52。
Alternatively, the data in first network data receiver caching 5011 and the second network data order caching 5013 are read
After taking, data are deleted in first network data receiver caching 5011 and the second network data order caching 5013.
In the present embodiment, disappeared with serial data receiving or sending thread, network data receiving or sending thread by service logic thread
Breath is exchanged, and is controlled with to the message that serial data receiving or sending thread and network data receiving or sending thread are received and dispatched, and main thread is to serial ports
Data transmit-receive thread, network data receiving or sending thread and service logic thread are controlled, and first serial receives data-message queue
The message that serial data receiving or sending thread sends is received, and provides messages to service logic thread and be read out;First serial number
The data of serial data receiving or sending thread transmission are received and cached according to order caching, and serves data to service logic thread is carried out
Read;Second serial receives data-message queue and receives the message that service logic thread sends, and provides messages to serial ports number
It is read out according to receiving or sending thread;The data that second serial data receiver caching is received and cache business logic thread sends, and will
Data are supplied to serial data receiving or sending thread to be read out, and can effectively lift the pipe of message queue in Cloud Server access procedure
Reason effect, makes the access procedure of multiple Cloud Servers and multiple household electrical appliance more efficient, convenient.
Fig. 3 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 main thread includes to the method that the state machine of wireless communication module is managed:
S301: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.
Current wireless communication module is used typically as receiving terminal, i.e., must rely on another network offer device (for example,
Cable network) network connection electron device is provided.However, user is likely to wish that wireless communication module can be while have
Other kinds of function.If bad corner or thering is the multiple to need to use the electronics of network for example, user's family has to collect mail
Device, then may want to increase the scope that network signal is covered using wireless communication module;Or, it is also possible to think while making wireless
Cable network is transformed into wireless network by communication module;Or, it is also possible to want to make wireless communication module as wireless base station (AP),
Interconnect electronic installation.Wireless communication module in correlation technique is typically only capable to provide one of which network morphology or work(
Energy.
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 passes through application affairs callback module control business by the main thread in wireless communication module
Logic thread is generated, and WIFI callback events message is produced by application program.
Specifically, application affairs message can be the event of the upper layer application active generation of wireless communication module, for example, nothing
Line communication module cancels ap mode, then can produce the application affairs message of AF_EVT_AP_STOP.
WIFI callback events message can be the event of the WIFI bottoms feedback of wireless communication module, for example, radio communication
The ap mode of module is opened successfully, then can produce the WIFI callback events message of AF_EVT_AP_STARTED_SUCCESS.
Alternatively, before wireless communication module receives event message, also include:Configure the State Transferring of wireless communication module
Mechanism.
S302:Event message is distributed to corresponding state machine by the mode attribute according to event message, wherein, mode attribute
It is any one in AP-Mode, STA-Mode, or System.
Specifically, event message is distributed to according to the mode attribute of event message by state machine events distribution processor module
Corresponding state machine, wherein, mode attribute is any one in AP-Mode, STA-Mode, or System.
Wireless communication module supports that focus (Access Point, AP) mode of operation AP-Mode, AP-Mode are applied 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,
The central apparatus of suitable WLAN.Wireless communication module can also support workstation mode STA-Mode, it is understood that for certain
A work station in grid is client.When a WIFI chip for wireless communication module provides STA-Mode functions, nothing
Line communication module can be just connected in the middle of 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 in systems with the network connection state of 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.
S303:The state of the State Transferring mechanism control wireless communication module according to 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
Not busy three kinds of states, in the connection in STA-Mode state machines, have connected and idle three kinds of states;In System state machines
Network does not set up, network has been set up and initializes three kinds of states.
Alternatively, the State Transferring mechanism according to event message and corresponding state machine controls the state of wireless communication module
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 STA-Mode state machines State Transferring mechanism 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 any one in AP-Mode, STA-Mode, or 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 cooperating operation of machine, effectively the condition managing effect of lifting wireless communication module.
Fig. 4 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 main thread includes to the method that the state machine of wireless communication module is managed:
S401:Configure the State Transferring mechanism of wireless communication module.
Specifically, by state machine events distribution processor module by AP-Mode state machines, STA-Mode state machines, 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 to identify the state of wireless communication module.
By this step, the plug-in in wireless communication module can be made to call the status attribute for having configured, made wireless
Communication module can be switched between different states, realize three kinds of cooperating operations of state machine in wireless communication module.
S402:Application affairs message queue receives the application affairs message of service logic thread generation.
Wherein, application affairs message passes through application affairs callback module control business by the main thread in wireless communication module
Logic thread is generated.
Specifically, application affairs message can be the event of the upper layer application active generation of wireless communication module, for example, nothing
Line communication module cancels ap mode, then can produce the application affairs message of AF_EVT_AP_STOP.
S403:WIFI event call-backs submodule receives WIFI callback events message, and disappears WIFI callback events are received
After breath, WIFI callback events message is added to application affairs message queue.
WIFI callback events message can be the event of the WIFI bottoms feedback of wireless communication module, for example, radio communication
The ap mode of module is opened successfully, then can produce the WIFI callback events message of AF_EVT_AP_STARTED_SUCCESS.
S404:Read the application affairs message and WIFI callback events message in application affairs message queue.
Specifically, application affairs are read by state machine events distribution processor module by the main thread in wireless communication module
Application affairs message and WIFI callback events message in message queue.
S405:Event message is distributed to corresponding state machine by the mode attribute according to event message, wherein, mode attribute
It is any one in AP-Mode, STA-Mode, or System.
Specifically, event message is distributed to according to the mode attribute of event message by state machine events distribution processor module
Corresponding state machine, wherein, mode attribute is any one in AP-Mode, STA-Mode, or System.
Wireless communication module supports that focus (Access Point, AP) mode of operation AP-Mode, AP-Mode are applied 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,
The central apparatus of suitable WLAN.Wireless communication module can also support workstation mode STA-Mode, it is understood that for certain
A work station in grid is client.When a WIFI chip for wireless communication module provides STA-Mode functions, nothing
Line communication module can be just connected in the middle of 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 in systems with the network connection state of 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
Part realization aspect can strengthen the logicality of code structure, reduce the complexity of code development, be easy to later stage wireless communication module
The Function Extension of hardware system.
S406:State according to event message and State Transferring mechanism control wireless communication module is switched over.
Specifically, as shown in figure 5, being radio communication mold bulk state switching schematic diagram in the embodiment of the present invention, wherein, bag
Include:AP-Mode state machines 51, STA-Mode state machines 52, System state machines 53, state machine events distribution processor module 54,
Application affairs message queue 55, AP-Mode state machine states switching flow 56, STA-Mode state machine states switching flow 57,
And System state machine states switching flow 58.
Wireless communication module can be controlled according to the State Transferring mechanism of the content of event message and corresponding state machine
State is switched over.
For example, as shown in figure 5, 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 run to cancel ap mode when wireless communication module is in AP
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 that the state of free time is switched to by the operating states of AP.
In the present embodiment, by configuring the State Transferring mechanism of wireless communication module, in can making wireless communication module
Plug-in calls the status attribute for having configured, and wireless communication module is switched between different states, by basis
Event message is distributed to corresponding state machine by the mode attribute of event message, wherein, mode attribute is AP-Mode, STA-
Any one in Mode, or System, and it is wireless according to the control of the State Transferring mechanism of event message and corresponding state machine
The state of communication module is switched over, and can realize three kinds of cooperating operations of state machine in wireless communication module, effectively lifts 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,
Wireless communication module bottom hardware realization aspect can strengthen the logicality of code structure, reduce the complexity of code development, just
In the Function Extension of later stage wireless communication module hardware system.
Fig. 6 is the schematic flow sheet of the cloud access method based on wireless communication module that another embodiment of the present invention is proposed,
The cloud access method for being based on wireless communication module includes:
S601:Wireless communication module receives the first kind message that Cloud Server sends, and obtains the type of Cloud Server
Information, wherein, wireless communication module is connected with multiple Cloud Servers.
Used as a kind of hot technology in recent years and development trend, its principle is exactly to reach by resource-sharing to Cloud Server
While to reduces 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
Cloud Server is accessed to provide the user with related service, therefore Cloud Server is accessed and there is many demands and challenge.Therefore, have
Necessity is realized that household electrical appliance are convenient with multiple Cloud Servers, is efficiently accessed.
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 beautiful cloud with Cloud Server
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 are used to realize being based on M-
The treatment logic of the service logic thread of Smart systems, millet SDK22 is used to realize the protocol conversion file xm_ of millet cloud 25
Agreement in profile.c, manufacturer bottom SDK23 is used to realize the bottom hardware logic of 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 to be provided the service of integrated service ability to all kinds of Internet users.For example beautiful cloud of Cloud Server, 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, the use of microwave ovens function of U.S. has Cookbooks resource newly developed, micro-wave oven manufacturer is newly developed by this
The storage of Cookbooks resource in the intelligent cloud storage of beautiful cloud, as user by using wireless communication module by beautiful microwave
After stove is interconnected with the cloud of U.S., beautiful cloud can be by the Cookbooks resource supplying newly developed to beautiful micro-wave oven, so that user can
Cookbooks resource newly developed is performed with 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 exchange and the data cell transmitted, i.e. the website data block disposably to be sent in network.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 does not carry out concrete restriction to this.
Alternatively, the type information for obtaining Cloud Server is specifically included:Wireless communication module is obtained and is connected with Cloud Server
The Socket link informations for connecing;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 delivering to the first kind message of household electrical appliance, network data receiving or sending thread creates network transceiving data bag message queue, and will
First kind message is added to network transceiving data bag message queue, the industry based on M-Smart systems in 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.
S602:Wireless communication module calls corresponding translation-protocol according to the type information of Cloud Server.
Wherein, the protocol conversion of translation-protocol corresponding with the type information of Cloud Server such as Ali's cloud ali_sdk.c
It is agreement in file ali_profile.c, the agreement in the protocol conversion file jd_profile.c of Jingdone district cloud jd_sdk.c, small
Agreement in the protocol conversion file xm_profile.c of rice cloud xm_sdk.c, and the protocol conversion of the cloud md_sdk.c of U.S. is literary
Agreement in part md_profile.c.
S603: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, cloud ID of the wireless communication module 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 application affairs readjustment submodule service logic of the 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, the cloud access method that should be based on wireless communication module includes:Wireless communication module receives household electrical appliance hair
The Second Type message for sending, 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 sends
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, and effectively cloud access of the lifting based on wireless communication module is imitated
Really.
Fig. 7 is the schematic flow sheet of the cloud access method based on wireless communication module that another embodiment of the present invention is proposed,
The cloud access method for being based on wireless communication module includes:
S701:Wireless communication module receives the Second Type message that household electrical appliance send, and obtains Second Type message pair
The destination address answered, and the type information of correspondence Cloud Server is determined according to destination address.
In an embodiment of the present invention, the corresponding destination address mark Cloud Server of Second Type message, the destination address
Can be arranged in the heading of Second Type message, can be the reserved field in heading, it is also possible to be arranged on other words
Section, the embodiment of the present invention does not carry out concrete restriction to this.
Specifically, reporting message exchanges flow for example, the serial data receiving or sending thread in wireless communication module receives family expenses
After the Second Type message that electrical equipment sends, serial data receiving or sending thread creates serial ports transceiving data bag message queue, and by second
Type message is added in serial ports transceiving data bag message queue, the business based on M-Smart systems in wireless communication module
Logic thread is corresponding from serial ports transceiving data bag message queue by the function interface of protocol conversion file in Cloud Server SDK
Second Type message is obtained in serial data transmitting-receiving caching, and, destination address is true in the heading according to Second Type message
The type information of fixed corresponding Cloud Server.
S702:Wireless communication module calls corresponding translation-protocol according to the type information of Cloud Server.
Wherein, the protocol conversion of translation-protocol corresponding with the type information of Cloud Server such as Ali's cloud ali_sdk.c
It is agreement in file ali_profile.c, the agreement in the protocol conversion file jd_profile.c of Jingdone district cloud jd_sdk.c, small
Agreement in the protocol conversion file xm_profile.c of rice cloud xm_sdk.c, and the protocol conversion of the cloud md_sdk.c of U.S. is literary
Agreement in part md_profile.c.
S703: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, 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
Event call-back submodule service logic thread of the 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 send
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, realizes household electric
Device and the access of multiple Cloud Servers, effectively lift the cloud access effect based on wireless communication module.
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 implying relative importance.Additionally, 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 in flow chart or herein is construed as, and expression includes
It is one or more for realizing specific logical function or process the step of the module of code of executable instruction, fragment or portion
Point, and the scope of the preferred embodiment of the present invention includes other realization, wherein can not press shown or discussion suitable
Sequence, including function involved by basis 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 invention can be realized with hardware, software, firmware or combinations thereof.Above-mentioned
In implementation method, 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 for example, realized with hardware, and in another embodiment, can be with well known in the art
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
The rapid hardware that can be by program to instruct correlation is completed, and 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.
Additionally, during each functional unit in each embodiment of the invention can be integrated in a processing module, it is also possible to
It is that unit is individually physically present, it is also possible to which two or more units are 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 to realize in the form of software function module and as independent production marketing or when using, it is also possible to which storage is 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 spy that the embodiment or example are described
Point is contained at least one embodiment of the invention or example.In this manual, to the schematic representation of above-mentioned term not
Necessarily refer to identical embodiment or example.And, the specific features of description, structure, material or feature 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, changes, replacing and modification.