update the sub-title of apprach/gan.md
This commit is contained in:
parent
0333d1f582
commit
1ef86c63c8
|
@ -10,7 +10,9 @@ XiUOS的传感器框架以用户为中心,采用了以物理量为中心的抽
|
||||||
|
|
||||||
从关联关系上来看,一个xs_SensorQuantity对应一个xs_SensorDevice,一个xs_SensorDevice对应一个或多个xs_SensorQuantity。例如,对于一个可以测量温度与湿度的传感器设备,该设备唯一对应一个xs_SensorDevice结构,而该设备测量温度与湿度的能力分别对应一个xs_SensorQuantity结构。两种数据结构的具体定义如下。
|
从关联关系上来看,一个xs_SensorQuantity对应一个xs_SensorDevice,一个xs_SensorDevice对应一个或多个xs_SensorQuantity。例如,对于一个可以测量温度与湿度的传感器设备,该设备唯一对应一个xs_SensorDevice结构,而该设备测量温度与湿度的能力分别对应一个xs_SensorQuantity结构。两种数据结构的具体定义如下。
|
||||||
|
|
||||||
## struct xs_SensorQuantity结构
|
## 1. XiUOS传感器框架的关键数据结构定义和解析
|
||||||
|
|
||||||
|
* struct xs_SensorQuantity结构
|
||||||
```c
|
```c
|
||||||
struct xs_SensorQuantity {
|
struct xs_SensorQuantity {
|
||||||
const char name[XS_NAME_MAX]; /* name of the sensor quantity instance */
|
const char name[XS_NAME_MAX]; /* name of the sensor quantity instance */
|
||||||
|
@ -36,7 +38,7 @@ sdev成员表示该xs_SensorQuantity所属的xs_SensorDevice结构,其具体
|
||||||
|
|
||||||
最后,在系统中每种物理量的xs_SensorQuantity被分别组织成不同双链表,如二氧化碳浓度xs_SensorQuantity链表、温度xs_SensorQuantity链表等,使用的链表节点即为link成员。
|
最后,在系统中每种物理量的xs_SensorQuantity被分别组织成不同双链表,如二氧化碳浓度xs_SensorQuantity链表、温度xs_SensorQuantity链表等,使用的链表节点即为link成员。
|
||||||
|
|
||||||
## struct xs_SensorDevice结构
|
* struct xs_SensorDevice结构
|
||||||
```c
|
```c
|
||||||
struct xs_SensorDevice {
|
struct xs_SensorDevice {
|
||||||
const char name[XS_NAME_MAX]; /* name of the sensor device */
|
const char name[XS_NAME_MAX]; /* name of the sensor device */
|
||||||
|
@ -82,7 +84,7 @@ struct xs_SensorInterface {
|
||||||
|
|
||||||
最后,系统中所有注册过的传感器设备被组织成一个双链表,即link成员。
|
最后,系统中所有注册过的传感器设备被组织成一个双链表,即link成员。
|
||||||
|
|
||||||
## 传感器框架驱动开发
|
## 2. XiUOS传感器框架驱动开发
|
||||||
|
|
||||||
以二氧化碳传感器为例。传感器框架针对每个具体的物理量将xs_SensorQuantity进行扩充,采用类似面向对象的手段添加其他必要成员,如:
|
以二氧化碳传感器为例。传感器框架针对每个具体的物理量将xs_SensorQuantity进行扩充,采用类似面向对象的手段添加其他必要成员,如:
|
||||||
```c
|
```c
|
||||||
|
@ -151,7 +153,7 @@ void register_co2_sensor()
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## 传感器框架的使用
|
## 3. XiUOS传感器框架的使用实例
|
||||||
|
|
||||||
传感器应用开发者使用传感器框架提供的API操作传感器,传感器API可以分为通用API与物理量特有API。通用API用于传感器的获取、打开与关闭,物理量特有API用于传感器的数据采样。以二氧化碳传感器为例:
|
传感器应用开发者使用传感器框架提供的API操作传感器,传感器API可以分为通用API与物理量特有API。通用API用于传感器的获取、打开与关闭,物理量特有API用于传感器的数据采样。以二氧化碳传感器为例:
|
||||||
```c
|
```c
|
||||||
|
|
Loading…
Reference in New Issue