BLE fota Robot Demo

Dependencies:   mbed-rtos mbed mbed_fota_fan_control

Fork of mbed_fota_lamp_control by KIM HyoengJun

Revision:
13:e714e2971c49
Parent:
12:e3d3676753cc
--- a/dialog_fota/app.cpp	Wed Sep 02 07:44:29 2015 +0000
+++ b/dialog_fota/app.cpp	Tue Oct 13 06:35:19 2015 +0000
@@ -13,6 +13,8 @@
 #include "diss_task.h"
 #include "fota_server_task.h"
 #include "fan_control_task.h"
+#include "lamp_control_task.h"
+
 
 namespace sevencore_fota{
 /**
@@ -119,6 +121,26 @@
 }
 /**
  ****************************************************************************************
+ * @brief Send enable request to Lamp Control profile task.
+ * @param[in] BMH     Ble Message Handler class reference
+ * @return void.
+ ****************************************************************************************
+ */
+void app_lamp_control_db_create(BleMsgHandler* BMH)
+{
+    uint8_t *msg;
+    // Add fan_control service table in the database
+    struct lamp_control_create_db_req req;
+    unsigned short msg_size = 1 + sizeof(ble_hdr) + sizeof(struct lamp_control_create_db_req);
+    req.features = 0x000F;
+    
+    msg = new uint8_t[msg_size];
+    
+    BMH->BleMsgAlloc(LAMP_CONTROL_CREATE_DB_REQ,TASK_LAMP_CONTROL, TASK_GTL,sizeof(struct lamp_control_create_db_req),&req,msg);
+    BMH->BleSendMsg(msg,msg_size);
+}
+/**
+ ****************************************************************************************
  * @brief Send Start Advertising command to GAPM task.
  * @param[in] BMH     Ble Message Handler class reference
  * @return void.
@@ -335,6 +357,28 @@
 }
 /**
  ****************************************************************************************
+ * @brief Send enable request to lamp_control profile task.
+ * @param[in] device  Ble device info
+ * @param[in] BMH     Ble Message Handler class reference
+ * @return void.
+ ****************************************************************************************
+ */
+void app_lamp_control_enable(ble_dev *device,BleMsgHandler* BMH)
+{
+    uint8_t *msg;
+    struct lamp_control_enable_req req;
+    unsigned short msg_size = 1 + sizeof(ble_hdr) + sizeof(struct lamp_control_enable_req);
+    req.conhdl = device->conhdl;
+    req.sec_lvl = 1;
+    
+    msg = new uint8_t[msg_size];
+
+    // Send the message
+    BMH->BleMsgAlloc(LAMP_CONTROL_ENABLE_REQ, TASK_LAMP_CONTROL, TASK_GTL,sizeof(struct lamp_control_enable_req),&req,msg);
+    BMH->BleSendMsg(msg,msg_size);
+}
+/**
+ ****************************************************************************************
  * @brief Send connection confirmation.
  * param[in] auth  Authentication requirements.
  * @param[in] device  Ble device info