static const int SYSTEM_TYPE_MUSIC = 3;
static const int SYSTEM_TYPE_OTHER = 4;
static const double DEFAULT_COORDINATE = -200.0;
-static const int SOURCE_PATH_LENGTH = 200;
// For extern declaration in FCntTypes.h
const wchar_t OSP_HOME[] = L"/Home/";
static void
OnScanCompleted(media_content_error_e error, void* user_data)
{
- ClearLastResult();
-
SysLog(NID_CNT, "OnScanCompleted callback method is called.");
- if (user_data == null)
- {
- SysLog(NID_CNT, "OnScanCompleted failed.");
- return;
- }
+ ClearLastResult();
+ result r = E_SUCCESS;
+ String scanPath(L"");
+ IContentScanListener* pListener = null;
+ RequestId reqId;
+ unique_ptr< ScanResult > pScanResult;
- unique_ptr< ScanResult > pScanResult(static_cast< ScanResult* >(user_data));
+ SysTryLogCatch(NID_CNT, user_data != null, , "OnScanCompleted failed.");
- if (pScanResult == null || pScanResult->pScanPath == null || pScanResult->pScanListener == null)
- {
- SysLog(NID_CNT, "OnScanCompleted failed.");
- return;
- }
+ pScanResult = unique_ptr< ScanResult >(static_cast< ScanResult* >(user_data));
+
+ SysTryLogCatch(NID_CNT, pScanResult != null && pScanResult->pScanPath != null, , "OnScanCompleted failed.");
+ SysTryLogCatch(NID_CNT, pScanResult->pScanListener != null, , "Listener is null. OnScanCompleted succeeded.");
- String scanPath(pScanResult->pScanPath);
- IContentScanListener* pListener = pScanResult->pScanListener;
- RequestId reqId = pScanResult->requestId;
+ scanPath = pScanResult->pScanPath;
+ pListener = pScanResult->pScanListener;
+ reqId = pScanResult->requestId;
- result r = ConvertError(error);
+ r = ConvertError(error);
pListener->OnContentScanCompleted(reqId, scanPath, r);
+ SysLog(NID_CNT, "OnContentScanCompleted fired.");
+CATCH:
int val = media_content_disconnect();
SysTryLog(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, "The disconnection failed[%d].", val);
-
- SysLog(NID_CNT, "Fire the OnContentScanCompleted method.");
}
static void
SysLog(NID_CNT, "The scan path is [%ls].", directoryPath.GetPointer());
- SysTryReturnResult(NID_CNT, pListener != null, E_INVALID_ARG, "Failed to ScanDirectory method.");
-
unique_ptr<char[]> pDirPath(_StringConverter::CopyToCharArrayN(directoryPath));
SysTryReturnResult(NID_CNT, (pDirPath.get())[0] != null, E_SYSTEM, "pDirPath is NULL.");