mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-30 19:19:21 +00:00
ble_mesh: add Generic/Sensor/Time and Scenes/Lighting Server models
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _MODEL_COMMON_H_
|
||||
#define _MODEL_COMMON_H_
|
||||
#ifndef _CLIENT_COMMON_H_
|
||||
#define _CLIENT_COMMON_H_
|
||||
|
||||
#include "mesh_access.h"
|
||||
|
||||
@@ -136,5 +136,5 @@ typedef struct {
|
||||
*/
|
||||
int bt_mesh_set_client_model_role(bt_mesh_role_param_t *common);
|
||||
|
||||
#endif /* _MODEL_COMMON_H_ */
|
||||
#endif /* _CLIENT_COMMON_H_ */
|
||||
|
||||
|
150
components/bt/esp_ble_mesh/mesh_models/server/device_property.c
Normal file
150
components/bt/esp_ble_mesh/mesh_models/server/device_property.c
Normal file
@@ -0,0 +1,150 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mesh_types.h"
|
||||
|
||||
#include "server_common.h"
|
||||
#include "device_property.h"
|
||||
|
||||
static struct bt_mesh_dev_prop {
|
||||
u16_t prop_id;
|
||||
u8_t len;
|
||||
} device_properties [] = {
|
||||
{ BLE_MESH_INVALID_DEVICE_PROPERTY_ID, 0xFF },
|
||||
{ BLE_MESH_AVERAGE_AMBIENT_TEMPERATURE_IN_A_PERIOD_OF_DAY, 0x03 },
|
||||
{ BLE_MESH_AVERAGE_INPUT_CURRENT, 0x03 },
|
||||
{ BLE_MESH_AVERAGE_INPUT_VOLTAGE, 0x03 },
|
||||
{ BLE_MESH_AVERAGE_OUTPUT_CURRENT, 0x03 },
|
||||
{ BLE_MESH_AVERAGE_OUTPUT_VOLTAGE, 0x03 },
|
||||
{ BLE_MESH_CENTER_BEAM_INTENSITY_AT_FULL_POWER, 0x02 },
|
||||
{ BLE_MESH_CHROMATICITY_TOLERANCE, 0x01 },
|
||||
{ BLE_MESH_COLOR_RENDERING_INDEX_R9, 0x01 },
|
||||
{ BLE_MESH_COLOR_RENDERING_INDEX_RA, 0x01 },
|
||||
{ BLE_MESH_DEVICE_APPEARANCE, 0x02 },
|
||||
{ BLE_MESH_DEVICE_COUNTRY_OF_ORIGIN, 0x02 },
|
||||
{ BLE_MESH_DEVICE_DATE_OF_MANUFACTURE, 0x04 },
|
||||
{ BLE_MESH_DEVICE_ENERGY_USE_SINCE_TURN_ON, 0x04 },
|
||||
{ BLE_MESH_DEVICE_FIRMWARE_REVISION, 0x08 },
|
||||
{ BLE_MESH_DEVICE_GLOBAL_TRADE_ITEM_NUMBER, 0x08 },
|
||||
{ BLE_MESH_DEVICE_HARDWARE_REVISION, 0x16 },
|
||||
{ BLE_MESH_DEVICE_MANUFACTURER_NAME, 0x36 },
|
||||
{ BLE_MESH_DEVICE_MODEL_NUMBER, 0x24 },
|
||||
{ BLE_MESH_DEVICE_OPERATING_TEMPERATURE_RANGE_SPECIFICATION, 0x04 },
|
||||
{ BLE_MESH_DEVICE_OPERATING_TEMPERATURE_STATISTICAL_VALUES, 0x09 },
|
||||
{ BLE_MESH_DEVICE_OVER_TEMPERATURE_EVENT_STATISTICS, 0x06 },
|
||||
{ BLE_MESH_DEVICE_POWER_RANGE_SPECIFICATION, 0x12 },
|
||||
{ BLE_MESH_DEVICE_RUNTIME_SINCE_TURN_ON, 0x04 },
|
||||
{ BLE_MESH_DEVICE_RUNTIME_WARRANTY, 0x04 },
|
||||
{ BLE_MESH_DEVICE_SERIAL_NUMBER, 0x16 },
|
||||
{ BLE_MESH_DEVICE_SOFTWARE_REVISION, 0x08 },
|
||||
{ BLE_MESH_DEVICE_UNDER_TEMPERATURE_EVENT_STATISTICS, 0x06 },
|
||||
{ BLE_MESH_INDOOR_AMBIENT_TEMPERATURE_STATISTICAL_VALUES, 0x05 },
|
||||
{ BLE_MESH_INITIAL_CIE_1931_CHROMATICITY_COORDINATES, 0x04 },
|
||||
{ BLE_MESH_INITIAL_CORRELATED_COLOR_TEMPERATURE, 0x02 },
|
||||
{ BLE_MESH_INITIAL_LUMINOUS_FLUX, 0x02 },
|
||||
{ BLE_MESH_INITIAL_PLANCKIAN_DISTANCE, 0x02 },
|
||||
{ BLE_MESH_INPUT_CURRENT_RANGE_SPECIFICATION, 0x06 },
|
||||
{ BLE_MESH_INPUT_CURRENT_STATISTICS, 0x09 },
|
||||
{ BLE_MESH_INPUT_OVER_CURRENT_EVENT_STATISTICS, 0x06 },
|
||||
{ BLE_MESH_INPUT_OVER_RIPPLE_VOLTAGE_EVENT_STATISTICS, 0x06 },
|
||||
{ BLE_MESH_INPUT_OVER_VOLTAGE_EVENT_STATISTICS, 0x06 },
|
||||
{ BLE_MESH_INPUT_UNDER_CURRENT_EVENT_STATISTICS, 0x06 },
|
||||
{ BLE_MESH_INPUT_UNDER_VOLTAGE_EVENT_STATISTICS, 0x06 },
|
||||
{ BLE_MESH_INPUT_VOLTAGE_RANGE_SPECIFICATION, 0x06 },
|
||||
{ BLE_MESH_INPUT_VOLTAGE_RIPPLE_SPECIFICATION, 0x01 },
|
||||
{ BLE_MESH_INPUT_VOLTAGE_STATISTICS, 0x09 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_AMBIENT_LUXLEVEL_ON, 0x04 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_AMBIENT_LUXLEVEL_PROLONG, 0x04 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_AMBIENT_LUXLEVEL_STANDBY, 0x04 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_LIGHTNESS_ON, 0x02 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_LIGHTNESS_PROLONG, 0x02 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_LIGHTNESS_STANDBY, 0x02 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_REGULATOR_ACCURACY, 0x01 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_REGULATOR_KID, 0x04 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_REGULATOR_KIU, 0x04 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_REGULATOR_KPD, 0x04 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_REGULATOR_KPU, 0x04 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_TIME_FADE, 0x03 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_TIME_FADE_ON, 0x03 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_TIME_FADE_STANDBY_AUTO, 0x03 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_TIME_FADE_STANDBY_MANUAL, 0x03 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_TIME_OCCUPANCY_DELAY, 0x03 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_TIME_PROLONG, 0x03 },
|
||||
{ BLE_MESH_LIGHT_CONTROL_TIME_RUN_ON, 0x03 },
|
||||
{ BLE_MESH_LUMEN_MAINTENANCE_FACTOR, 0x01 },
|
||||
{ BLE_MESH_LUMINOUS_EFFICACY, 0x02 },
|
||||
{ BLE_MESH_LUMINOUS_ENERGY_SINCE_TURN_ON, 0x04 },
|
||||
{ BLE_MESH_LUMINOUS_EXPOSURE, 0x04 },
|
||||
{ BLE_MESH_LUMINOUS_FLUX_RANGE, 0x04 },
|
||||
{ BLE_MESH_MOTION_SENSED, 0x01 },
|
||||
{ BLE_MESH_MOTION_THRESHOLD, 0x01 },
|
||||
{ BLE_MESH_OPEN_CIRCUIT_EVENT_STATISTICS, 0x06 },
|
||||
{ BLE_MESH_OUTDOOR_STATISTICAL_VALUES, 0x05 },
|
||||
{ BLE_MESH_OUTPUT_CURRENT_RANGE, 0x04 },
|
||||
{ BLE_MESH_OUTPUT_CURRENT_STATISTICS, 0x09 },
|
||||
{ BLE_MESH_OUTPUT_RIPPLE_VOLTAGE_SPECIFICATION, 0x01 },
|
||||
{ BLE_MESH_OUTPUT_VOLTAGE_RANGE, 0x06 },
|
||||
{ BLE_MESH_OUTPUT_VOLTAGE_STATISTICS, 0x09 },
|
||||
{ BLE_MESH_OVER_OUTPUT_RIPPLE_VOLTAGE_EVENT_STATISTICS, 0x06 },
|
||||
{ BLE_MESH_PEOPLE_COUNT, 0x02 },
|
||||
{ BLE_MESH_PRESENCE_DETECTED, 0x01 },
|
||||
{ BLE_MESH_PRESENT_AMBIENT_LIGHT_LEVEL, 0x04 },
|
||||
{ BLE_MESH_PRESENT_AMBIENT_TEMPERATURE, 0x01 },
|
||||
{ BLE_MESH_PRESENT_CIE_1931_CHROMATICITY, 0x04 },
|
||||
{ BLE_MESH_PRESENT_CORRELATED_COLOR_TEMPERATURE, 0x02 },
|
||||
{ BLE_MESH_PRESENT_DEVICE_INPUT_POWER, 0x04 },
|
||||
{ BLE_MESH_PRESENT_DEVICE_OPERATING_EFFICIENCY, 0x01 },
|
||||
{ BLE_MESH_PRESENT_DEVICE_OPERATING_TEMPERATURE, 0x02 },
|
||||
{ BLE_MESH_PRESENT_ILLUMINANCE, 0x04 },
|
||||
{ BLE_MESH_PRESENT_INDOOR_AMBIENT_TEMPERATURE, 0x01 },
|
||||
{ BLE_MESH_PRESENT_INPUT_CURRENT, 0x02 },
|
||||
{ BLE_MESH_PRESENT_INPUT_RIPPLE_VOLTAGE, 0x01 },
|
||||
{ BLE_MESH_PRESENT_INPUT_VOLTAGE, 0x02 },
|
||||
{ BLE_MESH_PRESENT_LUMINOUS_FLUX, 0x02 },
|
||||
{ BLE_MESH_PRESENT_OUTDOOR_AMBIENT_TEMPERATURE, 0x01 },
|
||||
{ BLE_MESH_PRESENT_OUTPUT_CURRENT, 0x02 },
|
||||
{ BLE_MESH_PRESENT_OUTPUT_VOLTAGE, 0x02 },
|
||||
{ BLE_MESH_PRESENT_PLANCKIAN_DISTANCE, 0x02 },
|
||||
{ BLE_MESH_PRESENT_RELATIVE_OUTPUT_RIPPLE_VOLTAGE, 0x01 },
|
||||
{ BLE_MESH_RELATIVE_DEVICE_ENERGY_USE_IN_A_PERIOD_OF_DAY, 0x06 },
|
||||
{ BLE_MESH_RELATIVE_DEVICE_RUNTIME_IN_A_GENERIC_LEVEL_RANGE, 0x05 },
|
||||
{ BLE_MESH_RELATIVE_EXPOSURE_TIME_IN_AN_ILLUMINANCE_RANGE, 0x09 },
|
||||
{ BLE_MESH_RELATIVE_RUNTIME_IN_A_CORRELATED_COLOR_TEMPERATURE_RANGE, 0x04 },
|
||||
{ BLE_MESH_RELATIVE_RUNTIME_IN_A_DEVICE_OPERATING_TEMPERATURE_RANGE, 0x05 },
|
||||
{ BLE_MESH_RELATIVE_RUNTIME_IN_AN_INPUT_CURRENT_RANGE, 0x05 },
|
||||
{ BLE_MESH_RELATIVE_RUNTIME_IN_AN_INPUT_VOLTAGE_RANGE, 0x05 },
|
||||
{ BLE_MESH_SHORT_CIRCUIT_EVENT_STATISTICS, 0x06 },
|
||||
{ BLE_MESH_TIME_SINCE_MOTION_SENSED, 0x02 },
|
||||
{ BLE_MESH_TIME_SINCE_PRESENCE_DETECTED, 0x02 },
|
||||
{ BLE_MESH_TOTAL_DEVICE_ENERGY_USE, 0x04 },
|
||||
{ BLE_MESH_TOTAL_DEVICE_OFF_ON_CYCLES, 0x04 },
|
||||
{ BLE_MESH_TOTAL_DEVICE_POWER_ON_CYCLES, 0x04 },
|
||||
{ BLE_MESH_TOTAL_DEVICE_POWER_ON_TIME, 0x04 },
|
||||
{ BLE_MESH_TOTAL_DEVICE_RUNTIME, 0x04 },
|
||||
{ BLE_MESH_TOTAL_LIGHT_EXPOSURE_TIME, 0x04 },
|
||||
{ BLE_MESH_TOTAL_LUMINOUS_ENERGY, 0x04 },
|
||||
};
|
||||
|
||||
u8_t bt_mesh_get_dev_prop_len(u16_t prop_id)
|
||||
{
|
||||
if (prop_id > BLE_MESH_TOTAL_LUMINOUS_ENERGY) {
|
||||
BT_ERR("%s, Unknown Device Property ID 0x%04x", __func__, prop_id);
|
||||
return UINT8_MAX;
|
||||
}
|
||||
|
||||
return device_properties[prop_id].len;
|
||||
}
|
2629
components/bt/esp_ble_mesh/mesh_models/server/generic_server.c
Normal file
2629
components/bt/esp_ble_mesh/mesh_models/server/generic_server.c
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,374 @@
|
||||
/* Bluetooth: Mesh Generic OnOff, Generic Level, Lighting & Vendor Models
|
||||
*
|
||||
* Copyright (c) 2018 Vikrant More
|
||||
* Additional Copyright (c) 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _GENERIC_SERVER_H_
|
||||
#define _GENERIC_SERVER_H_
|
||||
|
||||
#include "server_common.h"
|
||||
|
||||
struct bt_mesh_gen_onoff_state {
|
||||
u8_t onoff;
|
||||
u8_t target_onoff;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_onoff_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_gen_onoff_state state;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition transition;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_level_state {
|
||||
s16_t level;
|
||||
s16_t target_level;
|
||||
|
||||
s16_t last_level;
|
||||
s32_t last_delta;
|
||||
|
||||
bool move_start;
|
||||
bool positive;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_level_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_gen_level_state state;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition transition;
|
||||
s32_t tt_delta_level;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_def_trans_time_state {
|
||||
u8_t trans_time;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_def_trans_time_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_gen_def_trans_time_state state;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_onpowerup_state {
|
||||
u8_t onpowerup;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_power_onoff_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_gen_onpowerup_state *state;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_power_onoff_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_gen_onpowerup_state *state;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_power_level_state {
|
||||
u16_t power_actual;
|
||||
u16_t target_power_actual;
|
||||
|
||||
u16_t power_last;
|
||||
u16_t power_default;
|
||||
|
||||
u8_t status_code;
|
||||
u16_t power_range_min;
|
||||
u16_t power_range_max;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_power_level_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_gen_power_level_state *state;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition transition;
|
||||
s32_t tt_delta_level;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_power_level_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_gen_power_level_state *state;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_battery_state {
|
||||
u32_t battery_level : 8,
|
||||
time_to_discharge : 24;
|
||||
u32_t time_to_charge : 24,
|
||||
battery_flags : 8;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_battery_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_gen_battery_state state;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_location_state {
|
||||
s32_t global_latitude;
|
||||
s32_t global_longitude;
|
||||
s16_t global_altitude;
|
||||
s16_t local_north;
|
||||
s16_t local_east;
|
||||
s16_t local_altitude;
|
||||
u8_t floor_number;
|
||||
u16_t uncertainty;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_location_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_gen_location_state *state;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_location_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_gen_location_state *state;
|
||||
};
|
||||
|
||||
/**
|
||||
* According to the hierarchy of Generic Property states (Model Spec section 3.1.8),
|
||||
* the Manufacturer Properties and Admin Properties may contain multiple Property
|
||||
* states. User Properties just a collection of which can be accessed.
|
||||
*
|
||||
* property_count: Number of the properties contained in the table
|
||||
* properties: Table of the properties
|
||||
*
|
||||
* These variables need to be initialized in the application layer, the precise
|
||||
* number of the properties should be set and memories used to store the property
|
||||
* values should be allocated.
|
||||
*/
|
||||
|
||||
enum bt_mesh_gen_user_prop_access {
|
||||
USER_ACCESS_PROHIBIT,
|
||||
USER_ACCESS_READ,
|
||||
USER_ACCESS_WRITE,
|
||||
USER_ACCESS_READ_WRITE,
|
||||
};
|
||||
|
||||
enum bt_mesh_gen_admin_prop_access {
|
||||
ADMIN_NOT_USER_PROP,
|
||||
ADMIN_ACCESS_READ,
|
||||
ADMIN_ACCESS_WRITE,
|
||||
ADMIN_ACCESS_READ_WRITE,
|
||||
};
|
||||
|
||||
enum bt_mesh_gen_manu_prop_access {
|
||||
MANU_NOT_USER_PROP,
|
||||
MANU_ACCESS_READ,
|
||||
};
|
||||
|
||||
struct bt_mesh_generic_property {
|
||||
u16_t id;
|
||||
u8_t user_access;
|
||||
u8_t admin_access;
|
||||
u8_t manu_access;
|
||||
struct net_buf_simple *val;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_user_prop_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
u8_t property_count;
|
||||
struct bt_mesh_generic_property *properties;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_admin_prop_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
u8_t property_count;
|
||||
struct bt_mesh_generic_property *properties;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_manu_prop_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
u8_t property_count;
|
||||
struct bt_mesh_generic_property *properties;
|
||||
};
|
||||
|
||||
struct bt_mesh_gen_client_prop_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
u8_t id_count;
|
||||
u16_t *property_ids;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u8_t onoff;
|
||||
} gen_onoff_set;
|
||||
struct {
|
||||
s16_t level;
|
||||
} gen_level_set;
|
||||
struct {
|
||||
s16_t level;
|
||||
} gen_delta_set;
|
||||
struct {
|
||||
s16_t level;
|
||||
} gen_move_set;
|
||||
struct {
|
||||
u8_t trans_time;
|
||||
} gen_def_trans_time_set;
|
||||
struct {
|
||||
u8_t onpowerup;
|
||||
} gen_onpowerup_set;
|
||||
struct {
|
||||
u16_t power;
|
||||
} gen_power_level_set;
|
||||
struct {
|
||||
u16_t power;
|
||||
} gen_power_default_set;
|
||||
struct {
|
||||
u16_t range_min;
|
||||
u16_t range_max;
|
||||
} gen_power_range_set;
|
||||
struct {
|
||||
s32_t latitude;
|
||||
s32_t longitude;
|
||||
s16_t altitude;
|
||||
} gen_loc_global_set;
|
||||
struct {
|
||||
s16_t north;
|
||||
s16_t east;
|
||||
s16_t altitude;
|
||||
u8_t floor_number;
|
||||
u16_t uncertainty;
|
||||
} gen_loc_local_set;
|
||||
struct {
|
||||
u16_t id;
|
||||
struct net_buf_simple *value;
|
||||
} gen_user_prop_set;
|
||||
struct {
|
||||
u16_t id;
|
||||
u8_t access;
|
||||
struct net_buf_simple *value;
|
||||
} gen_admin_prop_set;
|
||||
struct {
|
||||
u16_t id;
|
||||
u8_t access;
|
||||
} gen_manu_prop_set;
|
||||
} bt_mesh_gen_server_state_change_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u16_t id;
|
||||
} user_property_get;
|
||||
struct {
|
||||
u16_t id;
|
||||
} admin_property_get;
|
||||
struct {
|
||||
u16_t id;
|
||||
} manu_property_get;
|
||||
struct {
|
||||
u16_t id;
|
||||
} client_properties_get;
|
||||
} bt_mesh_gen_server_recv_get_msg_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
bool op_en;
|
||||
u8_t onoff;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} onoff_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
s16_t level;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} level_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
s32_t delta_level;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} delta_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
s16_t delta_level;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} move_set;
|
||||
struct {
|
||||
u8_t trans_time;
|
||||
} def_trans_time_set;
|
||||
struct {
|
||||
u8_t onpowerup;
|
||||
} onpowerup_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t power;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} power_level_set;
|
||||
struct {
|
||||
u16_t power;
|
||||
} power_default_set;
|
||||
struct {
|
||||
u16_t range_min;
|
||||
u16_t range_max;
|
||||
} power_range_set;
|
||||
struct {
|
||||
s32_t latitude;
|
||||
s32_t longitude;
|
||||
s16_t altitude;
|
||||
} loc_global_set;
|
||||
struct {
|
||||
s16_t north;
|
||||
s16_t east;
|
||||
s16_t altitude;
|
||||
u8_t floor_number;
|
||||
u16_t uncertainty;
|
||||
} loc_local_set;
|
||||
struct {
|
||||
u16_t id;
|
||||
struct net_buf_simple *value;
|
||||
} user_property_set;
|
||||
struct {
|
||||
u16_t id;
|
||||
u8_t access;
|
||||
struct net_buf_simple *value;
|
||||
} admin_property_set;
|
||||
struct {
|
||||
u16_t id;
|
||||
u8_t access;
|
||||
} manu_property_set;
|
||||
} bt_mesh_gen_server_recv_set_msg_t;
|
||||
|
||||
void bt_mesh_generic_server_lock(void);
|
||||
void bt_mesh_generic_server_unlock(void);
|
||||
|
||||
void gen_onoff_publish(struct bt_mesh_model *model);
|
||||
void gen_level_publish(struct bt_mesh_model *model);
|
||||
void gen_onpowerup_publish(struct bt_mesh_model *model);
|
||||
void gen_power_level_publish(struct bt_mesh_model *model, u16_t opcode);
|
||||
|
||||
int bt_mesh_gen_onoff_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_level_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_def_trans_time_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_power_onoff_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_power_onoff_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_power_level_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_power_level_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_battery_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_location_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_location_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_user_prop_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_admin_prop_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_manu_prop_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_gen_client_prop_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
#endif /* _GENERIC_SERVER_H_ */
|
@@ -0,0 +1,516 @@
|
||||
/* Bluetooth: Mesh Generic OnOff, Generic Level, Lighting & Vendor Models
|
||||
*
|
||||
* Copyright (c) 2018 Vikrant More
|
||||
* Additional Copyright (c) 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _LIGHTING_SERVER_H_
|
||||
#define _LIGHTING_SERVER_H_
|
||||
|
||||
#include "server_common.h"
|
||||
|
||||
struct bt_mesh_light_lightness_state {
|
||||
u16_t lightness_linear;
|
||||
u16_t target_lightness_linear;
|
||||
|
||||
u16_t lightness_actual;
|
||||
u16_t target_lightness_actual;
|
||||
|
||||
u16_t lightness_last;
|
||||
u16_t lightness_default;
|
||||
|
||||
u8_t status_code;
|
||||
u16_t lightness_range_min;
|
||||
u16_t lightness_range_max;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lightness_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_lightness_state *state;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition actual_transition;
|
||||
struct bt_mesh_state_transition linear_transition;
|
||||
s32_t tt_delta_lightness_actual;
|
||||
s32_t tt_delta_lightness_linear;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lightness_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_lightness_state *state;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_ctl_state {
|
||||
u16_t lightness;
|
||||
u16_t target_lightness;
|
||||
|
||||
u16_t temperature;
|
||||
u16_t target_temperature;
|
||||
|
||||
s16_t delta_uv;
|
||||
s16_t target_delta_uv;
|
||||
|
||||
u8_t status_code;
|
||||
u16_t temperature_range_min;
|
||||
u16_t temperature_range_max;
|
||||
|
||||
u16_t lightness_default;
|
||||
u16_t temperature_default;
|
||||
s16_t delta_uv_default;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_ctl_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_ctl_state *state;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition transition;
|
||||
s32_t tt_delta_lightness;
|
||||
s32_t tt_delta_temperature;
|
||||
s32_t tt_delta_delta_uv;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_ctl_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_ctl_state *state;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_ctl_temp_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_ctl_state *state;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition transition;
|
||||
s32_t tt_delta_temperature;
|
||||
s32_t tt_delta_delta_uv;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_state {
|
||||
u16_t lightness;
|
||||
u16_t target_lightness;
|
||||
|
||||
u16_t hue;
|
||||
u16_t target_hue;
|
||||
|
||||
u16_t saturation;
|
||||
u16_t target_saturation;
|
||||
|
||||
u16_t lightness_default;
|
||||
u16_t hue_default;
|
||||
u16_t saturation_default;
|
||||
|
||||
u8_t status_code;
|
||||
u16_t hue_range_min;
|
||||
u16_t hue_range_max;
|
||||
u16_t saturation_range_min;
|
||||
u16_t saturation_range_max;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_hsl_state *state;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition transition;
|
||||
s32_t tt_delta_lightness;
|
||||
s32_t tt_delta_hue;
|
||||
s32_t tt_delta_saturation;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_hsl_state *state;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_hue_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_hsl_state *state;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition transition;
|
||||
s32_t tt_delta_hue;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_hsl_sat_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_hsl_state *state;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition transition;
|
||||
s32_t tt_delta_saturation;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_xyl_state {
|
||||
u16_t lightness;
|
||||
u16_t target_lightness;
|
||||
|
||||
u16_t x;
|
||||
u16_t target_x;
|
||||
|
||||
u16_t y;
|
||||
u16_t target_y;
|
||||
|
||||
u16_t lightness_default;
|
||||
u16_t x_default;
|
||||
u16_t y_default;
|
||||
|
||||
u8_t status_code;
|
||||
u16_t x_range_min;
|
||||
u16_t x_range_max;
|
||||
u16_t y_range_min;
|
||||
u16_t y_range_max;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_xyl_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_xyl_state *state;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition transition;
|
||||
s32_t tt_delta_lightness;
|
||||
s32_t tt_delta_x;
|
||||
s32_t tt_delta_y;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_xyl_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_xyl_state *state;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lc_state {
|
||||
u32_t mode : 1, /* default 0 */
|
||||
occupancy_mode : 1, /* default 1 */
|
||||
light_onoff : 1,
|
||||
target_light_onoff : 1,
|
||||
occupancy : 1,
|
||||
ambient_luxlevel : 24; /* 0x000000 ~ 0xFFFFFF */
|
||||
|
||||
u16_t linear_output; /* 0x0000 ~ 0xFFFF */
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lc_property_state {
|
||||
u32_t time_occupancy_delay; /* 0x003A */
|
||||
u32_t time_fade_on; /* 0x0037 */
|
||||
u32_t time_run_on; /* 0x003C */
|
||||
u32_t time_fade; /* 0x0036 */
|
||||
u32_t time_prolong; /* 0x003B */
|
||||
u32_t time_fade_standby_auto; /* 0x0038 */
|
||||
u32_t time_fade_standby_manual; /* 0x0039 */
|
||||
|
||||
u16_t lightness_on; /* 0x002E */
|
||||
u16_t lightness_prolong; /* 0x002F */
|
||||
u16_t lightness_standby; /* 0x0030 */
|
||||
|
||||
u16_t ambient_luxlevel_on; /* 0x002B, 0x0000 ~ 0xFFFF */
|
||||
u16_t ambient_luxlevel_prolong; /* 0x002C, 0x0000 ~ 0xFFFF */
|
||||
u16_t ambient_luxlevel_standby; /* 0x002D, 0x0000 ~ 0xFFFF */
|
||||
|
||||
float regulator_kiu; /* 0x0033, 0.0 ~ 1000.0, default 250.0 */
|
||||
float regulator_kid; /* 0x0032, 0.0 ~ 1000.0, default 25.0 */
|
||||
float regulator_kpu; /* 0x0035, 0.0 ~ 1000.0, default 80.0 */
|
||||
float regulator_kpd; /* 0x0034, 0.0 ~ 1000.0, default 80.0 */
|
||||
s8_t regulator_accuracy; /* 0x0031, 0.0 ~ 100.0, default 2.0 */
|
||||
|
||||
u32_t set_occupancy_to_1_delay;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
LC_OFF,
|
||||
LC_STANDBY,
|
||||
LC_FADE_ON,
|
||||
LC_RUN,
|
||||
LC_FADE,
|
||||
LC_PROLONG,
|
||||
LC_FADE_STANDBY_AUTO,
|
||||
LC_FADE_STANDBY_MANUAL,
|
||||
} bt_mesh_lc_state;
|
||||
|
||||
struct bt_mesh_light_lc_state_machine {
|
||||
struct {
|
||||
u8_t fade_on;
|
||||
u8_t fade;
|
||||
u8_t fade_standby_auto;
|
||||
u8_t fade_standby_manual;
|
||||
} trans_time;
|
||||
bt_mesh_lc_state state;
|
||||
struct k_delayed_work timer;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_control {
|
||||
struct bt_mesh_light_lc_state state;
|
||||
struct bt_mesh_light_lc_property_state prop_state;
|
||||
struct bt_mesh_light_lc_state_machine state_machine;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lc_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_control *lc;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition transition;
|
||||
};
|
||||
|
||||
struct bt_mesh_light_lc_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_light_control *lc;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u16_t lightness;
|
||||
} lightness_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
} lightness_linear_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
} lightness_default_set;
|
||||
struct {
|
||||
u16_t range_min;
|
||||
u16_t range_max;
|
||||
} lightness_range_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
u16_t temperature;
|
||||
s16_t delta_uv;
|
||||
} ctl_set;
|
||||
struct {
|
||||
u16_t temperature;
|
||||
s16_t delta_uv;
|
||||
} ctl_temp_set;
|
||||
struct {
|
||||
u16_t range_min;
|
||||
u16_t range_max;
|
||||
} ctl_temp_range_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
u16_t temperature;
|
||||
s16_t delta_uv;
|
||||
} ctl_default_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
u16_t hue;
|
||||
u16_t saturation;
|
||||
} hsl_set;
|
||||
struct {
|
||||
u16_t hue;
|
||||
} hsl_hue_set;
|
||||
struct {
|
||||
u16_t saturation;
|
||||
} hsl_saturation_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
u16_t hue;
|
||||
u16_t saturation;
|
||||
} hsl_default_set;
|
||||
struct {
|
||||
u16_t hue_range_min;
|
||||
u16_t hue_range_max;
|
||||
u16_t sat_range_min;
|
||||
u16_t sat_range_max;
|
||||
} hsl_range_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
u16_t x;
|
||||
u16_t y;
|
||||
} xyl_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
u16_t x;
|
||||
u16_t y;
|
||||
} xyl_default_set;
|
||||
struct {
|
||||
u16_t x_range_min;
|
||||
u16_t x_range_max;
|
||||
u16_t y_range_min;
|
||||
u16_t y_range_max;
|
||||
} xyl_range_set;
|
||||
struct {
|
||||
u8_t mode;
|
||||
} lc_mode_set;
|
||||
struct {
|
||||
u8_t mode;
|
||||
} lc_om_set;
|
||||
struct {
|
||||
u8_t onoff;
|
||||
} lc_light_onoff_set;
|
||||
struct {
|
||||
u16_t id;
|
||||
struct net_buf_simple *value;
|
||||
} lc_property_set;
|
||||
struct {
|
||||
u16_t property_id;
|
||||
union {
|
||||
u8_t occupancy;
|
||||
u32_t set_occupancy_to_1_delay;
|
||||
u32_t ambient_luxlevel;
|
||||
} state;
|
||||
} sensor_status;
|
||||
} bt_mesh_light_server_state_change_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u16_t id;
|
||||
} lc_property_get;
|
||||
} bt_mesh_light_server_recv_get_msg_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t lightness;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} lightness_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t lightness;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} lightness_linear_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
} lightness_default_set;
|
||||
struct {
|
||||
u16_t range_min;
|
||||
u16_t range_max;
|
||||
} lightness_range_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t lightness;
|
||||
u16_t temperature;
|
||||
s16_t delta_uv;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} ctl_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t temperature;
|
||||
s16_t delta_uv;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} ctl_temp_set;
|
||||
struct {
|
||||
u16_t range_min;
|
||||
u16_t range_max;
|
||||
} ctl_temp_range_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
u16_t temperature;
|
||||
s16_t delta_uv;
|
||||
} ctl_default_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t lightness;
|
||||
u16_t hue;
|
||||
u16_t saturation;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} hsl_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t hue;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} hsl_hue_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t saturation;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} hsl_saturation_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
u16_t hue;
|
||||
u16_t saturation;
|
||||
} hsl_default_set;
|
||||
struct {
|
||||
u16_t hue_range_min;
|
||||
u16_t hue_range_max;
|
||||
u16_t sat_range_min;
|
||||
u16_t sat_range_max;
|
||||
} hsl_range_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t lightness;
|
||||
u16_t x;
|
||||
u16_t y;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} xyl_set;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
u16_t x;
|
||||
u16_t y;
|
||||
} xyl_default_set;
|
||||
struct {
|
||||
u16_t x_range_min;
|
||||
u16_t x_range_max;
|
||||
u16_t y_range_min;
|
||||
u16_t y_range_max;
|
||||
} xyl_range_set;
|
||||
struct {
|
||||
u8_t mode;
|
||||
} lc_mode_set;
|
||||
struct {
|
||||
u8_t mode;
|
||||
} lc_om_set;
|
||||
struct {
|
||||
bool op_en;
|
||||
u8_t light_onoff;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} lc_light_onoff_set;
|
||||
struct {
|
||||
u16_t id;
|
||||
struct net_buf_simple *value;
|
||||
} lc_property_set;
|
||||
} bt_mesh_light_server_recv_set_msg_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
struct net_buf_simple *data;
|
||||
} sensor_status;
|
||||
} bt_mesh_light_server_recv_status_msg_t;
|
||||
|
||||
void bt_mesh_light_server_lock(void);
|
||||
void bt_mesh_light_server_unlock(void);
|
||||
|
||||
u8_t *bt_mesh_get_lc_prop_value(struct bt_mesh_model *model, u16_t prop_id);
|
||||
|
||||
void light_lightness_publish(struct bt_mesh_model *model, u16_t opcode);
|
||||
void light_ctl_publish(struct bt_mesh_model *model, u16_t opcode);
|
||||
void light_hsl_publish(struct bt_mesh_model *model, u16_t opcode);
|
||||
void light_xyl_publish(struct bt_mesh_model *model, u16_t opcode);
|
||||
void light_lc_publish(struct bt_mesh_model *model, u16_t opcode);
|
||||
|
||||
int bt_mesh_light_lightness_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_lightness_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_ctl_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_ctl_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_ctl_temp_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_hsl_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_hsl_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_hsl_hue_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_hsl_sat_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_xyl_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_xyl_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_lc_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_light_lc_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
#endif /* _LIGHTING_SERVER_H_ */
|
@@ -0,0 +1,249 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _SENSOR_SERVER_H_
|
||||
#define _SENSOR_SERVER_H_
|
||||
|
||||
#include "server_common.h"
|
||||
|
||||
/* Sensor Property ID related */
|
||||
#define INVALID_SENSOR_PROPERTY_ID 0x0000
|
||||
|
||||
#define SENSOR_PROPERTY_ID_LEN 0x02
|
||||
|
||||
/* Sensor Descriptor state related */
|
||||
#define SENSOR_DESCRIPTOR_LEN 0x08
|
||||
|
||||
#define SENSOR_UNSPECIFIED_POS_TOLERANCE 0x000
|
||||
#define SENSOR_UNSPECIFIED_NEG_TOLERANCE 0x000
|
||||
|
||||
#define SENSOR_NOT_APPL_MEASURE_PERIOD 0x00
|
||||
|
||||
#define SENSOR_NOT_APPL_UPDATE_INTERVAL 0x00
|
||||
|
||||
/* Sensor Setting state related */
|
||||
#define INVALID_SENSOR_SETTING_PROPERTY_ID 0x0000
|
||||
|
||||
#define SENSOR_SETTING_PROPERTY_ID_LEN 0x02
|
||||
#define SENSOR_SETTING_ACCESS_LEN 0x01
|
||||
|
||||
#define SENSOR_SETTING_ACCESS_READ 0x01
|
||||
#define SENSOR_SETTING_ACCESS_READ_WRITE 0x03
|
||||
|
||||
/* Sensor Cadence state related */
|
||||
#define SENSOR_DIVISOR_TRIGGER_TYPE_LEN 0x01
|
||||
#define SENSOR_STATUS_MIN_INTERVAL_LEN 0x01
|
||||
|
||||
#define SENSOR_PERIOD_DIVISOR_MAX_VALUE 15
|
||||
|
||||
#define SENSOR_STATUS_MIN_INTERVAL_MAX 26
|
||||
|
||||
#define SENSOR_STATUS_TRIGGER_TYPE_CHAR 0
|
||||
#define SENSOR_STATUS_TRIGGER_TYPE_UINT16 1
|
||||
|
||||
#define SENSOR_STATUS_TRIGGER_UINT16_LEN 0x02
|
||||
|
||||
/* Sensor Data state related */
|
||||
#define SENSOR_DATA_FORMAT_A 0x00
|
||||
#define SENSOR_DATA_FORMAT_B 0x01
|
||||
|
||||
#define SENSOR_DATA_FORMAT_A_MPID_LEN 0x02
|
||||
#define SENSOR_DATA_FORMAT_B_MPID_LEN 0x03
|
||||
|
||||
#define SENSOR_DATA_ZERO_LEN 0x7F
|
||||
|
||||
enum bt_mesh_sensor_sample_func {
|
||||
UNSPECIFIED,
|
||||
INSTANTANEOUS,
|
||||
ARITHMETIC_MEAN,
|
||||
RMS,
|
||||
MAXIMUM,
|
||||
MINIMUM,
|
||||
ACCUMULATED,
|
||||
COUNT,
|
||||
};
|
||||
|
||||
struct sensor_descriptor {
|
||||
u32_t positive_tolerance : 12,
|
||||
negative_tolerance : 12,
|
||||
sample_function : 8;
|
||||
u8_t measure_period;
|
||||
u8_t update_interval;
|
||||
};
|
||||
|
||||
struct sensor_setting {
|
||||
u16_t property_id;
|
||||
u8_t access;
|
||||
/* Or use union to include all possible types */
|
||||
struct net_buf_simple *raw;
|
||||
};
|
||||
|
||||
struct sensor_cadence {
|
||||
u8_t period_divisor : 7,
|
||||
trigger_type : 1;
|
||||
struct net_buf_simple *trigger_delta_down;
|
||||
struct net_buf_simple *trigger_delta_up;
|
||||
u8_t min_interval;
|
||||
struct net_buf_simple *fast_cadence_low;
|
||||
struct net_buf_simple *fast_cadence_high;
|
||||
};
|
||||
|
||||
struct sensor_data {
|
||||
/**
|
||||
* Format A: The Length field is a 1-based uint4 value (valid range 0x0–0xF,
|
||||
* representing range of 1 – 16).
|
||||
* Format B: The Length field is a 1-based uint7 value (valid range 0x0–0x7F,
|
||||
* representing range of 1 – 127). The value 0x7F represents a
|
||||
* length of zero.
|
||||
*/
|
||||
u8_t format : 1,
|
||||
length : 7;
|
||||
struct net_buf_simple *raw_value;
|
||||
};
|
||||
|
||||
struct sensor_series_column {
|
||||
struct net_buf_simple *raw_value_x;
|
||||
struct net_buf_simple *column_width;
|
||||
struct net_buf_simple *raw_value_y;
|
||||
};
|
||||
|
||||
struct bt_mesh_sensor_state {
|
||||
u16_t sensor_property_id;
|
||||
|
||||
/* Constant throughout the lifetime of an element */
|
||||
struct sensor_descriptor descriptor;
|
||||
|
||||
/* Multiple Sensor Setting states may be present for each sensor.
|
||||
* The Sensor Setting Property ID values shall be unique for each
|
||||
* Sensor Property ID that identifies a sensor within an element.
|
||||
*/
|
||||
const u8_t setting_count;
|
||||
struct sensor_setting *settings;
|
||||
|
||||
/* The Sensor Cadence state may be not supported by sensors based
|
||||
* on device properties referencing "non-scalar characteristics"
|
||||
* such as "histograms" or "composite characteristics".
|
||||
*/
|
||||
struct sensor_cadence *cadence;
|
||||
|
||||
struct sensor_data sensor_data;
|
||||
|
||||
/* Values measured by sensors may be organized as arrays (and
|
||||
* represented as series of columns, such as histograms).
|
||||
* 1. The Sensor Raw Value X field has a size and representation
|
||||
* defined by the Sensor Property ID and represents the left
|
||||
* corner of the column on the X axis.
|
||||
* 2. The Sensor Column Width field has a size and representation
|
||||
* defined by the Sensor Property ID and represents the width
|
||||
* of the column on the X axis.
|
||||
* 3. The Sensor Raw Value Y field has a size and representation
|
||||
* defined by the Sensor Property ID and represents the height
|
||||
* of the column on the Y axis.
|
||||
* Note: Values outside the bins defined by a Sensor Property are
|
||||
* not included. For example, if the histogram is defined as 3 bins
|
||||
* representing “lamp operating hours in a given temperature range”
|
||||
* and the bins are [40,60), [60, 80), and [80,100], then any hours
|
||||
* outside that [40, 100] range would not be included.
|
||||
*/
|
||||
struct sensor_series_column series_column;
|
||||
};
|
||||
|
||||
/* 1. Multiple instances of the Sensor states may be present within the
|
||||
* same model, provided that each instance has a unique value of the
|
||||
* Sensor Property ID to allow the instances to be differentiated.
|
||||
* 2. Note: The number of sensors within a multisensor is limited by the
|
||||
* size of the message payload for the Sensor Descriptor Status message.
|
||||
* A single Sensor Descriptor may be sent using a single Unsegmented
|
||||
* Access message. Using Segmentation and Reassembly (SAR), up to 38
|
||||
* Sensor Descriptor states may be sent.
|
||||
*/
|
||||
|
||||
struct bt_mesh_sensor_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
const u8_t state_count;
|
||||
struct bt_mesh_sensor_state *states;
|
||||
};
|
||||
|
||||
struct bt_mesh_sensor_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
const u8_t state_count;
|
||||
struct bt_mesh_sensor_state *states;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u16_t id;
|
||||
u8_t period_divisor : 7,
|
||||
trigger_type : 1;
|
||||
struct net_buf_simple *trigger_delta_down;
|
||||
struct net_buf_simple *trigger_delta_up;
|
||||
u8_t min_interval;
|
||||
struct net_buf_simple *fast_cadence_low;
|
||||
struct net_buf_simple *fast_cadence_high;
|
||||
} sensor_cadence_set;
|
||||
struct {
|
||||
u16_t id;
|
||||
u16_t setting_id;
|
||||
struct net_buf_simple *value;
|
||||
} sensor_setting_set;
|
||||
} bt_mesh_sensor_server_state_change_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t id;
|
||||
} sensor_descriptor_get;
|
||||
struct {
|
||||
u16_t id;
|
||||
} sensor_cadence_get;
|
||||
struct {
|
||||
u16_t id;
|
||||
} sensor_settings_get;
|
||||
struct {
|
||||
u16_t id;
|
||||
u16_t setting_id;
|
||||
} sensor_setting_get;
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t id;
|
||||
} sensor_get;
|
||||
struct {
|
||||
u16_t id;
|
||||
struct net_buf_simple *raw_x;
|
||||
} sensor_column_get;
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t id;
|
||||
struct net_buf_simple *raw;
|
||||
} sensor_series_get;
|
||||
} bt_mesh_sensor_server_recv_get_msg_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u16_t id;
|
||||
struct net_buf_simple *cadence;
|
||||
} sensor_cadence_set;
|
||||
struct {
|
||||
u16_t id;
|
||||
u16_t setting_id;
|
||||
struct net_buf_simple *raw;
|
||||
} sensor_setting_set;
|
||||
} bt_mesh_sensor_server_recv_set_msg_t;
|
||||
|
||||
int bt_mesh_sensor_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_sensor_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
#endif /* _SENSOR_SERVER_H_ */
|
@@ -0,0 +1,127 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _SERVER_COMMON_H_
|
||||
#define _SERVER_COMMON_H_
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mesh_buf.h"
|
||||
#include "mesh_access.h"
|
||||
#include "mesh_kernel.h"
|
||||
|
||||
#define BLE_MESH_SERVER_RSP_MAX_LEN 384
|
||||
|
||||
#define BLE_MESH_SERVER_TRANS_MIC_SIZE 4
|
||||
|
||||
#define BLE_MESH_CHECK_SEND_STATUS(_func) do { \
|
||||
int __status = (_func); \
|
||||
if (__status) { \
|
||||
BT_ERR("%s, Send failed, err %d", __func__, __status); \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#define BLE_MESH_STATE_OFF 0x00
|
||||
#define BLE_MESH_STATE_ON 0x01
|
||||
#define BLE_MESH_STATE_RESTORE 0x02
|
||||
|
||||
/* Following 4 values are as per Mesh Model specification */
|
||||
#define BLE_MESH_LIGHTNESS_MIN 0x0001
|
||||
#define BLE_MESH_LIGHTNESS_MAX 0xFFFF
|
||||
#define BLE_MESH_TEMPERATURE_MIN 0x0320
|
||||
#define BLE_MESH_TEMPERATURE_MAX 0x4E20
|
||||
#define BLE_MESH_TEMPERATURE_UNKNOWN 0xFFFF
|
||||
|
||||
/* Refer 7.2 of Mesh Model Specification */
|
||||
#define BLE_MESH_RANGE_UPDATE_SUCCESS 0x00
|
||||
#define BLE_MESH_CANNOT_SET_RANGE_MIN 0x01
|
||||
#define BLE_MESH_CANNOT_SET_RANGE_MAX 0x02
|
||||
|
||||
#define BLE_MESH_UNKNOWN_REMAIN_TIME 0x3F
|
||||
#define BLE_MESH_DEVICE_SPECIFIC_RESOLUTION 10
|
||||
|
||||
#define BLE_MESH_INVALID_DEVICE_PROPERTY_ID 0x0000
|
||||
|
||||
enum {
|
||||
BLE_MESH_TRANS_TIMER_START, /* Proper transition timer has been started */
|
||||
BLE_MESH_TRANS_FLAG_MAX,
|
||||
};
|
||||
|
||||
struct bt_mesh_state_transition {
|
||||
bool just_started;
|
||||
|
||||
u8_t trans_time;
|
||||
u8_t remain_time;
|
||||
u8_t delay;
|
||||
u32_t quo_tt;
|
||||
u32_t counter;
|
||||
u32_t total_duration;
|
||||
s64_t start_timestamp;
|
||||
|
||||
BLE_MESH_ATOMIC_DEFINE(flag, BLE_MESH_TRANS_FLAG_MAX);
|
||||
struct k_delayed_work timer;
|
||||
};
|
||||
|
||||
struct bt_mesh_last_msg_info {
|
||||
u8_t tid;
|
||||
u16_t src;
|
||||
u16_t dst;
|
||||
s64_t timestamp;
|
||||
};
|
||||
|
||||
#define BLE_MESH_SERVER_RSP_BY_APP 0
|
||||
#define BLE_MESH_SERVER_AUTO_RSP 1
|
||||
|
||||
struct bt_mesh_server_rsp_ctrl {
|
||||
/**
|
||||
* @brief BLE Mesh Server Response Option
|
||||
* 1. If get_auto_rsp is set to BLE_MESH_SERVER_RSP_BY_APP, then the response
|
||||
* of Client Get messages need to be replied by the application;
|
||||
* 2. If get_auto_rsp is set to BLE_MESH_SERVER_AUTO_RSP, then the response
|
||||
* of Client Get messages will be replied by the server models;
|
||||
* 3. If set_auto_rsp is set to BLE_MESH_SERVER_RSP_BY_APP, then the response
|
||||
* of Client Set messages need to be replied by the application;
|
||||
* 4. If set_auto_rsp is set to BLE_MESH_SERVER_AUTO_RSP, then the response
|
||||
* of Client Set messages will be replied by the server models;
|
||||
* 5. If status_auto_rsp is set to BLE_MESH_SERVER_RSP_BY_APP, then the response
|
||||
* of Server Status messages need to be replied by the application;
|
||||
* 6. If status_auto_rsp is set to BLE_MESH_SERVER_AUTO_RSP, then the response
|
||||
* of Server status messages will be replied by the server models;
|
||||
*/
|
||||
u8_t get_auto_rsp : 1, /* Response for Client Get messages */
|
||||
set_auto_rsp : 1, /* Response for Client Set messages */
|
||||
status_auto_rsp : 1; /* Response for Server Status messages */
|
||||
};
|
||||
|
||||
u8_t bt_mesh_get_default_trans_time(struct bt_mesh_model *model);
|
||||
|
||||
int bt_mesh_get_light_lc_trans_time(struct bt_mesh_model *model, u8_t *trans_time);
|
||||
|
||||
int bt_mesh_server_get_optional(struct bt_mesh_model *model,
|
||||
struct net_buf_simple *buf,
|
||||
u8_t *trans_time, u8_t *delay,
|
||||
bool *optional);
|
||||
|
||||
void bt_mesh_server_alloc_ctx(struct k_work *work);
|
||||
|
||||
bool bt_mesh_is_server_recv_last_msg(struct bt_mesh_last_msg_info *last,
|
||||
u8_t tid, u16_t src, u16_t dst, s64_t *now);
|
||||
|
||||
void bt_mesh_server_update_last_msg(struct bt_mesh_last_msg_info *last,
|
||||
u8_t tid, u16_t src, u16_t dst, s64_t *now);
|
||||
|
||||
struct net_buf_simple *bt_mesh_server_get_pub_msg(struct bt_mesh_model *model, u16_t msg_len);
|
||||
|
||||
#endif /* _SERVER_COMMON_H_ */
|
@@ -0,0 +1,92 @@
|
||||
/* Bluetooth: Mesh Generic OnOff, Generic Level, Lighting & Vendor Models
|
||||
*
|
||||
* Copyright (c) 2018 Vikrant More
|
||||
* Additional Copyright (c) 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _STATE_BINDING_H_
|
||||
#define _STATE_BINDING_H_
|
||||
|
||||
typedef enum {
|
||||
GENERIC_ONOFF_STATE,
|
||||
GENERIC_LEVEL_STATE,
|
||||
GENERIC_ONPOWERUP_STATE,
|
||||
GENERIC_POWER_ACTUAL_STATE,
|
||||
LIGHT_LIGHTNESS_ACTUAL_STATE,
|
||||
LIGHT_LIGHTNESS_LINEAR_STATE,
|
||||
LIGHT_CTL_LIGHTNESS_STATE,
|
||||
LIGHT_CTL_TEMP_DELTA_UV_STATE,
|
||||
LIGHT_HSL_LIGHTNESS_STATE,
|
||||
LIGHT_HSL_HUE_STATE,
|
||||
LIGHT_HSL_SATURATION_STATE,
|
||||
LIGHT_XYL_LIGHTNESS_STATE,
|
||||
LIGHT_LC_LIGHT_ONOFF_STATE,
|
||||
BIND_STATE_MAX,
|
||||
} bt_mesh_server_state_type_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u8_t onoff;
|
||||
} gen_onoff;
|
||||
struct {
|
||||
s16_t level;
|
||||
} gen_level;
|
||||
struct {
|
||||
u8_t onpowerup;
|
||||
} gen_onpowerup;
|
||||
struct {
|
||||
u16_t power;
|
||||
} gen_power_actual;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
} light_lightness_actual;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
} light_lightness_linear;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
} light_ctl_lightness;
|
||||
struct {
|
||||
u16_t temperature;
|
||||
s16_t delta_uv;
|
||||
} light_ctl_temp_delta_uv;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
} light_hsl_lightness;
|
||||
struct {
|
||||
u16_t hue;
|
||||
} light_hsl_hue;
|
||||
struct {
|
||||
u16_t saturation;
|
||||
} light_hsl_saturation;
|
||||
struct {
|
||||
u16_t lightness;
|
||||
} light_xyl_lightness;
|
||||
struct {
|
||||
u8_t onoff;
|
||||
} light_lc_light_onoff;
|
||||
} bt_mesh_server_state_value_t;
|
||||
|
||||
u16_t bt_mesh_convert_lightness_actual_to_linear(u16_t actual);
|
||||
|
||||
u16_t bt_mesh_convert_lightness_linear_to_actual(u16_t linear);
|
||||
|
||||
s16_t bt_mesh_convert_temperature_to_gen_level(u16_t temp, u16_t min, u16_t max);
|
||||
|
||||
u16_t bt_mesh_covert_gen_level_to_temperature(s16_t level, u16_t min, u16_t max);
|
||||
|
||||
s16_t bt_mesh_convert_hue_to_level(u16_t hue);
|
||||
|
||||
u16_t bt_mesh_convert_level_to_hue(s16_t level);
|
||||
|
||||
s16_t bt_mesh_convert_saturation_to_level(u16_t saturation);
|
||||
|
||||
u16_t bt_mesh_convert_level_to_saturation(s16_t level);
|
||||
|
||||
int bt_mesh_update_binding_state(struct bt_mesh_model *model,
|
||||
bt_mesh_server_state_type_t type,
|
||||
bt_mesh_server_state_value_t *value);
|
||||
|
||||
#endif /* _STATE_BINDING_H_ */
|
@@ -0,0 +1,91 @@
|
||||
/* Bluetooth: Mesh Generic OnOff, Generic Level, Lighting & Vendor Models
|
||||
*
|
||||
* Copyright (c) 2018 Vikrant More
|
||||
* Additional Copyright (c) 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef _STATE_TRANSITION_H_
|
||||
#define _STATE_TRANSITION_H_
|
||||
|
||||
#include "server_common.h"
|
||||
#include "generic_server.h"
|
||||
#include "lighting_server.h"
|
||||
#include "time_scene_server.h"
|
||||
|
||||
void bt_mesh_server_calc_remain_time(struct bt_mesh_state_transition *transition);
|
||||
|
||||
/* APIs used to get server model transtion time values */
|
||||
|
||||
void generic_onoff_tt_values(struct bt_mesh_gen_onoff_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void generic_level_tt_values(struct bt_mesh_gen_level_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void generic_power_level_tt_values(struct bt_mesh_gen_power_level_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void light_lightness_actual_tt_values(struct bt_mesh_light_lightness_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void light_lightness_linear_tt_values(struct bt_mesh_light_lightness_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void light_ctl_tt_values(struct bt_mesh_light_ctl_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void light_ctl_temp_tt_values(struct bt_mesh_light_ctl_temp_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void light_hsl_tt_values(struct bt_mesh_light_hsl_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void light_hsl_hue_tt_values(struct bt_mesh_light_hsl_hue_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void light_hsl_sat_tt_values(struct bt_mesh_light_hsl_sat_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void light_xyl_tt_values(struct bt_mesh_light_xyl_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void light_lc_tt_values(struct bt_mesh_light_lc_srv *srv,
|
||||
u8_t trans_time, u8_t delay);
|
||||
|
||||
void scene_tt_values(struct bt_mesh_scene_srv *srv, u8_t trans_time, u8_t delay);
|
||||
|
||||
/* Server model transtion timer handlers */
|
||||
|
||||
void generic_onoff_work_handler(struct k_work *work);
|
||||
|
||||
void generic_level_work_handler(struct k_work *work);
|
||||
|
||||
void generic_power_level_work_handler(struct k_work *work);
|
||||
|
||||
void light_lightness_actual_work_handler(struct k_work *work);
|
||||
|
||||
void light_lightness_linear_work_handler(struct k_work *work);
|
||||
|
||||
void light_ctl_work_handler(struct k_work *work);
|
||||
|
||||
void light_ctl_temp_work_handler(struct k_work *work);
|
||||
|
||||
void light_hsl_work_handler(struct k_work *work);
|
||||
|
||||
void light_hsl_hue_work_handler(struct k_work *work);
|
||||
|
||||
void light_hsl_sat_work_handler(struct k_work *work);
|
||||
|
||||
void light_xyl_work_handler(struct k_work *work);
|
||||
|
||||
void light_lc_work_handler(struct k_work *work);
|
||||
|
||||
void scene_recall_work_handler(struct k_work *work);
|
||||
|
||||
void bt_mesh_server_stop_transition(struct bt_mesh_state_transition *transition);
|
||||
|
||||
void bt_mesh_server_start_transition(struct bt_mesh_state_transition *transition);
|
||||
|
||||
#endif /* _STATE_TRANSITION_H_ */
|
@@ -0,0 +1,393 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef _TIME_SCENE_SERVER_H_
|
||||
#define _TIME_SCENE_SERVER_H_
|
||||
|
||||
#include "mesh_slist.h"
|
||||
#include "mesh_kernel.h"
|
||||
#include "server_common.h"
|
||||
|
||||
/**
|
||||
* 1. Mesh defines times based on International Atomic Time (TAI). The base
|
||||
* representation of times is the number of seconds after 00:00:00 TAI
|
||||
* on 2000-01-01 (that is, 1999-12-31 T23:59:28 UTC).
|
||||
* 2. UTC: Coordinated Universal Time. For more information, please refer
|
||||
* to https://time.is/zh/UTC
|
||||
* 3. For the algorithm used for the transfer between TAI and UTC, please
|
||||
* refer to Mesh Model Spec Section 5.1.1
|
||||
*/
|
||||
|
||||
#define UNKNOWN_TAI_SECONDS 0x0000000000
|
||||
#define UNKNOWN_TAI_ZONE_CHANGE 0x0000000000
|
||||
#define UNKNOWN_TAI_DELTA_CHANGE 0x0000000000
|
||||
#define TAI_UTC_DELAT_MAX_VALUE 0x7FFF
|
||||
#define TAI_SECONDS_LEN 0x05
|
||||
#define TAI_OF_ZONE_CHANGE_LEN 0x05
|
||||
#define TAI_OF_DELTA_CHANGE_LEN 0x05
|
||||
|
||||
#define INVALID_SCENE_NUMBER 0x0000
|
||||
#define SCENE_NUMBER_LEN 0x02
|
||||
|
||||
#define SCHEDULE_YEAR_ANY_YEAR 0x64
|
||||
|
||||
#define SCHEDULE_DAY_ANY_DAY 0x00
|
||||
|
||||
#define SCHEDULE_HOUR_ANY_HOUR 0x18
|
||||
#define SCHEDULE_HOUR_ONCE_A_DAY 0x19
|
||||
|
||||
#define SCHEDULE_SEC_ANY_OF_HOUR 0x3C
|
||||
#define SCHEDULE_SEC_EVERY_15_MIN 0x3D
|
||||
#define SCHEDULE_SEC_EVERY_20_MIN 0x3E
|
||||
#define SCHEDULE_SEC_ONCE_AN_HOUR 0x3F
|
||||
|
||||
#define SCHEDULE_SEC_ANY_OF_MIN 0x3C
|
||||
#define SCHEDULE_SEC_EVERY_15_SEC 0x3D
|
||||
#define SCHEDULE_SEC_EVERY_20_SEC 0x3E
|
||||
#define SCHEDULE_SEC_ONCE_AN_MIN 0x3F
|
||||
|
||||
#define SCHEDULE_ACT_TURN_OFF 0x00
|
||||
#define SCHEDULE_ACT_TURN_ON 0x01
|
||||
#define SCHEDULE_ACT_SCENE_RECALL 0x02
|
||||
#define SCHEDULE_ACT_NO_ACTION 0x0F
|
||||
|
||||
#define SCHEDULE_SCENE_NO_SCENE 0x0000
|
||||
|
||||
#define SCHEDULE_ENTRY_MAX_INDEX 0x0F
|
||||
|
||||
#define TIME_NONE 0x00
|
||||
#define TIME_AUTHORITY 0x01
|
||||
#define TIME_RELAY 0x02
|
||||
#define TIME_CLINET 0x03
|
||||
|
||||
#define SCENE_SUCCESS 0x00
|
||||
#define SCENE_REG_FULL 0x01
|
||||
#define SCENE_NOT_FOUND 0x02
|
||||
|
||||
/**
|
||||
* The Time state represents the present TAI time, the current TAI-UTC Delta
|
||||
* and local time zone offset, and the next change to each of the latter
|
||||
* (e.g., because of a switch from winter to summer time or an announced leap
|
||||
* second). It consists of 10 fields with a total size of 183 bits.
|
||||
*/
|
||||
struct bt_mesh_time_state {
|
||||
struct {
|
||||
u8_t tai_seconds[5];
|
||||
u8_t subsecond;
|
||||
u8_t uncertainty;
|
||||
u8_t time_zone_offset_curr;
|
||||
u8_t time_zone_offset_new;
|
||||
u8_t tai_zone_change[5];
|
||||
u16_t time_authority : 1,
|
||||
tai_utc_delta_curr : 15;
|
||||
u16_t tai_utc_delta_new : 15;
|
||||
u8_t tai_delta_change[5];
|
||||
} time;
|
||||
u8_t time_role;
|
||||
};
|
||||
|
||||
struct bt_mesh_time_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_time_state *state;
|
||||
};
|
||||
|
||||
struct bt_mesh_time_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_time_state *state;
|
||||
};
|
||||
|
||||
struct scene_register {
|
||||
u16_t scene_number;
|
||||
u8_t scene_type; /* Indicate the type of scene value */
|
||||
/**
|
||||
* Scene value may use a union to represent later, the union contains
|
||||
* structures of all the model states which can be stored in a scene.
|
||||
*/
|
||||
struct net_buf_simple *scene_value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scenes serve as memory banks for storage of states (e.g., a power level
|
||||
* or a light level/color). Values of states of an element can be stored
|
||||
* as a scene and can be recalled later from the scene memory.
|
||||
*
|
||||
* A scene is represented by a Scene Number, which is a 16-bit non-zero,
|
||||
* mesh-wide value. (There can be a maximum of 65535 scenes in a mesh
|
||||
* network.) The meaning of a scene, as well as the state storage container
|
||||
* associated with it, are determined by a model.
|
||||
*
|
||||
* The Scenes state change may start numerous parallel model transitions.
|
||||
* In that case, each individual model handles the transition internally.
|
||||
*
|
||||
* The scene transition is defined as a group of individual model transitions
|
||||
* started by a Scene Recall operation. The scene transition is in progress
|
||||
* when at least one transition from the group of individual model transitions
|
||||
* is in progress.
|
||||
*/
|
||||
struct bt_mesh_scenes_state {
|
||||
const u16_t scene_count;
|
||||
struct scene_register *scenes;
|
||||
|
||||
/**
|
||||
* The Current Scene state is a 16-bit value that contains either the Scene
|
||||
* Number of the currently active scene or a value of 0x0000 when no scene
|
||||
* is active.
|
||||
*
|
||||
* When a Scene Store operation or a Scene Recall operation completes with
|
||||
* success, the Current Scene state value shall be to the Scene Number used
|
||||
* during that operation.
|
||||
*
|
||||
* When the Current Scene Number is deleted from a Scene Register state as a
|
||||
* result of Scene Delete operation, the Current Scene state shall be set to
|
||||
* 0x0000.
|
||||
*
|
||||
* When any of the element's state that is marked as “Stored with Scene” has
|
||||
* changed not as a result of a Scene Recall operation, the value of the
|
||||
* Current Scene state shall be set to 0x0000.
|
||||
*
|
||||
* When a scene transition is in progress, the value of the Current Scene
|
||||
* state shall be set to 0x0000.
|
||||
*/
|
||||
u16_t current_scene;
|
||||
|
||||
/**
|
||||
* The Target Scene state is a 16-bit value that contains the target Scene
|
||||
* Number when a scene transition is in progress.
|
||||
*
|
||||
* When the scene transition is in progress and the target Scene Number is
|
||||
* deleted from a Scene Register state as a result of Scene Delete operation,
|
||||
* the Target Scene state shall be set to 0x0000.
|
||||
*
|
||||
* When the scene transition is in progress and a new Scene Number is stored
|
||||
* in the Scene Register as a result of Scene Store operation, the Target
|
||||
* Scene state shall be set to the new Scene Number.
|
||||
*
|
||||
* When the scene transition is not in progress, the value of the Target Scene
|
||||
* state shall be set to 0x0000.
|
||||
*/
|
||||
u16_t target_scene;
|
||||
|
||||
/* Indicate the status code for the last operation */
|
||||
u8_t status_code;
|
||||
|
||||
/* Indicate if scene transition is in progress */
|
||||
bool in_progress;
|
||||
};
|
||||
|
||||
struct bt_mesh_scene_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_scenes_state *state;
|
||||
struct bt_mesh_last_msg_info last;
|
||||
struct bt_mesh_state_transition transition;
|
||||
};
|
||||
|
||||
struct bt_mesh_scene_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_scenes_state *state;
|
||||
};
|
||||
|
||||
struct schedule_register {
|
||||
bool in_use;
|
||||
u64_t year : 7,
|
||||
month : 12,
|
||||
day : 5,
|
||||
hour : 5,
|
||||
minute : 6,
|
||||
second : 6,
|
||||
day_of_week : 7,
|
||||
action : 4,
|
||||
trans_time : 8;
|
||||
u16_t scene_number;
|
||||
};
|
||||
|
||||
struct bt_mesh_scheduler_state {
|
||||
const u8_t schedule_count;
|
||||
struct schedule_register *schedules; /* Up to 16 scheduled entries */
|
||||
|
||||
/**
|
||||
* A recommended implementation of the Scheduler should calculate the
|
||||
* value of the TAI Seconds of the next scheduled event and put it in
|
||||
* a queue of scheduled events sorted by time.
|
||||
*
|
||||
* Every second, the first event in the queue is compared with the value
|
||||
* of the Time state. The first event is executed if it is less than or
|
||||
* equal to the Time state and then removed from the queue. After
|
||||
* execution, the Repeat Flag shall be checked, and the next occurrence
|
||||
* of the scheduled event is calculated and put in the queue.
|
||||
*
|
||||
* One second timeout value, and compare the first event in queue with the
|
||||
* Time state. If it is satisfied, then execute the first event. Also the
|
||||
* Repeat Flag need to be checked, if it is set then the event needs to
|
||||
* be put into the end of queue.
|
||||
*
|
||||
* sys_slist_t event_queue;
|
||||
*
|
||||
* For each event_queue item, it can use the following struct:
|
||||
* struct schedule_event {
|
||||
* sys_snode_t node;
|
||||
* u8_t event_index;
|
||||
* };
|
||||
*
|
||||
* Also we need a "struct k_delayed_work track_timer" which can be used to
|
||||
* track the schedule timer and handle proper scheduled events.
|
||||
*/
|
||||
};
|
||||
|
||||
struct bt_mesh_scheduler_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_scheduler_state *state;
|
||||
};
|
||||
|
||||
struct bt_mesh_scheduler_setup_srv {
|
||||
struct bt_mesh_model *model;
|
||||
struct bt_mesh_server_rsp_ctrl rsp_ctrl;
|
||||
struct bt_mesh_scheduler_state *state;
|
||||
};
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u8_t tai_seconds[5];
|
||||
u8_t subsecond;
|
||||
u8_t uncertainty;
|
||||
u16_t time_authority : 1;
|
||||
u16_t tai_utc_delta_curr : 15;
|
||||
u8_t time_zone_offset_curr;
|
||||
} time_set;
|
||||
struct {
|
||||
u8_t tai_seconds[5];
|
||||
u8_t subsecond;
|
||||
u8_t uncertainty;
|
||||
u16_t time_authority : 1;
|
||||
u16_t tai_utc_delta_curr : 15;
|
||||
u8_t time_zone_offset_curr;
|
||||
} time_status;
|
||||
struct {
|
||||
u8_t time_zone_offset_new;
|
||||
u8_t tai_zone_change[5];
|
||||
} time_zone_set;
|
||||
struct {
|
||||
u16_t tai_utc_delta_new : 15;
|
||||
u8_t tai_delta_change[5];
|
||||
} tai_utc_delta_set;
|
||||
struct {
|
||||
u8_t role;
|
||||
} time_role_set;
|
||||
struct {
|
||||
u16_t scene_number;
|
||||
} scene_store;
|
||||
struct {
|
||||
u16_t scene_number;
|
||||
} scene_recall;
|
||||
struct {
|
||||
u16_t scene_number;
|
||||
} scene_delete;
|
||||
struct {
|
||||
u64_t index : 4,
|
||||
year : 7,
|
||||
month : 12,
|
||||
day : 5,
|
||||
hour : 5,
|
||||
minute : 6,
|
||||
second : 6,
|
||||
day_of_week : 7,
|
||||
action : 4,
|
||||
trans_time : 8;
|
||||
u16_t scene_number;
|
||||
} scheduler_act_set;
|
||||
} bt_mesh_time_scene_server_state_change_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u8_t index;
|
||||
} scheduler_act_get;
|
||||
} bt_mesh_time_scene_server_recv_get_msg_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u8_t tai_seconds[5];
|
||||
u8_t subsecond;
|
||||
u8_t uncertainty;
|
||||
u16_t time_authority : 1;
|
||||
u16_t tai_utc_delta : 15;
|
||||
u8_t time_zone_offset;
|
||||
} time_set;
|
||||
struct {
|
||||
u8_t time_zone_offset_new;
|
||||
u8_t tai_zone_change[5];
|
||||
} time_zone_set;
|
||||
struct {
|
||||
u16_t tai_utc_delta_new : 15;
|
||||
u16_t padding : 1;
|
||||
u8_t tai_delta_change[5];
|
||||
} tai_utc_delta_set;
|
||||
struct {
|
||||
u8_t time_role;
|
||||
} time_role_set;
|
||||
struct {
|
||||
u16_t scene_number;
|
||||
} scene_store;
|
||||
struct {
|
||||
bool op_en;
|
||||
u16_t scene_number;
|
||||
u8_t tid;
|
||||
u8_t trans_time;
|
||||
u8_t delay;
|
||||
} scene_recall;
|
||||
struct {
|
||||
u16_t scene_number;
|
||||
} scene_delete;
|
||||
struct {
|
||||
u64_t index : 4,
|
||||
year : 7,
|
||||
month : 12,
|
||||
day : 5,
|
||||
hour : 5,
|
||||
minute : 6,
|
||||
second : 6,
|
||||
day_of_week : 7,
|
||||
action : 4,
|
||||
trans_time : 8;
|
||||
u16_t scene_number;
|
||||
} scheduler_act_set;
|
||||
} bt_mesh_time_scene_server_recv_set_msg_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u8_t tai_seconds[5];
|
||||
u8_t subsecond;
|
||||
u8_t uncertainty;
|
||||
u16_t time_authority : 1;
|
||||
u16_t tai_utc_delta : 15;
|
||||
u8_t time_zone_offset;
|
||||
} time_status;
|
||||
} bt_mesh_time_scene_server_recv_status_msg_t;
|
||||
|
||||
void bt_mesh_time_scene_server_lock(void);
|
||||
void bt_mesh_time_scene_server_unlock(void);
|
||||
|
||||
void scene_publish(struct bt_mesh_model *model, struct bt_mesh_msg_ctx *ctx, u16_t opcode);
|
||||
|
||||
int bt_mesh_time_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_time_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_scene_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_scene_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_scheduler_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
int bt_mesh_scheduler_setup_srv_init(struct bt_mesh_model *model, bool primary);
|
||||
|
||||
#endif /* _TIME_SCENE_SERVER_H_ */
|
3333
components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c
Normal file
3333
components/bt/esp_ble_mesh/mesh_models/server/lighting_server.c
Normal file
File diff suppressed because it is too large
Load Diff
1088
components/bt/esp_ble_mesh/mesh_models/server/sensor_server.c
Normal file
1088
components/bt/esp_ble_mesh/mesh_models/server/sensor_server.c
Normal file
File diff suppressed because it is too large
Load Diff
237
components/bt/esp_ble_mesh/mesh_models/server/server_common.c
Normal file
237
components/bt/esp_ble_mesh/mesh_models/server/server_common.c
Normal file
@@ -0,0 +1,237 @@
|
||||
// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "osi/allocator.h"
|
||||
|
||||
#include "mesh_types.h"
|
||||
#include "mesh_kernel.h"
|
||||
#include "mesh_trace.h"
|
||||
#include "mesh.h"
|
||||
#include "access.h"
|
||||
#include "model_opcode.h"
|
||||
|
||||
#include "server_common.h"
|
||||
#include "state_binding.h"
|
||||
#include "state_transition.h"
|
||||
|
||||
/**
|
||||
* According to Mesh Model Spec:
|
||||
* If the Transition Time field is not present and the Generic Default Transition
|
||||
* Time state is supported, the Generic Default Transition Time state shall be
|
||||
* used. Otherwise the transition shall be instantaneous.
|
||||
*/
|
||||
#define INSTANTANEOUS_TRANS_TIME 0
|
||||
|
||||
u8_t bt_mesh_get_default_trans_time(struct bt_mesh_model *model)
|
||||
{
|
||||
/**
|
||||
* 1. If a Generic Default Transition Time Server model is present on the
|
||||
* main element of the model, that model instance shall be used.
|
||||
* 2. If a Generic Default Transition Time Server model is not present on
|
||||
* the main element of the model, then the Generic Default Transition
|
||||
* Time Server model instance that is present on the element with the
|
||||
* largest address that is smaller than the address of the main element
|
||||
* of the node shall be used; if no model instance is present on any
|
||||
* element with an address smaller than the address of the main element,
|
||||
* then the Generic Default Transition Time Server is not supported.
|
||||
*/
|
||||
struct bt_mesh_elem *element = bt_mesh_model_elem(model);
|
||||
struct bt_mesh_gen_def_trans_time_srv *state = NULL;
|
||||
u16_t primary_addr = bt_mesh_primary_addr();
|
||||
struct bt_mesh_model *srv = NULL;
|
||||
|
||||
for (u16_t addr = element->addr; addr >= primary_addr; addr--) {
|
||||
element = bt_mesh_elem_find(addr);
|
||||
if (element) {
|
||||
srv = bt_mesh_model_find(element, BLE_MESH_MODEL_ID_GEN_DEF_TRANS_TIME_SRV);
|
||||
if (srv) {
|
||||
state = (struct bt_mesh_gen_def_trans_time_srv *)srv->user_data;
|
||||
if (state) {
|
||||
return state->state.trans_time;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return INSTANTANEOUS_TRANS_TIME;
|
||||
}
|
||||
|
||||
int bt_mesh_get_light_lc_trans_time(struct bt_mesh_model *model, u8_t *trans_time)
|
||||
{
|
||||
struct bt_mesh_light_lc_srv *srv = NULL;
|
||||
u32_t value;
|
||||
|
||||
if (model == NULL || trans_time == NULL) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (model->id != BLE_MESH_MODEL_ID_LIGHT_LC_SRV) {
|
||||
BT_ERR("%s, Not a Light LC Server", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
srv = (struct bt_mesh_light_lc_srv *)model->user_data;
|
||||
if (srv == NULL) {
|
||||
BT_ERR("%s, Invalid Light LC Server user_data", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Set transition time to 0x54 for BQB test case MESH/SR/LLC/BV-04-C.
|
||||
* Light LC Property Set: 0x3C, 0x004E20 -> Light LC Time Run On
|
||||
* Light LC Property Set: 0x37, 0x004E20 -> Light LC Time Fade On
|
||||
* Light LC Property Set: 0x39, 0x004E20 -> Light LC Time Fade Standby Manual
|
||||
*
|
||||
* 2. Set transition time to 0x0 for BQB test case MESH/SR/LLC/BV-08-C.
|
||||
*
|
||||
* TODO: Based on Light LC state and choose property property value as the
|
||||
* transition time. Currently directly use Light LC Time Run On property value.
|
||||
* Unit: Millisecond, range: [0, 16777214(0xFFFFFE)]
|
||||
*/
|
||||
value = srv->lc->prop_state.time_run_on & 0xFFFFFF;
|
||||
|
||||
/**
|
||||
* Convert value into Default Transition Time state format.
|
||||
* 0b00: 0 ~ 6.2s, 100 millisecond step resolution
|
||||
* 0b01: 0 ~ 62s, 1 second step resolution
|
||||
* 0b10: 0 ~ 620s, 10 seconds step resolution
|
||||
* 0b11: 0 ~ 620m, 10 minutes step resolution
|
||||
*/
|
||||
if (value <= 6200) {
|
||||
*trans_time = (0 << 6) | (value / 100);
|
||||
} else if (value <= 62000) {
|
||||
*trans_time = (1 << 6) | (value / 1000);
|
||||
} else if (value <= 620000) {
|
||||
*trans_time = (2 << 6) | (value / 10000);
|
||||
} else {
|
||||
*trans_time = (3 << 6) | (value / 600000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bt_mesh_server_get_optional(struct bt_mesh_model *model,
|
||||
struct net_buf_simple *buf,
|
||||
u8_t *trans_time, u8_t *delay,
|
||||
bool *optional)
|
||||
{
|
||||
if (model == NULL || buf == NULL || trans_time == NULL ||
|
||||
delay == NULL || optional == NULL) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (buf->len != 0x00 && buf->len != 0x02) {
|
||||
BT_ERR("%s, Invalid optional message length %d", __func__, buf->len);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* No optional fields are available */
|
||||
if (buf->len == 0x00) {
|
||||
if (model->id == BLE_MESH_MODEL_ID_LIGHT_LC_SRV) {
|
||||
/**
|
||||
* Both messages(i.e. Light LC OnOff Set/Set Unack) may optionally include
|
||||
* a Transition Time field indicating the transition time to the target state.
|
||||
* If the Transition Time is not included, the Light LC Server shall use
|
||||
* its appropriate transition times defined by the Light LC Property states.
|
||||
*/
|
||||
if (bt_mesh_get_light_lc_trans_time(model, trans_time)) {
|
||||
BT_ERR("%s, Failed to get Light LC transition time", __func__);
|
||||
return -EIO;
|
||||
}
|
||||
} else {
|
||||
*trans_time = bt_mesh_get_default_trans_time(model);
|
||||
}
|
||||
*delay = 0U;
|
||||
*optional = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Optional fields are available */
|
||||
*trans_time = net_buf_simple_pull_u8(buf);
|
||||
if ((*trans_time & 0x3F) == 0x3F) {
|
||||
BT_ERR("%s, Invalid Transaction Number of Steps 0x3F", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*delay = net_buf_simple_pull_u8(buf);
|
||||
*optional = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void bt_mesh_server_alloc_ctx(struct k_work *work)
|
||||
{
|
||||
/**
|
||||
* This function is used to allocate memory for storing "struct bt_mesh_msg_ctx"
|
||||
* of the received messages, because some server models will callback the "struct
|
||||
* bt_mesh_msg_ctx" info to the application layer after a certain delay.
|
||||
* Here we use the allocated heap memory to store the "struct bt_mesh_msg_ctx".
|
||||
*/
|
||||
__ASSERT(work, "%s, Invalid parameter", __func__);
|
||||
work->_reserved = osi_calloc(sizeof(struct bt_mesh_msg_ctx));
|
||||
__ASSERT(work->_reserved, "%s, Failed to allocate memory", __func__);
|
||||
}
|
||||
|
||||
bool bt_mesh_is_server_recv_last_msg(struct bt_mesh_last_msg_info *last,
|
||||
u8_t tid, u16_t src, u16_t dst, s64_t *now)
|
||||
{
|
||||
*now = k_uptime_get();
|
||||
|
||||
if (last->tid == tid && last->src == src && last->dst == dst &&
|
||||
(*now - last->timestamp <= K_SECONDS(6))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void bt_mesh_server_update_last_msg(struct bt_mesh_last_msg_info *last,
|
||||
u8_t tid, u16_t src, u16_t dst, s64_t *now)
|
||||
{
|
||||
last->tid = tid;
|
||||
last->src = src;
|
||||
last->dst = dst;
|
||||
last->timestamp = *now;
|
||||
return;
|
||||
}
|
||||
|
||||
struct net_buf_simple *bt_mesh_server_get_pub_msg(struct bt_mesh_model *model, u16_t msg_len)
|
||||
{
|
||||
struct net_buf_simple *buf = NULL;
|
||||
|
||||
if (model == NULL) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (model->pub == NULL || model->pub->msg == NULL ||
|
||||
model->pub->addr == BLE_MESH_ADDR_UNASSIGNED) {
|
||||
BT_DBG("%s, Model 0x%04x has no publication support", __func__, model->id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
buf = model->pub->msg;
|
||||
if (buf->size < msg_len) {
|
||||
BT_ERR("%s, Too small publication msg size %d, model 0x%04x",
|
||||
__func__, buf->size, model->id);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
342
components/bt/esp_ble_mesh/mesh_models/server/state_binding.c
Normal file
342
components/bt/esp_ble_mesh/mesh_models/server/state_binding.c
Normal file
@@ -0,0 +1,342 @@
|
||||
/* Bluetooth: Mesh Generic OnOff, Generic Level, Lighting & Vendor Models
|
||||
*
|
||||
* Copyright (c) 2018 Vikrant More
|
||||
* Additional Copyright (c) 2018 Espressif Systems (Shanghai) PTE LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "mesh_types.h"
|
||||
#include "mesh_kernel.h"
|
||||
#include "mesh_trace.h"
|
||||
#include "mesh.h"
|
||||
|
||||
#include "model_opcode.h"
|
||||
#include "server_common.h"
|
||||
#include "state_binding.h"
|
||||
#include "state_transition.h"
|
||||
#include "generic_server.h"
|
||||
#include "lighting_server.h"
|
||||
|
||||
#define MINDIFF (2.25e-308)
|
||||
|
||||
static float bt_mesh_sqrt(float square)
|
||||
{
|
||||
float root, last, diff;
|
||||
|
||||
root = square / 3.0;
|
||||
diff = 1;
|
||||
|
||||
if (square <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
do {
|
||||
last = root;
|
||||
root = (root + square / root) / 2.0;
|
||||
diff = root - last;
|
||||
} while (diff > MINDIFF || diff < -MINDIFF);
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
static s32_t bt_mesh_ceiling(float num)
|
||||
{
|
||||
s32_t inum = (s32_t)num;
|
||||
|
||||
if (num == (float)inum) {
|
||||
return inum;
|
||||
}
|
||||
|
||||
return inum + 1;
|
||||
}
|
||||
|
||||
u16_t bt_mesh_convert_lightness_actual_to_linear(u16_t actual)
|
||||
{
|
||||
float tmp = ((float) actual / UINT16_MAX);
|
||||
|
||||
return bt_mesh_ceiling(UINT16_MAX * tmp * tmp);
|
||||
}
|
||||
|
||||
u16_t bt_mesh_convert_lightness_linear_to_actual(u16_t linear)
|
||||
{
|
||||
return (u16_t) (UINT16_MAX * bt_mesh_sqrt(((float) linear / UINT16_MAX)));
|
||||
}
|
||||
|
||||
s16_t bt_mesh_convert_temperature_to_gen_level(u16_t temp, u16_t min, u16_t max)
|
||||
{
|
||||
float tmp = (temp - min) * UINT16_MAX / (max - min);
|
||||
return (s16_t) (tmp + INT16_MIN);
|
||||
}
|
||||
|
||||
u16_t bt_mesh_covert_gen_level_to_temperature(s16_t level, u16_t min, u16_t max)
|
||||
{
|
||||
float diff = (float) (max - min) / UINT16_MAX;
|
||||
u16_t tmp = (u16_t) ((level - INT16_MIN) * diff);
|
||||
return (u16_t) (min + tmp);
|
||||
}
|
||||
|
||||
s16_t bt_mesh_convert_hue_to_level(u16_t hue)
|
||||
{
|
||||
return (s16_t) (hue + INT16_MIN);
|
||||
}
|
||||
|
||||
u16_t bt_mesh_convert_level_to_hue(s16_t level)
|
||||
{
|
||||
return (u16_t) (level - INT16_MIN);
|
||||
}
|
||||
|
||||
s16_t bt_mesh_convert_saturation_to_level(u16_t saturation)
|
||||
{
|
||||
return (s16_t) (saturation + INT16_MIN);
|
||||
}
|
||||
|
||||
u16_t bt_mesh_convert_level_to_saturation(s16_t level)
|
||||
{
|
||||
return (u16_t) (level - INT16_MIN);
|
||||
}
|
||||
|
||||
int bt_mesh_update_binding_state(struct bt_mesh_model *model,
|
||||
bt_mesh_server_state_type_t type,
|
||||
bt_mesh_server_state_value_t *value)
|
||||
{
|
||||
if (model == NULL || model->user_data == NULL ||
|
||||
value == NULL || type > BIND_STATE_MAX) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case GENERIC_ONOFF_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_GEN_ONOFF_SRV) {
|
||||
BT_ERR("%s, Not a Generic OnOff Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_gen_onoff_srv *srv = model->user_data;
|
||||
bt_mesh_server_stop_transition(&srv->transition);
|
||||
srv->state.onoff = value->gen_onoff.onoff;
|
||||
gen_onoff_publish(model);
|
||||
break;
|
||||
}
|
||||
case GENERIC_LEVEL_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_GEN_LEVEL_SRV) {
|
||||
BT_ERR("%s, Not a Generic Level Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_gen_level_srv *srv = model->user_data;
|
||||
bt_mesh_server_stop_transition(&srv->transition);
|
||||
srv->state.level = value->gen_level.level;
|
||||
gen_level_publish(model);
|
||||
break;
|
||||
}
|
||||
case GENERIC_ONPOWERUP_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_GEN_POWER_ONOFF_SRV) {
|
||||
BT_ERR("%s, Not a Generic Power OnOff Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_gen_power_onoff_srv *srv = model->user_data;
|
||||
if (srv->state == NULL) {
|
||||
BT_ERR("%s, Invalid Generic Power OnOff Server state", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
srv->state->onpowerup = value->gen_onpowerup.onpowerup;
|
||||
gen_onpowerup_publish(model);
|
||||
break;
|
||||
}
|
||||
case GENERIC_POWER_ACTUAL_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_GEN_POWER_LEVEL_SRV) {
|
||||
BT_ERR("%s, Not a Generic Power Level Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_gen_power_level_srv *srv = model->user_data;
|
||||
if (srv->state == NULL) {
|
||||
BT_ERR("%s, Invalid Generic Power Level Server state", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bt_mesh_server_stop_transition(&srv->transition);
|
||||
srv->state->power_actual = value->gen_power_actual.power;
|
||||
/**
|
||||
* Whenever the Generic Power Actual state is changed to a non-zero value
|
||||
* as a result of a non-transactional message or a completed sequence of
|
||||
* transactional messages, the value of the Generic Power Last state shall
|
||||
* be set to the value of the Generic Power Actual state.
|
||||
*/
|
||||
if (srv->state->power_actual) {
|
||||
srv->state->power_last = srv->state->power_actual;
|
||||
}
|
||||
gen_power_level_publish(model, BLE_MESH_MODEL_OP_GEN_POWER_LEVEL_STATUS);
|
||||
break;
|
||||
}
|
||||
case LIGHT_LIGHTNESS_ACTUAL_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV) {
|
||||
BT_ERR("%s, Not a Light Lightness Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_light_lightness_srv *srv = model->user_data;
|
||||
if (srv->state == NULL) {
|
||||
BT_ERR("%s, Invalid Light Lightness Server state", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bt_mesh_server_stop_transition(&srv->actual_transition);
|
||||
srv->state->lightness_actual = value->light_lightness_actual.lightness;
|
||||
light_lightness_publish(model, BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_STATUS);
|
||||
break;
|
||||
}
|
||||
case LIGHT_LIGHTNESS_LINEAR_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_LIGHT_LIGHTNESS_SRV) {
|
||||
BT_ERR("%s, Not a Light Lightness Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_light_lightness_srv *srv = model->user_data;
|
||||
if (srv->state == NULL) {
|
||||
BT_ERR("%s, Invalid Light Lightness Server state", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bt_mesh_server_stop_transition(&srv->linear_transition);
|
||||
srv->state->lightness_linear = value->light_lightness_linear.lightness;
|
||||
light_lightness_publish(model, BLE_MESH_MODEL_OP_LIGHT_LIGHTNESS_LINEAR_STATUS);
|
||||
break;
|
||||
}
|
||||
case LIGHT_CTL_LIGHTNESS_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_LIGHT_CTL_SRV) {
|
||||
BT_ERR("%s, Not a Light CTL Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_light_ctl_srv *srv = model->user_data;
|
||||
if (srv->state == NULL) {
|
||||
BT_ERR("%s, Invalid Light CTL Server state", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bt_mesh_server_stop_transition(&srv->transition);
|
||||
srv->state->lightness = value->light_ctl_lightness.lightness;
|
||||
light_ctl_publish(model, BLE_MESH_MODEL_OP_LIGHT_CTL_STATUS);
|
||||
break;
|
||||
}
|
||||
case LIGHT_CTL_TEMP_DELTA_UV_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_LIGHT_CTL_TEMP_SRV) {
|
||||
BT_ERR("%s, Not a Light CTL Temperature Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_light_ctl_temp_srv *srv = model->user_data;
|
||||
if (srv->state == NULL) {
|
||||
BT_ERR("%s, Invalid Light CTL Temperature Server state", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bt_mesh_server_stop_transition(&srv->transition);
|
||||
srv->state->temperature = value->light_ctl_temp_delta_uv.temperature;
|
||||
srv->state->delta_uv = value->light_ctl_temp_delta_uv.delta_uv;
|
||||
light_ctl_publish(model, BLE_MESH_MODEL_OP_LIGHT_CTL_TEMPERATURE_STATUS);
|
||||
break;
|
||||
}
|
||||
case LIGHT_HSL_LIGHTNESS_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_LIGHT_HSL_SRV) {
|
||||
BT_ERR("%s, Not a Light HSL Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_light_hsl_srv *srv = model->user_data;
|
||||
if (srv->state == NULL) {
|
||||
BT_ERR("%s, Invalid Light HSL Server state", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bt_mesh_server_stop_transition(&srv->transition);
|
||||
srv->state->lightness = value->light_hsl_lightness.lightness;
|
||||
light_hsl_publish(model, BLE_MESH_MODEL_OP_LIGHT_HSL_STATUS);
|
||||
break;
|
||||
}
|
||||
case LIGHT_HSL_HUE_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_LIGHT_HSL_HUE_SRV) {
|
||||
BT_ERR("%s, Not a Light HSL Hue Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_light_hsl_hue_srv *srv = model->user_data;
|
||||
if (srv->state == NULL) {
|
||||
BT_ERR("%s, Invalid Light HSL Hue Server state", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bt_mesh_server_stop_transition(&srv->transition);
|
||||
srv->state->hue = value->light_hsl_hue.hue;
|
||||
light_hsl_publish(model, BLE_MESH_MODEL_OP_LIGHT_HSL_HUE_STATUS);
|
||||
break;
|
||||
}
|
||||
case LIGHT_HSL_SATURATION_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_LIGHT_HSL_SAT_SRV) {
|
||||
BT_ERR("%s, Not a Light HSL Saturation Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_light_hsl_sat_srv *srv = model->user_data;
|
||||
if (srv->state == NULL) {
|
||||
BT_ERR("%s, Invalid Light HSL Saturation Server state", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bt_mesh_server_stop_transition(&srv->transition);
|
||||
srv->state->saturation = value->light_hsl_saturation.saturation;
|
||||
light_hsl_publish(model, BLE_MESH_MODEL_OP_LIGHT_HSL_SATURATION_STATUS);
|
||||
break;
|
||||
}
|
||||
case LIGHT_XYL_LIGHTNESS_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_LIGHT_XYL_SRV) {
|
||||
BT_ERR("%s, Not a Light xyL Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_light_xyl_srv *srv = model->user_data;
|
||||
if (srv->state == NULL) {
|
||||
BT_ERR("%s, Invalid Light xyL Server state", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bt_mesh_server_stop_transition(&srv->transition);
|
||||
srv->state->lightness = value->light_xyl_lightness.lightness;
|
||||
light_xyl_publish(model, BLE_MESH_MODEL_OP_LIGHT_XYL_STATUS);
|
||||
break;
|
||||
}
|
||||
case LIGHT_LC_LIGHT_ONOFF_STATE: {
|
||||
if (model->id != BLE_MESH_MODEL_ID_LIGHT_LC_SRV) {
|
||||
BT_ERR("%s, Not a Light LC Server Model, id 0x%04x", __func__, model->id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
struct bt_mesh_light_lc_srv *srv = model->user_data;
|
||||
if (srv->lc == NULL) {
|
||||
BT_ERR("%s, Invalid Light LC Server state", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
bt_mesh_server_stop_transition(&srv->transition);
|
||||
srv->lc->state.light_onoff = value->light_lc_light_onoff.onoff;
|
||||
light_lc_publish(model, BLE_MESH_MODEL_OP_LIGHT_LC_LIGHT_ONOFF_STATUS);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BT_WARN("%s, Unknown binding state type 0x%02x", __func__, type);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
1034
components/bt/esp_ble_mesh/mesh_models/server/state_transition.c
Normal file
1034
components/bt/esp_ble_mesh/mesh_models/server/state_transition.c
Normal file
File diff suppressed because it is too large
Load Diff
1424
components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c
Normal file
1424
components/bt/esp_ble_mesh/mesh_models/server/time_scene_server.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user