Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos mbed mbed_fota_fan_control
Fork of mbed_fota_lamp_control by
Diff: ext_fota/SerialManager.cpp
- Revision:
- 9:fcf91f563147
- Parent:
- 6:8dd20294b2aa
--- a/ext_fota/SerialManager.cpp Thu Aug 20 05:16:55 2015 +0000
+++ b/ext_fota/SerialManager.cpp Mon Aug 24 02:29:16 2015 +0000
@@ -1,8 +1,29 @@
+/**
+ * @file SerialManager.cpp
+ * @brief Serial Communication Management
+ * Copyright 2015 SEVENCORE Co., Ltd.
+ *
+ * @author HyeongJun Kim
+ * @version 1.0.0
+ * @date 2015-08-19
+*/
#include "SerialManager.h"
-
+/**
+ ****************************************************************************************
+ * @addtogroup ext_fota module
+ * @brief Serial Manager Class Method Definition.
+ *
+ * @{
+ ****************************************************************************************
+ */
namespace sevencore_fota{
-
+/**
+ ****************************************************************************************
+ * @brief Serial Manager constructor only connected Device.
+ * @param[in] mbed serial class reference to device.
+ ****************************************************************************************
+ */
SerialManager::SerialManager(Serial *_device)
{
print_flag = 0;
@@ -15,7 +36,13 @@
bHdrBytesRead = 0;
memset(bReceiveElementArr,0,512);
}
-
+/**
+ ****************************************************************************************
+ * @brief Serial Manager constructor with connected Device & HostPC.
+ * @param[in] mbed serial class reference to device.
+ * @param[in] mbed serial class reference to hostpc.
+ ****************************************************************************************
+ */
SerialManager::SerialManager(Serial *_device, Serial *_hostpc)
{
print_flag = 1;
@@ -30,17 +57,31 @@
memset(bReceiveElementArr,0,512);
PrintSerialManager();
}
-
+/**
+ ****************************************************************************************
+ * @brief Serial Manager destructor.
+ ****************************************************************************************
+ */
SerialManager::~SerialManager(void)
{
}
-
+/**
+ ****************************************************************************************
+ * @brief Serial Manager Start title print function.
+ ****************************************************************************************
+ */
void SerialManager::PrintSerialManager(void)
{
if(print_flag == 1)
hostpc->printf("\nSerialManager Start!!\n");
}
-
+/**
+ ****************************************************************************************
+ * @brief Send ble message to serial port.
+ * @param[in] Sending data pointer.
+ * @param[in] Sending data size.
+ ****************************************************************************************
+ */
int SerialManager::SendToSerial(uint8_t *data,unsigned short size)
{
int cnt = 0;
@@ -59,8 +100,13 @@
}
return cnt;
}
-
-// return boolean : msg_size (receive complete) or -1 (receive not complete)
+/**
+ ****************************************************************************************
+ * @brief Receive ble message from serial port.
+ * @param[in] Storing data pointer.
+ * @return Boolean - msg_size (receive complete) or -1 (receive not complete)
+ ****************************************************************************************
+ */
int SerialManager::ReceiveToSerial(unsigned char *receive_msg)
{
int ret = -1;
@@ -158,7 +204,13 @@
return ret;
}
-
+/**
+ ****************************************************************************************
+ * @brief Receive data for size.
+ * @param[in] Storing data pointer.
+ * @param[in] transmision data size.
+ ****************************************************************************************
+ */
void SerialManager::DataReceive(uint8_t *databuf, unsigned short size)
{
int i;
@@ -168,7 +220,11 @@
databuf[i] = (uint8_t)device->getc();
}
}
-
+/**
+ ****************************************************************************************
+ * @brief Receive data test function.
+ ****************************************************************************************
+ */
void SerialManager::ReceiveToSerialTest(void)
{
unsigned char tmp;
@@ -213,3 +269,4 @@
}
}//namespace
+/// @} ext_fota module
