Index: ModuleDemo/BlueTooth/BT_BLE/prj/MDK/YC3121_Keil.uvoptx
===================================================================
--- /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/prj/MDK/YC3121_Keil.uvoptx	(revision 950)
+++ /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/prj/MDK/YC3121_Keil.uvoptx	(working copy)
@@ -209,7 +209,7 @@
       <GroupNumber>1</GroupNumber>
       <FileNumber>1</FileNumber>
       <FileType>1</FileType>
-      <tvExp>1</tvExp>
+      <tvExp>0</tvExp>
       <tvExpOptDlg>0</tvExpOptDlg>
       <bDave2>0</bDave2>
       <PathWithFileName>..\..\..\..\..\Librarier\core\misc.c</PathWithFileName>
@@ -423,4 +423,24 @@
     </File>
   </Group>
 
+  <Group>
+    <GroupName>ble</GroupName>
+    <tvExp>1</tvExp>
+    <tvExpOptDlg>0</tvExpOptDlg>
+    <cbSel>0</cbSel>
+    <RteFlg>0</RteFlg>
+    <File>
+      <GroupNumber>5</GroupNumber>
+      <FileNumber>17</FileNumber>
+      <FileType>1</FileType>
+      <tvExp>0</tvExp>
+      <tvExpOptDlg>0</tvExpOptDlg>
+      <bDave2>0</bDave2>
+      <PathWithFileName>..\..\user\app_ble_gatt.c</PathWithFileName>
+      <FilenameWithoutPath>app_ble_gatt.c</FilenameWithoutPath>
+      <RteFlg>0</RteFlg>
+      <bShared>0</bShared>
+    </File>
+  </Group>
+
 </ProjectOpt>
Index: ModuleDemo/BlueTooth/BT_BLE/prj/MDK/YC3121_Keil.uvprojx
===================================================================
--- /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/prj/MDK/YC3121_Keil.uvprojx	(revision 950)
+++ /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/prj/MDK/YC3121_Keil.uvprojx	(working copy)
@@ -479,6 +479,16 @@
             </File>
           </Files>
         </Group>
+        <Group>
+          <GroupName>ble</GroupName>
+          <Files>
+            <File>
+              <FileName>app_ble_gatt.c</FileName>
+              <FileType>1</FileType>
+              <FilePath>..\..\user\app_ble_gatt.c</FilePath>
+            </File>
+          </Files>
+        </Group>
       </Groups>
     </Target>
   </Targets>
