CN114564438A - Sensor subsystem based on Internet of things and application method of sensor subsystem - Google Patents

Sensor subsystem based on Internet of things and application method of sensor subsystem Download PDF

Info

Publication number
CN114564438A
CN114564438A CN202210096203.XA CN202210096203A CN114564438A CN 114564438 A CN114564438 A CN 114564438A CN 202210096203 A CN202210096203 A CN 202210096203A CN 114564438 A CN114564438 A CN 114564438A
Authority
CN
China
Prior art keywords
sensor
physical quantity
information
data
callback function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210096203.XA
Other languages
Chinese (zh)
Inventor
薛栋梁
曹东刚
刘伟超
麻志毅
梅宏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peking University
Advanced Institute of Information Technology AIIT of Peking University
Original Assignee
Advanced Institute of Information Technology AIIT of Peking University
Hangzhou Weiming Information 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 Advanced Institute of Information Technology AIIT of Peking University, Hangzhou Weiming Information Technology Co Ltd filed Critical Advanced Institute of Information Technology AIIT of Peking University
Priority to CN202210096203.XA priority Critical patent/CN114564438A/en
Publication of CN114564438A publication Critical patent/CN114564438A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs
    • G06F15/163Interprocessor communication
    • G06F15/173Interprocessor communication using an interconnection network, e.g. matrix, shuffle, pyramid, star, snowflake
    • G06F15/17306Intercommunication techniques
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16YINFORMATION AND COMMUNICATION TECHNOLOGY SPECIALLY ADAPTED FOR THE INTERNET OF THINGS [IoT]
    • G16Y10/00Economic sectors
    • G16Y10/25Manufacturing
    • GPHYSICS
    • G16INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR SPECIFIC APPLICATION FIELDS
    • G16YINFORMATION AND COMMUNICATION TECHNOLOGY SPECIALLY ADAPTED FOR THE INTERNET OF THINGS [IoT]
    • G16Y20/00Information sensed or collected by the things
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Computer Hardware Design (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Manufacturing & Machinery (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • General Business, Economics & Management (AREA)
  • Arrangements For Transmission Of Measured Signals (AREA)

Abstract

The application discloses sensor subsystem and application method of sensor subsystem based on thing networking, the system includes: the variable definition module is used for defining the variable of the sensor subsystem according to the sensor connected with the Internet of things system and the acquired physical quantity; the initialization module is used for initializing variables of the sensor subsystem and storing initialized data into the bidirectional linked list; and the application module is used for providing a searching interface and a data acquisition interface of the physical quantity, searching and acquiring the physical quantity from the two-way linked list, and sending the acquired physical quantity to the upper application. According to the sensor subsystem provided by the application, the physical quantity is used as the center, the difference of the bottom sensor hardware is shielded, a uniform and general API is provided for the outside, the upper application development logic is simplified, and the programming efficiency is improved. The scheme is independent of the chip architecture, and the multi-platform and multi-architecture transplantation is supported, so that the same data source can be applied in multiple scenes.

Description

Sensor subsystem based on Internet of things and application method of sensor subsystem
Technical Field
The invention relates to the technical field of the Internet of things, in particular to a sensor subsystem based on the Internet of things and an application method of the sensor subsystem.
Background
In the field of industrial internet of things, a plurality of application scenes need to comprehensively sense an industrial production link, an internet of things application strategy is adjusted by real-time data feedback of the production link, and a sensor serves as a key module of the industrial production link and provides continuous data for upper-layer application, so that the quality of sensor software directly influences the upper limit of the industrial internet of things, and how to better design the sensor software is the core requirement of an internet of things operating system.
In the prior art, in most embedded internet of things operating systems, sensors are integrated into the system as a type of peripheral hardware, physical hardware of the sensors is used as abstraction, and for the variety of massive heterogeneous sensors, no matter the sensor hardware is abstracted, or the sensor hardware is applied on an upper layer, the difference of the sensors compatible with different types and different collected data has to be considered, so that the difficulty and the period of application development are increased.
Disclosure of Invention
The embodiment of the application provides a sensor subsystem based on the Internet of things and an application method of the sensor subsystem. The following presents a simplified summary in order to provide a basic understanding of some aspects of the disclosed embodiments. This summary is not an extensive overview and is intended to neither identify key/critical elements nor delineate the scope of such embodiments. Its sole purpose is to present some concepts in a simplified form as a prelude to the more detailed description that is presented later.
In a first aspect, an embodiment of the present application provides an internet of things-based sensor subsystem, including:
the variable definition module is used for defining the variable of the sensor subsystem according to the sensor connected with the Internet of things system and the acquired physical quantity;
the initialization module is used for initializing variables of the sensor subsystem and storing initialized data into the bidirectional linked list;
and the application module is used for providing a searching interface and a data acquisition interface of the physical quantity, searching and acquiring the physical quantity from the two-way linked list, and sending the acquired physical quantity to the upper-layer application.
In an optional embodiment, the variable definition module comprises:
the macro configuration unit is used for defining variables of the sensor subsystem in a directory structure layering mode in the Kconfig file;
and the compiling and configuring unit is used for defining the variables of the sensor subsystem in the Makefile by adopting a directory structure layering method.
In an optional embodiment, the initialization module includes:
the sensor data initialization unit is used for initializing sensor name information, sensor attribute information, sensor callback function information, sensor list information and physical quantity list information which is acquired by the support of the sensor;
And the physical quantity data initialization unit is used for initializing physical quantity name information, physical quantity type information, physical quantity attribute value information, sensor information to which the physical quantity belongs, physical quantity callback function information, physical quantity list information which is acquired by the sensor to which the physical quantity belongs and all physical quantity list information of the system.
In an optional embodiment, the sensor attribute information includes the acquisition capability of the sensor, the manufacturer name and the product model;
the sensor callback function information includes a sensor-driven callback function that is turned on, a sensor-driven callback function that is turned off, a callback function that receives data from the sensor, a callback function that sends data to the sensor, and a callback function that configures the sensor drive.
In an optional embodiment, the application module comprises:
the physical quantity searching unit is used for searching whether the physical quantity to be acquired exists in the bidirectional linked list;
and the data acquisition unit is used for calling a callback function of the physical quantity to be acquired when the physical quantity to be acquired is in the doubly linked list, opening a sensor driver, receiving data from the sensor and sending the received data to the upper application.
In an optional embodiment, searching whether the physical quantity to be acquired is found in the doubly-linked list, calling a callback function of the physical quantity to be acquired when the physical quantity to be acquired is found in the doubly-linked list, opening a sensor driver, receiving data from a sensor, and sending the received data to an upper application, includes:
Calling a callback function for searching the physical quantity, and searching the physical quantity to be collected in the bidirectional linked list through the initialized physical quantity name;
if the data structure of the physical quantity to be collected is returned, calling and opening a callback function of the sensor drive corresponding to the physical quantity to be collected;
and calling a callback function for receiving data from the sensor, receiving the acquired physical quantity, and sending the acquired physical quantity to the upper application.
In an optional embodiment, further comprising:
and after the physical quantity is acquired, calling a callback function for closing the sensor drive corresponding to the physical quantity to be acquired, and closing the acquisition function of the sensor.
In a second aspect, an embodiment of the present application provides a method for applying a sensor subsystem, including:
defining variables of a sensor subsystem according to sensors connected with the Internet of things system and the collected physical quantity;
initializing variables of a sensor subsystem, and storing initialized data into a bidirectional linked list;
and providing a physical quantity searching interface and a physical quantity data acquisition interface, searching and acquiring the physical quantity from the doubly linked list, and sending the acquired physical quantity to the upper application.
In an optional embodiment, providing a lookup interface for physical quantities and a data acquisition interface, looking up and acquiring the physical quantities from a doubly linked list, and sending the acquired physical quantities to an upper application includes:
Calling a callback function for searching the physical quantity, and searching the physical quantity to be collected in the bidirectional linked list through the initialized physical quantity name;
if the data structure of the physical quantity to be collected is returned, calling and opening a callback function of the sensor drive corresponding to the physical quantity to be collected;
and calling a callback function for receiving data from the sensor, receiving the acquired physical quantity, and sending the acquired physical quantity to the upper application.
In an alternative embodiment, initializing variables of the sensor subsystem includes:
initializing sensor name information, sensor attribute information, sensor callback function information, sensor list information and physical quantity list information which is collected by a sensor in a supporting way;
initializing name information of the physical quantity, type information of the physical quantity, attribute value information of the physical quantity, sensor information to which the physical quantity belongs, callback function information of the physical quantity, list information of the physical quantity which is supported and collected by a sensor to which the physical quantity belongs, and list information of all physical quantities of the system.
The technical scheme provided by the embodiment of the application can have the following beneficial effects:
according to the sensor subsystem based on the Internet of things, provided by the embodiment of the application, the physical quantity is used as the center, the uniform characteristic of the data collected by the sensor is abstracted, the hardware difference of the bottom sensor is shielded, different types of sensors compatible with the same data are provided, a uniform universal data collection interface is provided for the outside, the upper application development logic is simplified, and the programming efficiency is improved. And the scheme is independent of the chip architecture, and supports multi-platform and multi-architecture transplantation. The basic data source and the external API interface are greatly decoupled, so that the same data source can be applied in multiple scenes, can be migrated and applied in various Internet of things embedded operating systems, has better transportability and universality, and greatly simplifies the programming development of sensor software.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention, as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
FIG. 1 is a schematic diagram illustrating an architecture of an Internet of things based sensor subsystem in accordance with an exemplary embodiment;
FIG. 2 is a schematic diagram illustrating a method of applying a sensor subsystem in accordance with an exemplary embodiment;
FIG. 3 is a schematic diagram illustrating a computer storage medium in accordance with an exemplary embodiment.
Detailed Description
The following description and the drawings sufficiently illustrate specific embodiments of the invention to enable those skilled in the art to practice them.
It should be understood that the described embodiments are only some embodiments of the invention, and not all 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.
When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of systems and methods consistent with certain aspects of the invention, as detailed in the appended claims.
In most of the existing embedded internet-of-things operating systems, sensors are integrated into the system as a type of peripheral hardware, physical hardware of the sensors is used as abstraction, and for the variety of massive heterogeneous sensors, the difference of the sensors compatible with different types and different collected data has to be considered no matter the sensor hardware is abstracted or the sensor hardware is applied on the upper layer, so that the difficulty and the period of sensor driving and application development are increased.
Based on this, the embodiment of the application provides a sensor subsystem based on an industrial internet of things operating system, and provides a method for abstracting the unified characteristics of the sensor functions and providing a general API (application program interface) for the outside by taking physical quantity as a center aiming at the pain point problem of the current embedded internet of things operating system on the types of massive heterogeneous sensors, so that the programming of the application program of the sensor is simplified, and the sensor subsystem can be conveniently transplanted among the embedded internet of things operating systems.
The internet of things based sensor subsystem provided by the embodiment of the present application will be described in detail with reference to fig. 1.
Referring to fig. 1, the system includes a variable definition module, an initialization module, and an application module.
The variable definition module is used for defining the variable of the sensor subsystem according to the sensors connected with the Internet of things system and the collected physical quantity. The method is mainly responsible for managing the configuration of Kconfig files and Makefile files related to physical quantities, providing a frame cutting function, being compatible with the mapping configuration of peripheral paths of a file system and butting bottom peripheral drivers.
In a possible implementation manner, the variable definition module includes a macro configuration unit, which is used for defining the variables of the sensor subsystem in a directory structure hierarchical manner in the Kconfig file. For example, the method of layering the Kconfig file by adopting the directory structure can be divided into sensor/Kconfig, sensor/co2/Kconfig, sensor/humidaty/Kconfig, sensor/pm/Kconfig, sensor/temperature/Kconfig, sensor/voice/Kconfig, and the like. To specify a variable of a physical quantity such as carbon dioxide co2The humidity, pm, temperature, voice, etc. are stored in the Kconfig file by means of a root directory.
Further, it is also possible to click on a list of specified physical quantities and continue to define variables and enables associated with the physical quantities, e.g. click on sensor/co2Kconfig, continued definition with co2The variables involved.
The system also comprises a compiling configuration unit which is used for defining variables needing to be compiled by the sensor subsystem in the Makefile by adopting a directory structure layering method.
For example, Makefile adopts a directory structure layering method which can be divided into sensor/Makefile and sensor/co2[ the term "sensor"/Makefile, sensor/hub/Makefile, sensor/pm/Makefile, sensor/temperature/Makefile, sensor/voice/Makefile, etc.
Further, it is also possible to start a list of specified physical quantities, continue to configure the physical quantities to be compiled in relation to the physical quantities, for example, start a sensor/humidity/Makefile, and continue to configure the humidity-related variables.
According to the configured Kconfig file and the Makefile, the number of physical quantities required to be supported by the frame can be determined in the compiling stage, and the frame cutting function is realized.
Meanwhile, if the operating system supports a file system, the physical quantity tailorable configuration module can realize the mapping of the sensor file path through the Kconfig configuration, and the actual peripheral drivers such as "/dev/uart", "/dev/spi", and "/dev/i 2 c" are connected through the file descriptor.
According to the variable definition module, corresponding variables such as sensor names, physical quantity names, sensor hardware driving types and other parameters can be defined in the Kconfig and Makefile according to the sensor types supported by the operating system and the corresponding acquired physical quantity types, the sensors and the physical quantities are enabled, and the related module files are compiled.
The sensor subsystem provided by the embodiment of the application further comprises an initialization module, wherein the initialization module is used for initializing variables of the sensor subsystem and storing initialized data into the doubly linked list. The system is mainly responsible for initializing a data structure of the sensor equipment and an abstract data structure of physical quantity, managing through a bidirectional linked list, and butting corresponding peripheral interface drivers according to actual hardware connection of the sensor.
Wherein, the initialization module includes: and the sensor data initialization unit is used for initializing sensor name information, sensor attribute information, sensor callback function information, sensor list information and physical quantity list information which is acquired by the support of the sensor.
Specifically, the initialized sensor data structure sensorrevice includes sensor name information sensor _ name for recording the name of the sensor device in the system, and uniquely identifies one sensorrevice data structure. The sensor attribute information product _ info is used for recording attribute characteristics of sensor equipment, including acquisition capability ability of the sensor, manufacturer name vendor _ name and product model _ name, wherein the acquisition capability ability uses a 32-bit unsigned integer bitmap to represent the types of acquired data supported by the sensor. The device comprises sensor callback function information sensor _ operations, and is used for recording callback functions similar to a posix interface of a file system, wherein the callback functions comprise open, close, read, write and ioctl, and respectively represent that a sensor driver is opened, the sensor driver is closed, data is received from a sensor, the sensor driver is sent to the sensor, the sensor driver is configured, and peripheral drivers at the bottom layer of an operating system, such as peripheral interfaces of a serial port UART (universal asynchronous receiver/transmitter), an SPI (serial peripheral interface), an I2C and the like, are butted. The sensor device data structure comprises sensor list information used for recording all registered sensor devices in the system and obtaining the sensor device data structure by searching in the doubly linked list. The sensorquality data structure comprises sensor _ quant _ link which is used for recording the physical quantity which is acquired by the sensor in the system and searching in a double linked list to obtain the sensorquality data structure.
The system also comprises a physical quantity data initialization unit used for initializing physical quantity name information, physical quantity type information, physical quantity attribute value information, sensor information to which the physical quantity belongs, physical quantity callback function information, physical quantity list information which is supported and collected by a sensor to which the physical quantity belongs and all physical quantity list information of the system.
The initialized physical quantity data structure includes physical quantity name information for recording the name of the physical quantity in the system and uniquely identifying one of the SensorQuantity data structures. Physical quantity type information quantjype is included for recording the type of the physical quantity, which is expressed using an enumeration variable. The method comprises physical quantity attribute value information quant _ value used for recording numerical values related to the physical quantity, wherein the numerical values include decimal place number of results, maximum value and minimum value of collection history, maximum value and minimum value of national standard, last collected value and other variables. The sensor information comprises sensor _ dev to which the physical quantity belongs, is used for recording a sensor device data structure sensor device to which the physical quantity belongs in a system, and is acquired and assigned when the abstract data structure of the physical quantity is registered. The method comprises physical quantity callback function information ready _ operations, is used for recording callback functions of the physical quantity, and is realized according to the drive and the protocol of a corresponding sensor, and function pointer assignment is carried out during registration. The sensor device comprises sensor _ quant _ link supporting collection of the sensor to which the physical quantity belongs, and is used for registering in a sensor device data structure sensor device to which the physical quantity belongs, so that the sensor device data structure sensor _ quant _ link supporting collection of the physical quantity can be conveniently searched through the sensor device data structure. The method comprises list information quant _ link of all physical quantities of the system, is used for recording all registered physical quantities in the system, and can acquire the SensorQuantity data structure by searching in a double linked list.
According to the initialization module, initialization and doubly linked list registration of the sensor device and physical quantity sensing quantity data structures can be completed, so that a follow-up module can construct a universal API interface.
The application module provided by the embodiment of the application is used for providing a searching interface and a data acquisition interface of the physical quantity, searching and acquiring the physical quantity from the doubly-linked list, and sending the acquired physical quantity to the upper application.
In an optional embodiment, the application module comprises: the physical quantity searching unit is used for searching whether the physical quantity to be acquired exists in the two-way linked list or not, and comprises a data acquisition unit used for calling a callback function of the physical quantity to be acquired when the physical quantity to be acquired exists in the two-way linked list, opening a sensor drive, receiving data from a sensor and sending the received data to an upper application.
Specifically, the application module includes a physical quantity lookup function interface and a data acquisition function interface, including SensorQuantityFind, SensorQuantityOpen, SensorQuantityClose, and SensorQuantityRead.
The SensorQuantityFind is used for searching whether a certain type of physical quantity collection is supported in the system, namely whether a corresponding physical quantity type exists in a doubly linked list is searched, if so, the SensorQuantity of the physical quantity data structure is returned, and if not, an empty NULL is returned.
On the premise that the sensorQuantity data structure is effective, the sensorQuantityOpen is used for opening the physical quantity, and sensor _ operations- > open and sensor _ operations- > ioctl members in the SensorDevice data structure are used for configuring drive related operations of the sensor and breaking through a bottom-layer hardware channel.
The SensorQuantityClose is used to turn off the physical quantity, and also turns off the underlying sensor drive using the sensor _ operations- > close and sensor _ operations- > ioctl members within the SensorDevice data structure. The SensorQuantityRead is used for reading the physical quantity, is realized by a readvalue _ operations callback function in a sensorquantitydata structure, links sensor _ operations- > read and sensor _ operations- > write members in the SensorDevice data structure, and reads the physical quantity parameters from sensor hardware.
In the operating process of the operating system, an application program acquires specific physical quantity data by calling a sensor physical quantity application module and utilizing a framework general API (application program interface) for upper-layer application processing, wherein the specific physical quantity data comprises the API interfaces of SensorQuantyFind, SensorQuantyOpen, SensorQuantyRead, SensorQuantyClose and the like. The upper application calls a function interface provided by the application module, only the type of the physical quantity to be read needs to be concerned, and logic related to sensor hardware does not need to be processed. The method has better portability and universality, and greatly simplifies the programming development of the sensor software.
The sensor subsystem of the embodiment of the present application is described in detail below in conjunction with the HS3000x temperature and humidity sensor. In one exemplary scenario, a sensor subsystem is implemented based on an HS300x temperature and humidity sensor, and an HS300x is connected with a terminal device through an I2C interface, and supports acquisition of two physical quantities, namely temperature and humidity.
And in the variable definition module, a macro configuration unit and a compiling configuration unit are included, wherein the macro configuration unit is realized by a Kconfig tool. SENSOR/hub/Kconfig and SENSOR/TEMPERATURE/Kconfig define SENSOR _ QUANTITY _ HS300X _ HUMIDITY and SENSOR _ QUANTITY _ HS300X _ TEMPERATURE, respectively, the quant _ name as the hub _ SensorQuantQuantDataStructure and the TEMPERATURE _ SensorQuantDataStructure, the SENSOR _ DEVICE _ HS300X as the HS300x _ SensorDevice data structure, and the SENSOR _ DEVICE _ HS300X _ DEV as the file system I2C peripheral path. Meanwhile, the SENSOR _ HS300X is enabled, the compiling configuration unit enables the temperature and humidity directory Makefile, i.e., the SENSOR/humidity/Makefile and the SENSOR/temperature/Makefile, to compile the corresponding files according to macro definitions such as the SENSOR _ HS 300X.
The initialization module comprises a sensor device registration module and a physical quantity abstract data structure registration module, and is respectively responsible for initializing the sensor device data structure and the physical quantity abstract data structure. Namely, hs300x _ SensorDevice data structure, husidation _ SensorQuantity data structure, and temperature _ SensorQuantity data structure.
Wherein, the sensor _ operations callback function in the hs300x _ sensor device data structure is correspondingly driven by an operating system bottom layer I2C, i.e., open corresponds to I2c _ open, close corresponds to I2c _ close, read corresponds to I2c _ read, write corresponds to I2c _ write, and ioctl corresponds to I2c _ ioctl.
hs300x _ SensorDevice data structure is registered into the sensor _ link doubly linked list and inserted into the tail of the list. In the data structures of the hub _ sensor quantity and the temperature _ sensor quantity, the quant _ type is the hub _ type and the temperature _ type respectively, the sensor _ dev is the HS300x _ sensor function pointer, so that the two physical quantities of the hub and the temperature correspond to the sensors, the readvalue _ operations callback function is realized according to the HS300x sensor data analysis protocol, and the data collected by the I2C peripheral is analyzed into hub humidity data and temperature data respectively. Similarly, the data structures of the hunidatity _ SensorQuantity and the temperature _ SensorQuantity are both registered into the quant _ link doubly linked list and inserted into the tail of the list.
In the application module, the physical quantity searching unit and the data acquisition unit are included, a humidity and temperature physical quantity application framework interface is provided, and the execution process is as follows:
and C, according to the requirements of the sensor application program, selectively reading the humidity or temperature physical quantity, reading the humidity physical quantity to execute the step B, and reading the temperature physical quantity to execute the step C.
Step B, reading the humidity physical quantity, and dividing the humidity physical quantity into the following four steps:
step B1, calling a sensorQuantyFind function, searching a hunitySensQuantity data structure in a physical QUANTITY double-linked list in the system through quant _ name (SENSOR _ QUANTITY _ HS300X _ HUMIDITY), ending if returning to null, indicating that the physical QUANTITY collection is not supported in the current system, otherwise, executing step B2.
Step B2, a sensorQuantyOpen function is called, and a humidity _ sensorQuanty data structure is transmitted, so that the humidity physical quantity acquisition function is enabled.
Step B3, a sensorQuantyRead function is called, a humidity _ sensorQuanty data structure is transmitted, and analyzed humidity physical quantity data are obtained for use by subsequent application logic.
And step B4, calling a sensorQuantyClose function, transmitting the humidity _ sensorQuantity data structure, closing the humidity physical quantity acquisition function, and stopping the sensor bottom layer function.
Step C, reading the temperature physical quantity, which comprises the following four steps:
step C1, calling a sensorQuantyFind function, searching a temporal _ sensorQuantydata structure in a physical QUANTITY double-linked list in the system through a quant _ name (SENSOR _ QUANTITY _ HS300X _ TEMPERATURE), ending if returning to null, indicating that the physical QUANTITY collection is not supported in the current system, otherwise, executing the step C2.
Step C2, the sensorquantitypen function is called and transmitted into the temperature _ SensorQuantity data structure, so that the temperature physical quantity acquisition function is enabled.
Step C3, the sensorquantitoryread function is called and transmitted into the temperature _ sensorquantitity data structure, and the analyzed temperature physical quantity data is obtained for the subsequent application logic.
And step C4, calling a sensorQuantyClose function, transmitting a temperature _ sensorQuantity data structure, closing the temperature physical quantity acquisition function, and stopping the sensor bottom layer function.
According to the sensor subsystem based on the Internet of things, provided by the embodiment of the application, the physical quantity is used as the center, the uniform characteristic of the data collected by the sensor is abstracted, the hardware difference of the bottom sensor is shielded, different types of sensors compatible with the same data are provided, a uniform universal data collection interface is provided for the outside, the upper application development logic is simplified, and the programming efficiency is improved. And the scheme is irrelevant to the chip architecture, and supports multi-platform and multi-architecture transplantation. The basic data source and the external API interface are displayed to be greatly decoupled, the method can be migrated and applied in various Internet of things embedded operating systems, has better transportability and universality, and greatly simplifies the programming development of sensor software.
In a second aspect, an embodiment of the present application provides a method for applying a sensor subsystem, as shown in fig. 2, the method includes the following steps:
s201, defining variables of a sensor subsystem according to sensors connected with the Internet of things system and the acquired physical quantity.
In one possible implementation, the variables of the sensor subsystem are defined in a hierarchical manner in a directory structure within the Kconfig file. For example, the method of using directory structure hierarchy for the Kconfig file can be classified as sensor/Kconfig, sensor/co2/Kconfig, sensor/homidity/Kconfig, sensor/pm/Kconfig, sensor/temperature/Kconfig, sensor/voice/Kconfig, and the like. Variables specifying physical quantities, such as carbon dioxide co2, humidity, pm, temperature, voice, etc., are stored in the Kconfig file in the form of a root directory. It is also possible to click on a directory specifying a physical quantity and continue to define variables and enables associated with that physical quantity, for example click on sensor/co2/Kconfig and continue to define variables associated with co 2.
And defining variables needing to be compiled by the sensor subsystem in the Makefile by adopting a directory structure hierarchical method.
For example, Makefile adopts directory structure layering method can be divided into sensor/Makefile, sensor/co2/Makefile, sensor/hub/Makefile, sensor/pm/Makefile, sensor/temperature/Makefile, sensor/voice/Makefile, etc. Further, it is also possible to point out a directory of specified physical quantities and continue to configure the physical quantities to be compiled in relation to the physical quantities.
S202, initializing variables of the sensor subsystem, and storing the initialized data into a doubly-linked list.
In the initialization process, the operating system applies for two memory spaces respectively for storing sensor device and physical quantity sensor quantity data structures, registers according to specific sensors and physical quantities, and initializes the relevant characteristics of the sensors, including attributes, macro definitions, physical quantity types, callback functions and the like, wherein the callback functions need to be in butt joint with a peripheral driving interface at the bottom layer of the operating system, and get through application and driving data paths.
In one possible implementation, initializing variables of the sensor subsystem includes: initializing sensor name information, sensor attribute information, sensor callback function information, sensor list information and physical quantity list information which is collected by a sensor in a supporting way; initializing name information of the physical quantity, type information of the physical quantity, attribute value information of the physical quantity, sensor information to which the physical quantity belongs, callback function information of the physical quantity, list information of the physical quantity which is supported and collected by a sensor to which the physical quantity belongs, and list information of all physical quantities of the system.
S203, a physical quantity searching interface and a data acquisition interface are provided, the physical quantity is searched and acquired from the double linked list, and the acquired physical quantity is sent to the upper application.
Specifically, a callback function for searching the physical quantity is called, and the physical quantity to be collected is searched in the doubly-linked list through the initialized physical quantity name; if the data structure of the physical quantity to be collected is returned, calling and opening a callback function of the sensor drive corresponding to the physical quantity to be collected; and calling a callback function for receiving data from the sensor, receiving the acquired physical quantity, and sending the acquired physical quantity to the upper application.
In one possible implementation, the application modules include SensorQuantityFind, SensorQuantityOpen, SensorQuantityClose, and SensorQuantityRead.
The SensorQuantityFind is used for searching whether a certain type of physical quantity collection is supported in the system, namely whether a corresponding physical quantity type exists in a doubly linked list is searched, if so, the SensorQuantity of the physical quantity data structure is returned, and if not, an empty NULL is returned.
On the premise that the sensorQuantity data structure is valid, sensorQuantityOpen is used for opening the physical quantity, and sensor _ operations- > open and sensor _ operations- > ioctl members in the SensorDevice data structure are used for configuring driving related operations of the sensor and opening a bottom-layer hardware path.
The SensorQuantityClose is used to turn off the physical quantity, and also turns off the underlying sensor drive using the sensor _ operations- > close and sensor _ operations- > ioctl members within the SensorDevice data structure. The sensorQuantyRead is used for reading the physical quantity, is realized by a readvalue _ operations callback function in a sensorQuantity data structure, links sensor _ operations- > read and sensor _ operations- > write members in the SensorDevice data structure, and reads the physical quantity parameters from sensor hardware.
In the operating process of the operating system, the application program calls the sensor physical quantity application module and utilizes the framework general API interface to obtain specific physical quantity data for upper-layer application processing. And the software programming development of the sensor is greatly simplified.
It should be noted that, when the sensor subsystem based on the internet of things provided in the foregoing embodiment executes the application method of the sensor subsystem, only the division of the functional modules is used for illustration, and in practical application, the function distribution may be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the sensor subsystem based on the internet of things and the application method embodiment of the sensor subsystem provided by the above embodiment belong to the same concept, and the embodiment of the implementation process is described in detail in the system embodiment, and are not described again here.
Referring to fig. 3, the computer readable storage medium is an optical disc 300, on which a computer program (i.e., a program product) is stored, and when the computer program is executed by a processor, the computer program performs the method for applying the sensor subsystem according to any of the foregoing embodiments.
It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory, or other optical and magnetic storage media, which are not described in detail herein.
The computer readable storage medium provided by the above embodiments of the present application and the application method of the sensor subsystem provided by the embodiments of the present application have the same advantages as the method adopted, run or implemented by the application program stored in the computer readable storage medium.
All possible combinations of the technical features in the above embodiments may not be described for the sake of brevity, but should be considered as being within the scope of the present disclosure as long as there is no contradiction between the combinations of the technical features.
The above examples only show several embodiments of the present invention, and the description thereof is specific and detailed, but not to be construed as limiting the scope of the present invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent should be subject to the appended claims.

Claims (10)

1. An internet of things based sensor subsystem, comprising:
the variable definition module is used for defining the variable of the sensor subsystem according to the sensor connected with the Internet of things system and the acquired physical quantity;
the initialization module is used for initializing variables of the sensor subsystem and storing initialized data into the bidirectional linked list;
and the application module is used for providing a searching interface and a data acquisition interface of the physical quantity, searching and acquiring the physical quantity from the two-way linked list, and sending the acquired physical quantity to the upper application.
2. The system of claim 1, wherein the variable definition module comprises:
the macro configuration unit is used for defining variables of the sensor subsystem in a directory structure layering mode in the Kconfig file;
and the compiling and configuring unit is used for defining the variables of the sensor subsystem in the Makefile by adopting a directory structure layering method.
3. The system of claim 1, wherein the initialization module comprises:
the sensor data initialization unit is used for initializing sensor name information, sensor attribute information, sensor callback function information, sensor list information and physical quantity list information which is acquired by the support of the sensor;
And the physical quantity data initialization unit is used for initializing physical quantity name information, physical quantity type information, physical quantity attribute value information, sensor information to which the physical quantity belongs, physical quantity callback function information, physical quantity list information which is acquired by the sensor to which the physical quantity belongs and all physical quantity list information of the system.
4. The system of claim 3,
the sensor attribute information comprises the acquisition capacity, the manufacturer name and the product model of the sensor;
the sensor callback function information includes a callback function to turn on a sensor drive, a callback function to turn off a sensor drive, a callback function to receive data from a sensor, a callback function to send data to a sensor, and a callback function to configure a sensor drive.
5. The system of claim 1, wherein the application module comprises:
the physical quantity searching unit is used for searching whether the physical quantity to be acquired exists in the bidirectional linked list;
and the data acquisition unit is used for calling a callback function of the physical quantity to be acquired when the physical quantity to be acquired is in the doubly linked list, opening a sensor driver, receiving data from the sensor and sending the received data to the upper application.
6. The system of claim 5, wherein the look-up of the doubly-linked list for the physical quantity to be collected is performed, and when the physical quantity to be collected is present in the doubly-linked list, the call back function of the physical quantity to be collected is called, the sensor driver is turned on, the data is received from the sensor, and the received data is sent to the upper application, and the method comprises:
calling a callback function for searching the physical quantity, and searching the physical quantity to be collected in the doubly linked list through the initialized physical quantity name;
if the data structure of the physical quantity to be collected is returned, calling and opening a callback function driven by the sensor corresponding to the physical quantity to be collected;
and calling a callback function for receiving data from the sensor, receiving the acquired physical quantity, and sending the acquired physical quantity to the upper application.
7. The system of claim 6, further comprising:
and after the physical quantity is collected, calling and closing a callback function driven by the sensor corresponding to the physical quantity to be collected, and closing the collection function of the sensor.
8. A method of using a sensor subsystem, comprising:
defining variables of a sensor subsystem according to sensors connected with the Internet of things system and the collected physical quantity;
Initializing variables of a sensor subsystem, and storing initialized data into a bidirectional linked list;
and providing a searching interface and a data acquisition interface of the physical quantity, searching and acquiring the physical quantity from the two-way linked list, and sending the acquired physical quantity to the upper application.
9. The method of claim 8, wherein providing a lookup interface for physical quantities and a data acquisition interface, looking up and acquiring the physical quantities from the doubly linked list, and sending the acquired physical quantities to an upper layer application comprises:
calling a callback function for searching the physical quantity, and searching the physical quantity to be collected in the doubly linked list through the initialized physical quantity name;
if the data structure of the physical quantity to be collected is returned, calling and opening a callback function driven by the sensor corresponding to the physical quantity to be collected;
and calling a callback function for receiving data from the sensor, receiving the acquired physical quantity, and sending the acquired physical quantity to the upper application.
10. The method of claim 8, wherein initializing variables of the sensor subsystem comprises:
initializing sensor name information, sensor attribute information, sensor callback function information, sensor list information and physical quantity list information which is collected by a sensor in a supporting way;
Initializing name information of the physical quantity, type information of the physical quantity, attribute value information of the physical quantity, sensor information to which the physical quantity belongs, callback function information of the physical quantity, list information of the physical quantity which is supported and collected by a sensor to which the physical quantity belongs, and list information of all physical quantities of the system.
CN202210096203.XA 2022-01-26 2022-01-26 Sensor subsystem based on Internet of things and application method of sensor subsystem Pending CN114564438A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210096203.XA CN114564438A (en) 2022-01-26 2022-01-26 Sensor subsystem based on Internet of things and application method of sensor subsystem

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210096203.XA CN114564438A (en) 2022-01-26 2022-01-26 Sensor subsystem based on Internet of things and application method of sensor subsystem

Publications (1)

Publication Number Publication Date
CN114564438A true CN114564438A (en) 2022-05-31

Family

ID=81713415

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210096203.XA Pending CN114564438A (en) 2022-01-26 2022-01-26 Sensor subsystem based on Internet of things and application method of sensor subsystem

Country Status (1)

Country Link
CN (1) CN114564438A (en)

Similar Documents

Publication Publication Date Title
CN110083706B (en) Internet of things-oriented micro-service framework and service combination method thereof
US9979603B2 (en) System architecture for cloud-platform infrastructure layouts
US8589522B2 (en) Incrementally updatable system software infrastructure for sensor networks
TWI354900B (en) Method, system, and computer program product for a
CN104050080B (en) User space debugs the method and system of linux kernel
WO2006022894A1 (en) Index-based parameter access and software for using the same
CN101488085A (en) Software interface test method and apparatus
CN109614147A (en) A kind of PHY register reading/writing method and device
CN111158741A (en) Method and device for monitoring change of dependency relationship of business module on third-party class library
CN110213092A (en) Resource access method, platform management equipment, storage medium and the device of mixed cloud
CN103853535A (en) Method and device for modifying middleware
CN110119282A (en) A kind of internet-of-things terminal and system based on general-purpose built-in type computer
CN110912782A (en) Data acquisition method, device and storage medium
CN108021357A (en) The optimization method and device of routine call
CN111611022A (en) Data processing method, device, equipment and system for applet application
JP4620112B2 (en) How to collect monitor information
CN109960709B (en) Database driver processing method, device, equipment and storage medium
CN111679871A (en) Database driver loading method and database driver loading device
CN115033230A (en) Method, device, equipment and medium for generating driver of embedded hardware platform
CN111095874B (en) Data structure for transmitting data from a fieldbus network to a cloud
CN114564438A (en) Sensor subsystem based on Internet of things and application method of sensor subsystem
CN101719069B (en) Method and device of Web servitization of Java system
CN113448690A (en) Monitoring method and device
CN111309634A (en) Code detection rule framework establishing and using method based on inheritance and proxy
CN113568603B (en) Component object creating and interface method calling method, terminal and storage device

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
TA01 Transfer of patent application right

Effective date of registration: 20221013

Address after: 311200 room 288-1, No. 857, Shixin North Road, ningwei Town, Xiaoshan District, Hangzhou City, Zhejiang Province

Applicant after: Institute of Information Technology, Zhejiang Peking University

Applicant after: Peking University

Address before: 311200 room 288-1, No. 857, Shixin North Road, ningwei Town, Xiaoshan District, Hangzhou City, Zhejiang Province

Applicant before: Institute of Information Technology, Zhejiang Peking University

Applicant before: Hangzhou Weiming Information Technology Co.,Ltd.

TA01 Transfer of patent application right