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
Cloud access system based on wireless communication module is included wireless communication module 101, is in communication with each other by wireless communication module 101
Cloud Server 102 and household electrical appliance 103, wherein, wireless communication module 101 includes:Serial data receiving or sending thread, for family
Electrical appliance 103 is communicated;Network data receiving or sending thread, for being communicated with Cloud Server 102;Service logic thread, uses
In message exchange is carried out with serial data receiving or sending thread, network data receiving or sending thread, with to serial data receiving or sending thread and network
The message of data transmit-receive thread transmitting-receiving is controlled;And main thread, main thread is for serial data receiving or sending thread, network number
It is controlled according to receiving or sending thread and service logic thread.
Cloud Server 102 is exactly by resource-sharing as a kind of hot technology in recent years and development trend, its principle
To reach while reduces cost, the efficiency of IT basic platform resilient expansions is improved.The construction of current Cloud Server 102 it is intended that
Users provide service on demand.Cloud Server 102 carries a large amount of important operation systems and data, while different family expenses
Electrical equipment 103 needs to access Cloud Server 102 to provide the user with related service, thus Cloud Server 102 access exist it is many
Demand and challenge.
In one embodiment of the invention, the cloud access system that should be based on wireless communication module includes wireless communication module
101。
In an embodiment of the present invention, wireless communication module 101 is specially wireless WIFI communication modules.
Wherein, wireless WIFI communication modules support Wi-Fi technology, for household electrical appliance 103.
Household electrical appliance 103 such as air-conditioner, refrigerator, and water heater etc..
For example, user's family Asymmetrical Digital Subscriber Line (Asymmetric Digital SubscriberLine,
ADSL), partial wideband etc., can connect wireless communication module 101 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 101 by family expenses
Electrical equipment 103 is interconnected with corresponding Cloud Server 102, to realize the resource-sharing of household electrical appliance 103 and Cloud Server 102.
Fig. 2 is the hardware architecture diagram of wireless communication module 101 in the embodiment of the present invention, and Fig. 2 is with Cloud Server 102
Beautiful 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 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 101, beautiful cloud 24
It is used to provide cloud service resource with millet cloud 25.
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 102 and household electrical appliance 103 that letter module 101 is in communication with each other.
Wherein, Cloud Server 102 be a kind of simple efficient, safe and reliable, disposal ability can elastic telescopic calculating service.
Cloud Server 102 is used to be provided the service of integrated service ability to all kinds of Internet users.For example beautiful cloud of Cloud Server 102,
Jingdone district cloud, A Liyun, or millet cloud.
Cloud Server 102 has intelligent cloud access, intelligent cloud storage, and the function that intelligent information is pushed.When user is logical
Cross after using wireless communication module 101, household electrical appliance 103 are interconnected with corresponding Cloud Server 102, Cloud Server 102 can be by
, to household electrical appliance 103, user can be by the application program of household electrical appliance in mobile terminal 103 to household electrical appliance for resource supplying
103 are controlled.
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 by using wireless communication module 101
After micro-wave oven is interconnected with the cloud of U.S., beautiful cloud can be by the Cookbooks resource supplying newly developed to beautiful micro-wave oven, to use
Family can perform Cookbooks newly developed and provide by the beautiful micro-wave oven of the application program controlling of the micro-wave oven of mobile terminal Sino-U.S.
Source.
Household electrical appliance 103 refer to the various Electrical and Electronic utensils used in family and similar site.Household electrical appliance 103
Such as television set, refrigerator, or air-conditioner etc..
With continuous progressive and user's growth in the living standard, increasing household electrical appliance 103 of smart home technology
Intelligent operating can be realized, user can in the terminal install the application program of household electrical appliance 103, by application program
Control household electrical appliance 103 be operated, user can also by using wireless communication module 101 by household electrical appliance 103 with it is corresponding
Cloud Server 102 interconnect.
Specifically, the operation system and the household electrical appliance 103 of data that user will can need to obtain in Cloud Server 102 are led to
Cross wireless communication module 101 and access corresponding Cloud Server 102, to realize the shared of resource in Cloud Server 102.
For example, it is desired to it is beautiful air-conditioner to obtain the household electrical appliance 103 of operation system in Cloud Server 102 and data,
Beautiful air-conditioner needs to share the resource of agreement matching from beautiful Cloud Server 102, therefore, by beautiful air-conditioner by wireless
Communication module 101 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 will be beautiful
Air-conditioner accesses millet cloud by wireless communication module 101, with air-conditioner and the millet cloud of realizing U.S. resource it is shared.
In one embodiment of the invention, wireless communication module 101 include serial data receiving or sending thread, for family expenses
Electrical equipment 103 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 101 receives the message of the transmission of household electrical appliance 103, to the message serially leading to
Letter mode is processed, and the message after treatment is reported into Cloud Server 102.
In one embodiment of the invention, wireless communication module 101 also include network data receiving or sending thread, for cloud
Server 102 is communicated.
For example, when wireless communication module 101 receives the message that Cloud Server 102 sends by network data receiving or sending thread
When, the message is processed, the message after treatment is issued to household electrical appliance 103.
In one embodiment of the invention, wireless communication module 101 also include service logic thread, for serial ports number
Message exchange is carried out according to receiving or sending thread, network data receiving or sending thread, with to serial data receiving or sending thread and network data transmitting-receiving line
The message of journey transmitting-receiving is controlled.
Wherein, the service logic thread in the embodiment of the present invention is the service logic thread based on M-Smart systems.M-
The service content that Smart open systems are specifically provided, M-Smart systems are directed to using third party cloud, the built-in cloud using U.S., do not have
Three kinds of internet partners for having cloud open docking form.
Specifically, service logic thread is by M-Smart agreements and serial data receiving or sending thread, network data receiving or sending thread
Carry out message exchange.
Alternatively, service logic thread obtains Cloud Server 102 and sends to household electrical appliance by network data receiving or sending thread
103 first kind message;Service logic thread obtains the type information of Cloud Server 102, and according to type information by first
Type message is converted to Second Type message;Service logic thread is sent Second Type message by serial data receiving or sending thread
To household electrical appliance 103.
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 102 can such as cloud ID, different cloud ID marks are not
With Cloud Server 102, 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 102 is obtained, is specifically included:Wireless communication module 101 is obtained and cloud service
The Socket link informations that device 102 is connected;And wireless communication module 101 determines that type is believed according to Socket link informations
Breath.
Specifically, as shown in figure 3, being the message exchange flow schematic diagram of wireless communication module 101 in the embodiment of the present invention.Bag
Include: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
Data transmit-receive buffer 34, network data transmitting-receiving buffer 35, the translation-protocol 36, Cloud Server based on M-Smart systems
102, and household electrical appliance 103.
Issuing message exchanges flow for example, the network data receiving or sending thread 33 in wireless communication module 101 gets cloud clothes
Business device 102 is sent to the first kind message of household electrical appliance 103, and network data receiving or sending thread 33 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 101 based on
The service logic thread 32 of M-Smart systems is received by the function interface of protocol conversion file in Cloud Server 102SDK from network
First kind message is obtained in the corresponding network data transmitting-receiving buffer 35 of hair data packet message queue, according to first kind message
Heading in cloud ID, protocol conversion is carried out to first kind message, obtain Second Type message, Second Type message is deposited
Store up in the serial data transmitting-receiving buffer 34 of cloud access system distribution, and trigger application affairs readjustment submodule control based on M-
Second Type message is issued to household electrical appliance by the service logic thread 32 of Smart systems by serial data receiving or sending thread 31
103.Wherein, in Cloud Server 102SDK protocol conversion file 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 101 receives the Second Type message that household electrical appliance 103 send, and obtains Equations of The Second Kind
The corresponding destination address of type message, and the type information of correspondence Cloud Server 102 is determined according to destination address;Radio communication mold
Block 101 calls corresponding translation-protocol according to the type information of Cloud Server 102;And wireless communication module 101 is according to conversion
Second Type message is converted to first kind message by agreement, and first kind message is sent to corresponding Cloud Server 102.
In an embodiment of the present invention, the corresponding destination address mark Cloud Server 102 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, as shown in figure 3, reporting message exchanges flow for example, the serial data in wireless communication module 101 is received and dispatched
After thread 31 receives the Second Type message that household electrical appliance 103 send, serial data receiving or sending thread 31 creates serial ports transceiving data
Bag message queue, and Second Type message is added in serial ports transceiving data bag message queue, in wireless communication module 101
Service logic thread 32 based on M-Smart systems is by the function interface of protocol conversion file in Cloud Server 102SDK from string
Second Type message is obtained in the corresponding serial data transmitting-receiving buffer 34 of mouth transceiving data bag message queue, according to Second Type
The type information of the corresponding Cloud Server 102 of destination address, protocol conversion is carried out to Second Type message in the heading of message,
First kind message is obtained, by first kind packet storage in the network data transmitting-receiving buffer 35 that cloud access system is distributed,
And trigger application affairs readjustment submodule control and passed through first kind message based on the service logic thread 32 of M-Smart systems
Network data receiving or sending thread 33 reports to Cloud Server 102.
In one embodiment of the invention, wireless communication module 101 also includes main thread, and main thread is used for serial ports number
It is controlled according to receiving or sending thread, network data receiving or sending thread and service logic thread.
Alternatively, main thread is used to be managed the state machine of wireless communication module 101.
Main thread is used to be managed the state machine of wireless communication module 101, specifically includes:Wireless communication module 101
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 101 is switched over.
Alternatively, main thread refers to Fig. 4 and Tu to the flow embodiment that the state machine of wireless communication module 101 is managed
5 embodiments.
In one embodiment of the invention, wireless communication module 101 also includes Conversion Protocol Data storehouse, for storing cloud
The corresponding translation-protocol of server 102.
In an embodiment of the present invention, the translation-protocol based on M-Smart systems is specifically included in Conversion Protocol Data storehouse.
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 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 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.
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:Wireless communication module receives event message.
Wireless communication module is specially wireless WIFI communication modules.
Wherein, wireless WIFI communication modules support Wi-Fi technology, for household electrical appliance.
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
Module increases the scope that 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) to 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 is adjusted back submodule and controls industry by the main thread in wireless communication module by application affairs
Business logic thread generation, 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.
S402: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 according to the mode attribute of event message by state machine events distribution processor submodule
To 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.
S403: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. 5 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:
S501:Configure the State Transferring mechanism of wireless communication module.
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 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.
S502:Application affairs message queue receives the application affairs message of service logic thread generation.
Wherein, application affairs message is adjusted back submodule and controls industry by the main thread in wireless communication module by application affairs
Business logic thread generation.
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.
S503: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.
S504:Read the application affairs message and WIFI callback events message in application affairs message queue.
Specifically, read by state machine events distribution processor submodule by the main thread in wireless communication module and apply thing
Application affairs message and WIFI callback events message in part message queue.
S505: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 according to the mode attribute of event message by state machine events distribution processor submodule
To 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.
S506:State according to event message and State Transferring mechanism control wireless communication module is switched over.
Specifically, as shown in fig. 6, being radio communication mold bulk state switching schematic diagram in the embodiment of the present invention, wherein, bag
Include:AP-Mode state machines 61, STA-Mode state machines 62, System state machines 63, state machine events distribution processor submodule
64th, application affairs message queue 65, AP-Mode state machine states switching flow 66, STA-Mode state machine state switching flows
67, and System state machine states switching flow 68.
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 fig. 6, 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. 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:Service logic thread carries out message exchange with serial data receiving or sending thread, network data receiving or sending thread, with right
Serial data receiving or sending thread and the message of network data receiving or sending thread transmitting-receiving are controlled.
Wherein, the service logic thread in the embodiment of the present invention is the service logic thread based on M-Smart systems.M-
The service content that Smart open systems are specifically provided, M-Smart systems are directed to using third party cloud, the built-in cloud using U.S., do not have
Three kinds of internet partners for having cloud open docking form.
Specifically, service logic thread is by M-Smart agreements and serial data receiving or sending thread, network data receiving or sending thread
Carry out message exchange.
S702:Main thread is controlled to serial data receiving or sending thread, network data receiving or sending thread and service logic thread.
Alternatively, main thread is used to be managed the state machine of wireless communication module.
Main thread is used to be managed the state machine of wireless communication module, specifically includes:Wireless communication module receives thing
Part message;Event message is distributed to corresponding state machine by the mode attribute according to event message, wherein, mode attribute is AP-
Any one in Mode, STA-Mode, or System;According to the State Transferring mechanism control of event message and corresponding state machine
The state of wireless communication module processed is switched over.
Alternatively, main thread refers to Fig. 4 and Fig. 5 realities to the flow embodiment that the state machine of wireless communication module is managed
Apply example.
Alternatively, the cloud access method that should be based on wireless communication module also includes:Service logic thread passes through network data
Receiving or sending thread obtains Cloud Server and sends to the first kind message of household electrical appliance;Service logic thread obtains the class of Cloud Server
Type information, and first kind message is converted to by Second Type message according to type information;Service logic thread passes through serial ports number
Second Type message is sent to household electrical appliance according to receiving or sending thread.
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 of Cloud Server is obtained, 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.
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 buffer 34, network data transmitting-receiving buffer 35, the translation-protocol 36 based on M-Smart systems, Cloud Server 102,
And household electrical appliance 103.
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 buffer in obtain first kind message, the cloud ID in the heading according to first kind message, to the
One type message carries out protocol conversion, obtains Second Type message, and Second Type packet storage is distributed in cloud access system
In serial data transmitting-receiving buffer, and trigger application affairs readjustment submodule service logic line of the control based on M-Smart systems
Second Type message is issued to household electrical appliance by journey by serial data receiving or sending thread.Wherein, the agreement in Cloud Server SDK turns
Exchange of notes part is for example, the protocol conversion file ali_profile.c of Ali's cloud ali_sdk.c, the agreement of Jingdone district cloud jd_sdk.c turn
The protocol conversion file xm_profile.c of exchange of notes part jd_profile.c, millet cloud xm_sdk.c, and U.S. cloud md_
The protocol conversion file md_profile.c of sdk.c.
Alternatively, the cloud access method that should be based on wireless communication module also includes:Wireless communication module receives household electrical appliance
The Second Type message of transmission, and the corresponding destination address of Second Type message is obtained, and correspondence is determined according to destination address
The type information of Cloud Server;Wireless communication module calls corresponding translation-protocol according to the type information of Cloud Server;And
Second Type message is converted to first kind message by wireless communication module according to translation-protocol, 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
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, as shown in figure 3, reporting message exchanges flow for example, the serial data in wireless communication module receives and dispatches line
After journey receives the Second Type message that household electrical appliance send, serial data receiving or sending thread creates serial ports transceiving data bag message team
Row, and by Second Type message added in serial ports transceiving data bag message queue, 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, purpose in the heading according to Second Type message are obtained in the corresponding serial data transmitting-receiving buffer of queue
The type information of the corresponding Cloud Server in address, protocol conversion is carried out to Second Type message, obtains first kind message, by
The storage of one type message triggers application affairs readjustment submodule in the network data transmitting-receiving buffer of cloud access system distribution
First kind message is reported to cloud and taken by service logic thread of the control based on M-Smart systems by network data receiving or sending thread
Business device.
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 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.
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.