CN107911435A - A kind of http open interface call methods based on embedded device - Google Patents

A kind of http open interface call methods based on embedded device Download PDF

Info

Publication number
CN107911435A
CN107911435A CN201711103462.6A CN201711103462A CN107911435A CN 107911435 A CN107911435 A CN 107911435A CN 201711103462 A CN201711103462 A CN 201711103462A CN 107911435 A CN107911435 A CN 107911435A
Authority
CN
China
Prior art keywords
cmd
embedded device
request
bit
param
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201711103462.6A
Other languages
Chinese (zh)
Inventor
王卫
汤友俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing Jusha Display Technology Co Ltd
Nanjing Jusha Medical Technology Co Ltd
Original Assignee
Nanjing Jusha Display Technology Co Ltd
Nanjing Jusha Medical Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing Jusha Display Technology Co Ltd, Nanjing Jusha Medical Technology Co Ltd filed Critical Nanjing Jusha Display Technology Co Ltd
Priority to CN201711103462.6A priority Critical patent/CN107911435A/en
Publication of CN107911435A publication Critical patent/CN107911435A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a kind of http open interface call methods based on embedded device:Embedded device is as http-server, there is provided the open interface based on http agreements, for being interacted with the embedded device.On any network link with the client of the embedded device intercommunication, either windows application software, windows browsers, Linux application software, Linux browsers, or mobile terminal (Android/iOS) is as long as the open interface based on http agreements that application software or browser are provided in accordance with the embedded device, can interact with the embedded device.The present invention solves the problems, such as embedded device cross-platform integration so that embedded device need not be that each platform (Windows/Linux/Android/iOS) customizes a set of open interface, highly shortened the construction cycle of embedded device.

Description

