mirror of
https://github.com/Ai-Thinker-Open/Ai-Thinker-Open_RTL8710BX_ALIOS_SDK.git
synced 2026-07-01 17:05:37 +00:00
rel_1.6.0 init
This commit is contained in:
commit
27b3e2883d
19359 changed files with 8093121 additions and 0 deletions
25
Living_SDK/framework/uData/include/abs_data_model.h
Normal file
25
Living_SDK/framework/uData/include/abs_data_model.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
|
||||
*/
|
||||
|
||||
/**
|
||||
* @abstract data model
|
||||
* @brief abstract data api
|
||||
* @version since 0.0.1
|
||||
*/
|
||||
|
||||
#ifndef ABS_SENSOR_MODEL_H
|
||||
#define ABS_SENSOR_MODEL_H
|
||||
|
||||
#include "uData_com_desc.h"
|
||||
|
||||
int abs_data_model_init(void);
|
||||
int abs_data_open(uData_service_t *service);
|
||||
int abs_data_close(sensor_tag_e tag);
|
||||
int abs_data_read(sensor_tag_e tag, void* pdata, uint32_t nbyte);
|
||||
int abs_data_ioctl(sensor_tag_e tag, void* config);
|
||||
int abs_cali_data_register(sensor_tag_e tag, void* cb);
|
||||
int abs_cali_data_unregister(udata_type_e type);
|
||||
|
||||
#endif /*ABS_SENSOR_MODEL_H*/
|
||||
|
||||
12
Living_SDK/framework/uData/include/service_algo.h
Normal file
12
Living_SDK/framework/uData/include/service_algo.h
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
|
||||
*/
|
||||
|
||||
#ifndef SERVICE_ALGO_H
|
||||
#define SERVICE_ALGO_H
|
||||
|
||||
extern int service_example_init(void);
|
||||
|
||||
|
||||
#endif /* SERVICE_ALGO_H */
|
||||
|
||||
22
Living_SDK/framework/uData/include/service_mgr.h
Normal file
22
Living_SDK/framework/uData/include/service_mgr.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
|
||||
*/
|
||||
|
||||
/**
|
||||
* @uData service manager
|
||||
* @brief serive manager API
|
||||
* @version since 0.0.1
|
||||
*/
|
||||
|
||||
#ifndef SERVICE_MANAGER_H
|
||||
#define SERVICE_MANAGER_H
|
||||
|
||||
#include "uData_com_desc.h"
|
||||
|
||||
|
||||
int uData_service_mgr_init(void);
|
||||
int uData_service_register(uData_service_t *service);
|
||||
int uData_service_unregister(udata_type_e type);
|
||||
|
||||
#endif /*SERVICE_MANAGER_H*/
|
||||
|
||||
123
Living_SDK/framework/uData/include/uData_com_desc.h
Normal file
123
Living_SDK/framework/uData/include/uData_com_desc.h
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
|
||||
/*
|
||||
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
|
||||
*/
|
||||
|
||||
/**
|
||||
* @uData
|
||||
* @brief uData object desc
|
||||
* @version since 0.0.1
|
||||
*/
|
||||
|
||||
#ifndef UDATA_OBJ_DESC_H
|
||||
#define UDATA_OBJ_DESC_H
|
||||
|
||||
#include <aos/kernel.h>
|
||||
#include "hal/sensor.h"
|
||||
#include "aos/log.h"
|
||||
|
||||
|
||||
#define DO_FOREVER
|
||||
|
||||
#define uDATA_STR "uData: " /* uData debug header */
|
||||
|
||||
#define TIMESTAMP_2_MS(t) ((t) / 1000)
|
||||
#define MS_2_TIMESTAMP(ms) ((ms) * 1000)
|
||||
|
||||
#define INTERVAL_2_MS(i) TIMESTAMP_2_MS(i)
|
||||
#define MS_TO_INTERVAL(ms) MS_2_TIMESTAMP(ms)
|
||||
|
||||
#define HZ_2_INTERVAL(hz) ((hz) ? ((1000) / (hz)) : 0)
|
||||
#define INTERVAL_2_HZ(i) ((i) == 0 ? 0 : ((i) > MS_2_TIMESTAMP(1000) ? 1 : (MS_2_TIMESTAMP(1000) / (i))))
|
||||
|
||||
#define HZ_2_TIMESTAMP(hz) HZ_2_INTERVAL(hz)
|
||||
#define TIMESTAMP_2_HZ(t) INTERVAL_2_HZ(t)
|
||||
|
||||
typedef bool b_subscribed;
|
||||
typedef bool b_enbled;
|
||||
typedef int (*fn_cb)(void* pData); /* callback for calibrated algo */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
UDATA_SERVICE_ACC = 0, /* Accelerometer */
|
||||
UDATA_SERVICE_MAG, /* Magnetometer */
|
||||
UDATA_SERVICE_GYRO, /* Gyroscope */
|
||||
UDATA_SERVICE_ALS, /* Ambient light sensor */
|
||||
UDATA_SERVICE_PS, /* Proximity */
|
||||
UDATA_SERVICE_BARO, /* Barometer */
|
||||
UDATA_SERVICE_TEMP, /* Temperature */
|
||||
UDATA_SERVICE_UV, /* Ultraviolet */
|
||||
UDATA_SERVICE_HUMI, /* Humidity */
|
||||
UDATA_SERVICE_HALL, /* HALL sensor */
|
||||
UDATA_SERVICE_HR, /* Heart Rate sensor */
|
||||
UDATA_SERVICE_PEDOMETER,
|
||||
UDATA_SERVICE_PDR,
|
||||
UDATA_SERVICE_VDR,
|
||||
UDATA_SERVICE_GPS,
|
||||
|
||||
UDATA_MAX_CNT,
|
||||
}udata_type_e;
|
||||
|
||||
/* the max size of the dat buf */
|
||||
#define DATA_SIZE 64
|
||||
#define ABS_DATA_MAX_CNT TAG_DEV_SENSOR_NUM_MAX
|
||||
|
||||
struct _abs_cali_cb_t {
|
||||
sensor_tag_e tag;
|
||||
int (*calibrated_algo_process_cb)(sensor_tag_e tag, void* pData); /* callback for calibrated algo */
|
||||
};
|
||||
typedef struct _abs_cali_cb_t abs_cali_cb_t;
|
||||
|
||||
struct _abs_data_pkg_t {
|
||||
sensor_tag_e tag;
|
||||
uint8_t srv_cnt; /* count of the registed service base on this sensor */
|
||||
bool poweron; /* the power status of the registed service base on this sensor */
|
||||
uint32_t interval;/* the report data interval of the sensor*/
|
||||
uint64_t cur_timestamp; /* the current timestamp for every sensor, the unit is ms */
|
||||
int (*calibrated_algo_process_cb)(void* pData); /* callback for calibrated algo */
|
||||
dev_sensor_full_info_t full_info;
|
||||
};
|
||||
typedef struct _abs_data_pkg_t abs_data_pkg_t;
|
||||
|
||||
/* sensor service manager layer*/
|
||||
struct _uData_service_t {
|
||||
udata_type_e type;
|
||||
sensor_tag_e tag;
|
||||
b_subscribed subscribe; /* subscribe only from aliyun side */
|
||||
b_enbled running;
|
||||
dev_sensor_config_t config;
|
||||
uint8_t payload[DATA_SIZE];
|
||||
size_t(*service_process_cb)(sensor_tag_e tag, void* pdata); /* process callback for udata service handle */
|
||||
int(*service_ioctl_cb)(udata_type_e type, sensor_tag_e tag); /* ioclt callback for udata service handle */
|
||||
};
|
||||
typedef struct _uData_service_t uData_service_t;
|
||||
|
||||
struct _sensor_msg_pkg_t {
|
||||
sensor_tag_e tag;
|
||||
uint8_t cmd;
|
||||
dev_sensor_config_t config;
|
||||
};
|
||||
typedef struct _sensor_msg_pkg_t sensor_msg_pkg_t;
|
||||
|
||||
/* define the udata serivce struct here, please aline with aliyun side
|
||||
for the physical sensor, should be same as the dev sensor struct */
|
||||
typedef struct _dev_barometer_data_t service_barometer_t;
|
||||
|
||||
typedef struct _service_pedometer_t{
|
||||
udata_type_e type;
|
||||
uint32_t step;
|
||||
} service_pedometer_t;
|
||||
|
||||
typedef struct _udata_t{
|
||||
udata_type_e type;
|
||||
uint16_t value;
|
||||
} udata_t;
|
||||
|
||||
typedef struct _udata_pkg_t{
|
||||
bool valid;
|
||||
udata_type_e type;
|
||||
__attribute__((aligned(4))) char payload[DATA_SIZE];
|
||||
}udata_pkg_t;
|
||||
|
||||
#endif /*UDATA_OBJ_DESC_H*/
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue