CN105117270A - Sensor simulation method and apparatus - Google Patents

Sensor simulation method and apparatus Download PDF

Info

Publication number
CN105117270A
CN105117270A CN201510456938.9A CN201510456938A CN105117270A CN 105117270 A CN105117270 A CN 105117270A CN 201510456938 A CN201510456938 A CN 201510456938A CN 105117270 A CN105117270 A CN 105117270A
Authority
CN
China
Prior art keywords
client
service end
sensing data
predetermined format
data
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.)
Granted
Application number
CN201510456938.9A
Other languages
Chinese (zh)
Other versions
CN105117270B (en
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.)
Baidu Online Network Technology Beijing Co Ltd
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201510456938.9A priority Critical patent/CN105117270B/en
Publication of CN105117270A publication Critical patent/CN105117270A/en
Application granted granted Critical
Publication of CN105117270B publication Critical patent/CN105117270B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Telephonic Communication Services (AREA)

Abstract

The invention aims to provide a sensor simulation method and apparatus. A client 2 obtains external sensor, converts the external sensor data to be in a predetermined format capable of communicating with a server 1, and sends the external sensor data to the server 1; and the server 1 obtains the sensor data in the predetermined format, sent by the client 2, converts the sensor data to be in a device related format available for a corresponding application, and provides the sensor data for the corresponding application to use, so that a device without a sensor hardware module also can obtain and use the sensor data, the operational efficiency of the device is improved, and the user experience is improved. The sensor simulation method and apparatus have relatively good security and flexibility; an external sensor event source does not directly communicate with the server 1; and a communication format between the client 2 and the server 1 does not need to be exposed to the outside.

Description