A kind of http open interface call methods based on embedded device
Technical field
The present invention relates to a kind of http open interface call methods based on embedded device, belong to Computer Applied Technology Field.
Background technology
At present, as the development of social science and technology, Linux embedded devices are more and more accepted by people and make With, such as various intelligent terminals.
But, it is necessary to be various platform (Windows/Linux/ during these Linux embedded devices are developed Android/iOS) provide open interface facilitate each platform intergration quotient set into.
But this demand can cause the construction cycle to be grown, personnel put into it is high, product not easy care a series of problems, such as.Directly prolong The market periods of product, and manufacture cost are grown.
The content of the invention
Purpose:In order to overcome the deficiencies in the prior art, the present invention provides a kind of based on embedded device Http open interface call methods.
Technical solution:In order to solve the above technical problems, the technical solution adopted by the present invention is:
A kind of http open interface call methods based on embedded device, include the following steps:
Step 1:Start embedded device, after embedded device system normal initialization, begin listening for 80 ports of http, Prepare to receive the request from client;
Step 2:The client of platform connects the embedded device where user starts, and is opened according to what embedded device provided Interface requests data format is put, sends request, and wait the response of embedded device;
Step 3:After embedded device receives request, reply data is returned to according to response data format by client;
Step 4:After client receives reply data, response is completed.
Preferably, the embedded device is Linux equipment.
Preferably, the step 2 includes:Client connects what the embedded device was provided according to embedded device Open interface request data format, filling send the ip, port, ctrl, cmd_type, device_id, device_ in request After type, cmd_length, cmd_id, cmd_param, check_bit, end field, then it is transmitted, and waits embedded The response of equipment;
The request data format is as follows:
http://ip:port/ctrl[cmd_type],[device_id],[device_type],[cmd_ length],[cmd_id],[cmd_param[...]],[check_bit],[end]
Request data format field is as shown in table 1:
Preferably, the definition method of the check bit for it is cumulative send integer datas all in request and with 0x95277259 carries out exclusive or;Formula is as follows:
Check_bit=(port+cmd_type+device_id+device_type+cmd_leng th+cmd_id+ check_bit)^0x95277259。
Preferably, the step 3 includes:
After 3.1 embedded devices receive request, first judge whether device_id and device_type is effective, if invalid The response for then returning to failure is to client, wherein response data format:device_id,device_type,cmd_id, Check_bit, end are identical with demand signalling, and param_length 0, param are sky, and it is invalid that ret_value returns to verification Error code;
3.2 calculate the value of check bit and compared with the check bit check_bit of request according to the formula of check bit, if lost Lose, then the response for returning to failure is to client, wherein response data format:device_id,device_type,cmd_id, Check_bit, end are identical with demand signalling, and param_length 0, param are sky, and ret_value back-checkings code is not The error code matched somebody with somebody;
3.3 respond according to cmd_type, cmd_id, cmd_length, and correctly fill in response data format, Device_id, device_type, cmd_id, check_bit, end are identical with request form, and ret_value 0,0 is represented just It should indeed answer;The platform properties of request form are obtained according to http agreements, param_length is filled in further according to platform properties, The data of param;
3.4 reply datas return to client.
The response data format is as follows:
[device_id],[device_type],[cmd_id],[ret_value],[param_length],[param [...]],[check_bit],[end]
Response data format field is as shown in table 2:
Preferably, the step 4 includes:
After 4.1 clients receive reply data, judge whether device_id and device_type is effective, if invalid Do error handling processing;
4.2 compare the check bit for sending request and response request, if unequal, do error handling processing;
4.3 parsing cmd_id, param_length, param, successfully complete response.
Preferably, the client platform uses Windows, Linux, Android, iOS.
Beneficial effect:A kind of http open interface call methods based on embedded device provided by the invention, solve The problem of embedded device cross-platform integration so that embedded device need not be each platform (Windows/Linux/ Android/iOS a set of open interface) is all customized, highly shortened the construction cycle of embedded device.
Brief description of the drawings
Fig. 1 is the flow diagram of the method for the present invention.
Embodiment
The present invention is further described below in conjunction with the accompanying drawings.
As shown in Figure 1, a kind of http open interface call methods based on embedded device, it includes the following steps:
Step 1:Start embedded device, the embedded device is Linux equipment, and embedded device system is normally initial After change, 80 ports of http are begun listening for, prepare to receive the request from client.
Step 2:Platform where user starts, such as:The client of Windows/Linux/Android/iOS connects the insertion Formula equipment, the open interface request data format provided according to embedded device, filling send ip, port, the ctrl in request, Cmd_type, device_id, device_type, cmd_length, cmd_id, cmd_param, check_bit, end field Afterwards, then it is transmitted, and waits the response of embedded device.
Request data format is as follows:
http://ip:port/ctrl[cmd_type],[device_id],[device_type],[cmd_ length],[cmd_id],[cmd_param[...]],[check_bit],[end]
Request data format field is as shown in table 1:
Wherein, the definition method of check bit carries out for integer data all in cumulative transmission request and with 0x95277259 Exclusive or.Formula is as follows:
Check_bit=(port+cmd_type+device_id+device_type+cmd_length+cmd_id+ check_bit)^0x95277259。
Step 3:After embedded device receives request, first judge whether device_id and device_type is effective, if Invalid, the response for returning to failure is to client, wherein response data format:device_id,device_type,cmd_id, Check_bit, end are identical with demand signalling, and param_length 0, param are sky, and it is invalid that ret_value returns to verification Error code.
The value of check bit is calculated further according to the formula of check bit and compared with the check bit check_bit of request, if lost Lose, the response for returning to failure is to client, wherein response data format:device_id,device_type,cmd_id, Check_bit, end are identical with demand signalling, and param_length 0, param are sky, and ret_value back-checkings code is not The error code matched somebody with somebody.
Finally responded according to cmd_type, cmd_id, cmd_length, and correctly fill in response data format, Device_id, device_type, cmd_id, check_bit, end are identical with request form, and ret_value 0,0 is represented just It should indeed answer.The platform properties of request form are obtained according to http agreements, param_length is filled in further according to platform properties, The data of param.
Reply data is finally returned to client.
Response data format is as follows:
[device_id],[device_type],[cmd_id],[ret_value],[param_length],[param [...]],[check_bit],[end]
Response data format field is as shown in table 2:
Step 4:After client receives reply data, first judge whether device_id and device_type is effective, if It is invalid, do error handling processing.
Compare the check bit for sending request and response request again, if unequal, do error handling processing.Finally parse cmd_ Id, param_length, param, successfully complete response.
The principle that http open interfaces wherein based on embedded device can be suitable for each platform be:
1.http agreements are a cross-platform agreement in itself, and each platform can use it, it is not for some Platform building;
2. the open interface based on http agreements is cross-platform, the form each asked can group in each platform Into each platform can use it, and interface is not for some platform building.
Specific implementation flow is exemplified below:
Embedded device normally starts, and begins listening for 80 ports of http.
User inputs the request based on http protocol open interfaces in the IE browser of windows platforms, such as: http://192.168.2.241:8000/ctrlGET, 0,0,0,42,0, # (being used to represent to obtain the pattern currently inputted).
Embedded device receives this request, and after the effective informations such as device id, device type, check bit are judged, making should Answer, such as:0,0,5,3,0,0, # (being used to represent that current input mode is pattern 3).
IE browser receives this response message, after the effective informations such as device id are judged, is shown in the control of html webpage Show relevant mode value, complete this interaction.
The system platform of client is obtained according to the http open interfaces agreement of embedded device, and is according to client System platform, the parameter list of the platform is returned in the param of open interface reply data, is facilitated at the system platform client Reason.
Such as:Android browser initiates http open interface call requests, embedded to set for showing user list The standby browser for learning that client is Android platform from http request, returns to the corresponding html format parameters row of browser Table, directly shows easy to Android platform browser.
Client is window application, initiates http open interface call requests, embedding for showing user list Enter formula equipment and learn it is windows platform application from http request, return using branch as separator user list to Client is parsed and shown.
The above is only the preferred embodiment of the present invention, it should be pointed out that:For the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications also should It is considered as protection scope of the present invention.

