CN106681670B - Sensor data reporting method and device - Google Patents

Sensor data reporting method and device Download PDF

Info

Publication number
CN106681670B
CN106681670B CN201710065253.0A CN201710065253A CN106681670B CN 106681670 B CN106681670 B CN 106681670B CN 201710065253 A CN201710065253 A CN 201710065253A CN 106681670 B CN106681670 B CN 106681670B
Authority
CN
China
Prior art keywords
sensor data
data
cache region
preset
sensor
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.)
Active
Application number
CN201710065253.0A
Other languages
Chinese (zh)
Other versions
CN106681670A (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.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp 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 Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201710065253.0A priority Critical patent/CN106681670B/en
Publication of CN106681670A publication Critical patent/CN106681670A/en
Application granted granted Critical
Publication of CN106681670B publication Critical patent/CN106681670B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3058Monitoring arrangements for monitoring environmental properties or parameters of the computing system or of the computing system component, e.g. monitoring of power, currents, temperature, humidity, position, vibrations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • Telephonic Communication Services (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention discloses a sensor data reporting method and a sensor data reporting device, wherein the method comprises the following steps: monitoring a plurality of sensors, intercepting the sensor data when monitoring that the sensors report the sensor data, caching the sensor data into a preset cache region, and if the group number or the data size of the sensor data cached in the cache region is larger than or equal to a corresponding preset number value in a preset time period, packaging the sensor data cached in the cache region according to the digit of preset type shaping data to obtain packaged data, and reporting the packaged data. Compared with the prior art, the sensor data are intercepted and cached in the cache region, and all the sensor data in the cache region are packaged, so that all the cached sensor data can be packaged and reported when being reported every time, each group of sensor data of the sensors is prevented from being reported, the reporting times are reduced, the resource consumption is reduced, and the system load is reduced.

Description

Sensor data reporting method and device
Technical Field
The invention relates to the technical field of electronics, in particular to a sensor data reporting method and device.
Background
With the development of electronic technology, smart terminals such as smart phones and tablet computers are rapidly developed, and a plurality of sensors, such as a gravity sensor, a gyroscope, an infrared proximity sensor, a compass, a pressure sensor, and the like, are installed in the smart terminals. And with the further development of terminal intellectualization, the number of sensors can be further increased. The data collected by these sensors may be called by different applications to perform specific functions, such as a pedometer that calls for data from a shock sensor.
However, as the number of sensors increases, each sensor needs to report data many times each time it is called, the number of data reporting times will increase greatly, and the increase of the number of sensor reporting times will bring about a large consumption of resources and cause a system burden.
Disclosure of Invention
The invention mainly aims to provide a sensor data reporting method and a sensor data reporting device, and aims to solve the technical problems that in the prior art, the increase of the reporting times of a sensor causes a large amount of resource consumption, system burden and the like.
In order to achieve the above object, a first aspect of the present invention provides a method for reporting sensor data, including:
monitoring a plurality of sensors, intercepting sensor data when monitoring that the sensors report the sensor data, and caching the sensor data into a preset cache region;
in a preset time period, if the group number or the data size of the sensor data cached in the cache region is larger than or equal to a corresponding preset number value, packaging the sensor data in the cache region according to the digit of preset type shaping data to obtain packaged data;
and reporting the packed data.
In order to achieve the above object, a second aspect of the present invention provides a sensor data reporting apparatus, including:
the intercepting and caching module is used for monitoring a plurality of sensors, intercepting the sensor data when monitoring that the sensors report the sensor data, and caching the sensor data into a preset caching area;
the packaging module is used for packaging the sensor data in the cache region according to the digit of the preset type of shaping data to obtain packaged data if the group number or the data size of the sensor data cached in the cache region is larger than or equal to a corresponding preset value within a preset time period;
and the reporting module is used for reporting the packed data.
The invention provides a sensor data reporting method, which comprises the steps of monitoring a plurality of sensors, intercepting sensor data when the sensors report the sensor data, caching the sensor data into a preset cache region, packing the sensor data cached in the cache region according to the digit of preset type shaping data to obtain packed data and reporting the packed data if the group number or the data size of the sensor data cached in the cache region is larger than or equal to a corresponding preset value within a preset time period. Compared with the prior art, the sensor data are intercepted and cached in the cache region, and all the sensor data in the cache region are packaged, so that all the cached sensor data can be packaged and reported when being reported every time, each group of sensor data of the sensors is prevented from being reported, the reporting times are reduced, the resource consumption is reduced, and the system load is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a block diagram of a mobile terminal;
fig. 2 is a schematic flow chart of a method for reporting sensor data according to a first embodiment of the present invention;
fig. 3 is a schematic flow chart of a method for reporting sensor data according to a second embodiment of the present invention;
fig. 4 is a schematic diagram of functional modules of a sensor data reporting apparatus according to a third embodiment of the present invention;
fig. 5 is a schematic diagram of functional modules of a sensor data reporting apparatus according to a fourth embodiment of the present invention.
Detailed Description
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The sensor data uploading method provided by the embodiment of the invention can be realized by a sensor data uploading device, the device can be a mobile terminal or a partial structure in the mobile terminal, and fig. 1 shows a structural block diagram of the mobile terminal. The sensor data uploading method provided by the embodiment of the present invention may be applied to the mobile terminal 10 shown in fig. 1, where the mobile terminal 10 may include, but is not limited to: the system is a smart phone, a notebook, a tablet computer, a wearable smart device and the like which need to maintain normal operation by depending on a battery and support network and downloading functions.
As shown in FIG. 1, the mobile terminal 10 includes a memory 101, a memory controller 102, one or more processors 103 (only one shown), a peripheral interface 104, a radio frequency module 105, a key module 106, an audio module 107, a touch screen 108, and a plurality of sensors 110. These components communicate with each other via one or more communication buses/signal lines 109.
The plurality of sensors 110 may include a plurality of different types of sensors, such as gravity sensors, gyroscopes, infrared proximity sensors, compasses, pressure sensors, and the like.
It is to be understood that the structure shown in fig. 1 is only an illustration and does not limit the structure of the mobile terminal. The mobile terminal 10 may also include more or fewer components than shown in FIG. 1, or may have a different configuration than shown in FIG. 1. The components shown in fig. 1 may be implemented in hardware, software, or a combination thereof.
The memory 101 may be configured to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for reporting sensor data in the embodiment of the present invention, and the processor 103 executes various functional applications and data processing by operating the software programs and modules stored in the memory 101, that is, implements the method for reporting sensor data.
Memory 101 may include high speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 101 may further include memory located remotely from the processor 103, which may be connected to the mobile terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. Access to the memory 101 by the processor 103 and possibly other components may be under the control of the memory controller 102.
The peripheral interface 104 couples various input/output devices to the CPU and to the memory 101. The processor 103 executes various software, instructions within the memory 101 to perform various functions of the mobile terminal 10 and to perform data processing.
In some embodiments, the peripheral interface 104, the processor 103, and the memory controller 102 may be implemented in a single chip. In other examples, they may be implemented separately from the individual chips.
The rf module 105 is used for receiving and transmitting electromagnetic waves, and implementing interconversion between the electromagnetic waves and electrical signals, so as to communicate with a communication network or other devices. The rf module 105 may include various existing circuit elements for performing these functions, such as an antenna, an rf transceiver, a digital signal processor, an encryption/decryption chip, a Subscriber Identity Module (SIM) card, memory, and so forth. The rf module 105 may communicate with various networks such as the internet, an intranet, a preset type of wireless network, or other devices through a preset type of wireless network. The preset types of wireless networks described above may include cellular telephone networks, wireless local area networks, or metropolitan area networks. The Wireless network of the above-mentioned preset type may use various communication standards, protocols and technologies, including but not limited to Global System for mobile communication (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (W-CDMA), Code Division Multiple Access (CDMA), Time Division Multiple Access (TDMA), bluetooth, Wireless Fidelity (WiFi) (e.g., IEEE802.11a, IEEE802.11 b, IEEE802.11g and/or IEEE802.11 n), Voice over internet protocol (VoIP), Global internet Access (wimax), other protocols for email, instant messaging, and short messaging, and any other suitable messaging protocol.
The key module 106 provides an interface for user input to the mobile terminal, and the user may cause the mobile terminal 10 to perform different functions by pressing different keys.
Audio module 107 provides an audio interface to a user that may include one or more microphones, one or more speakers, and audio circuitry. The audio circuitry receives audio data from the peripheral interface 104, converts the audio data to electrical information, and transmits the electrical information to the speaker. The speaker converts the electrical information into sound waves that the human ear can hear. The audio circuitry also receives electrical information from the microphone, converts the electrical information to voice data, and transmits the voice data to the peripheral interface 104 for further processing. The audio data may be retrieved from the memory 101 or through the radio frequency module 105. In addition, the audio data may also be stored in the memory 101 or transmitted through the radio frequency module 105. In some examples, audio module 107 may also include a headphone jack for providing an audio interface to headphones or other devices.
The touch screen 108 provides both an output and an input interface between the mobile terminal and the user. In particular, the touch screen 108 displays video output to the user, the content of which may include text, graphics, video, and any combination thereof. Some of the output results are for some of the user interface objects. The touch screen 108 also receives user inputs, such as user clicks, swipes, and other gesture operations, for the user interface objects to respond to these user inputs. The technique of detecting user input may be based on resistive, capacitive, or any other possible touch detection technique. Specific examples of touch screen 108 display units include, but are not limited to, liquid crystal displays or light emitting polymer displays.
The sensor data reporting method in the embodiment of the invention is described based on the mobile terminal.
Because the sensor in the prior art needs to report once every time when generating sensor data, the reporting times of the sensor are greatly increased along with the increase of the sensors, which brings the technical problems of large resource consumption, system burden and the like.
In order to solve the above problems, the present invention provides a method for reporting sensor data, which intercepts sensor data and caches the sensor data in a buffer area, and packages all sensor data in the buffer area, so that all buffered sensor data can be packaged and reported each time of reporting, thereby avoiding reporting each group of sensor data of a sensor, reducing the reporting times, reducing the resource consumption, and reducing the system load.
Please refer to fig. 2, which is a flowchart illustrating a method for reporting sensor data according to a first embodiment of the present invention, the method includes:
step 201, monitoring a plurality of sensors, intercepting sensor data when monitoring that the sensors report the sensor data, and caching the sensor data into a preset cache region;
in the embodiment of the present invention, a plurality of applications with different functions may be installed on the mobile terminal, and in order to implement the functions of the applications, the mobile terminal includes a plurality of sensors with different types, and after the applications are started or when a certain specified function is executed, the data of the sensors needs to be called, so as to implement the corresponding function.
The method for reporting sensor data is specifically realized by a sensor data reporting device (hereinafter referred to as reporting device), which may be a mobile terminal or a part of components in the mobile terminal.
In the embodiment of the invention, when the application program needs to use the data of the sensor, the calling instruction of the sensor is generated and sent to the sensor, and after the sensor receives the calling instruction, the sensor data is generated and reported.
In the embodiment of the invention, the reporting device monitors a plurality of sensors, wherein the plurality of sensors refer to all sensors in the mobile terminal, and when the sensors are monitored to report sensor data, the sensor data are intercepted and cached in a preset cache region.
Step 202, in a preset time period, if the group number or the data size of the sensor data cached in the cache region is greater than or equal to a corresponding preset number value, packing the sensor data in the cache region according to the digit of the preset type of shaping data to obtain packed data;
and step 203, reporting the packed data.
In the embodiment of the present invention, the reporting device determines whether the sensor data cached in the cache area needs to be packed, specifically: the reporting device determines whether the group number or the data size of the sensor data cached in the cache region is greater than or equal to a corresponding preset value within a preset time period.
The sensor data generated and reported by each sensor can be referred to as a group of sensor data, that is, the sensor data reported by the sensors is reported in units of groups.
In the embodiment of the present invention, in a preset time period, if the number of groups of sensor data cached in the cache region is greater than or equal to the preset number of groups, or the size of the data is greater than or equal to the preset size, in this case, the reporting device packages the sensor data in the cache region according to the number of bits of the preset type of shaped data to obtain packaged data, and reports the packaged data.
The shaping data may specifically be int shaping data, and the number of bits of the int shaping data is 32 bits.
It should be noted that the int shaping data is mainly used in consideration that many current ARM systems are 32 bits, that is, if the sensor data is reported in the form of int shaping data, the maximum is supported by the power of 32 of 2, the sensor data of the commonly used sensors are small, but 16 bits are needed at most, and 8 bits or even 2 bits are needed, so that if reporting is carried out by taking a group of sensor data as a unit, based on the point that a plurality of groups of sensor data or sensor data with the data size meeting the condition in the cache region are packed, each bit in the 32-bit data format can be fully used, the data reporting times can be reduced, the data size reported by the data can be reduced, and the resource occupation can be further reduced.
In the embodiment of the invention, a plurality of sensors are monitored, when the sensors report sensor data, the sensor data are intercepted and cached in a preset cache region, and if the group number or the data size of the sensor data cached in the cache region is larger than or equal to a corresponding preset number value in a preset time period, the sensor data cached in the cache region are packaged according to the digit of preset type shaping data to obtain packaged data, and the packaged data are reported. Compared with the prior art, the sensor data are intercepted and cached in the cache region, and all the sensor data in the cache region are packaged, so that all the cached sensor data can be packaged and reported when being reported every time, each group of sensor data of the sensors is prevented from being reported, the reporting times are reduced, the resource consumption is reduced, and the system load is reduced.
Please refer to fig. 3, which is a flowchart illustrating a method for reporting sensor data according to a second embodiment of the present invention, the method includes:
step 301, monitoring a plurality of sensors, intercepting sensor data when monitoring that the sensors report the sensor data, and caching the sensor data into a preset cache region;
in the embodiment of the present invention, the content of step 302 is similar to that described in step 201 of the first embodiment, and is not described herein again.
Step 302, in a preset time period, if the group number or the data size of the sensor data cached in the cache region is greater than or equal to a corresponding preset number value, packing the sensor data in the cache region according to the digit of the preset type of shaping data to obtain packed data;
303, when a preset time period is reached, if the group number or the data size of the sensors cached in the cache region is smaller than a corresponding preset number value, packaging the sensor data in the cache region according to the digit of the preset type of shaping data to obtain packaged data;
and step 304, reporting the packed data.
In the embodiment of the present invention, the preset time period is determined based on the timestamp included in the sensor data cached in the cache region, and the preset time period is a time period formed by taking the timestamp included in the sensor data cached earliest in the cache region as a starting point and a preset time period, that is, the preset time period is counted from the timestamp included in the sensor data cached earliest, for example, if A, B, C sets of sensor data are cached in the cache region, the preset time period is 5ms, and the timestamp of the sensor data of the group a is earliest, the sensor data in the cache region is counted by the timestamp of the sensor data of the group a, and the sensor data in the cache region is packed after 5 ms. It can be understood that by setting the preset time period and setting the preset time period with the timestamp included in the sensor data cached earliest in the cache region as the starting point, the sensor data in the cache region can be effectively prevented from being unreported for too long time, which brings influence on the application program function needing to use the sensor data, so that the sensor data can be packaged and reported on the basis of ensuring the reporting speed.
The reporting device monitors whether a preset time period is reached in real time, determines whether the group number or the data size of the sensor data cached in the cache region is larger than or equal to a corresponding preset value when the preset time period is not reached, and packages the sensor data in the cache region according to the digit of the preset type of shaping data to obtain packaged data under the condition that the group number or the data size of the sensor data cached in the cache region is larger than or equal to the corresponding preset value, or packages the sensor data in the cache region according to the digit of the preset type of shaping data to obtain packaged data when the preset time period is reached and if the group number or the data size of the sensor data cached in the cache region is smaller than the corresponding preset value.
The method includes the steps of packing sensor data in the cache region according to the number of bits of preset type shaping data to obtain packed data, and specifically includes the following steps: the reporting device determines the number of bits required to be used by the sensor data in the buffer area, for example, if 3 sets of sensor data are buffered in the buffer area, the number of bits required to be used by the 3 sets of sensor data are determined respectively. And after the number of bits required to be used by each group of sensor data is determined, combining the number of bits required to be used by each group of sensor data into at least one group of packed data in a 32-bit shaped data format by taking a group of packed data as a standard.
It will be appreciated that in combining sensor data, to distinguish between different data sets, a flag may be set that identifies all data preceding the next flag as belonging to the same sensor data. When multiple sets of sensor data are arranged, the flag bit, the sensor data, the identification bit, the sensor data, the flag bit, and the sensor data may be packed in sequence. The sensor data includes sensing data, a timestamp, and a sensor type. And each group of sensor data is arranged according to the sequence of the sensor type, the time stamp and the induction data when being packed.
In the embodiment of the invention, by intercepting the sensor data and caching the sensor data in the cache region and packaging all the sensor data in the cache region, all the cached sensor data can be packaged and reported each time of reporting, so that each group of sensor data of the sensors is prevented from being reported, the reporting times are reduced, the resource consumption is reduced, and the system load is reduced.
Please refer to fig. 4, which is a schematic diagram of functional modules of a sensor data reporting apparatus according to a third embodiment of the present invention, the reporting apparatus includes:
the intercepting and caching module 401 is configured to monitor a plurality of sensors, intercept sensor data when it is monitored that the sensors report the sensor data, and cache the sensor data in a preset caching area;
in the embodiment of the present invention, a plurality of applications with different functions may be installed on the mobile terminal, and in order to implement the functions of the applications, the mobile terminal includes a plurality of sensors with different types, and after the applications are started or when a certain specified function is executed, the data of the sensors needs to be called, so as to implement the corresponding function.
The reporting device may be a mobile terminal, or may be a part of components in the mobile terminal.
In the embodiment of the invention, when the application program needs to use the data of the sensor, the calling instruction of the sensor is generated and sent to the sensor, and after the sensor receives the calling instruction, the sensor data is generated and reported.
In the embodiment of the present invention, the intercepting cache module 401 monitors a plurality of sensors, where the plurality of sensors refer to all sensors in the mobile terminal, and intercepts sensor data when monitoring that the sensors report the sensor data, and caches the sensor data in a preset cache area.
A packing module 402, configured to, within a preset time period, pack the sensor data in the cache region according to a bit number of preset type shaping data if a group number or a data size of the sensor data cached in the cache region is greater than or equal to a corresponding preset number value, to obtain packed data;
a reporting module 403, configured to report the packed data.
In the embodiment of the present invention, the reporting device determines whether the sensor data cached in the cache area needs to be packed, specifically: the packing module 402 will determine whether the number of sets or the data size of the sensor data buffered in the buffer area is greater than or equal to the corresponding preset value within the preset time period.
The sensor data generated and reported by each sensor can be referred to as a group of sensor data, that is, the sensor data reported by the sensors is reported in units of groups.
In the embodiment of the present invention, in a preset time period, if the number of groups of sensor data cached in the cache region is greater than or equal to the preset number of groups, or the size of the data is greater than or equal to the preset size, in this case, the packing module 402 packs the sensor data in the cache region according to the number of bits of the preset type of shaping data to obtain packed data, and the reporting module 403 reports the packed data.
The shaping data may specifically be int shaping data, and the number of bits of the int shaping data is 32 bits.
It should be noted that the int shaping data is mainly used in consideration that many current ARM systems are 32 bits, that is, if the sensor data is reported in the form of int shaping data, the maximum is supported by the power of 32 of 2, the sensor data of the commonly used sensors are small, but 16 bits are needed at most, and 8 bits or even 2 bits are needed, so that if reporting is carried out by taking a group of sensor data as a unit, based on the point that a plurality of groups of sensor data or sensor data with the data size meeting the condition in the cache region are packed, each bit in the 32-bit data format can be fully used, the data reporting times can be reduced, the data size reported by the data can be reduced, and the resource occupation can be further reduced.
In the embodiment of the invention, a plurality of sensors are monitored, when the sensors report sensor data, the sensor data are intercepted and cached in a preset cache region, and if the group number or the data size of the sensor data cached in the cache region is larger than or equal to a corresponding preset number value in a preset time period, the sensor data cached in the cache region are packaged according to the digit of preset type shaping data to obtain packaged data, and the packaged data are reported. Compared with the prior art, the sensor data are intercepted and cached in the cache region, and all the sensor data in the cache region are packaged, so that all the cached sensor data can be packaged and reported when being reported every time, each group of sensor data of the sensors is prevented from being reported, the reporting times are reduced, the resource consumption is reduced, and the system load is reduced.
Please refer to fig. 5, which is a schematic diagram of functional modules of a sensor data reporting apparatus according to a fourth embodiment of the present invention, the reporting apparatus includes: the interception caching module 401, the packaging module 402, and the reporting module 403 in the third embodiment are similar to those described in the third embodiment, and are not described herein again.
In this embodiment of the present invention, the packing module 402 is further configured to: and when a preset time period is reached, if the group number or the data size of the sensors cached in the cache region is smaller than a corresponding preset number value, packaging the sensor data in the cache region according to the digit of the preset type of shaping data to obtain packaged data.
The preset time period is a time period formed by taking a timestamp contained in sensor data cached at the earliest in the cache region as a starting point and a preset time length.
Further, the packing module 402 includes:
a determining module 501, configured to determine, within a preset time period, a bit number that needs to be used by the sensor data in the cache region if the number of groups or the size of the sensor data cached in the cache region is greater than or equal to a corresponding preset value, or if the number of groups or the size of the sensor data cached in the cache region is smaller than the corresponding preset value when the preset time period is reached;
and the combining module 502 is configured to combine the sensor data into at least one group of packed data in a 32-bit data format according to the number of bits required to be used by the sensor data, with the group of packed data being 32 bits as a standard.
In the embodiment of the present invention, the preset time period is determined based on the timestamp included in the sensor data cached in the cache region, and the preset time period is a time period formed by taking the timestamp included in the sensor data cached earliest in the cache region as a starting point and a preset time period, that is, the preset time period is counted from the timestamp included in the sensor data cached earliest, for example, if A, B, C sets of sensor data are cached in the cache region, the preset time period is 5ms, and the timestamp of the sensor data of the group a is earliest, the sensor data in the cache region is counted by the timestamp of the sensor data of the group a, and the sensor data in the cache region is packed after 5 ms. It can be understood that by setting the preset time period and setting the preset time period with the timestamp included in the sensor data cached earliest in the cache region as the starting point, the sensor data in the cache region can be effectively prevented from being unreported for too long time, which brings influence on the application program function needing to use the sensor data, so that the sensor data can be packaged and reported on the basis of ensuring the reporting speed.
The packing module 402 monitors whether a preset time period has been reached in real time, and determines whether the number of groups of sensor data or the size of the sensor data cached in the cache region is greater than or equal to a corresponding preset value when the preset time period has not been reached, and the packing module 402 packs the sensor data in the cache region according to the number of bits of the preset type of shaping data to obtain packed data when the preset time period is greater than or equal to the corresponding preset value, or the packing module 402 packs the sensor data in the cache region according to the number of bits of the preset type of shaping data to obtain packed data when the preset time period is reached and if the number of groups of sensor data or the size of the sensor data cached in the cache region is less than the corresponding preset value.
The method includes the steps of packing sensor data in the cache region according to the number of bits of preset type shaping data to obtain packed data, and specifically includes the following steps: the determining module 501 determines the number of bits required to be used by the sensor data in the buffer area, for example, if 3 sets of sensor data are buffered in the buffer area, the number of bits required to be used by the 3 sets of sensor data are determined respectively. And after determining the number of bits required to be used for each set of sensor data, the combining module 502 combines the number of bits required to be used for each set of sensor data into at least one set of packed data in a 32-bit shaped data format, with a set of packed data being 32-bit standard.
It will be appreciated that in combining sensor data, to distinguish between different data sets, a flag may be set that identifies all data preceding the next flag as belonging to the same sensor data. When multiple sets of sensor data are arranged, the flag bit, the sensor data, the identification bit, the sensor data, the flag bit, and the sensor data may be packed in sequence. The sensor data includes sensing data, a timestamp, and a sensor type. And each group of sensor data is arranged according to the sequence of the sensor type, the time stamp and the induction data when being packed.
In the embodiment of the invention, by intercepting the sensor data and caching the sensor data in the cache region and packaging all the sensor data in the cache region, all the cached sensor data can be packaged and reported each time of reporting, so that each group of sensor data of the sensors is prevented from being reported, the reporting times are reduced, the resource consumption is reduced, and the system load is reduced.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the modules is merely a logical division, and in actual implementation, there may be other divisions, for example, multiple modules or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical modules, may be located in one place, or may be distributed on a plurality of network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present invention is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no acts or modules are necessarily required of the invention.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In view of the above description of the sensor data reporting method and apparatus provided by the present invention, those skilled in the art will recognize that changes may be made in the embodiments and applications of the method and apparatus according to the concepts of the present invention.

Claims (8)

1. A method for reporting sensor data is characterized in that the method comprises the following steps:
monitoring a plurality of sensors, intercepting sensor data when monitoring that the sensors report the sensor data, and caching the sensor data into a preset cache region;
in a preset time period, if the group number or the data size of the sensor data cached in the cache region is larger than or equal to a corresponding preset number value, packaging the sensor data in the cache region according to the digit of preset type shaping data to obtain packaged data;
reporting the packed data to an application program calling the sensor;
wherein, the packing the sensor data in the buffer area according to the bit number of the preset type of the shaping data to obtain the packed data comprises:
determining the number of bits required to be used by the sensor data in the cache region;
and combining the sensor data into at least one group of packed data in a 32-bit data format according to the number of bits required to be used by the sensor data by taking the group of packed data as a standard.
2. The method of claim 1, further comprising:
and when a preset time period is reached, if the group number or the data size of the sensors cached in the cache region is smaller than a corresponding preset number value, packaging the sensor data in the cache region according to the digit of the preset type of shaping data to obtain packaged data.
3. The method according to claim 1 or 2, wherein the preset time period is a time period formed by a preset time length and a time stamp contained in the sensor data cached earliest in the cache region as a starting point.
4. The method of claim 1, wherein the sensor data comprises sensory data, a timestamp, and a sensor type.
5. A sensor data reporting apparatus, the apparatus comprising:
the intercepting and caching module is used for monitoring a plurality of sensors, intercepting the sensor data when monitoring that the sensors report the sensor data, and caching the sensor data into a preset caching area;
the packaging module is used for packaging the sensor data in the cache region according to the digit of the preset type of shaping data to obtain packaged data if the group number or the data size of the sensor data cached in the cache region is larger than or equal to a corresponding preset value within a preset time period;
a reporting module, configured to report the packed data;
wherein the packing module comprises:
the determining module is configured to determine, within a preset time period, a bit number required to be used by the sensor data in the cache region if the number of sets or the size of the sensor data cached in the cache region is greater than or equal to a corresponding preset value, or if the number of sets or the size of the sensor data cached in the cache region is smaller than the corresponding preset value when the preset time period is reached;
and the combination module is used for combining the sensor data into at least one group of packed data in a 32-bit data format according to the number of bits required to be used by the sensor data by taking a group of packed data as a standard.
6. The apparatus of claim 5, wherein the packaging module is further configured to: and when a preset time period is reached, if the group number or the data size of the sensors cached in the cache region is smaller than a corresponding preset number value, packaging the sensor data in the cache region according to the digit of the preset type of shaping data to obtain packaged data.
7. The apparatus according to claim 5 or 6, wherein the preset time period is a time period formed by a preset time length and a time stamp included in the sensor data cached earliest in the cache region as a starting point.
8. The apparatus of claim 5, wherein the sensor data comprises sensory data, a timestamp, and a sensor type.
CN201710065253.0A 2017-02-06 2017-02-06 Sensor data reporting method and device Active CN106681670B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710065253.0A CN106681670B (en) 2017-02-06 2017-02-06 Sensor data reporting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710065253.0A CN106681670B (en) 2017-02-06 2017-02-06 Sensor data reporting method and device

Publications (2)

Publication Number Publication Date
CN106681670A CN106681670A (en) 2017-05-17
CN106681670B true CN106681670B (en) 2020-07-17

Family

ID=58860470

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710065253.0A Active CN106681670B (en) 2017-02-06 2017-02-06 Sensor data reporting method and device

Country Status (1)

Country Link
CN (1) CN106681670B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110213734B (en) * 2019-04-23 2020-02-14 重庆特斯联智慧科技股份有限公司 Dynamic data packet communication method and system based on intelligent building Internet of things
CN113993002A (en) * 2021-09-13 2022-01-28 广州番禺电缆集团有限公司 Cable monitoring data reporting method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216986A (en) * 2008-01-17 2008-07-09 上海交通大学 A port field data acquisition, transmission and issuance system based on Zig Bee technology
CN102053286A (en) * 2010-10-27 2011-05-11 哈尔滨工业大学 Meteorological information acquisition real-time communication and processing system
CN103984644A (en) * 2014-05-07 2014-08-13 华为技术有限公司 Data management method and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120203491A1 (en) * 2011-02-03 2012-08-09 Nokia Corporation Method and apparatus for providing context-aware control of sensors and sensor data
US20140172994A1 (en) * 2012-12-14 2014-06-19 Martin RAUMANN Preemptive data recovery and retransmission

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216986A (en) * 2008-01-17 2008-07-09 上海交通大学 A port field data acquisition, transmission and issuance system based on Zig Bee technology
CN102053286A (en) * 2010-10-27 2011-05-11 哈尔滨工业大学 Meteorological information acquisition real-time communication and processing system
CN103984644A (en) * 2014-05-07 2014-08-13 华为技术有限公司 Data management method and device

Also Published As

Publication number Publication date
CN106681670A (en) 2017-05-17

Similar Documents

Publication Publication Date Title
JP6526919B2 (en) Method, apparatus and mobile terminal for screen mirroring
US10678942B2 (en) Information processing method and related products
CN107871015B (en) Log data processing method and device, terminal and readable storage medium
CN112703714B (en) Application processing method and device, computer equipment and computer readable storage medium
CN106951521B (en) Method, device and system for reading and writing log file
CN108446211B (en) Browser exception collection method and device, mobile terminal and storage medium
US11099898B2 (en) Method for allocating memory resources and terminal device
CN107948055B (en) Method, apparatus and computer readable storage medium for masking messages sent by group members
CN107425568B (en) Method and device for preventing over-discharge of battery, mobile terminal and storage medium
CN106488413A (en) Notification message based reminding method and mobile terminal
CN106155468B (en) Alarm display method and terminal
CN106708240B (en) Power saving method, server and power saving system
CN110035504B (en) Method for determining spatial relationship, terminal and base station
CN106681670B (en) Sensor data reporting method and device
CN107623612B (en) Flow display method and device, computer equipment and computer readable storage medium
CN107484201B (en) Flow statistical method and device, terminal and computer readable storage medium
CN112997471B (en) Audio channel switching method and device, readable storage medium and electronic equipment
CN105204891B (en) Downloading method and device for shutdown of mobile terminal and mobile terminal
CN108256466B (en) Data processing method and device, electronic equipment and computer readable storage medium
CN106372003B (en) Cache data cleaning method and device and terminal
WO2017215664A1 (en) Sound effect processing method and terminal
CN106304287B (en) Method for reducing standby power consumption of mobile terminal and mobile terminal
CN106066814B (en) A kind of application control method and mobile terminal
CN107957899B (en) Screen recording method and device, computer readable storage medium and mobile terminal
CN108377298B (en) Method and device for switching answering mode, mobile terminal and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Applicant before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd.

GR01 Patent grant
GR01 Patent grant