Index: ModuleDemo/BlueTooth/BT_BLE/user/app_ble_gatt.h
===================================================================
--- /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/user/app_ble_gatt.h	(nonexistent)
+++ /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/user/app_ble_gatt.h	(working copy)
@@ -0,0 +1,223 @@
+#ifndef __SIMPLE_GATT_SERVICE_H_
+#define __SIMPLE_GATT_SERVICE_H_
+
+#include "app_ble_gatt_sig_uuid.h"
+
+
+#define ATT_VALUE_ZERO {0}
+
+#define HI_UINT16(a) (((a) >> 8) & 0xFF)
+#define LO_UINT16(a) ((a) & 0xFF)
+
+
+// Gap Profile attributes index. 
+enum
+{
+    // SERVICE
+    GAP_IDX_SERVICE,
+    // USER_IDX_CHAR1_USER_DESCRIPTION,
+    GAP_IDX_CHAR1_DECLARATION,
+    GAP_IDX_CHAR1_VALUE,
+
+    GAP_IDX_CHAR2_DECLARATION,
+    GAP_IDX_CHAR2_VALUE,
+ 
+    GAP_IDX_CHAR3_DECLARATION,
+    GAP_IDX_CHAR3_VALUE,
+    GAP_IDX_NB,
+};
+
+
+
+
+// Gatt Profile attributes index. 
+enum
+{
+    GATT_IDX_SERVICE,    // SERVICE
+
+    GATT_IDX_CHAR1_DECLARATION,    // USER_IDX_CHAR1_USER_DESCRIPTION
+    GATT_IDX_CHAR1_VALUE,
+    GATT_IDX_CHAR1_CFG,
+    
+    GATT_IDX_CHAR2_DECLARATION,    // USER_IDX_CHAR1_USER_DESCRIPTION
+    GATT_IDX_CHAR2_VALUE,
+    GATT_IDX_NB,
+};
+
+
+
+
+/// Keyboard Device
+#define HID_DEV_KEYBOARD    0x01
+/// Mouse Device
+#define HID_DEV_MOUSE       0x02
+/// Protocol Mode present
+#define HID_DEV_PROTO_MODE  0x04
+
+/* Current only support mouse device */
+//#define HID_DEV (HID_DEV_KEYBOARD)
+#define HID_DEV (HID_DEV_MOUSE | HID_DEV_PROTO_MODE)
+
+/* HID information flags */
+#define HID_FLAGS_REMOTE_WAKE           0x01 // RemoteWake
+#define HID_FLAGS_NORMALLY_CONNECTABLE  0x02 // NormallyConnectable
+
+/* HID protocol mode values */
+#define HID_PROTOCOL_MODE_BOOT      0x00 // Boot Protocol Mode
+#define HID_PROTOCOL_MODE_REPORT    0x01 // Report Protocol Mode
+
+/** @defgroup HID_REPORT_TYPE_GROUP */
+#define HID_REPORT_TYPE_INPUT       0x01
+#define HID_REPORT_TYPE_OUTPUT      0x02
+#define HID_REPORT_TYPE_FEATURE     0x03
+#define HID_REPORT_TYPE_WR          0x10    /// Input report with Write capabilities
+
+
+// HID Protocol mode
+#define HID_PROTOCOL_VALUE    \
+{                         \
+    0x01                  /*Protocol mode*/     \
+}
+
+// HID Report ID
+#define HID_REPORT_IDX    \
+{                         \
+    0x01,                     /*Report id*/     \
+    HID_REPORT_TYPE_INPUT     /*Input*/         \
+}
+
+// HID Information data
+#define HID_INFO_VALUE    \
+{                         \
+    LO_UINT16(0x0101), HI_UINT16(0x0101),             /*bcdHID (USB HID version)*/    \
+    0x00,                                             /*bCountryCode*/                \
+    HID_FLAGS_REMOTE_WAKE | HID_FLAGS_NORMALLY_CONNECTABLE     /*Flags*/              \
+}
+
+//HID Report Map characteristic defination
+#define HID_REPORT_MAP    \
+{                         \
+    /*---------mouse buttons+sensor+wheel-----------*/    \
+    0x05, 0x01,   /* Usage Page(Generic Desktop)    */    \
+    0x09, 0x02,   /* Usage(Mouse)                   */    \
+    0xa1, 0x01,   /* Collection(Application)        */    \
+    0x85, 0x01,   /* Report ID(1)                   */    \
+    0x09, 0x01,   /* Usage(Pointer)                 */    \
+    0xa1, 0x00,   /* Collection(Physical)           */    \
+    /*--------buttons---------*/                          \
+    0x05, 0x09,   /* Usage Page(Buttons)            */    \
+    0x19, 0x01,   /* Usage Minimum(1)               */    \
+    0x29, 0x08,   /* Usage Maximum(8)               */    \
+    0x15, 0x00,   /* Logical Minimum(0).            */    \
+    0x25, 0x01,   /* Logical Maximum(1)             */    \
+    0x75, 0x01,   /* Report Size(1)                 */    \
+    0x95, 0x08,   /* Report Count(8)                */    \
+    0x81, 0x02,   /* Input(Data Variable Absolute)  */    \
+    /*----------sensor boot--------*/                     \
+    0x05, 0x01,   /* Usage Page(Generic Desktop)    */    \
+    0x09, 0x30,   /* Usage(X)                       */    \
+    0x09, 0x31,   /* Usage(Y)                       */    \
+    0x16, 0x01, 0xf8,   /* Logical Minimum(-2047)   */    \
+    0x26, 0xff, 0x07,   /* Logical Maximum(2047)    */    \
+    0x75, 0x10,   /* Report Size(16)                */    \
+    0x95, 0x02,   /* Report Count(2)                */    \
+    0x81, 0x06,   /* Input(Data Variable Relative)  */    \
+    /*---------scroll wheel--------*/                     \
+    0x09, 0x38,   /* Usage(Wheel)                   */    \
+    0x15, 0x81,   /* Logical Minimum(-127)          */    \
+    0x25, 0x7f,   /* Logical Maximum(127)           */    \
+    0x75, 0x08,   /* Report Size(8)                 */    \
+    0x95, 0x01,   /* Report Count(1)                */    \
+    0x81, 0x06,   /* Input(Data Variable Relative)  */    \
+    0x05, 0x0c,   /* Usage Page(Consumer)           */    \
+    0x0a, 0x38, 0x02,   /* Usage(AC Pan)            */    \
+    0x95, 0x01,   /* Report Count(1)                */    \
+    0x81, 0x06,   /* Input(Data Variable Relative)  */    \
+    0xc0,         /* End Collection                 */    \
+    0xc0          /* End Collection                 */    \
+}
+
+// HID service attributes index.
+enum
+{
+    HID_IDX_SERVICE,                // HID Service
+
+#if ((HID_DEV & HID_DEV_PROTO_MODE) == HID_DEV_PROTO_MODE)
+    HID_PROTOCOL_MODE_DECL_IDX,     // HID Protocol Mode characteristic declaration
+    HID_PROTOCOL_MODE_IDX,          // HID Protocol Mode characteristic
+#endif
+
+    HID_FEATURE_DECL_IDX,           // Feature Report declaration
+    HID_FEATURE_IDX,                // Feature Report
+    HID_FEATURE_CCCD_IDX,           // Feature Report characteristic client characteristic configuration
+    HID_REPORT_REF_FEATURE_IDX,     // HID Report Reference characteristic descriptor, feature
+
+    HID_REPORT_MAP_DECL_IDX,        // HID Report Map characteristic declaration
+    HID_REPORT_MAP_IDX,             // HID Report Map characteristic
+
+#if ((HID_DEV & HID_DEV_MOUSE) == HID_DEV_MOUSE)
+    HID_BOOT_MOUSE_IN_DECL_IDX,     // HID Boot Mouse Input Report declaration
+    HID_BOOT_MOUSE_IN_IDX,          // HID Boot Mouse Input Report
+    HID_BOOT_MOUSE_IN_CCCD_IDX,     // HID Boot Mouse Input Report characteristic client characteristic configuration
+#endif
+
+    HID_INFO_DECL_IDX,              // HID Information characteristic declaration
+    HID_INFO_IDX,                   // HID Information characteristic
+
+    HID_CONTROL_POINT_DECL_IDX,     // HID Control Point characteristic declaration
+    HID_CONTROL_POINT_IDX,          // HID Control Point characteristic
+
+    HID_IDX_NB,
+};
+
+
+
+
+// User GATT Profile Service UUID
+#define USER_SVC_UUID             0xFFF0
+#define USER_CHAR1_NOTIFY_UUID    0xFFF1
+#define USER_CHAR2_WRITE_UUID     0xFFF2
+#define USER_CHAR3_NOTIFY_UUID    0xFFF3
+#define USER_CHAR4_WRITE_UUID     0xFFF4
+
+// User Profile attributes index. 
+enum
+{
+    // SERVICE
+    USER_IDX_SERVICE,
+    // USER_IDX_CHAR1_USER_DESCRIPTION,
+    USER_IDX_CHAR1_DECLARATION,
+    USER_IDX_CHAR1_VALUE,
+    USER_IDX_CHAR1_CFG,
+    // USER_IDX_CHAR2_USER_DESCRIPTION,
+    USER_IDX_CHAR2_DECLARATION,
+    USER_IDX_CHAR2_VALUE,
+    #if 0
+    // USER_IDX_CHAR3_USER_DESCRIPTION,
+    USER_IDX_CHAR3_DECLARATION,
+    USER_IDX_CHAR3_VALUE,
+    USER_IDX_CHAR3_CFG,
+    // USER_IDX_CHAR4_USER_DESCRIPTION,
+    USER_IDX_CHAR4_DECLARATION,
+    USER_IDX_CHAR4_VALUE,
+    #endif
+    //-------- add service ----------//
+
+    //-------- add service ----------//
+    USER_IDX_NB,
+};
+
+
+
+extern uint16_t user_ble_notify_handle;
+extern uint16_t user_ble_notify_char_handle;
+extern uint16_t user_ble_receive_handle;
+
+extern uint16_t hid_ble_notify_handle;
+extern uint16_t hid_ble_notify_char_handle;
+extern uint16_t hid_ble_receive_handle;
+extern uint16_t hid_ble_pair_handle;
+
+void bleGattServiceInit(void);
+
+#endif
Index: ModuleDemo/BlueTooth/BT_BLE/user/app_ble_gatt.c
===================================================================
--- /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/user/app_ble_gatt.c	(nonexistent)
+++ /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/user/app_ble_gatt.c	(working copy)
@@ -0,0 +1,369 @@
+#include "app_ble_gatt.h"
+#include "yc_ipc.h"
+#include "yc_bt.h"
+#include "bt_config.h"
+
+#define mem_le_pairing_handle 0xc44cc
+
+uint16_t user_ble_notify_handle;
+uint16_t user_ble_notify_char_handle;
+uint16_t user_ble_receive_handle;
+
+uint16_t hid_ble_notify_handle;
+uint16_t hid_ble_notify_char_handle;
+uint16_t hid_ble_receive_handle;
+uint16_t hid_ble_pair_handle;
+
+
+GATT_Attribute service_gap[GAP_IDX_NB] =
+{
+    // Gap Service Declaration
+    [GAP_IDX_SERVICE] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_PRIMARY_SERVICE_UUID)},
+        {SIZE_2, UUID16_ARR(GAP_SERVICE_UUID)},
+    },
+    
+    // Characteristic 1 Declaration   TX
+    [GAP_IDX_CHAR1_DECLARATION] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_READ},
+    },
+    // Characteristic 1 Value
+    [GAP_IDX_CHAR1_VALUE] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_DEVICE_NAME_UUID)},
+        {SIZE_16, {0}},
+    },
+ 
+  // Characteristic 2 Declaration   APPEARANCE
+ [GAP_IDX_CHAR2_DECLARATION] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_READ},
+    },
+    // Characteristic 2 Value
+    [GAP_IDX_CHAR2_VALUE] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_APPEARANCE_UUID)},
+        {SIZE_2, {0x03,0xc1}},
+    },
+ 
+ // Characteristic 3 Declaration   APPEARANCE
+ [GAP_IDX_CHAR3_DECLARATION] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_READ},
+    },
+    // Characteristic 3 Value
+    [GAP_IDX_CHAR3_VALUE] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_PERI_CONN_PARAM_UUID)},
+        {SIZE_8, {0x01,0x2c,0x00,0x05,0x00,0x18,0x00,0x18}},
+    },
+    
+};
+
+const GATT_Attribute service_gatt[GATT_IDX_NB] =
+{
+    // Gatt Service Declaration
+    [GATT_IDX_SERVICE] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_PRIMARY_SERVICE_UUID)},
+        {SIZE_2, UUID16_ARR(GATT_SERVICE_UUID)},
+    },
+
+    // Characteristic 1 Declaration   TX
+    [GATT_IDX_CHAR1_DECLARATION] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_INDI},
+    },
+    // Characteristic 1 Value
+    [GATT_IDX_CHAR1_VALUE] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_SERVICE_CHANGED_UUID)},
+        {SIZE_1, ATT_VALUE_ZERO},
+    },
+
+    // Characteristic 1 client characteristic configuration
+    [GATT_IDX_CHAR1_CFG] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID)},
+        {SIZE_2, ATT_VALUE_ZERO},
+    },
+    
+     // Characteristic 1 Declaration   RX
+    [GATT_IDX_CHAR2_DECLARATION] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_READ},
+    },
+    // Characteristic 1 client characteristic configuration
+    [GATT_IDX_CHAR2_VALUE] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_PERI_CONN_PARAM_UUID)},
+        {SIZE_2, ATT_VALUE_ZERO},
+    },
+
+};
+
+#if ((FUNC_DEVICE_BT & BLE_HID_SERVICE_ENABLE) == BLE_HID_SERVICE_ENABLE)
+
+const GATT_Attribute service_hid[HID_IDX_NB] =
+{
+    [HID_IDX_SERVICE] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_PRIMARY_SERVICE_UUID)},
+        {SIZE_2, UUID16_ARR(HID_SERV_UUID)},
+    },
+
+#if ((HID_DEV & HID_DEV_PROTO_MODE) == HID_DEV_PROTO_MODE)
+
+    // HID Protocol Mode characteristic declaration
+    [HID_PROTOCOL_MODE_DECL_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_READ | GATT_PROP_WRITE_CMD}
+    },
+
+    // HID Protocol Mode characteristic
+    [HID_PROTOCOL_MODE_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(PROTOCOL_MODE_UUID)},
+        {SIZE_1, HID_PROTOCOL_VALUE},
+    },
+#endif
+
+    // HID Feature Report ID 0
+    [HID_FEATURE_DECL_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_READ | GATT_PROP_WRITE_REQ | GATT_PROP_NOTI}
+    },
+
+    [HID_FEATURE_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(REPORT_UUID)},
+        {SIZE_7, ATT_VALUE_ZERO},
+    },
+
+    [HID_FEATURE_CCCD_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID)},
+        {SIZE_2, ATT_VALUE_ZERO},
+    },
+
+    [HID_REPORT_REF_FEATURE_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_REPORT_REF_UUID)},
+        {SIZE_2, HID_REPORT_IDX},
+    },
+
+    // HID Report Map characteristic declaration
+    [HID_REPORT_MAP_DECL_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_READ},
+    },
+
+    // HID Report Map characteristic
+    [HID_REPORT_MAP_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(REPORT_MAP_UUID)},
+        {SIZE_69, HID_REPORT_MAP},
+    },
+
+#if ((HID_DEV & HID_DEV_MOUSE) == HID_DEV_MOUSE)
+    // HID Boot Mouse Input Report declaration
+    [HID_BOOT_MOUSE_IN_DECL_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_READ | GATT_PROP_WRITE_REQ | GATT_PROP_NOTI}
+    },
+    
+    // HID Boot Mouse Input Report
+    [HID_BOOT_MOUSE_IN_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(BOOT_MOUSE_INPUT_UUID)},
+        {SIZE_8, ATT_VALUE_ZERO},
+    },
+    
+    // HID Report characteristic, key input client characteristic configuration
+    [HID_BOOT_MOUSE_IN_CCCD_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID)},
+        {SIZE_2, ATT_VALUE_ZERO},
+    },
+#endif
+
+    // Hid information
+    [HID_INFO_DECL_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_READ},
+    },
+    // Hid information
+    [HID_INFO_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(HID_INFORMATION_UUID)},
+        {SIZE_4, HID_INFO_VALUE},
+    },
+
+    // HID Control Point characteristic declaration
+    [HID_CONTROL_POINT_DECL_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_WRITE_CMD},
+    },
+
+    // HID Control Point characteristic value
+    [HID_CONTROL_POINT_IDX] = {
+        {UUID_SIZE_2, UUID16_ARR(HID_CTRL_PT_UUID)},
+        {SIZE_1, ATT_VALUE_ZERO},
+    },
+};
+
+#endif
+
+
+#if ((FUNC_DEVICE_BT & BLE_USER_SERVICE_ENABLE) == BLE_USER_SERVICE_ENABLE)
+
+//用户私有服务，结构体数组初始化
+const GATT_Attribute service_user_transceive[USER_IDX_NB] =
+{
+    // User Service Declaration
+    [USER_IDX_SERVICE] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_PRIMARY_SERVICE_UUID)},
+        {SIZE_2, UUID16_ARR(USER_SVC_UUID)},
+    },
+
+    // Characteristic 1 Declaration   TX
+    [USER_IDX_CHAR1_DECLARATION] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_NOTI},
+    },
+    // Characteristic 1 Value
+    [USER_IDX_CHAR1_VALUE] = {
+        {UUID_SIZE_2, UUID16_ARR(USER_CHAR1_NOTIFY_UUID)},
+        {SIZE_1, ATT_VALUE_ZERO},
+    },
+    // Characteristic 1 client characteristic configuration
+    [USER_IDX_CHAR1_CFG] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID)},
+        {SIZE_2, GATT_CCCD_VALUE},
+    },
+
+    // Characteristic 2 Declaration  RX
+    [USER_IDX_CHAR2_DECLARATION] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_WRITE_REQ},
+    },
+    // Characteristic 2 Value
+    [USER_IDX_CHAR2_VALUE] = {
+        {UUID_SIZE_2, UUID16_ARR(USER_CHAR2_WRITE_UUID)},
+        {SIZE_1, ATT_VALUE_ZERO},
+    },
+#if 0
+    // Characteristic 3 Declaration   TX
+    [USER_IDX_CHAR3_DECLARATION] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_NOTI},
+    },
+    // Characteristic 3 Value
+    [USER_IDX_CHAR3_VALUE] = {
+        {UUID_SIZE_2, UUID16_ARR(USER_CHAR3_NOTIFY_UUID)},
+        {SIZE_1, ATT_VALUE_ZERO},
+    },
+    // Characteristic 3 client characteristic configuration
+    [USER_IDX_CHAR3_CFG] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CLIENT_CHAR_CFG_UUID)},
+        {SIZE_2, GATT_CCCD_VALUE},
+    },
+
+    // Characteristic 4 Declaration  RX
+    [USER_IDX_CHAR4_DECLARATION] = {
+        {UUID_SIZE_2, UUID16_ARR(GATT_CHARACTER_UUID)},
+        {SIZE_1, GATT_PROP_WRITE_REQ},
+    },
+    // Characteristic 4 Value
+    [USER_IDX_CHAR4_VALUE] = {
+        {UUID_SIZE_2, UUID16_ARR(USER_CHAR4_WRITE_UUID)},
+        {SIZE_1, ATT_VALUE_ZERO},
+    },
+#endif
+
+};
+
+#endif
+
+void uartPrintStr(const char *str)
+{
+#if (UART_LOG_ENABLE)
+    for (uint8_t i = 0; i < strlen(str); i++)
+        MyPrintf("%c", (uint8_t)str[i]);
+    MyPrintf("\r\n");
+#endif
+}
+
+
+void genBleGattService(const GATT_Attribute *service_table, uint8_t service_index_max, uint16_t *service_handle, uint8_t *out_service_table, uint8_t *out_service_length)
+{
+    uint8_t loop_assist_idx = 0;
+    uint8_t uuid_inner_idx = 0;
+    uint8_t temp_index = 0;
+    uint8_t ble_inf_idx = 0;
+    uint8_t ble_inf_table[MAX_TCP_DATA_LEN] = {0};
+
+    for (loop_assist_idx = 0; loop_assist_idx < service_index_max; loop_assist_idx++)
+    {
+        temp_index = ble_inf_idx;
+
+        ble_inf_table[ble_inf_idx++] = *service_handle & 0xff;
+        ble_inf_table[ble_inf_idx++] = *service_handle >> 8;
+        (*service_handle)++;
+
+        ble_inf_table[ble_inf_idx++] = service_table[loop_assist_idx].uuid.size;
+        for (uuid_inner_idx = 0; uuid_inner_idx < service_table[loop_assist_idx].uuid.size; uuid_inner_idx++)
+        {
+            ble_inf_table[ble_inf_idx++] = service_table[loop_assist_idx].uuid.uuid[uuid_inner_idx];
+        }
+
+        ble_inf_table[ble_inf_idx++] = service_table[loop_assist_idx].attribute_data.size;
+        for (uuid_inner_idx = 0; uuid_inner_idx < service_table[loop_assist_idx].attribute_data.size; uuid_inner_idx++)
+        {
+            ble_inf_table[ble_inf_idx++] = service_table[loop_assist_idx].attribute_data.attribute[uuid_inner_idx];
+        }
+
+        for (int i = temp_index; i < ble_inf_idx; i++)
+            MyPrintf("%02x ", ble_inf_table[i]);
+        MyPrintf("\r\n");
+    }
+    
+    out_service_length[0] = ble_inf_idx;
+//    uartPrintArray("Size",out_service_length,1,TYPE_DEC);
+    memcpy(out_service_table,ble_inf_table,ble_inf_idx);
+}
+
+
+void bleGattServiceInit(void)
+{
+    uint16_t handle_num[1] = {0x0001};  //start handle
+    uint8_t service_table_gen[MAX_TCP_DATA_LEN] = {0};
+    uint8_t service_len_gen[1] = {0};
+    
+    uartPrintStr("[Primary service yichip config]:handle(2bytes)+len(1byte)+uuid(N bytes)+len(1byte)+attribute(N bytes)");
+
+    //service GAP
+    genBleGattService(service_gap,GAP_IDX_NB,handle_num,service_table_gen,service_len_gen);
+    if(BT_AddBleBlockService(service_table_gen,*service_len_gen)==TRUE)
+        uartPrintStr("SetGapService_suc");
+    else
+        uartPrintStr("SetGapService_failed");
+    
+    //service GATT
+    genBleGattService(service_gatt,GATT_IDX_NB,handle_num,service_table_gen,service_len_gen);
+    if(BT_AddBleBlockService(service_table_gen,*service_len_gen)==TRUE)
+        uartPrintStr("SetGattService_suc");
+    else
+        uartPrintStr("SetGattService_failed");
+
+#if ((FUNC_DEVICE_BT & BLE_HID_SERVICE_ENABLE) == BLE_HID_SERVICE_ENABLE)
+    //service HID
+    hid_ble_notify_handle = *handle_num + HID_FEATURE_IDX;
+    hid_ble_notify_char_handle = *handle_num + HID_FEATURE_CCCD_IDX;
+    hid_ble_pair_handle = *handle_num + HID_REPORT_MAP_IDX;
+    HW_REG_16BIT(mem_le_pairing_handle,hid_ble_pair_handle);
+    genBleGattService(service_hid,HID_IDX_NB,handle_num,service_table_gen,service_len_gen);
+    if(BT_AddBleBlockService(service_table_gen,*service_len_gen)==TRUE)
+        uartPrintStr("SetHidService_suc");
+    else
+        uartPrintStr("SetHidService_failed");
+#endif
+
+#if ((FUNC_DEVICE_BT & BLE_USER_SERVICE_ENABLE) == BLE_USER_SERVICE_ENABLE)
+    //service USER
+    user_ble_notify_handle = *handle_num + USER_IDX_CHAR1_VALUE;
+    user_ble_notify_char_handle = *handle_num + USER_IDX_CHAR1_CFG;
+    user_ble_receive_handle = *handle_num + USER_IDX_CHAR2_VALUE;
+    genBleGattService(service_user_transceive,USER_IDX_NB,handle_num,service_table_gen,service_len_gen);
+    if(BT_AddBleBlockService(service_table_gen,*service_len_gen)==TRUE)
+        uartPrintStr("SetUserService_suc");
+    else
+        uartPrintStr("SetUserService_failed");
+#endif
+}
+
Index: ModuleDemo/BlueTooth/BT_BLE/user/app_ble_gatt_sig_uuid.h
===================================================================
--- /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/user/app_ble_gatt_sig_uuid.h	(nonexistent)
+++ /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/user/app_ble_gatt_sig_uuid.h	(working copy)
@@ -0,0 +1,298 @@
+#ifndef __GATT_SIG_UUID_H_
+#define __GATT_SIG_UUID_H_
+
+#include "type.h"
+ 
+//uuid字节数
+#define UUID_SIZE_2         2 
+#define UUID_SIZE_16        16
+
+
+#define SIZE_1         1
+#define SIZE_2         2
+#define SIZE_3         3
+#define SIZE_4         4
+#define SIZE_5         5
+#define SIZE_6         6
+#define SIZE_7         7
+#define SIZE_8         8
+#define SIZE_16        16
+#define SIZE_69        69
+#define SIZE_255       255
+
+//字节顺序交换
+#define UUID16_ARR(uuid16)        {uuid16&0xff,(uuid16&0xff00)>>8}
+#define UUID128_ARR(uuid16)       {0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, \
+                                   0x00, 0x10, 0x00, 0x00, (uuid16 & 0xff),(uuid16&0xff00)>>8, 0x00, 0x00}
+
+
+// GATT_PROP_BITMAPS_DEFINES GATT Attribute Access Permissions Bit Fields
+#define GATT_PROP_BROADCAST             (1<<0)  //!< Attribute is able to broadcast
+#define GATT_PROP_READ                  (1<<1)  //!< Attribute is Readable
+#define GATT_PROP_WRITE_CMD             (1<<2)  //!< Attribute supports write with no response
+#define GATT_PROP_WRITE_REQ             (1<<3)  //!< Attribute supports write request
+#define GATT_PROP_NOTI                  (1<<4)  //!< Attribute is able to send notification
+#define GATT_PROP_INDI                  (1<<5)  //!< Attribute is able to send indication
+#define GATT_PROP_AUTH_SIG_WRTIE        (1<<6)  //!< Attribute supports authenticated signed write
+#define GATT_PROP_EXTEND_PROP           (1<<7)  //!< Attribute supports extended properities
+#define GATT_PROP_WRITE                 (1<<8)  //!< Attribute is Writable (support both write_req and write_cmd)
+
+#define GATT_CCCD_VALUE 0x0001
+
+
+
+
+
+/*
+ * WARNING: The 16-bit UUIDs are assigned by the Bluetooth SIG and published
+ *          in the Bluetooth Assigned Numbers page. Do not change these values.
+ *          Changing them will cause Bluetooth interoperability issues.
+ */
+
+/**
+ * GATT Services
+ */
+#define GAP_SERVICE_UUID                           0x1800 // Generic Access Profile
+#define GATT_SERVICE_UUID                          0x1801 // Generic Attribute Profile
+
+/**
+ * GATT Declarations
+ */
+#define GATT_PRIMARY_SERVICE_UUID                  0x2800 // Primary Service
+#define GATT_SECONDARY_SERVICE_UUID                0x2801 // Secondary Service
+#define GATT_INCLUDE_UUID                          0x2802 // Include
+#define GATT_CHARACTER_UUID                        0x2803 // Characteristic
+
+/**
+ * GATT Descriptors
+ */
+#define GATT_CHAR_EXT_PROPS_UUID                   0x2900 // Characteristic Extended Properties
+#define GATT_CHAR_USER_DESC_UUID                   0x2901 // Characteristic User Description
+#define GATT_CLIENT_CHAR_CFG_UUID                  0x2902 // Client Characteristic Configuration
+#define GATT_SERV_CHAR_CFG_UUID                    0x2903 // Server Characteristic Configuration
+#define GATT_CHAR_FORMAT_UUID                      0x2904 // Characteristic Presentation Format
+#define GATT_CHAR_AGG_FORMAT_UUID                  0x2905 // Characteristic Aggregate Format
+#define GATT_VALID_RANGE_UUID                      0x2906 // Valid Range
+#define GATT_EXT_REPORT_REF_UUID                   0x2907 // External Report Reference Descriptor
+#define GATT_REPORT_REF_UUID                       0x2908 // Report Reference Descriptor
+
+/**
+ * GATT Characteristics
+ */
+#define GATT_DEVICE_NAME_UUID                           0x2A00 // Device Name
+#define GATT_APPEARANCE_UUID                            0x2A01 // Appearance
+#define GATT_PERI_PRIVACY_FLAG_UUID                     0x2A02 // Peripheral Privacy Flag
+#define GATT_RECONNECT_ADDR_UUID                        0x2A03 // Reconnection Address
+#define GATT_PERI_CONN_PARAM_UUID                       0x2A04 // Peripheral Preferred Connection Parameters
+#define GATT_SERVICE_CHANGED_UUID                       0x2A05 // Service Changed
+#define GATT_ADDR_RESOL_SUPP                            0x2AA6 // Central Address Resolution supported
+#define GATT_RSLV_PRIV_ADDR_ONLY                        0x2AC9 // Resolvable Private Address only
+
+/*
+ * WARNING: The 16-bit UUIDs are assigned by the Bluetooth SIG and published
+ *          in the Bluetooth Assigned Numbers page. Do not change these values.
+ *          Changing them will cause Bluetooth interoperability issues.
+ */
+
+/**
+ * GATT Service UUIDs
+ */
+#define IMMEDIATE_ALERT_SERV_UUID       0x1802  // Immediate Alert
+#define LINK_LOSS_SERV_UUID             0x1803  // Link Loss
+#define TX_PWR_LEVEL_SERV_UUID          0x1804  // Tx Power
+#define CURRENT_TIME_SERV_UUID          0x1805  // Current Time Service
+#define REF_TIME_UPDATE_SERV_UUID       0x1806  // Reference Time Update Service
+#define NEXT_DST_CHANGE_SERV_UUID       0x1807  // Next DST Change Service
+#define GLUCOSE_SERV_UUID               0x1808  // Glucose
+#define THERMOMETER_SERV_UUID           0x1809  // Health Thermometer
+#define DEVINFO_SERV_UUID               0x180A  // Device Information
+#define NWA_SERV_UUID                   0x180B  // Network Availability
+#define HEARTRATE_SERV_UUID             0x180D  // Heart Rate
+#define PHONE_ALERT_STS_SERV_UUID       0x180E  // Phone Alert Status Service
+#define BATT_SERV_UUID                  0x180F  // Battery Service
+#define BLOODPRESSURE_SERV_UUID         0x1810  // Blood Pressure
+#define ALERT_NOTIF_SERV_UUID           0x1811  // Alert Notification Service
+#define HID_SERV_UUID                   0x1812  // Human Interface Device
+#define SCAN_PARAM_SERV_UUID            0x1813  // Scan Parameters
+#define RSC_SERV_UUID                   0x1814  // Running Speed and Cadence
+#define CSC_SERV_UUID                   0x1816  // Cycling Speed and Cadence
+#define CYCPWR_SERV_UUID                0x1818  // Cycling Power
+#define LOC_NAV_SERV_UUID               0x1819  // Location and Navigation
+#define FITMACHINE_SERV_UUID            0x1826  // Fitmachine
+
+/**
+ * GATT Characteristic UUIDs
+ */
+#define ALERT_LEVEL_UUID                0x2A06  // Alert Level
+#define TX_PWR_LEVEL_UUID               0x2A07  // Tx Power Level
+#define DATE_TIME_UUID                  0x2A08  // Date Time
+#define DAY_OF_WEEK_UUID                0x2A09  // Day of Week
+#define DAY_DATE_TIME_UUID              0x2A0A  // Day Date Time
+#define EXACT_TIME_256_UUID             0x2A0C  // Exact Time 256
+#define DST_OFFSET_UUID                 0x2A0D  // DST Offset
+#define TIME_ZONE_UUID                  0x2A0E  // Time Zone
+#define LOCAL_TIME_INFO_UUID            0x2A0F  // Local Time Information
+#define TIME_WITH_DST_UUID              0x2A11  // Time with DST
+#define TIME_ACCURACY_UUID              0x2A12  // Time Accuracy
+#define TIME_SOURCE_UUID                0x2A13  // Time Source
+#define REF_TIME_INFO_UUID              0x2A14  // Reference Time Information
+#define TIME_UPDATE_CTRL_PT_UUID        0x2A16  // Time Update Control Point
+#define TIME_UPDATE_STATE_UUID          0x2A17  // Time Update State
+#define GLUCOSE_MEAS_UUID               0x2A18  // Glucose Measurement
+#define BATT_LEVEL_UUID                 0x2A19  // Battery Level
+#define TEMP_MEAS_UUID                  0x2A1C  // Temperature Measurement
+#define TEMP_TYPE_UUID                  0x2A1D  // Temperature Type
+#define IMEDIATE_TEMP_UUID              0x2A1E  // Intermediate Temperature
+#define MEAS_INTERVAL_UUID              0x2A21  // Measurement Interval
+#define BOOT_KEY_INPUT_UUID             0x2A22  // Boot Keyboard Input Report
+#define SYSTEM_ID_UUID                  0x2A23  // System ID
+#define MODEL_NUMBER_UUID               0x2A24  // Model Number String
+#define SERIAL_NUMBER_UUID              0x2A25  // Serial Number String
+#define FIRMWARE_REV_UUID               0x2A26  // Firmware Revision String
+#define HARDWARE_REV_UUID               0x2A27  // Hardware Revision String
+#define SOFTWARE_REV_UUID               0x2A28  // Software Revision String
+#define MANUFACTURER_NAME_UUID          0x2A29  // Manufacturer Name String
+#define IEEE_11073_CERT_DATA_UUID       0x2A2A  // IEEE 11073-20601 Regulatory Certification Data List
+#define CURRENT_TIME_UUID               0x2A2B  // Current Time
+#define SCAN_REFRESH_UUID               0x2A31  // Scan Refresh
+#define BOOT_KEY_OUTPUT_UUID            0x2A32  // Boot Keyboard Output Report
+#define BOOT_MOUSE_INPUT_UUID           0x2A33  // Boot Mouse Input Report
+#define GLUCOSE_CONTEXT_UUID            0x2A34  // Glucose Measurement Context
+#define BLOODPRESSURE_MEAS_UUID         0x2A35  // Blood Pressure Measurement
+#define IMEDIATE_CUFF_PRESSURE_UUID     0x2A36  // Intermediate Cuff Pressure
+#define HEARTRATE_MEAS_UUID             0x2A37  // Heart Rate Measurement
+#define BODY_SENSOR_LOC_UUID            0x2A38  // Body Sensor Location
+#define HEARTRATE_CTRL_PT_UUID          0x2A39  // Heart Rate Control Point
+#define NETWORK_AVAIL_UUID              0x2A3E  // Network Availability
+#define ALERT_STATUS_UUID               0x2A3F  // Alert Status
+#define RINGER_CTRL_PT_UUID             0x2A40  // Ringer Control Point
+#define RINGER_SETTING_UUID             0x2A41  // Ringer Setting
+#define ALERT_CAT_ID_BMASK_UUID         0x2A42  // Alert Category ID Bit Mask
+#define ALERT_CAT_ID_UUID               0x2A43  // Alert Category ID
+#define ALERT_NOTIF_CTRL_PT_UUID        0x2A44  // Alert Notification Control Point
+#define UNREAD_ALERT_STATUS_UUID        0x2A45  // Unread Alert Status
+#define NEW_ALERT_UUID                  0x2A46  // New Alert
+#define SUP_NEW_ALERT_CAT_UUID          0x2A47  // Supported New Alert Category
+#define SUP_UNREAD_ALERT_CAT_UUID       0x2A48  // Supported Unread Alert Category
+#define BLOODPRESSURE_FEATURE_UUID      0x2A49  // Blood Pressure Feature
+#define HID_INFORMATION_UUID            0x2A4A  // HID Information
+#define REPORT_MAP_UUID                 0x2A4B  // Report Map
+#define HID_CTRL_PT_UUID                0x2A4C  // HID Control Point
+#define REPORT_UUID                     0x2A4D  // Report
+#define PROTOCOL_MODE_UUID              0x2A4E  // Protocol Mode
+#define SCAN_INTERVAL_WINDOW_UUID       0x2A4F  // Scan Interval Window
+#define PNP_ID_UUID                     0x2A50  // PnP ID
+#define GLUCOSE_FEATURE_UUID            0x2A51  // Glucose Feature
+#define RECORD_CTRL_PT_UUID             0x2A52  // Record Access Control Point
+#define RSC_MEAS_UUID                   0x2A53  // RSC Measurement
+#define RSC_FEATURE_UUID                0x2A54  // RSC Feature
+#define SC_CTRL_PT_UUID                 0x2A55  // SC Control Point
+#define CSC_MEAS_UUID                   0x2A5B  // CSC Measurement
+#define CSC_FEATURE_UUID                0x2A5C  // CSC Feature
+#define SENSOR_LOC_UUID                 0x2A5D  // Sensor Location
+#define CYCPWR_MEAS_UUID                0x2A63  // Cycling Power Measurement
+#define CYCPWR_VECTOR_UUID              0x2A64  // Cycling Power Vector
+#define CYCPWR_FEATURE_UUID             0x2A65  // Cycling Power Feature
+#define CYCPWR_CTRL_PT_UUID             0x2A66  // Cycling Power Control Point
+#define LOC_SPEED_UUID                  0x2A67  // Location and Speed
+#define NAV_UUID                        0x2A68  // Navigation
+#define POS_QUALITY_UUID                0x2A69  // Position Quality
+#define LN_FEATURE_UUID                 0x2A6A  // LN Feature
+#define LN_CTRL_PT_UUID                 0x2A6B  // LN Control Point  
+
+#define GATT_UUID_FITNESS_MACHINE_FEATURE           0x2ACC
+#define GATT_UUID_TREADMILL_DATA                    0x2ACD //跑步机数据
+#define GATT_UUID_CROSS_TRAINER_DATA                0x2ACE //椭圆机数据
+#define GATT_UUID_ROWER_DATA                        0x2AD1 //划船机数据
+#define GATT_UUID_INDOOR_BIKE_DATA                  0x2AD2 //单车数据
+#define GATT_UUID_STEP_CLIMBER_DATA                 0x2ACF //攀岩机
+#define GATT_UUID_STAIR_CLIMBER_DATA                0x2AD0  //爬楼梯机
+
+#define GATT_UUID_TRAINING_STATUS                   0x2AD3
+#define GATT_UUID_SUPPORT_SPEED_RANGE               0x2AD4
+#define GATT_UUID_SUPPORT_INCLINATION_RANGE         0x2AD5
+#define GATT_UUID_SUPPORT_RESISTANCE_LEVEL_RANGE    0x2AD6
+#define GATT_UUID_SUPPORT_HEART_RATE_RANGE          0x2AD7
+#define GATT_UUID_SUPPORT_POWER_RANGE               0x2AD8
+#define GATT_UUID_FITNESS_MACHINE_CONTROL_POINT     0x2AD9
+#define GATT_UUID_FITNESS_MACHINE_STATUS            0x2ADA
+
+/**
+ * GATT Unit UUIDs
+ */
+#define GATT_UNITLESS_UUID                    0x2700  // <Symbol>, <Expressed in terms of SI base units>
+#define GATT_UNIT_LENGTH_METER_UUID           0x2701  // m, m
+#define GATT_UNIT_MASS_KGRAM_UUID             0x2702  // kg, kg
+#define GATT_UNIT_TIME_SECOND_UUID            0x2703  // s, s
+#define GATT_UNIT_ELECTRIC_CURRENT_A_UUID     0x2704  // A, A
+#define GATT_UNIT_THERMODYN_TEMP_K_UUID       0x2705  // K, K
+#define GATT_UNIT_AMOUNT_SUBSTANCE_M_UUID     0x2706  // mol, mol
+#define GATT_UNIT_LUMINOUS_INTENSITY_C_UUID   0x2707  // cd, cd
+
+#define GATT_UNIT_AREA_SQ_MTR_UUID            0x2710  // m^2, m^2
+#define GATT_UNIT_VOLUME_CUBIC_MTR_UUID       0x2711  // m^3, m^3
+#define GATT_UNIT_VELOCITY_MPS_UUID           0x2712  // m/s, m s^-1
+#define GATT_UNIT_ACCELERATION_MPS_SQ_UUID    0x2713  // m/s^2, m s^-2
+#define GATT_UNIT_WAVENUMBER_RM_UUID          0x2714  // ? m^-1
+#define GATT_UNIT_DENSITY_KGPCM_UUID          0x2715  // p, kg m^-3
+#define GATT_UNIT_SURFACE_DENSITY_KGPSM_UUID  0x2716  // pA, kg m^-2
+#define GATT_UNIT_SPECIFIC_VOLUME_CMPKG_UUID  0x2717  // v, m^3 kg^-1
+#define GATT_UNIT_CURRENT_DENSITY_APSM_UUID   0x2718  // j, A m^-2
+#define GATT_UNIT_MAG_FIELD_STRENGTH_UUID     0x2719  // H, A m
+#define GATT_UNIT_AMOUNT_CONC_MPCM_UUID       0x271A  // c, mol m^-3
+#define GATT_UNIT_MASS_CONC_KGPCM_UUID        0x271B  // c, kg m^-3
+#define GATT_UNIT_LUMINANCE_CPSM_UUID         0x271C  // Lv, cd m^-2
+#define GATT_UNIT_REFRACTIVE_INDEX_UUID       0x271D  // n, 1
+#define GATT_UNIT_RELATIVE_PERMEABLILTY_UUID  0x271E  // u, 1
+#define GATT_UNIT_PLANE_ANGLE_RAD_UUID        0x2720  // rad, m m-1
+#define GATT_UNIT_SOLID_ANGLE_STERAD_UUID     0x2721  // sr, m2 m-2
+#define GATT_UNIT_FREQUENCY_HTZ_UUID          0x2722  // Hz, s-1
+#define GATT_UNIT_FORCE_NEWTON_UUID           0x2723  // N, m kg s-2
+#define GATT_UNIT_PRESSURE_PASCAL_UUID        0x2724  // Pa, N/m2 = m2 kg s-2
+#define GATT_UNIT_ENERGY_JOULE_UUID           0x2725  // J, N m = m2 kg s-2
+#define GATT_UNIT_POWER_WATT_UUID             0x2726  // W, J/s = m2 kg s-3
+#define GATT_UNIT_E_CHARGE_C_UUID             0x2727  // C, sA
+#define GATT_UNIT_E_POTENTIAL_DIF_V_UUID      0x2728  // V, W/A = m2 kg s-3 A-1
+
+#define GATT_UNIT_CELSIUS_TEMP_DC_UUID        0x272F  // oC, t/oC = T/K - 273.15
+
+#define GATT_UNIT_TIME_MINUTE_UUID            0x2760  // min, 60 s
+#define GATT_UNIT_TIME_HOUR_UUID              0x2761  // h, 3600 s
+#define GATT_UNIT_TIME_DAY_UUID               0x2762  // d, 86400 s
+#define GATT_UNIT_PLANE_ANGLE_DEGREE_UUID     0x2763  // o, (pi/180) rad
+#define GATT_UNIT_PLANE_ANGLE_MINUTE_UUID     0x2764  // ', (pi/10800) rad
+#define GATT_UNIT_PLANE_ANGLE_SECOND_UUID     0x2765  // '', (pi/648000) rad
+#define GATT_UNIT_AREA_HECTARE_UUID           0x2766  // ha, 10^4 m^2
+#define GATT_UNIT_VOLUME_LITRE_UUID           0x2767  // l, 10^-3 m^3
+#define GATT_UNIT_MASS_TONNE_UUID             0x2768  // t, 10^3 kg
+
+#define GATT_UINT_LENGTH_YARD_UUID            0x27A0  // yd, 0.9144 m
+#define GATT_UNIT_LENGTH_PARSEC_UUID          0x27A1  // pc, 3.085678 ?1016 m
+#define GATT_UNIT_LENGTH_INCH_UUID            0x27A2  // in, 0.0254 m
+#define GATT_UNIT_LENGTH_FOOT_UUID            0x27A3  // ft, 0.3048 m
+#define GATT_UNIT_LENGTH_MILE_UUID            0x27A4  // mi, 1609.347 m
+#define GATT_UNIT_PRESSURE_PFPSI_UUID         0x27A5  // psi, 6.894757 ?103 Pa
+#define GATT_UNIT_VELOCITY_KMPH_UUID          0x27A6  // km/h, 0.2777778 m^s-1
+#define GATT_UNIT_VELOCITY_MPH_UUID           0x27A7  // mi/h, 0.44704 m^ s-1
+#define GATT_UNIT_ANGULAR_VELOCITY_RPM_UUID   0x27A8  // r/min, 0.1047198 rad s-1
+#define GATT_UNIT_ENERGY_GCAL_UUID            0x27A9  //
+#define GATT_UNIT_ENERGY_KCAL_UUID            0x27AA  // kcal, 4190.02 J
+#define GATT_UNIT_ENERGY_KWH_UUID             0x27AB  // kWh, 3600000 J
+#define GATT_UNIT_THERMODYN_TEMP_DF_UUID      0x27AC  // oF, t/oF = T/K ?1.8 - 459.67
+#define GATT_UNIT_PERCENTAGE_UUID             0x27AD  // %
+#define GATT_UNIT_PER_MILE_UUID               0x27AE  //
+#define GATT_UNIT_PERIOD_BPM_UUID             0x27AF  //
+#define GATT_UNIT_E_CHARGE_AH_UUID            0x27B0  //
+#define GATT_UNIT_MASS_DENSITY_MGPD_UUID      0x27B1  //
+#define GATT_UNIT_MASS_DENSITY_MMPL_UUID      0x27B2  //
+#define GATT_UNIT_TIME_YEAR_UUID              0x27B3  //
+#define GATT_UNIT_TIME_MONTH_UUID             0x27B4  //
+
+
+
+
+
+
+
+
+#endif
Index: ModuleDemo/BlueTooth/BT_BLE/user/bt_config.h
===================================================================
--- /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/user/bt_config.h	(nonexistent)
+++ /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/user/bt_config.h	(working copy)
@@ -0,0 +1,111 @@
+/*
+File Name    : yc3121.h
+Author       : Yichip
+Version      : V1.0
+Date         : 2022/05/23
+Description  : BT information.
+*/
+
+#ifndef __BT_CONFIG_H_
+#define __BT_CONFIG_H_
+#include "type.h"
+
+/**************************蓝牙使能***************************/
+#define DEVICE_BLE_ENABLE         0x01
+#define DEVICE_BT_ENABLE          0x02
+#define BLE_HID_SERVICE_ENABLE    0x04
+#define BLE_USER_SERVICE_ENABLE   0x08
+#define FUNC_DEVICE_BT            (DEVICE_BLE_ENABLE | BLE_USER_SERVICE_ENABLE)
+
+
+/**************************蓝牙设备类型***************************/
+static const uint8_t bt_cod_const[3] = {0x24,0x04,0x04};
+
+/**************************蓝牙MTU***************************/
+#define BLE_LOCAL_MTU 185
+
+/**************************蓝牙设备名***************************/
+#define BLE_DEVICE_NAME    "3xble"
+#define BT_DEVICE_NAME     "3xbt"
+static const uint8_t ble_device_name_const[6] = BLE_DEVICE_NAME;
+static const uint8_t bt_device_name_const[5] =  BT_DEVICE_NAME;
+
+/**************************蓝牙Mac地址***************************/
+static const uint8_t ble_device_mac_const[6] = {0x11,0x11,0x11,0x44,0x22,0x10};   //0x102244000000
+static const uint8_t bt_device_mac_const[6] =  {0x22,0x22,0x22,0x33,0x22,0x10};   //0x102233000000
+
+/**************************蓝牙PINCODE***************************/
+#define BLE_RANDOM_PINCODE_VALUE     0x00
+#define BLE_FIXED_PINCODE_VALUE      0x01
+static const int ble_pincode_const = {123456};
+
+/**************************蓝牙连接参数***************************/
+static const uint8_t ble_conn_param_const[8] = 
+{
+    0x06, 0x00,         //minimum connection interval. unit: 1.25ms
+    0x0c, 0x00,         //maximum connection interval, in normal case can be set same as min_intv. unit: 1.25ms
+    0x00, 0x00,         //slave latency, number of connection events that slave would like to skip.
+    0x2c, 0x01          //timeout before connection is dropped. unit: 10ms
+};
+
+static const uint8_t ble_ota_conn_param_const[8] = 
+{
+    0x06, 0x00,         //minimum connection interval. unit: 1.25ms
+    0x06, 0x00,         //maximum connection interval, in normal case can be set same as min_intv. unit: 1.25ms
+    0x2b, 0x01,         //slave latency, number of connection events that slave would like to skip.
+    0xb0, 0x04          //timeout before connection is dropped. unit: 10ms
+};
+
+/**************************ADV数据包***************************/
+#define BLE_ADV_DATA_LEN_MAX    31
+#define BLE_SCAN_RSP_LEN_MAX    31
+
+#if ((FUNC_DEVICE_BT & BLE_HID_SERVICE_ENABLE) == BLE_HID_SERVICE_ENABLE)
+
+#define BLE_ADV_DATA_INDEX    13
+#define BLE_SCAN_RSP_INDEX    13
+
+#else
+
+#define BLE_ADV_DATA_INDEX    3
+#define BLE_SCAN_RSP_INDEX    3
+
+#endif
+
+static const uint8_t ble_adv_data_const[BLE_ADV_DATA_LEN_MAX] =
+{
+#if ((FUNC_DEVICE_BT & BLE_HID_SERVICE_ENABLE) == BLE_HID_SERVICE_ENABLE)
+    0x02, 0x01, 0x06,       //flag
+    0x03, 0x19, 0xc2, 0x03,   //appearance
+    0x05, 0x02, 0x12, 0x18, 0xF0, 0xFF,  //service uuid
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+#else
+    0x02, 0x01, 0x06,       //flag
+    0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+#endif
+};
+
+/**************************扫描响应包***************************/
+static const uint8_t ble_scan_rsp_const[BLE_SCAN_RSP_LEN_MAX] =
+{
+#if ((FUNC_DEVICE_BT & BLE_HID_SERVICE_ENABLE) == BLE_HID_SERVICE_ENABLE)
+    0x02, 0x01, 0x06,       //flag
+    0x03, 0x19, 0xc2, 0x03,   //appearance
+    0x05, 0x02, 0x12, 0x18, 0xF0, 0xFF,  //service uuid
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+#else
+    0x02, 0x01, 0x06,       //flag
+    0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+#endif
+};
+
+
+#endif
Index: ModuleDemo/BlueTooth/BT_BLE/user/main.c
===================================================================
--- /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/user/main.c	(revision 950)
+++ /YC3121_demo/ModuleDemo/BlueTooth/BT_BLE/user/main.c	(working copy)
@@ -30,6 +30,7 @@
 #include "yc_qspi.h"
 #include "yc_ipc.h"
 #include "board_config.h"
