修改了Web后台的部分界面,增加了HAmqtt中的总电量传感器,后台新增mqtt上报频率设置

This commit is contained in:
OOP
2025-03-03 21:49:41 +08:00
parent e1e00b60ce
commit 9f9d4c7a56
4468 changed files with 1473046 additions and 10728 deletions

View File

@@ -0,0 +1,185 @@
/**
******************************************************************************
* @file HomeKit.h
* @author William Xu
* @version V1.0.0
* @date 05-Oct-2014
* @brief
******************************************************************************
* UNPUBLISHED PROPRIETARY SOURCE CODE
* Copyright (c) 2016 MXCHIP Inc.
*
* The contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of MXCHIP Corporation.
******************************************************************************
*/
#ifndef __HOMEKIT_H
#define __HOMEKIT_H
#include "common.h"
#include "HomeKitPairList.h"
#include "json_c/json.h"
/*HomeKit definition*/
// ==== HKtatus ====
typedef int32_t HkStatus;
#define kHKNoErr 0 //! This specifies a success for the request.
#define kHKPrivilegeErr -70401 //! Request denied due to insufficient privileges.
#define kHKCommunicateErr -70402 //! Unable to communicate with requested service.
#define kHKBusyErr -70403 //! Resource is busy, try again.
#define kHKWriteToROErr -70404 //! Cannot write to read only characteristic.
#define kHKReadFromWOErr -70405 //! Cannot read from a write only characteristic.
#define kHKNotifyUnsupportErr -70406 //! Notification is not supported for characteristic.
#define kHKResourceErr -70407 //! Out of resource to process request.
#define kHKTimeOutErr -70408 //! Operation timed out.
#define kHKNotExistErr -70409 //! Resource does not exist.
#define kHKInvalidErr -70410 //! Accessory received an invalid value in a write request.
// CATEGORY_IDENTIFIER value
enum hk_ci_e{
CI_ORHER = 1,
CI_BRIDGE,
CI_FAN,
CI_GARAGE_DOOR_OPENER,
CI_LIGHTBULB,
CI_DOOR_LOCK,
CI_OUTLET,
CI_SWITCH,
CI_THERMOSTAT,
CI_SENSOR,
CI_SECURITY_SYSTEM,
CI_DOOR,
CI_WINDOW,
CI_WINDOW_COVERING,
CI_PROGRAMMABLE_SWITCH,
CI_RANGE_EXTENDER,
CI_RESERVED,
} ;
typedef uint8_t hk_ci_t;
typedef enum _valueType{
ValueType_bool,
ValueType_int,
ValueType_float,
ValueType_string,
ValueType_date,
ValueType_tlv8,
ValueType_data,
ValueType_array,
ValueType_dict,
ValueType_null,
} valueType;
typedef union {
bool boolValue;
int intValue;
double floatValue;
char *stringValue;
char *dateValue;
json_object *array;
json_object *object;
} value_union;
struct _hapCharacteristic_t {
char *type;
bool hasStaticValue;
valueType valueType;
value_union value;
bool secureRead;
bool secureWrite;
bool hasEvents;
bool hasMinimumValue;
union {
int intValue;
float floatValue;
} minimumValue;
bool hasMaximumValue;
union {
int intValue;
float floatValue;
} maximumValue;
bool hasMinimumStep;
union {
int intValue;
float floatValue;
} minimumStep;
bool hasMaxLength;
int maxLength;
bool hasMaxDataLength;
int maxDataLength;
char *description;
char *format;
char *unit;
};
struct _hapService_t {
char *type;
uint32_t num_of_characteristics;
struct _hapCharacteristic_t *characteristic;
};
struct _hapAccessory_t {
uint32_t num_of_services;
struct _hapService_t *services;
};
struct _hapProduct_t {
uint32_t num_of_accessories;
struct _hapAccessory_t *accessories;
};
typedef struct _hapProduct_t hapProduct_t;
typedef OSStatus (*hk_key_storage_cb)(unsigned char *pk, unsigned char *sk, bool write);
/*Running status*/
typedef struct _hk_init_t {
hk_ci_t ci;
char * model;
int config_number;
mico_i2c_t mfi_cp_port;
hapProduct_t * hap_product;
uint8_t * password;
int password_len;
uint8_t * verifier;
int verifier_len;
uint8_t * salt;
int salt_len;
hk_key_storage_cb key_storage;
} hk_init_t;
void hk_server_lib_version( uint8_t *major, uint8_t *minor, uint8_t *revision );
OSStatus hk_server_start( hk_init_t init );
OSStatus hk_server_update_attri_db( hapProduct_t *hap_product, int config_number );
OSStatus hk_server_notify_by_bonjour( void );
/* HomeKit callback functions */
HkStatus HKReadCharacteristicValue(int accessoryID, int serviceID, int characteristicID, value_union *value );
void HKWriteCharacteristicValue(int accessoryID, int serviceID, int characteristicID, value_union value, bool moreComing );
HkStatus HKReadCharacteristicStatus(int accessoryID, int serviceID, int characteristicID );
HkStatus HKExcuteUnpairedIdentityRoutine( void );
#endif