A kind of method and apparatus for analog sensor
Technical field
The present invention relates to field of computer technology, particularly relate to a kind of method and apparatus for analog sensor.
Background technology
At present, on the equipment not possessing sensor hardware module, use if want the application needing sensing data, usually all need to revise application source code.The sensor that these application can not use Android framework to provide is correlated with API, and wants the API that operational version itself provides, and as Sensor Analog Relay System device, they all can provide a set of api interface similar with Android framework.
The maximum defect of these schemes is to need to change application itself, cannot obtain application source code, or when cannot change application, these scheme complete failures.But the application source code of overwhelming majority application almost cannot obtain.
Therefore, how analog sensor, makes user can use the application needing sensing data on the equipment not possessing sensor hardware module, becomes one of those skilled in the art's problem needing solution badly.
Summary of the invention
The object of this invention is to provide a kind of method and apparatus for analog sensor.
According to an aspect of the present invention, provide a kind of for the method at service end analog sensor, wherein, the method comprises the following steps:
A obtains the sensing data that corresponding client sends, and wherein, described sensing data sends in a predetermined format;
B converts the described sensing data of predetermined format the sensing data of equipment related pattern to, and is provided to corresponding application.
According to another aspect of the present invention, additionally provide a kind of for the method at client simulation sensor, wherein, the method comprises the following steps:
A obtains external sensor data;
B converts described external sensor data the sensing data of predetermined format to;
Described sensing data is sent to corresponding service end with described predetermined format by C.
According to a further aspect of the invention, additionally provide a kind of service end for analog sensor, wherein, this service end comprises:
First acquisition device, for obtaining the sensing data that corresponding client sends, wherein, described sensing data sends in a predetermined format;
Generator, for the described sensing data of predetermined format being converted to the sensing data of equipment related pattern, and is provided to corresponding application.
According to a further aspect of the invention, additionally provide a kind of client for analog sensor, wherein, this client comprises:
Second acquisition device, for obtaining external sensor data;
Conversion equipment, for converting the sensing data of predetermined format to by described external sensor data;
Dispensing device, for sending to corresponding service end by described sensing data with described predetermined format.
According to a further aspect of the invention, additionally provide a kind of TV box, comprise service end as above, and client as above.
Compared with prior art, in the present invention, client 2 obtains external sensor data, convert to the predetermined format that can communicate between service end 1 and be sent to this service end 1, service end 1 obtains the sensing data of the predetermined format that this client 2 sends, convert the equipment related pattern that corresponding application is available again to, and be provided to corresponding application use, make the equipment not possessing sensor hardware module also can obtain and use sensing data, improve the efficiency of equipment running, improve the experience of user.
Present invention achieves analog sensor, make at TV box that these lack on the equipment of sensor hardware module, still can produce sensing data and use to upper layer application, and upper layer application does not need to do any change completely.Wherein analog sensor includes but not limited to the sensors such as gravity sensor, acceleration transducer, magnetic field sensor, direction sensor, temperature sensor.
The present invention has good security and dirigibility, and external sensor events source does not directly exchange with service end 1, and the communication format between client 2 and service end 1 does not need external exposure.
Further, service end 1 or client 2, or be arranged in TV box both it simultaneously, client 2 obtains external sensor data, convert to the predetermined format that can communicate between service end 1 and be sent to this service end 1, service end 1 obtains the sensing data of the predetermined format that this client 2 sends, convert the equipment related pattern that corresponding application is available again to, and be provided to corresponding application use, solve the problem that cannot use sensor on TV box, the classification of spendable application on TV box and quantity are increased greatly, the application that originally cannot use on TV box (such as needs gravity sensing, acceleration, the application of direction sensor etc.) can easily use on TV box.
Accompanying drawing explanation
By reading the detailed description done non-limiting example done with reference to the following drawings, other features, objects and advantages of the present invention will become more obvious:
Fig. 1 is the structural representation of the device of the service end for analog sensor of one embodiment of the invention;
Fig. 2 is the structural representation of the device of the client for analog sensor of one embodiment of the invention;
Fig. 3 is the schematic flow sheet for the method at service end analog sensor of one embodiment of the invention;
Fig. 4 is the schematic flow sheet for the method at client simulation sensor of another embodiment of the present invention.
In accompanying drawing, same or analogous Reference numeral represents same or analogous parts.
Embodiment
Before in further detail exemplary embodiment being discussed, it should be mentioned that some exemplary embodiments are described as the process or method described as process flow diagram.Although operations is described as the process of order by process flow diagram, many operations wherein can be implemented concurrently, concomitantly or simultaneously.In addition, the order of operations can be rearranged.Described process can be terminated when its operations are completed, but can also have the additional step do not comprised in the accompanying drawings.Described process can correspond to method, function, code, subroutine, subroutine etc.
Method (some of them are illustrated by process flow diagram) discussed below can be implemented by hardware, software, firmware, middleware, microcode, hardware description language or its combination in any.When implementing by software, firmware, middleware or microcode, program code or code segment in order to implement necessary task can be stored in machine or computer-readable medium (such as storage medium).(one or more) processor can implement necessary task.
Concrete structure disclosed herein and function detail are only representational, and are the objects for describing exemplary embodiment of the present invention.But the present invention can carry out specific implementation by many replacement forms, and should not be construed as only being limited to the embodiments set forth herein.
Should be understood that, although may have been used term " first ", " second " etc. here to describe unit, these unit should not limit by these terms.These terms are used to be only used to a unit and another unit to distinguish.For example, when not deviating from the scope of exemplary embodiment, first module can be called as second unit, and second unit can be called as first module similarly.Here used term "and/or" comprise one of them or more any and all combinations of listed associated item.
Should be understood that, when a unit is called as " connection " or " coupling " to another unit, it can directly connect or be coupled to another unit described, or can there is temporary location.On the other hand, " when being directly connected " or " directly coupled " to another unit, then there is not temporary location when a unit is called as.Should explain in a comparable manner the relation be used between description unit other words (such as " and be in ... between " compared to " and be directly in ... between ", " with ... contiguous " compared to " and with ... be directly close to " etc.).
Here used term is only used to describe specific embodiment and be not intended to limit exemplary embodiment.Unless context refers else clearly, otherwise singulative used here " ", " one " are also intended to comprise plural number.It is to be further understood that, the existence of the feature that term used here " comprises " and/or " comprising " specifies to state, integer, step, operation, unit and/or assembly, and do not get rid of and there is or add other features one or more, integer, step, operation, unit, assembly and/or its combination.
Also it should be mentioned that and to replace in implementation at some, the function/action mentioned can according to being different from occurring in sequence of indicating in accompanying drawing.For example, depend on involved function/action, in fact the two width figure in succession illustrated can perform simultaneously or sometimes can perform according to contrary order substantially.
Below in conjunction with accompanying drawing, the present invention is described in further detail.
Fig. 1 is the structural representation of the device of the service end for analog sensor of one embodiment of the invention.Service end 1 comprises the first acquisition device 101 and generator 102.
Wherein, the first acquisition device 101 of service end 1 obtains the sensing data that corresponding client 2 sends, and wherein, described sensing data sends in a predetermined format.
Particularly, client 2 obtains external sensor data; Described external sensor data are converted to the sensing data of predetermined format; And then, described sensing data is sent to corresponding service end 1 with described predetermined format; The communication mode of the first acquisition device 101 in service end 1 namely by arranging with this client 2, obtains the sensing data that this client 2 sends with this predetermined format.
Preferably, this first acquisition device 101 also can in conjunction with simulated sensor data storehouse, and obtain the sensing data that this client 2 sends with this predetermined format, concrete combination will be described in detail hereinafter.
At this, sensing data comprises but is not limited to gravity sensor data, acceleration transducer data, magnetic field sensor data, direction sensor data, temperature sensor data etc.It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; any other sensing data that is existing or that may occur from now on is as being applicable to the present invention; also within scope should being included in, and this is contained at this with way of reference.
The described sensing data of predetermined format is converted to the sensing data of equipment related pattern by the generator 102 of service end 1, and is provided to corresponding application.
Particularly, the sensing data with this predetermined format that generator 102 obtains according to this first acquisition device 101, convert thereof into the sensing data of equipment related pattern, and the communication mode by arranging with corresponding application, the sensing data with this equipment related pattern is provided to the application of this correspondence.
At this, sensing data is converted to the corresponding spendable equipment related pattern of application by this service end 1, uses to facilitate application.At this, apply the racing car etc. including but not limited to utilize the balanced ball of gravity sensing, utilize the compass in magnetic field, utilize acceleration and direction controlling.It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; any other application that is existing or that may occur from now on is as being applicable to the present invention; also within scope should being included in, and this is contained at this with way of reference.
Such as, suppose to be applied as racing car, user is manipulated by mobile phone, then this mobile phone is connected with client 2, and the sensing data such as such as acceleration transducer data, direction sensor data that himself produces is sent to this client 2, client 2 obtains these external sensor data and converts the sensing data of predetermined format to, and then is sent to this service end 1; First acquisition device 101 of service end 1 obtains the acceleration transducer data, direction sensor data etc. of this predetermined format, these sensing datas are converted to the spendable equipment related pattern of this race car applications by generator 102, and are supplied to this race car applications and use.
At this, client 2 obtains external sensor data, convert to the predetermined format that can communicate between service end 1 and be sent to this service end 1, service end 1 obtains the sensing data of the predetermined format that this client 2 sends, convert the equipment related pattern that corresponding application is available again to, and be provided to corresponding application use, make the equipment not possessing sensor hardware module also can obtain and use sensing data, improve the efficiency of equipment running, improve the experience of user.
At this, service end 1 and client 2 can be arranged in and anyly need sensing data and lack the equipment of related sensor hardware module.
Preferably, this service end 1 can be arranged in TV box, and this client 2 also can be arranged in TV box.More preferably, this service end 1 and client 2 can be arranged in TV box simultaneously.
At this, service end 1 or client 2, or be arranged in TV box both it simultaneously, client 2 obtains external sensor data, convert to the predetermined format that can communicate between service end 1 and be sent to this service end 1, service end 1 obtains the sensing data of the predetermined format that this client 2 sends, convert the equipment related pattern that corresponding application is available again to, and be provided to corresponding application use, solve the problem that cannot use sensor on TV box, the classification of spendable application on TV box and quantity are increased greatly, the application that originally cannot use on TV box (such as needs gravity sensing, acceleration, the application of direction sensor etc.) can easily use on TV box.
Preferably, this service end 1 also comprises monitoring device (not shown), and this monitoring device creates local socket and monitors; Wherein, described first acquisition device 101 is when described client 2 sends described sensing data, and by described local socket, obtain the described sensing data that described client 2 sends, wherein, described sensing data sends with described predetermined format.
Particularly, the monitoring device of service end 1 creates local socket, and monitor this socket, once client 2 is by this local socket, send sensing data to this service end 1 with above-mentioned predetermined format, this monitoring device such as with the communication mode of agreement, notifies the first acquisition device 101 of this service end 1, namely this first acquisition device 101 by this local socket, obtains the sensing data that this client 2 sends.Preferably, this first acquisition device 101 also in conjunction with simulated sensor data storehouse, can obtain the sensing data that this client 2 is sent with this predetermined format by this local socket.
More preferably, this service end 1 also comprises adding set (not shown), and described new client, when having new client's side link to described local socket, is added into monitoring queue by this adding set.
Particularly, when having new client's side link to this local socket, the adding set of service end 1 is added into monitoring queue by this new client.Each client in this monitoring queue monitored by the monitoring device of service end 1, when these clients are by this local socket, when sending sensing data to this service end 1 in a predetermined format, first acquisition device 101 of this service end 1, namely by this local socket, obtains the sensing data that these clients send.
At this, service end 1 can also create local socket and monitor, and when there being new client's side link to this local socket, this new client being added into monitoring queue and monitoring, when client has sensing data to send, obtained by this socket.
Preferably, this service end 1 also comprises charger (not shown), this charger loading simulation sensor database, and wherein, in described simulated sensor data storehouse, definition has simulated sensor data; Wherein, described first acquisition device 101, based on described simulated sensor data storehouse, obtains the sensing data that described client sends.
Particularly, the charger loading simulation sensor database of service end 1, such as, when this service end 1 starts, this charger and loading simulation sensor database, this simulated sensor data storehouse such as exists with the form of sensors.so shared library, wherein, in described simulated sensor data storehouse, definition has simulated sensor data, includes but not limited to the information such as title, manufacturer's information, classification, scope, precision.
Subsequently, the first acquisition device 101 of service end 1, based on described simulated sensor data storehouse, obtains the sensing data that described client 2 sends.Such as, client 2 is when sending sensing data, only have sent numerical information, and do not send unit information, when first acquisition device 101 obtains the sensing data that client 2 sends, determine the manufacturer's information corresponding to this sensing data, suppose that the sensor of each manufacturers produce all has fixing unit information, this first acquisition device 101 can according to this manufacturer's information, determine should the unit information of manufacturer's information in this simulated sensor data storehouse, and then finally determine corresponding sensing data.
At this, simulated sensor data storehouse can be arranged in this service end 1, also can be arranged in the third party device be connected by network with this service end 1.
At this, suppose that this service end 1 adopts Android agreement, then service end 1 follows AndroidHAL framework specification, simulated sensor data storehouse such as exists with the form of sensors.so shared library in AndroidROM, and android system can load this simulated sensor data storehouse in modular form when startup completes.In sensors.so, define various sensing data, include but not limited to the information such as title, manufacturer's information, classification, scope, precision.Sensors.so creates a local unixlocalsocket in the activate stage of HAL and monitors this socket.In order to raise the efficiency, this service end 1 can adopt Linuxepoll mechanism to monitor whether have client's side link.Afterwards, by epoll, each HAL layer, when poll calls, all can check whether whether client's side link and client have data to send, if there is client's side link, then new client joined epoll and monitors queue; If there is new client data, then resolve sensing data in the specific format after reading buffer memory, return to HAL layer.Sensing data can be passed to upper layer application by the SensorsAPI of Android framework by HAL layer further.
Fig. 2 is the structural representation of the device of the client for analog sensor of one embodiment of the invention.This client 2 comprises the second acquisition device 201, conversion equipment 202 and dispensing device 203.
Wherein, the second acquisition device 201 obtains external sensor data.
Particularly, client 2, by the connected mode of agreement, connects external sensor, and when this external sensor produces sensing data, the second acquisition device 201 of this client 2, namely by the communication mode of agreement, obtains its external sensor data.At this, the existence form in external sensor events source is varied, and such as, using mobile phone as carrier, the various external sensor data that mobile phone itself produces are sent to client 2, and the second acquisition device 201 of client 2 can obtain these external sensor data.
Such as, suppose to be applied as racing car, user is manipulated by mobile phone, then this mobile phone is connected with client 2, and the sensing data such as such as acceleration transducer data, direction sensor data that himself produces is sent to this client 2, the second acquisition device 201 of client 2 can obtain these external sensor data such as acceleration transducer data, direction sensor data.
It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; the mode of any other acquisition external sensor data that are existing or that may occur from now on; as being applicable to the present invention, within also scope should being included in, and be contained in this at this with way of reference.
Conversion equipment 202 converts described external sensor data the sensing data of predetermined format to.
Particularly, conversion equipment 202 converts the external sensor data that this second acquisition device 201 obtains the sensing data of predetermined format to, and this predetermined format facilitates this client 2 to communicate with service end 1.
Subsequently, described sensing data is sent to corresponding service end 1 with described predetermined format by dispensing device 203.
Particularly, the sensing data of the predetermined format that this conversion equipment 202 is converted to by dispensing device 203, is sent to corresponding service end 1.At this, described predetermined format is such as only between service end 1 and client 2 and carries out intercommunicating form, and does not need external exposure.
Preferably, described sensing data, by the socket of described service end 1, is sent to described service end 1 with described predetermined format by described dispensing device 203.
Particularly, service end 1 establishes local socket, such as, monitoring device on it creates local socket and monitors, the dispensing device 203 of client 2 is namely by the socket of this service end 1, by the sensing data of the predetermined format that this conversion equipment 202 is converted to, be sent to corresponding service end 1 in a predetermined format.
Preferably, described client 2 connects the socket of described service end 1 when starting.
Particularly, this client 2, when starting, can be connected to the socket of this service end 1, and this service end 1 is when this client 2 connects, this client 2 is added monitoring queue to monitor, if this client 2 sends sensing data to this service end 1 in a predetermined format, then obtain.
At this, client 2, as data channel, links up external sensor events source and service end 1.The socket of meeting Connection Service end 1 when client 2 starts.Client 2 obtains external sensor data, convert to and predetermined format special between service end 1 be sent to this service end 1, service end 1 obtains the sensing data of the predetermined format that this client 2 sends, convert the equipment related pattern that corresponding application is available again to, and be provided to the application of this correspondence.
Such as, suppose to be applied as racing car, user is manipulated by mobile phone, then this mobile phone is connected with client 2, and the sensing data such as such as acceleration transducer data, direction sensor data that himself produces is sent to this client 2.Second acquisition device 201 of client 2 obtains these external sensor data; Conversion equipment 202 converts these external sensor data the sensing data of predetermined format to; And then these sensing datas, by the local socket of this service end 1, with this predetermined format, are sent to this service end 1 by dispensing device 203.The monitoring device of service end 1 is monitored this local socket and is known that this client 2 sends sensing data in a predetermined format; First acquisition device 101 obtains the acceleration transducer data, direction sensor data etc. of this predetermined format; Subsequently, these sensing datas are converted to the spendable equipment related pattern of this race car applications by generator 102, and are supplied to this race car applications and use.
Fig. 3 is the schematic flow sheet for the method at service end analog sensor of one embodiment of the invention.
In step S301, service end 1 obtains the sensing data that corresponding client 2 sends, and wherein, described sensing data sends in a predetermined format.
Particularly, client 2 obtains external sensor data; Described external sensor data are converted to the sensing data of predetermined format; And then, described sensing data is sent to corresponding service end 1 with described predetermined format; In step S301, the communication mode of service end 1 namely by arranging with this client 2, obtains the sensing data that this client 2 sends with this predetermined format.
Preferably, this service end 1 also can in conjunction with simulated sensor data storehouse, and obtain the sensing data that this client 2 sends with this predetermined format, concrete combination will be described in detail hereinafter.
At this, sensing data comprises but is not limited to gravity sensor data, acceleration transducer data, magnetic field sensor data, direction sensor data, temperature sensor data etc.It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; any other sensing data that is existing or that may occur from now on is as being applicable to the present invention; also within scope should being included in, and this is contained at this with way of reference.
In step s 302, service end 1 converts the described sensing data of predetermined format the sensing data of equipment related pattern to, and is provided to corresponding application.
Particularly, in step s 302, service end 1 is according to the sensing data with this predetermined format obtained in step S301, convert thereof into the sensing data of equipment related pattern, and the communication mode by arranging with corresponding application, the sensing data with this equipment related pattern is provided to the application of this correspondence.
At this, sensing data is converted to the corresponding spendable equipment related pattern of application by this service end 1, uses to facilitate application.At this, apply the racing car etc. including but not limited to utilize the balanced ball of gravity sensing, utilize the compass in magnetic field, utilize acceleration and direction controlling.It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; any other application that is existing or that may occur from now on is as being applicable to the present invention; also within scope should being included in, and this is contained at this with way of reference.
Such as, suppose to be applied as racing car, user is manipulated by mobile phone, then this mobile phone is connected with client 2, and the sensing data such as such as acceleration transducer data, direction sensor data that himself produces is sent to this client 2, client 2 obtains these external sensor data and converts the sensing data of predetermined format to, and then is sent to this service end 1; In step S301, service end 1 obtains the acceleration transducer data, direction sensor data etc. of this predetermined format, in step s 302, these sensing datas are converted to the spendable equipment related pattern of this race car applications by service end 1, and are supplied to this race car applications and use.
At this, client 2 obtains external sensor data, convert to the predetermined format that can communicate between service end 1 and be sent to this service end 1, service end 1 obtains the sensing data of the predetermined format that this client 2 sends, convert the equipment related pattern that corresponding application is available again to, and be provided to corresponding application use, make the equipment not possessing sensor hardware module also can obtain and use sensing data, improve the efficiency of equipment running, improve the experience of user.
At this, service end 1 and client 2 can be arranged in and anyly need sensing data and lack the equipment of related sensor hardware module.
Preferably, this service end 1 can be arranged in TV box, and this client 2 also can be arranged in TV box.More preferably, this service end 1 and client 2 can be arranged in TV box simultaneously.
At this, service end 1 or client 2, or be arranged in TV box both it simultaneously, client 2 obtains external sensor data, convert to the predetermined format that can communicate between service end 1 and be sent to this service end 1, service end 1 obtains the sensing data of the predetermined format that this client 2 sends, convert the equipment related pattern that corresponding application is available again to, and be provided to corresponding application use, solve the problem that cannot use sensor on TV box, the classification of spendable application on TV box and quantity are increased greatly, the application that originally cannot use on TV box (such as needs gravity sensing, acceleration, the application of direction sensor etc.) can easily use on TV box.
Preferably, the method also comprises step S303 (not shown), and in step S303, service end 1 creates local socket and monitors; Wherein, when described client 2 sends described sensing data, in step S301, service end 1 is by described local socket, and obtain the described sensing data that described client 2 sends, wherein, described sensing data sends with described predetermined format.
Particularly, in step S303, service end 1 creates local socket, and monitor this socket, once client 2 is by this local socket, send sensing data, to this service end 1 in step S301 with above-mentioned predetermined format, namely service end 1 by this local socket, obtains the sensing data that this client 2 sends.Preferably, in step S301, service end 1 also in conjunction with simulated sensor data storehouse, can obtain the sensing data that this client 2 is sent with this predetermined format by this local socket.
More preferably, the method also comprises step S304 (not shown), and when having new client's side link to described local socket, in step s 304, described new client is added into monitoring queue by service end 1.
Particularly, when having new client's side link to this local socket, in step s 304, service end 1 is added into monitoring queue by this new client.In step s 304, service end 1 monitors each client in this monitoring queue, when these clients are by this local socket, when sending sensing data to this service end 1 in a predetermined format, in step S301, namely service end 1 by this local socket, obtains the sensing data that these clients send.
At this, service end 1 can also create local socket and monitor, and when there being new client's side link to this local socket, this new client being added into monitoring queue and monitoring, when client has sensing data to send, obtained by this socket.
Preferably, the method also comprises step S305 (not shown), in step S305, and service end 1 loading simulation sensor database, wherein, in described simulated sensor data storehouse, definition has simulated sensor data; Wherein, in step S301, service end 1, based on described simulated sensor data storehouse, obtains the sensing data that described client sends.
Particularly, in step S305, service end 1 loading simulation sensor database, such as, when this service end 1 starts, service end 1 i.e. loading simulation sensor database, this simulated sensor data storehouse such as exists with the form of sensors.so shared library, wherein, in described simulated sensor data storehouse, definition has simulated sensor data, includes but not limited to the information such as title, manufacturer's information, classification, scope, precision.
Subsequently, in step S301, service end 1, based on described simulated sensor data storehouse, obtains the sensing data that described client 2 sends.Such as, client 2 is when sending sensing data, only have sent numerical information, and do not send unit information, in step S301, when service end 1 obtains the sensing data that client 2 sends, determine the manufacturer's information corresponding to this sensing data, suppose that the sensor of each manufacturers produce all has fixing unit information, this service end 1 can according to this manufacturer's information, determine should the unit information of manufacturer's information in this simulated sensor data storehouse, and then finally determine corresponding sensing data.
At this, simulated sensor data storehouse can be arranged in this service end 1, also can be arranged in the third party device be connected by network with this service end 1.
At this, suppose that this service end 1 adopts Android agreement, then service end 1 follows AndroidHAL framework specification, simulated sensor data storehouse such as exists with the form of sensors.so shared library in AndroidROM, and android system can load this simulated sensor data storehouse in modular form when startup completes.In sensors.so, define various sensing data, include but not limited to the information such as title, manufacturer's information, classification, scope, precision.Sensors.so creates a local unixlocalsocket in the activate stage of HAL and monitors this socket.In order to raise the efficiency, this service end 1 can adopt Linuxepoll mechanism to monitor whether have client's side link.Afterwards, by epoll, each HAL layer, when poll calls, all can check whether whether client's side link and client have data to send, if there is client's side link, then new client joined epoll and monitors queue; If there is new client data, then resolve sensing data in the specific format after reading buffer memory, return to HAL layer.Sensing data can be passed to upper layer application by the SensorsAPI of Android framework by HAL layer further.
Fig. 4 is the schematic flow sheet for the method at client simulation sensor of another embodiment of the present invention.
In step S401, client 2 obtains external sensor data.
Particularly, client 2, by the connected mode of agreement, connects external sensor, and when this external sensor produces sensing data, in step S401, namely client 2 by the communication mode of agreement, obtains its external sensor data.At this, the existence form in external sensor events source is varied, and such as, using mobile phone as carrier, the various external sensor data that mobile phone itself produces are sent to client 2, and in step S401, client 2 can obtain these external sensor data.
Such as, suppose to be applied as racing car, user is manipulated by mobile phone, then this mobile phone is connected with client 2, and the sensing data such as such as acceleration transducer data, direction sensor data that himself produces is sent to this client 2, in step S401, client 2 can obtain these external sensor data such as acceleration transducer data, direction sensor data.
It should be noted that; above-mentioned citing is only and technical scheme of the present invention is described better; but not limitation of the present invention; those skilled in the art should understand that; the mode of any other acquisition external sensor data that are existing or that may occur from now on; as being applicable to the present invention, within also scope should being included in, and be contained in this at this with way of reference.
In step S402, client 2 converts described external sensor data the sensing data of predetermined format to.
Particularly, in step S402, client 2 converts the external sensor data obtained in step S401 the sensing data of predetermined format to, and this predetermined format facilitates this client 2 to communicate with service end 1.
Subsequently, in step S403, described sensing data is sent to corresponding service end 1 with described predetermined format by client 2.
Particularly, in step S403, the sensing data of predetermined format that client 2 will be converted in step S402, is sent to corresponding service end 1.At this, described predetermined format is such as only between service end 1 and client 2 and carries out intercommunicating form, and does not need external exposure.
Preferably, in step S403, described sensing data, by the socket of described service end 1, is sent to described service end 1 with described predetermined format by client 2.
Particularly, service end 1 establishes local socket, such as, it creates local socket and monitors, in step S403, client 2, namely by the socket of this service end 1, by the sensing data of predetermined format be converted in step S402, is sent to corresponding service end 1 in a predetermined format.
Preferably, described client 2 connects the socket of described service end 1 when starting.
Particularly, this client 2, when starting, can be connected to the socket of this service end 1, and this service end 1 is when this client 2 connects, this client 2 is added monitoring queue to monitor, if this client 2 sends sensing data to this service end 1 in a predetermined format, then obtain.
At this, client 2, as data channel, links up external sensor events source and service end 1.The socket of meeting Connection Service end 1 when client 2 starts.Client 2 obtains external sensor data, convert to and predetermined format special between service end 1 be sent to this service end 1, service end 1 obtains the sensing data of the predetermined format that this client 2 sends, convert the equipment related pattern that corresponding application is available again to, and be provided to the application of this correspondence.
Such as, suppose to be applied as racing car, user is manipulated by mobile phone, then this mobile phone is connected with client 2, and the sensing data such as such as acceleration transducer data, direction sensor data that himself produces is sent to this client 2.In step S401, client 2 obtains these external sensor data; In step S402, client 2 converts these external sensor data the sensing data of predetermined format to; And then in step S403, these sensing datas, by the local socket of this service end 1, with this predetermined format, are sent to this service end 1 by client 2.Service end 1 is monitored this local socket and is known that this client 2 sends sensing data in a predetermined format; Then, the acceleration transducer data of this predetermined format, direction sensor data etc. are obtained; Subsequently, these sensing datas are converted to the spendable equipment related pattern of this race car applications, and be supplied to this race car applications and use.
It should be noted that the present invention can be implemented in the assembly of software and/or software restraint, such as, each device of the present invention can adopt special IC (ASIC) or any other similar hardware device to realize.In one embodiment, software program of the present invention can perform to realize step mentioned above or function by processor.Similarly, software program of the present invention (comprising relevant data structure) can be stored in computer readable recording medium storing program for performing, such as, and RAM storer, magnetic or CD-ROM driver or flexible plastic disc and similar devices.In addition, steps more of the present invention or function can adopt hardware to realize, such as, as coordinating with processor thus performing the circuit of each step or function.
To those skilled in the art, obviously the invention is not restricted to the details of above-mentioned one exemplary embodiment, and when not deviating from spirit of the present invention or essential characteristic, the present invention can be realized in other specific forms.Therefore, no matter from which point, all should embodiment be regarded as exemplary, and be nonrestrictive, scope of the present invention is limited by claims instead of above-mentioned explanation, and all changes be therefore intended in the implication of the equivalency by dropping on claim and scope are included in the present invention.Any Reference numeral in claim should be considered as the claim involved by limiting.In addition, obviously " comprising " one word do not get rid of other unit or step, odd number does not get rid of plural number.Multiple unit of stating in system claims or device also can be realized by software or hardware by a unit or device.First, second word such as grade is used for representing title, and does not represent any specific order.