Claims (7)

  1. A kind of 1. http open interface call methods based on embedded device, it is characterised in that:Include the following steps:
    Step 1:Start embedded device, after embedded device system normal initialization, begin listening for 80 ports of http, prepare Receive the request from client;
    Step 2:The client of platform connects the embedded device where user starts, and is connect according to the opening that embedded device provides Mouth request data format, sends request, and wait the response of embedded device;
    Step 3:After embedded device receives request, reply data is returned to according to response data format by client;
    Step 4:After client receives reply data, response is completed.
  2. A kind of 2. http open interface call methods based on embedded device according to claim 1, it is characterised in that: The embedded device is Linux equipment.
  3. A kind of 3. http open interface call methods based on embedded device according to claim 1, it is characterised in that: The step 2 includes:Client connects the open interface request data format that the embedded device is provided according to embedded device, Filling sends the ip, port, ctrl, cmd_type, device_id, device_type, cmd_length, cmd_ in request After id, cmd_param, check_bit, end field, then it is transmitted, and waits the response of embedded device;
    The request data format is as follows:
    http://ip:port/ctrl[cmd_type],[device_id],[device_type],[cmd_length], [cmd_id],[cmd_param[...]],[check_bit],[end]
    Request data format field is as shown in table 1:
  4. A kind of 4. http open interface call methods based on embedded device according to claim 3, it is characterised in that: The definition method of the check bit for integer data all in cumulative transmission request and carries out exclusive or with 0x95277259;Formula It is as follows:
    Check_bit=(port+cmd_type+device_id+device_type+cmd_length+cmd_id+ch eck_ bit)^0x95277259。
  5. A kind of 5. http open interface call methods based on embedded device according to claim 1, it is characterised in that: The step 3 includes:
    After 3.1 embedded devices receive request, first judge whether device_id and device_type is effective, is returned if invalid Return the response to fail is to client, wherein response data format:device_id,device_type,cmd_id,check_ Bit, end are identical with demand signalling, and param_length 0, param are sky, and ret_value, which is returned, verifies invalid mistake Code;
    3.2 calculate the value of check bit and compared with the check bit check_bit of request according to the formula of check bit, if it fails, The response for then returning to failure is to client, wherein response data format:device_id,device_type,cmd_id, Check_bit, end are identical with demand signalling, and param_length 0, param are sky, and ret_value back-checkings code is not The error code matched somebody with somebody;
    3.3 respond according to cmd_type, cmd_id, cmd_length, and correctly fill in response data format, device_ Id, device_type, cmd_id, check_bit, end are identical with request form, and ret_value 0,0 represents correct response; The platform properties of request form are obtained according to http agreements, param_length, the number of param are filled in further according to platform properties According to;
    3.4 reply datas return to client.
    The response data format is as follows:
    [device_id],[device_type],[cmd_id],[ret_value],[param_length],[param [...]],[check_bit],[end]
    Response data format field is as shown in table 2:
  6. A kind of 6. http open interface call methods based on embedded device according to claim 1, it is characterised in that: The step 4 includes:
    After 4.1 clients receive reply data, judge whether device_id and device_type is effective, is made if invalid Fault is managed;
    4.2 compare the check bit for sending request and response request, if unequal, do error handling processing;
    4.3 parsing cmd_id, param_length, param, successfully complete response.
  7. A kind of 7. http open interface call methods based on embedded device according to claim 1, it is characterised in that: The client platform uses Windows, Linux, Android, iOS.