+#include "app_ble_gatt.h"
 
 /* Private typedef -----------------------------------------------------------*/
 /* Private define ------------------------------------------------------------*/
@@ -42,28 +43,6 @@
 /* Private function prototypes -----------------------------------------------*/
 void UART_Configuration(void);
 
-
-
-// byte0： uuid length
-//byte1-16: uuid
-// 49535343-FE78-4AE5-8FA9-9FAFD205E455
-uint8_t ble_service_uuid_lsps[] = {0x10,0x55,0xe4,0x05,0xd2,0xaf,0x9f,0xa9,0x8f,0xe5,0x4a,0x7d,0xfe,0x43,0x53,0x53,0x49};
-
-/*
-byte0: characterisitic
-byte1:characterisitic uuid length
-byte2-17:characterisitic uuid
-byte18:write/read payload length
-byte19-20:write/read payload
-*/
-//49535343-1E4D-4BD9-BA61-23C647249616
-uint8_t ble_Characteristic_uuid_lsps_tx[] = {0x10,0x10,0x16,0x96,0x24,0x47,0xc6,0x23,0x61,0xba,0xd9,0x4b,0x4d,0x1e,0x43,0x53,0x53,0x49,0x01,0x00};
-//49535343-8841-43F4-A8D4-ECBE34729BB3
-uint8_t ble_Characteristic_uuid_lsps_rx[] = {0x0c,0x10,0xb3,0x9b,0x72,0x34,0xbe,0xec,0xd4,0xa8,0xf4,0x43,0x41,0x88,0x43,0x53,0x53,0x49,0x01,0x00};
-//49535343-aca3-481c-91ec-d85e28a60318
-uint8_t ble_Characteristic_uuid_flow_ctrl[] = {0x18,0x10,0x18,0x03,0xa6,0x28,0x5e,0xd8,0xec,0x91,0x1c,0x48,0xa3,0xac,0x43,0x53,0x53,0x49,0x01,0x00};
-
-
 #define IFLASH_NVRAM_ADDR 0x1000000+((512-4)*1024)
 #define NVRAM_LEN 170//Nvram 长度170bytes,每组Nvram长度为34bytes,最多可存储5组配对信息
 