Claims (19)

1. for the method at service end analog sensor, wherein, the method comprises the following steps:
A obtains the sensing data that corresponding client sends, and wherein, described sensing data sends in a predetermined format;
B converts the described sensing data of predetermined format the sensing data of equipment related pattern to, and is provided to corresponding application.
2. method according to claim 1, wherein, the method also comprises:
-create local socket and monitor;
Wherein, described step a comprises:
-when described client sends described sensing data, by described local socket, obtain the described sensing data that described client sends, wherein, described sensing data sends with described predetermined format.
3. method according to claim 2, wherein, the method also comprises:
-when there is new client's side link to described local socket, described new client is added into monitoring queue.
4. according to the method in any one of claims 1 to 3, wherein, the method also comprises:
-loading simulation sensor database, wherein, in described simulated sensor data storehouse, definition has simulated sensor data;
Wherein, described step a comprises:
-based on described simulated sensor data storehouse, obtain the sensing data that described client sends.
5. according to the method in any one of claims 1 to 3, wherein, described service end is arranged in TV box.
6. for the method at client simulation sensor, wherein, the method comprises the following steps:
A obtains external sensor data;
B converts described external sensor data the sensing data of predetermined format to;
Described sensing data is sent to corresponding service end with described predetermined format by C.
7. method according to claim 6, wherein, described step C comprises:
-by the socket of described service end, described sensing data is sent to described service end with described predetermined format.
8. method according to claim 7, wherein, described client connects the socket of described service end when starting.
9. the method according to any one of claim 6 to 8, wherein, described client is arranged in TV box.
10. for a service end for analog sensor, wherein, this service end comprises:
First acquisition device, for obtaining the sensing data that corresponding client sends, wherein, described sensing data sends in a predetermined format;
Generator, for the described sensing data of predetermined format being converted to the sensing data of equipment related pattern, and is provided to corresponding application.
11. service ends according to claim 10, wherein, this service end also comprises:
Monitoring device, for creating local socket and monitoring;
Wherein, described first acquisition device is used for:
-when described client sends described sensing data, by described local socket, obtain the described sensing data that described client sends, wherein, described sensing data sends with described predetermined format.
12. service ends according to claim 11, wherein, this service end also comprises:
Adding set, for when having new client's side link to described local socket, is added into monitoring queue by described new client.
13. according to claim 10 to the service end according to any one of 12, and wherein, this service end also comprises:
Charger, for loading simulation sensor database, wherein, in described simulated sensor data storehouse, definition has simulated sensor data;
Wherein, described first acquisition device is used for:
-based on described simulated sensor data storehouse, obtain the sensing data that described client sends.
14. according to claim 10 to the service end according to any one of 12, and wherein, described service end is arranged in TV box.
15. 1 kinds of clients for analog sensor, wherein, this client comprises:
Second acquisition device, for obtaining external sensor data;
Conversion equipment, for converting the sensing data of predetermined format to by described external sensor data;
Dispensing device, for sending to corresponding service end by described sensing data with described predetermined format.
16. clients according to claim 15, wherein, described dispensing device is used for:
-by the socket of described service end, described sensing data is sent to described service end with described predetermined format.
17. clients according to claim 16, wherein, described client connects the socket of described service end when starting.
18. according to claim 15 to the client according to any one of 17, and wherein, described client is arranged in TV box.
19. 1 kinds of TV boxes, comprise the service end according to any one of claim 10 to 14, and the client according to any one of claim 15 to 18.
CN201510456938.9A 2015-07-29 2015-07-29 A kind of method and apparatus for analog sensor Active CN105117270B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510456938.9A CN105117270B (en) 2015-07-29 2015-07-29 A kind of method and apparatus for analog sensor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510456938.9A CN105117270B (en) 2015-07-29 2015-07-29 A kind of method and apparatus for analog sensor

