The content of the invention
The technical problem to be solved in the present invention is, is all generally for above-mentioned application program in vehicle device in the prior artThe application of customization, these adapted to screen sizes of application can not accomplish the effect that many places use to be fixed, aggravate exploitation intoA kind of this problem of, there is provided method and system interacted by web interface with vehicle device.
The technical solution adopted for the present invention to solve the technical problems is:
On the one hand, a kind of method interacted by web interface with vehicle device is constructed, including:
Control instruction is triggered by operating web interface;
The control instruction is sent to socket servers by web server;
The socket servers parse the control instruction and performed according to control instruction control engine end correspondingOperation;
The socket servers feed back to the operation performed by the engine end by the web server describedWeb interface.
It is described by operating in the step of web interface triggers control instruction in method of the present invention:
Script is touched by js and obtains control instruction in the web interface.
In method of the present invention, described send the control instruction to socket by web server servicesThe step of device, includes following sub-step:
The control instruction is sent to the web server by the web interface;
The control instruction is arranged to default interaction protocol form in the web server, and by the controlInstruction is packaged as default data format;
The control instruction is transmitted to the socket servers according to the interaction protocol form.
In method of the present invention, the socket servers parse the control instruction and referred to according to the controlThe step of order control engine end performs corresponding operation includes following sub-step:
According to control instruction described in the interaction protocol reception of beacons;
Parse to be controlled engine end to perform corresponding operation in the control instruction according to the data format;
Engine end described in the socket server controls performs corresponding operation.
In method of the present invention, the socket servers are by the operation performed by the engine end by describedWeb server, which feeds back to the step of web interface, includes following sub-step:
Performed operational feedback is returned the socket servers by the engine end;
Performed operation is synchronized to described by the socket servers by the engine end by the web serverWeb interface.
On the other hand, there is provided a kind of system interacted by web interface with vehicle device, including:
Trigger device, for triggering control instruction by operating web interface;
Retransmission unit, for the control instruction to be sent to socket servers by web server;
Resolver, for parsing the control instruction and performing corresponding behaviour according to control instruction control engine endMake;
Feedback device, for the operation performed by the engine end to be fed back into web circle by the web serverFace.
In the systems described in the present invention, the trigger device is additionally operable to touch script in the web interface by jsObtain control instruction.
In the systems described in the present invention, the retransmission unit includes:
First sending module, for the control instruction to be sent to the web server by the web interface;
Packetization module is set, for the control instruction to be arranged into default interaction protocol in the web serverForm, and the control instruction is packaged as default data format;
Second sending module, taken for transmitting the control instruction to the socket according to the interaction protocol formBusiness device.
In the systems described in the present invention, the resolver includes:
Receiving module, for according to control instruction described in the interaction protocol reception of beacons;
Parsing module, for parsing in the control instruction to be controlled engine end to perform accordingly according to the data formatOperation;
Control module, for controlling the engine end to perform corresponding operation.
In the systems described in the present invention, the feedback device includes:
Feedback module, for performed operational feedback to be returned into the socket servers;
Synchronization module, for the engine end to be synchronized into the web by performed operation by the web serverInterface.
A kind of method and system interacted by web interface with vehicle device disclosed above have the advantages that:Pass throughWeb interface is adapted to the screen size of various various sizes of vehicle devices and mobile terminal, without additionally mounted client orApplication program is that the information exchange with vehicle device can be achieved, and has saved development cost.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and ExamplesThe present invention is further elaborated.It should be appreciated that specific embodiment described herein is only to explain the present invention, notFor limiting the present invention.
The invention provides a kind of method and system interacted by web interface with vehicle device, it is intended that passing through webInterface is adapted to the screen size of various various sizes of vehicle devices and mobile terminal, without additionally mounted client or applicationProgram is that the information exchange with vehicle device can be achieved, and has saved development cost.
Referring to Fig. 1, Fig. 1 is a kind of method sequential flow chart interacted by web interface with vehicle device provided by the invention, shouldMethod need to provide control terminal 1, web server 2, socket servers 3 and engine end 4;Wherein, control terminal 1 can beThe mobile terminals such as mobile phone, pad, as long as there is the web browser for accessing web server 2;Engine end 4 is arranged at carIn, for controlling each equipment in vehicle.Specifically, this method comprises the following steps S1-S4:
S1, user are manipulated by the web interface triggering control instruction of terminal 1;In general, pass through js (full nameJavaScript, it is a kind of literal translation formula script, is a kind of regime type, weak type, the language based on prototype, built-in supportType.Its interpreter is referred to as JavaScript engine, is a part for browser, is widely used in the script of client,It is to be used on html web page earliest, for increasing dynamic function to html web page.) touch script obtained in the web interfaceTake control instruction.Web page is write by HTML (application under standard generalized markup language) language.Control terminal 1 logicalCross Http protocol access web server 2.
Such as:By the air-conditioner temperature that vehicle interior is adjusted in html page.User clicks on temperature in terminal 1 is controlledIncrease button, js scripts send request to web server 2, and script is:Xmlhttp.open (" GET ", " connect.phpBtn_id=3 ", ture);Button information is passed into web server 2.
S2, the control instruction sent to socket servers 3 by web server 2;Step S2 includes sub-stepS21-S23:
S21, the control instruction sent to the web server 2 by the web interface;By in control terminal 1In web interface access web server 2, so as to transmit the control instruction.
S22, the control instruction is arranged to default interaction protocol form in the web server 2, and by described inControl instruction is packaged as default data format;In general, the interaction protocol form support PHP language, that is, have used PHP versionsProtobuf agreements, the agreement can support C++ simultaneously, while foregoing Socket service device is write for C Plus Plus, such as:
And the data format that air-conditioner temperature controls is protobuf protocol formats, the data packed through protobuf will be insertedBusiness datum part in upper table, specific data format are as follows:
Wherein, Google Protocol Buffer (abbreviation Protobuf) are used for RPC systems and duration data storage systemSystem.
Protocol Buffers are a kind of structural data storage formats of portable and effective, can be used for structural dataSerialization, is serialized in other words.It is well suited for doing data storage or RPC data interchange formats.Deposited available for communications protocol, dataThe language in the fields such as storage is unrelated, platform is unrelated, expansible serializing structured data formats.Currently provide C++, Java,The API of nine kinds of language such as Python.
S23, according to the interaction protocol form control instruction is transmitted to the socket servers 3.
S3, the socket servers 3 parse the control instruction and performed according to control instruction control engine end 4Corresponding operation;Step S3 includes sub-step S31-S33:
S31, according to control instruction described in the interaction protocol reception of beacons;I.e. socket servers 3 receive data and pressedAccording to parsing interaction protocol form and data format in two above form.
S32, according to the data format parse in the control instruction to be controlled engine end 4 to perform corresponding operation;The temperature value to be set is parsed by above table.
S33, the socket servers 3 control the engine end 4 to perform corresponding operation.Engine end 4 is controlled by meshMark temperature value, which is set, arrives air-conditioning.
S4, the socket servers 3 feed back to the operation performed by the engine end 4 by the web server 2The web interface.Step S4 includes sub-step S41-S42:
Performed operational feedback is returned the socket servers 3 by S41, the engine end 4;That is air-conditioning is to engine end 4Real-time result is returned to, the state of temperature after setting is returned to socket servers 3 by engine end 4.
S42, the socket servers 3 are same by performed operation by the engine end 4 by the web server 2Walk to the web interface.The state of air-conditioning is according to backtracking web interface, after web interface receives temperature, shown by renewalVehicle air conditioning temperature.
The present invention also provides a kind of system interacted by web interface with vehicle device, and the system passes through in control terminal 1, webServer 2, socket servers 3 and engine end 4 are disposed corresponding program and realized, specifically, the system includes:
Trigger device, for triggering control instruction by operating web interface;The trigger device is additionally operable to touch by jsScript obtains control instruction in the web interface.Trigger device is deployed in control terminal 1.
Retransmission unit, for the control instruction to be sent to socket servers 3 by web server 2;Retransmission unitIt is deployed in web server 2.
Resolver, for parsing the control instruction and being performed accordingly according to control instruction control engine end 4Operation;Resolver is deployed in socket servers 3.
Feedback device, for the operation performed by the engine end 4 to be fed back into the web by the web server 2Interface.Feedback device is deployed in control terminal 1, web server 2, socket servers 3 and engine end 4.
Preferably, the retransmission unit includes:
First sending module, for the control instruction to be sent to the web server 2 by the web interface;TheOne sending module is deployed in web server 2.
Packetization module is set, for the control instruction to be arranged into default interaction protocol in the web server 2Form, and the control instruction is packaged as default data format;Packetization module is set to be deployed in web server 2.
Second sending module, taken for transmitting the control instruction to the socket according to the interaction protocol formBusiness device 3.Second sending module is deployed in web server 2.
Preferably, the resolver includes:
Receiving module, for according to control instruction described in the interaction protocol reception of beacons;Receiving module is deployed inIn socket servers 3.
Parsing module, for parsing in the control instruction to be controlled engine end 4 to perform phase according to the data formatThe operation answered;Parsing module is deployed in socket servers 3.
Control module, for controlling the engine end 4 to perform corresponding operation.Control module is deployed in socket serversIn 3.
Preferably, the feedback device includes:
Feedback module, for performed operational feedback to be returned into the socket servers 3;Feedback module is deployed in vehicle deviceEnd 4.
Synchronization module, it is described for performed operation to be synchronized to the engine end 4 by the web server 2Web interface.Synchronization module is deployed in control terminal 1, web server 2 and socket servers 3.
To sum up, using scheme provided by the invention, it can reach and only develop a set of Html interfaces, different sizes can be directed toScreen is realized adaptive well;In addition, the equipment for surfing the net such as mobile phone, pad need to only install browser without installing client justOperation interface can be obtained, realizes that various functions are connected and controlled and is interacted between automobile and various terminals.
There is provided herein the various operations of embodiment.In one embodiment, described one or operation may be constructed oneThe computer-readable instruction stored on individual or computer-readable medium, it will be so that computing device be held when being performed by electronic equipmentThe row operation.Describing the orders of some or all of operations, to should not be construed as to imply that these operations necessarily order dependent's.It will be appreciated by those skilled in the art that the alternative sequence of the benefit with this specification.Furthermore, it is to be understood that it is not instituteThere is operation to exist in each embodiment provided in this article.
Moreover, word " preferable " used herein means serving as example, example or illustration.Feng Wen is described as " preferably" any aspect or design be not necessarily to be construed as than other aspect or design it is more favourable.On the contrary, the use purport of word " preferable "Concept is being proposed in a concrete fashion.Term "or" as used in this application is intended to mean the "or" included and non-excluded"or".I.e., unless otherwise or clear from the context, " X means that nature includes any one of arrangement using A or B ".That is, if X uses A;X uses B;Or X uses A and B both, then " X is met using A or B " in foregoing any example.
Moreover, although having shown and described the disclosure relative to one or implementation, but people in the artMember is based on the reading to the specification and drawings and understands it will be appreciated that equivalent variations and modification.The disclosure includes all suchModifications and variations, and be limited only by the scope of the following claims.In particular, to by said modules (such as element, resourceDeng) various functions that perform, the term for describing such component is intended to correspond to the specified function (example for performing the componentAs it is functionally of equal value) random component (unless otherwise instructed), in structure with perform shown in this articleThe open structure of function in disclosed exemplary implementations is not equivalent.In addition, the although special characteristic of the disclosure phaseBe disclosed for the only one in some implementations, but this feature can with such as can be for given or application-specificIt is it is expected one or other combinations of features with other favourable implementations.Moreover, with regard to term " comprising ", " having ", " containHave " or its deformation be used in embodiment or claim for, such term be intended to with term "comprising" phaseAs mode include.
Each functional unit in the utility model embodiment can be integrated in a processing module or each listMember be individually physically present, can also two or more units be integrated in a module.Above-mentioned integrated module both can be withRealized, can also be realized in the form of software function module in the form of hardware.If the integrated module is with softwareThe form of functional module is realized and is used as independent production marketing or computer-readable is deposited in use, one can also be stored inIn storage media.Storage medium mentioned above can be read-only storage, disk or CD etc..Above-mentioned each device or system,The storage method in correlation method embodiment can be performed.
In summary, although the utility model is disclosed above with preferred embodiment, above preferred embodiment is not usedTo limit the utility model, one of ordinary skill in the art, do not departing from spirit and scope of the present utility model, can makeVarious changes and retouching, therefore the scope of protection of the utility model is defined by the scope that claim defines.