@@ -213,40 +192,7 @@
 	else
 		MyPrintf("set COD failed\n");
 
-	if(BT_SetLpmMode(0x00) == TRUE) //设置低功耗模式
-		MyPrintf("set lpm mode sucess\n");
-	else
-		MyPrintf("set lpm mode failed\n");
-
-
-	if(BT_DeleteService() == TRUE) //  删除用户自定义服务
-		MyPrintf("delete service sucess\n");
-	else
-		MyPrintf("delete service failed\n");
-
-	temp_handle=BT_AddBleService(ble_service_uuid_lsps,sizeof(ble_service_uuid_lsps));
-	if( temp_handle!= 0)  //增加服务 返回handle无需保存
-		MyPrintf("add service sucess,handle=%04x\n",temp_handle);
-	else
-		MyPrintf("add service failed,return=%04x\n",temp_handle);
-
-	ble_send_handle=BT_AddBleCharacteristic(ble_Characteristic_uuid_lsps_tx,sizeof(ble_Characteristic_uuid_lsps_tx));
-	if( ble_send_handle!= 0)  //增加服务特征  write返回的handle需要保存，发数据使用
-		MyPrintf("add Characteristic tx sucess,handle=%04x\n",ble_send_handle);
-	else
-		MyPrintf("add Characteristic tx failed,return=%04x\n",ble_send_handle);
-
-	temp_handle=BT_AddBleCharacteristic(ble_Characteristic_uuid_lsps_rx,sizeof(ble_Characteristic_uuid_lsps_rx));
-	if( temp_handle!= 0)
-		MyPrintf("add Characteristic rx sucess;handle=%04x\n",temp_handle);
-	else
-		MyPrintf("add Characteristic rx failed,return=%04x\n",temp_handle);
-
-	temp_handle=BT_AddBleCharacteristic(ble_Characteristic_uuid_flow_ctrl,sizeof(ble_Characteristic_uuid_flow_ctrl));
-	if( temp_handle!= 0)
-		MyPrintf("add Characteristic flow_ctrl sucess;handle=%04x\n",temp_handle);
-	else
-		MyPrintf("add Characteristic flow_ctrl failed,return=%04x\n",temp_handle);
+    bleGattServiceInit();       //设置服务
 
     genBleAdvData(bt_name,sizeof(bt_name)-1,bt_addr,ble_adv_data);
     if(BT_SetLEAdvData(ble_adv_data,sizeof(ble_adv_data)) == TRUE)
@@ -393,9 +339,6 @@
 					for(int i=0;i<(BleDataLen-2);i++)	MyPrintf("%02x ",bleData[2+i]);
 					MyPrintf("\n");
 
-					//add handle
-					bleData[0]=(ble_send_handle&0xff);
-					bleData[1]=((ble_send_handle>>8)&0xff);
 					BT_SendBleData(bleData,BleDataLen);
 					MyPrintf("send %d bytes ble data[%02x %02x]:\n",BleDataLen-2,bleData[0],bleData[1]);
 					for(int i=0;i<(BleDataLen-2);i++)	MyPrintf("%02x ",bleData[2+i]);