Publications (2)

Publication Number Publication Date
CN105117270A true CN105117270A (en) 2015-12-02
CN105117270B CN105117270B (en) 2019-04-12

Family

ID=54665271

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510456938.9A Active CN105117270B (en) 2015-07-29 2015-07-29 A kind of method and apparatus for analog sensor

Country Status (1)

Country Link
CN (1) CN105117270B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106776057A (en) * 2016-11-22 2017-05-31 北京云知声信息技术有限公司 Event-handling method and device
CN107342981A (en) * 2017-06-07 2017-11-10 北京小鸟看看科技有限公司 Transmission method and device, the virtual reality helmet of sensing data
CN108089881A (en) * 2017-12-04 2018-05-29 北京小鸟看看科技有限公司 Transmission method, device and the virtual reality device of sensing data
CN108363609A (en) * 2018-02-07 2018-08-03 腾讯科技(深圳)有限公司 The method, apparatus and storage medium of analog sensor
CN111737269A (en) * 2020-08-26 2020-10-02 苏州浪潮智能科技有限公司 Data query response method and device and computer readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102802081A (en) * 2012-07-24 2012-11-28 四川长虹电器股份有限公司 Method achieving virtual peripheral based on intelligent television terminals and hand-hold equipment
CN102869123A (en) * 2012-08-02 2013-01-09 Tcl集团股份有限公司 Virtual peripheral data acquisition method and system applicable to intelligent display equipment
CN103713934A (en) * 2012-09-29 2014-04-09 京信通信系统(中国)有限公司 Method and system for application program visiting physical peripheral

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102802081A (en) * 2012-07-24 2012-11-28 四川长虹电器股份有限公司 Method achieving virtual peripheral based on intelligent television terminals and hand-hold equipment
CN102869123A (en) * 2012-08-02 2013-01-09 Tcl集团股份有限公司 Virtual peripheral data acquisition method and system applicable to intelligent display equipment
CN103713934A (en) * 2012-09-29 2014-04-09 京信通信系统(中国)有限公司 Method and system for application program visiting physical peripheral

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106776057A (en) * 2016-11-22 2017-05-31 北京云知声信息技术有限公司 Event-handling method and device
CN107342981A (en) * 2017-06-07 2017-11-10 北京小鸟看看科技有限公司 Transmission method and device, the virtual reality helmet of sensing data
CN108089881A (en) * 2017-12-04 2018-05-29 北京小鸟看看科技有限公司 Transmission method, device and the virtual reality device of sensing data
CN108363609A (en) * 2018-02-07 2018-08-03 腾讯科技(深圳)有限公司 The method, apparatus and storage medium of analog sensor
CN111737269A (en) * 2020-08-26 2020-10-02 苏州浪潮智能科技有限公司 Data query response method and device and computer readable storage medium

