Summary of the invention
In view of this, the invention provides a kind of data sharing method and the device that are applied to data platform, to overcome in prior art because the form of each shared information may be different, so not easily each shared information is integrated, thus make the problem that developer strengthens the development difficulty of upper layer application.
For achieving the above object, the invention provides following technical scheme:
Be applied to a data sharing method for data platform, comprise:
The request of the first shared device is accessed in response to user, from the corresponding relation of the facility information of shared device of each access prestored, sensing passage information and sensing data, obtain and identify the first corresponding sensing data with the device identification of described first shared device and sensing passage, described request comprises the device identification of the first shared device and the sensing passage mark of described first shared device, described facility information comprises device identification, and described sensing passage information comprises sensing passage mark;
Described first sensing data is fed back to described user.
Wherein, the method obtaining the corresponding relation of described facility information, sensing passage information and sensing data comprises:
During instruction in response to shared device access data platform, obtain facility information and the sensing passage information of described shared device;
Receive the sensing data corresponding with described sensing passage information that described shared device gathers;
Store the corresponding relation of described facility information, described sensing passage information and described sensing data.
Wherein, described access the request of the first shared device in response to user before, also comprise password authentification, described password authentification comprises:
Receive the user name of described user input and the password of input;
According to the corresponding relation of the username and password prestored, obtain the first password that the user name of described user input is corresponding;
When the password that described user inputs and described first password match, determine to be verified.
Wherein, the user name of described user input and the password of input are after described data platform detects that described first shared device is verified the application information that described user submits to, for described user distributes.
Wherein, also comprise:
When detecting that the first sensing data of described first shared device collection belongs to preset range, comprise the instruction of the first parameter regulating described first shared device to described first shared device feedback, described first parameter operates accordingly for triggering described first shared device.
Be applied to a data sharing device for data platform, comprise:
First acquisition module, for accessing the request of the first shared device in response to user, from the corresponding relation of the facility information of shared device of each access prestored, sensing passage information and sensing data, obtain and identify the first corresponding sensing data with the device identification of described first shared device and sensing passage, described request comprises the device identification of the first shared device and the sensing passage mark of described first shared device, described facility information comprises device identification, and described sensing passage information comprises sensing passage mark;
Sending module, for feeding back to described user by described first sensing data.
Wherein, also comprise:
Second acquisition module, during for instruction in response to shared device access data platform, obtains facility information and the sensing passage information of described shared device;
Receiver module, for receiving the sensing data corresponding with described sensing passage information that described shared device gathers;
Memory module, for storing the corresponding relation of described facility information, described sensing passage information and described sensing data.
Wherein, also comprise password authentication module, described password authentication module comprises:
Receiving element, for receiving user name and the password of input of described user input;
Acquiring unit, for the corresponding relation according to the username and password prestored, obtains the first password that the user name of described user input is corresponding;
Determining unit, for when the password that described user inputs and described first password match, determines to be verified, and triggers described first acquisition module.
Wherein, the user name of described user input and the password of input are after described data platform detects that described first shared device is verified the application information that described user submits to, for described user distributes.
Wherein, also comprise:
Control module, during for detecting that the first sensing data of described first shared device collection belongs to preset range, comprise the instruction of the first parameter regulating described first shared device to described first shared device feedback, described first parameter operates accordingly for triggering described first shared device.
Known via above-mentioned technical scheme, compared with prior art, embodiments provide a kind of data sharing method being applied to data platform, the facility information of each access shared device is stored in data platform, the corresponding relation of sensing passage information and sensing data, this corresponding relation goes for the sensing node in nearly all Internet of Things, after information is uploaded to data platform by namely all sensing nodes, the form stored at data platform can be all facility information, the corresponding relation of sensing passage information and sensing data, so user is after the shared information of data platform acquisition, file layout due to shared information is all the same, so be easy to integrate, thus reduce the difficulty of developer to the exploitation of upper layer application.
Embodiment
For the purpose of quoting and know, the explanation of the technical term hereinafter used, write a Chinese character in simplified form or abridge and be summarized as follows:
REST:Representational State Transfer, access control style;
TCP:Transmission Control Protocol, transmission control protocol.
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Refer to accompanying drawing 1, be a kind of schematic flow sheet being applied to the data sharing method of data platform that the embodiment of the present invention provides, the method comprises:
Step S101: the request of accessing the first shared device in response to user, from the corresponding relation of the facility information of shared device of each access prestored, sensing passage information and sensing data, obtain and identify the first corresponding sensing data with the device identification of the first shared device and sensing passage.
Above-mentioned request comprises the device identification of the first shared device and the sensing passage mark of the first shared device.The structure of above-mentioned request is corresponding with the corresponding relation of facility information, sensing passage information and sensing data.
Facility information comprises device identification, and sensing passage information comprises sensing passage mark.
Facility information can also comprise the attribute information of the equipment such as model, the size of equipment, the state of equipment of equipment.Sensing passage information can also comprise the function information of equipment.
First shared device can be sensor.Such as there is temperature sensor etc. in weather bureau, temperature sensor can detect the temperature of air, the management system of weather bureau can receive the air themperature that temperature sensor detects, the management system of weather bureau can as a shared device, and the air themperature data upload that temperature sensor can detect by weather bureau is to data platform.Above-mentioned sensing data can comprise this air themperature data.
Step S102: the first sensing data is fed back to user.
This first sensing data can be sent to this user with the form of response, and the structure of this response is corresponding with the corresponding relation of facility information, sensing passage information and sensing data.
Embodiments provide a kind of data sharing method being applied to data platform, the facility information of each access shared device is stored in data platform, the corresponding relation of sensing passage information and sensing data, this corresponding relation goes for the sensing node in nearly all Internet of Things, after information is uploaded to data platform by namely all sensing nodes, the form stored at data platform can be all facility information, the corresponding relation of sensing passage information and sensing data, so user is after the shared information of data platform acquisition, file layout due to shared information is all the same, so be easy to integrate, thus reduce the difficulty of developer to the exploitation of upper layer application.
Further, because the data structure of request mutual between user with data platform and response is also corresponding with the corresponding relation of facility information, sensing passage information and sensing data, so can the data structure of the mutual request between user and data platform and response be carried out open, so that other users also can adopt this data structure and data platform to carry out alternately, thus each communication interface on data platform is unified, thus the communications cost between user and data platform is reduced.
Refer to Fig. 2, be a kind of method flow schematic diagram being applied in the data sharing method of data platform a kind of implementation of method of the corresponding relation obtaining facility information, sensing passage information and sensing data that the embodiment of the present invention provides, the method comprises:
Step S201: during instruction in response to shared device access data platform, obtains facility information and the sensing passage information of shared device.
Each shared device can be counted as each sensing node in Internet of Things, and shared device is when access data platform, and data platform can the facility information of this shared device of active obtaining and sensing passage information.Also can be that shared device is initiatively for data platform provides facility information and the sensing passage information of shared device.
Each shared device all has self facility information and sensing passage information.
Above-mentioned shared device cut-in method can be the Internet of Things resource access method based on rest pattern.In the method, shared device is by the http api reporting equipment information of restfull, sensing passage information and sensing data, and these information carry out mapping and storing with the facility information-Resource TOC structure of sensing passage information-sensing data on data platform.Internet of Things application developer can read by the http api of restfull the facility information, sensing passage information and the sensing data that are stored on data platform again.The method helps Internet of Things developer access shared device and manage shared device, stores the sensing data of shared device, and supports the Reverse Turning Control to shared device.This method provide unified restfull access module, provide convenient for developer develops Internet of Things application, save development cost.
Step S202: receive the sensing data corresponding with sensing passage information that shared device gathers.
Shared device can gather a secondary data every Preset Time, so sensing data can comprise the data of acquisition time data and shared device collection.The request that corresponding above-mentioned user accesses the first shared device can comprise acquisition time data.When the sensing passage of device identification and the first shared device that above-mentioned request comprises the first shared device identifies, the data feedback of all time periods that the first shared device can gather by data platform is to this user, or calculate the data of the time period needed for this user according to the browsing histories of this user, by the data feedback in this time period to this user.
Step S203: the corresponding relation of storing device information, sensing passage information and sensing data.
The corresponding relation of facility information, sensing passage information and sensing data can be stored in data platform in table form, or be stored in data platform with the form of structure, the embodiment of the present invention does not do concrete restriction to the file layout of the corresponding relation of the said equipment information, sensing passage information and sensing data.
Based on the three layer model structure of facility information-sensing passage information-sensing data, make the storage of the data in data platform form good bibliographic structure, fetch for shared device access and sensing data and provide clear and succinct access stencil.The interface url of the rest style of this three layer model structure can as table 1 (only listing part of interface):
Table 1
At the data storage layer of data platform, the corresponding relation of facility information, sensing passage information and sensing data with the Resource TOC structure of rest style for model basis, can set up the concrete model of good rest presentation state-transition as shown in Figure 3.
In Fig. 3, Device301 represents an actual shared device, and Datastream represents the sensing passage information of shared device, and Datapoint304 represents sensing data.
Shared device shown in Fig. 3 comprises Datastream302 and Datastream303, the sensing data that Datastream302 is corresponding comprises 12,25,17, the sensing data that Datastream303 is corresponding comprises: 12,25,17, the sensing data that Datastream301 and Datastream302 is corresponding can be the same or different, and concrete can determine according to actual conditions.
In the prior art in construction networked platforms, data platform carries the weighty responsibility of connection device and application, need to possess large data to store, the functions such as the monitoring of each equipment state and countercharge in real time, the developer of each Internet of Things is so just needed all to need the huge data platform oneself going structure one such, workload is very big, even for some Small Groups, just hold such development difficulty of daring not accept at all, and the data sharing method being applied to data platform that the embodiment of the present invention provides, developer can be helped to access shared device and management shared device, and the sensing data that Storage sharing equipment provides, thus make exploitation convenient and swift, greatly reduce development cost.Share in this at sensing data, traditional pattern be all based on application layer service share, cannot formulate unified interface, the form of sensing data is also different.And the data sharing method being applied to data platform that the embodiment of the present invention provides carries out sharing of information in equipment aspect, according to the three layer model structure of facility information-sensing passage information-sensing data, define unified message structure, accomplish the consistent of shared information.Meanwhile, data platform by issuing easily, can be subscribed to function, allowing developer share voluntarily and to subscribe to shared device, can really realize freely sharing of Internet of Things resource.
Refer to Fig. 4, be a kind of method flow diagram being applied to a kind of implementation of method of password authentication in the data sharing method of data platform that the embodiment of the present invention provides, this method of password authentication comprises:
Step S401: receive the user name of user's input and the password of input.
User name and the password of input of user's input can be after data platform detects that the first shared device is verified the application information that user submits, for user's distribution.
In order to ensure the safety of sensing data in data platform, can be each user's distributing user name and password.
Suppose the information that other users need pay-for-access first shared device and issue on data platform, then need submit applications information on data platform, payment information can be comprised in this application information, after first shared device finds this application information in data platform, and determine that the user of this application information pays, then confirm that the application information of this user is verified, data platform can at random for this user distributes a username and password.Lift an object lesson to be below described, after other developers search interested shared device, access application is initiated to this shared device owner, the owner of this shared device audits application information, after examination & verification is verified, data platform is by access key corresponding with this application information for generation one.The sensing data of http api to this shared device that applicant calls restfull by this key conducts interviews.By this free shared model based on web, developer can accomplish sharing of information in equipment aspect, realizes the convergence of capacity of equipment.
If the information that the first shared device is issued on data platform is free, other users are when the data that access first shared device is issued, and can not need submit applications information, data platform does not need for other user's distributing user name and password.
Step S402: according to the corresponding relation of the username and password prestored, obtains the first password that the user name of user's input is corresponding.
Step S403: when the password that user inputs and first password match, determine to be verified.
The authentication that can be conducted interviews by the information in httpheader in rest interface and control.Parameter concrete in Header can comprise api-user-id (access developer id) and api-key (access key and password).When the application of developer or equipment need to be undertaken mutual by api and data platform time, need to provide api-user-id and api-key.
Above-mentioned arbitrary data platform be applied in the data sharing method embodiment of data platform can also be used for: when detecting that the first sensing data of the first shared device collection belongs to preset range, comprise the instruction of the first parameter of adjustment first shared device to the first shared device feedback, the first parameter operates accordingly for triggering the first shared device.
Above-mentioned preset range can for being more than or equal to the first predetermined threshold value, then the first parameter can gather sensing data higher than described first predetermined threshold value for triggering the first shared device.
Above-mentioned preset range can for being less than or equal to the second predetermined threshold value, then the first parameter can gather sensing data lower than the second predetermined threshold value for triggering the first shared device.
Or the first parameter is closed for triggering the first shared device or is opened etc.
The embodiment of the present invention does not specifically limit above-mentioned " operating accordingly ", can determine according to actual conditions, the owner of shared device can log in the web site of data platform, configures the facility information (if there is access key, can also arrange access key) of all kinds of shared devices of oneself.Shared device can by unified Rest style api to facility information on data platform (if there is access key, also needing to upload access key), and shared device can also be connect by TCP and platform foundation countercharge long-chain simultaneously.After shared device completes access, developer equally by unified Rest style api to data platform inquiry apparatus information, sensing passage information, such as, and can carry out real-time countercharge to shared device, " triggering the first shared device to operate accordingly " is exactly an example of countercharging to shared device.
Above-mentioned arbitrary being applied to can for accessing the pattern of shared device and shared device in the data sharing method embodiment of data platform based on the restfull http api pattern of web.This pattern is compared with traditional webservice, succinctly, more easy-to-use, and the Resource TOC structure exposed is unified, is convenient to the access of the application indifference of various shared device.
Describe method in detail in embodiment disclosed in the invention described above, the device of various ways can be adopted to realize for method of the present invention, therefore the invention also discloses a kind of device, provide specific embodiment below and be described in detail.
Refer to Fig. 5, be a kind of structural representation being applied to the data sharing device of data platform that the embodiment of the present invention provides, this device comprises: the first acquisition module 501 and sending module 502, wherein:
First acquisition module 501, for accessing the request of the first shared device in response to user, from the corresponding relation of the facility information of shared device of each access prestored, sensing passage information and sensing data, obtain and identify the first corresponding sensing data with the device identification of the first shared device and sensing passage.
Above-mentioned request comprises the device identification of the first shared device and the sensing passage mark of the first shared device, and facility information comprises device identification, and sensing passage information comprises sensing passage mark.
Facility information can also comprise the attribute information of the equipment such as model, the size of equipment, the state of equipment of equipment.Sensing passage information can also comprise the function information of equipment.
First shared device can be sensor.Such as there is temperature sensor etc. in weather bureau, temperature sensor can detect the temperature of air, the management system of weather bureau can receive the air themperature that temperature sensor detects, the management system of weather bureau can as a shared device, and the air themperature data upload that temperature sensor can detect by weather bureau is to data platform.Above-mentioned sensing data can comprise this air themperature data.
Sending module 502, for feeding back to user by the first sensing data.
This first sensing data can be sent to this user with the form of response, and the structure of this response is corresponding with the corresponding relation of facility information, sensing passage information and sensing data.
Embodiments provide a kind of data sharing device being applied to data platform, the facility information of each access shared device is stored in data platform, the corresponding relation of sensing passage information and sensing data, this corresponding relation goes for the sensing node in nearly all Internet of Things, after information is uploaded to data platform by namely all sensing nodes, the form stored at data platform can be all facility information, the corresponding relation of sensing passage information and sensing data, so user is after the shared information of data platform acquisition, file layout due to shared information is all the same, so be easy to integrate, thus reduce the difficulty of developer to the exploitation of upper layer application.
Further, because the data structure of request mutual between user with data platform and response is also corresponding with the corresponding relation of facility information, sensing passage information and sensing data, so can the data structure of the mutual request between user and data platform and response be carried out open, so that other users also can adopt this data structure and data platform to carry out alternately, thus each communication interface on data platform is unified, thus the communications cost between user and data platform is reduced.
Refer to Fig. 6, for a kind of structural representation being applied in the data sharing device of data platform a kind of implementation of device of the corresponding relation obtaining facility information, sensing passage information and sensing data that the embodiment of the present invention provides, this device comprises: the second acquisition module 601, receiver module 602 and memory module 603, wherein:
Second acquisition module 601, during for instruction in response to shared device access data platform, obtains facility information and the sensing passage information of shared device.
Each shared device can be counted as each sensing node in Internet of Things, and shared device is when access data platform, and data platform can the facility information of this shared device of active obtaining and sensing passage information.Also can be that shared device is initiatively for data platform provides facility information and the sensing passage information of shared device.
Each shared device all has self facility information and sensing passage information.
Above-mentioned shared device cut-in method can be the Internet of Things resource access method based on rest pattern.In the method, shared device is by the http api reporting equipment information of restfull, sensing passage information and sensing data, and these information carry out mapping and storing with the facility information-Resource TOC structure of sensing passage information-sensing data on data platform.Internet of Things application developer can read by the http api of restfull the facility information, sensing passage information and the sensing data that are stored on data platform again.The method helps Internet of Things developer access shared device and manage shared device, stores the sensing data of shared device, and supports the Reverse Turning Control to shared device.This method provide unified restfull access module, provide convenient for developer develops Internet of Things application, save development cost.
Receiver module 602, for receiving the sensing data corresponding with sensing passage information that shared device gathers.
Shared device can gather a secondary data every Preset Time, so sensing data can comprise the data of acquisition time data and shared device collection.The request that corresponding above-mentioned user accesses the first shared device can comprise acquisition time data.When the sensing passage of device identification and the first shared device that above-mentioned request comprises the first shared device identifies, the data feedback of all time periods that the first shared device can gather by data platform is to this user, or calculate the data of the time period needed for this user according to the browsing histories of this user, by the data feedback in this time period to this user.
Memory module 603, for the corresponding relation of storing device information, sensing passage information and sensing data.
The corresponding relation of facility information, sensing passage information and sensing data can be stored in data platform in table form, or be stored in data platform with the form of structure, the embodiment of the present invention does not do concrete restriction to the file layout of the corresponding relation of the said equipment information, sensing passage information and sensing data.
Refer to Fig. 7, for a kind of structural representation being applied to a kind of implementation of password authentication module in the data sharing device of data platform that the embodiment of the present invention provides, this password authentication module comprises: receiving element 701, acquiring unit 702 and determining unit 703, wherein:
Receiving element 701, for receiving user name and the password of input of user's input.
User name and the password of input of user's input can be after data platform detects that the first shared device is verified the application information that user submits, for user's distribution.
In order to ensure the safety of sensing data in data platform, can be each user's distributing user name and password.
Suppose the information that other users need pay-for-access first shared device and issue on data platform, then need submit applications information on data platform, payment information can be comprised in this application information, after first shared device finds this application information in data platform, and determine that the user of this application information pays, then confirm that the application information of this user is verified, data platform can at random for this user distributes a username and password.Lift an object lesson to be below described, after other developers search interested shared device, access application is initiated to this shared device owner, the owner of this shared device audits application information, after examination & verification is verified, data platform is by access key corresponding with this application information for generation one.The sensing data of http api to this shared device that applicant calls restfull by this key conducts interviews.By this free shared model based on web, developer can accomplish sharing of information in equipment aspect, realizes the convergence of capacity of equipment.
If the information that the first shared device is issued on data platform is free, other users are when the data that access first shared device is issued, and can not need submit applications information, data platform does not need for other user's distributing user name and password.
Acquiring unit 702, for the corresponding relation according to the username and password prestored, obtains the first password that the user name of user's input is corresponding.
Determining unit 703, for when the password that user inputs and first password match, determines to be verified, and triggers the first acquisition module.
The authentication that can be conducted interviews by the information in httpheader in rest interface and control.Parameter concrete in Header can comprise api-user-id (access developer id) and api-key (access key and password).When the application of developer or equipment need to be undertaken mutual by api and data platform time, need to provide api-user-id and api-key.
A kind of data sharing device being applied to data platform that the embodiment of the present invention provides can also comprise: control module, during for detecting that the first sensing data of the first shared device collection belongs to preset range, comprise the instruction of the first parameter of adjustment first shared device to the first shared device feedback, the first parameter operates accordingly for triggering the first shared device.
Above-mentioned preset range can for being more than or equal to the first predetermined threshold value, then the first parameter can gather sensing data higher than described first predetermined threshold value for triggering the first shared device.
Above-mentioned preset range can for being less than or equal to the second predetermined threshold value, then the first parameter can gather sensing data lower than the second predetermined threshold value for triggering the first shared device.
Or the first parameter is closed for triggering the first shared device or is opened etc.
The embodiment of the present invention does not specifically limit above-mentioned " operating accordingly ", can determine according to actual conditions, the owner of shared device can log in the web site of data platform, configures the facility information (if there is access key, can also arrange access key) of all kinds of shared devices of oneself.Shared device can by unified Rest style api to facility information on data platform (if there is access key, also needing to upload access key), and shared device can also be connect by TCP and platform foundation countercharge long-chain simultaneously.After shared device completes access, developer equally by unified Rest style api to data platform inquiry apparatus information, sensing passage information, such as, and can carry out real-time countercharge to shared device, " triggering the first shared device to operate accordingly " is exactly an example of countercharging to shared device.
It should be noted that, each embodiment in this specification all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.For device or system class embodiment, due to itself and embodiment of the method basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
Also it should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operating space, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical element.
The software module that the method described in conjunction with embodiment disclosed herein or the step of algorithm can directly use hardware, processor to perform, or the combination of the two is implemented.Software module can be placed in the storage medium of other form any known in random asccess memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technical field.
To the above-mentioned explanation of the disclosed embodiments, professional and technical personnel in the field are realized or uses the present invention.To be apparent for those skilled in the art to the multiple amendment of these embodiments, General Principle as defined herein can without departing from the spirit or scope of the present invention, realize in other embodiments.Therefore, the present invention can not be restricted to these embodiments shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.