View File

@@ -0,0 +1,53 @@
/**
******************************************************************************
* @file HomeKitPairList.h
* @author William Xu
* @version V1.0.0
* @date 05-Oct-2014
* @brief
******************************************************************************
* UNPUBLISHED PROPRIETARY SOURCE CODE
* Copyright (c) 2016 MXCHIP Inc.
*
* The contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of MXCHIP Corporation.
******************************************************************************
*/
#pragma once
#include "common.h"
#include "platform.h"
#include "platform_config.h"
#define MaxControllerNameLen 64
#define MaxPairRecord 16
/*Pair Info flash content*/
typedef struct _pair_t {
char controllerName[MaxControllerNameLen];
uint8_t controllerLTPK[32];
int permission;
} _pair_t;
typedef struct _pair_list_in_flash_t {
_pair_t pairInfo[MaxPairRecord];
} pair_list_in_flash_t;
/* Malloc a memory and */
//OSStatus HKReadPairList(pair_list_in_flash_t **pPairList);
uint32_t HKPairInfoCount(void);
OSStatus HKPairInfoClear(void);
OSStatus HKPairInfoInsert(char controllerIdentifier[64], uint8_t controllerLTPK[32], bool admin);
OSStatus HKPairInfoFindByName(char controllerIdentifier[64], uint8_t foundControllerLTPK[32], bool *isAdmin );
OSStatus HKPairInfoFindByIndex(uint32_t index, char controllerIdentifier[64], uint8_t foundControllerLTPK[32], bool *isAdmin );
OSStatus HKPairInfoRemove(char controllerIdentifier[64]);

View File

@@ -0,0 +1 @@
git@code.aliyun.com/mico_inner_developer/Lib_HomeKit_Server.git/#607040fca28777c472d93c9c595bbff6c92a30f9

View File

@@ -0,0 +1,25 @@
#
# UNPUBLISHED PROPRIETARY SOURCE CODE
# Copyright (c) 2016 MXCHIP Inc.
#
# The contents of this file may not be disclosed to third parties, copied or
# duplicated in any form, in whole or in part, without the prior written
# permission of MXCHIP Corporation.
#
NAME := Lib_HomeKit_Server
GLOBAL_INCLUDES += .
ifneq ($(wildcard $(CURDIR)Lib_HomeKit_Server.$(HOST_ARCH).$(TOOLCHAIN_NAME).release.a),)
$(NAME)_PREBUILT_LIBRARY := Lib_HomeKit_Server.$(HOST_ARCH).$(TOOLCHAIN_NAME).release.a
else
# Build from source
Lib_HomeKit_Server_DIR := Lib_HomeKit_Server
include $(CURDIR)Lib_HomeKit_Server/Lib_HomeKit_Server_src.mk
endif
$(NAME)_COMPONENTS += drivers/MiCODriverMFiAuth