CN201711103462.6A 2017-11-09 2017-11-09 A kind of http open interface call methods based on embedded device Pending CN107911435A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711103462.6A CN107911435A (en) 2017-11-09 2017-11-09 A kind of http open interface call methods based on embedded device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711103462.6A CN107911435A (en) 2017-11-09 2017-11-09 A kind of http open interface call methods based on embedded device

Publications (1)

Publication Number Publication Date
CN107911435A true CN107911435A (en) 2018-04-13

Family

ID=61844609

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711103462.6A Pending CN107911435A (en) 2017-11-09 2017-11-09 A kind of http open interface call methods based on embedded device

Country Status (1)

Country Link
CN (1) CN107911435A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109714642A (en) * 2018-12-29 2019-05-03 深圳Tcl数字技术有限公司 Linux application multiplexing is in the method for intelligence system, smart television and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109714642A (en) * 2018-12-29 2019-05-03 深圳Tcl数字技术有限公司 Linux application multiplexing is in the method for intelligence system, smart television and storage medium

Similar Documents

Publication Publication Date Title
US10635436B2 (en) Compatibility method based on hybrid, adapter, operation device, system and computer-readable storage medium
CN105591819B (en) The method and device of Configuration network equipment
CN103780577B (en) Implementation method, device and the terminal of Internet of Things application
CN108667807A (en) A kind of protocol self-adapting method and system based on monitoring cloud platform and gateway
CN110417783B (en) Data transmission method and device based on Internet of things, storage medium and terminal
CN106656953A (en) Method for realizing safe interface calling between systems based on Internet
CN105229972B (en) The dynamic host configuration protocol method of enhancing
CN107612661A (en) Data communication method and device
CN103236960A (en) Method and system for data interaction between home server and plurality of terminals
CN107360177B (en) A kind of message transmitting method and device based on UDP
CN102684899B (en) Method, ACS (auto-configuration server) and system for obtaining equipment status based on TR069 protocol
CN105897652A (en) Standard protocol based heterogeneous terminal dynamic access method
CN105302564B (en) Network OA service control and implementation method
CN101226700A (en) Teaching experimental approach for slicing and regrouping process of IP datagram
CN106487746A (en) A kind of method and device of BMP message authentication
CN108322437A (en) For the adaptive communications method and apparatus between more stipulations equipment
CN106130855B (en) Data processing method and device
CN101567861A (en) Data synchronization method and application system between heterogeneous application systems
CN102664958A (en) Transparent computing system
CN108683702A (en) A kind of driving method of the plug and play of Internet of Things equipment access internet
CN103841587B (en) A kind of implementation method, the apparatus and system of Internet of Things Convergence gateway
CN107911435A (en) A kind of http open interface call methods based on embedded device
CN103997416B (en) The error correction method and error correction device of mobile terminal Internet access
CN103391223B (en) A kind of IEC101 protocol massages fast automatic detecting method
CN109271454A (en) A kind of method and the network equipment that data are synchronous

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20180413

RJ01 Rejection of invention patent application after publication