Also Published As

Publication number Publication date
CN105117270B (en) 2019-04-12

Similar Documents

Publication Publication Date Title
CN105117270A (en) Sensor simulation method and apparatus
CN103177043A (en) Method and electronic system used for transferring file across system platform
CN104461897A (en) Application program test method and device
CN104702665A (en) Information sharing method and information sharing device
CN104899136A (en) Method and device used for generating test case
CN103942022A (en) Mobile terminal and vehicle-mounted terminal interconnection method and system and mobile terminal
CN104468260A (en) Recognition method, device and system for mobile terminal device
CN110955715A (en) ERP system, data conversion method and device of target platform and electronic equipment
CN102710740A (en) Device identification using device functions
CN109815120A (en) Test method, device, computer equipment and the storage medium of application
CN106095518A (en) Application program installation method and device
CN110245128A (en) Method for building up and device, storage medium, the electronic device of meta-model
CN102831000B (en) The method and system of system upgrade
CN102801782B (en) A kind of synchronous updating method of data and system
US20170168796A1 (en) Method and electronic apparatus for transferring application program from pc to mobile apparatus
CN103327469A (en) Method and system of data sharing and mobile terminal
JP6168581B2 (en) COMMUNICATION PROCESSING DEVICE, COMMUNICATION PROCESSING METHOD, AND PROGRAM
CN109286689B (en) Information sending method and device and vehicle-mounted man-vehicle interaction terminal
CN113986312B (en) Software upgrading method and device, electronic equipment and computer readable storage medium
CN102306130A (en) System and method for controlling mobile equipment by using computer and mobile equipment test system
CN108667902A (en) Tele-control system, method, apparatus and the equipment of iOS device
CN102929657A (en) Internal memory data sharing method, device and system
CN104050199B (en) Data transmission method and electronic equipment
CN111010366A (en) Data transmission method and system based on reverse isolation technology
CN104375969A (en) Base device and connecting method thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant