#include "CmCameraResourceManager.h"
#include "CmCameraThumbnailPanel.h"
#include "CmCameraInfoPanel.h"
+#include "CmUtility.h"
class BaseForm :
public Tizen::Ui::Controls::Form
void HideScreenOverlayHelp();
void OnHelpCloseTimerExpired(void);
bool CheckCallStatus(void);
+ void ShowMemoryFullPopup(void);
protected:
CameraPresentationModel* _pCameraPresentationModel;
#include <FSystem.h>
#include <FUi.h>
#include "CmTypes.h"
+#include "CmUtility.h"
class CameraPresentationModel;
class CameraSettingsPresentationModel;
private:
void OnRequestAppControlTest(void);
result OnRequestAppControl(void);
- long long GetAvailableMemory(void);
private:
RequestId __requestId;
#include <FUi.h>
#include "CmICameraEventListener.h"
#include "CmTypes.h"
+#include "CmUtility.h"
class CameraSettingsPresentationModel;
#include <FApp.h>
#include <FIo.h>
+#include <FBase.h>
#include <FMedia.h>
+#include <FSystem.h>
#include "CmTypes.h"
+#include "CmUtility.h"
class CameraSettingsPresentationModel
{
--- /dev/null
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.1 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file: MfUtility.h
+ * @brief: This file contains the declaration of MfUtility class, which is a common utility function class and
+ * contains helper functions which are used throughout the Application.
+ */
+
+#ifndef _CM_UTILITY_H_
+#define _CM_UTILITY_H_
+
+#include <FApp.h>
+#include <FBase.h>
+#include <FIo.h>
+#include <FSystem.h>
+
+class CmUtility
+{
+public:
+ static long long GetAvailableMemory(void);
+};
+
+#endif /* _CM_UTILITY_H_ */
AppLogDebug("Enter");
AppLogDebug("Exit");
}
+
+
+void
+BaseForm::ShowMemoryFullPopup(void)
+{
+ AppLogDebug("ENTER");
+ int modalResult = 0;
+ MessageBox msgBox;
+ AppResource* pAppResource = null;
+ String memoryLowTitle;
+ String memoryLowMessage;
+ result r = E_SUCCESS;
+
+ pAppResource = Application::GetInstance()->GetAppResource();
+ TryReturnVoid(pAppResource != null, "Failed to allocate memory for pAppResource");
+
+ pAppResource->GetString(L"IDS_LOW_MEMORY_MSG_TITLE", memoryLowTitle);
+ pAppResource->GetString(L"IDS_LOW_MEMORY_MSG", memoryLowMessage);
+
+
+ r = msgBox.Construct(memoryLowTitle, memoryLowMessage, MSGBOX_STYLE_NONE, MESSAGEBOX_DISPLAY_TIME_3_SEC);
+ TryReturnVoid(r == E_SUCCESS, "msgBox::Construct() failed by [%s]", GetErrorMessage(r));
+ msgBox.ShowAndWait(modalResult);
+
+ switch (modalResult)
+ {
+ case MSGBOX_RESULT_CLOSE:
+ {
+ AppLogDebug("MSGBOX_RESULT_CLOSE");
+ _pCameraPresentationModel->SetAppControlRequestType(CameraPresentationModel::APP_CONTROL_REQUEST_TYPE_FAILED);
+
+ r = TerminateApp();
+ AppLogDebug("TerminateApp fail [%s]", GetErrorMessage(r));
+ }
+ break;
+
+ default:
+ break;
+ }
+ AppLogDebug("EXIT");
+}
bool isInitCameraStaus = false;
bool isCharging = false;
+ int mem = 0;
BatteryLevel batteryLevel;
CameraApp* pCameraApp = static_cast<CameraApp*>(CameraApp::GetInstance());
_pCameraPresentationModel->SetStartPreviewException(false);
}
+ if(mem < MIN_MEMORY_NEEDED)
+ {
+ ShowMemoryFullPopup();
+ return;
+ }
+
batteryLevel = _pCameraPresentationModel->GetBatteryLevel();
isCharging = _pCameraPresentationModel->IsCharging();
int mode = 0;
NotificationManager notiMgr;
String errorMessage;
- String memoryLowTitle;
- String memoryLowMessage;
-
- MessageBox errorMsgBox;
- int badgeNumber = 0, modResult=0;
-
- long long mem = GetAvailableMemory();
- AppResource* pAppResource = null;
- pAppResource = Application::GetInstance()->GetAppResource();
-
- pAppResource->GetString(L"IDS_LOW_MEMORY_MSG_TITLE", memoryLowTitle);
- pAppResource->GetString(L"IDS_LOW_MEMORY_MSG", memoryLowMessage);
-
- AppLogDebug("%lld",mem);
- if(mem < MIN_MEMORY_NEEDED)
- {
- MessageBox LowMemory;
- String msg = L"";
- LowMemory.Construct(memoryLowTitle, memoryLowMessage, MSGBOX_STYLE_NONE,1000);
- int modalResult = 0;
- // Calls ShowAndWait() : Draws and Shows itself and processes events
- LowMemory.ShowAndWait(modalResult);
-
- if ( GetAppControlType() == APP_CONTROL_TYPE_REQUESET)
- {
- r = AppControlProviderManager::GetInstance()->SendAppControlResult(__requestId, APP_CTRL_RESULT_FAILED, null);
- AppLogDebug("Appcontrol result is %s",GetErrorMessage(r));
- }
-
- return false;
-
- }
+ CameraPresentationModel* pCameraPresentationModel = null;
MainFrame* pCameraAppFrame = new (std::nothrow) MainFrame();
r = pCameraAppFrame->Construct();
- CameraPresentationModel* pCameraPresentationModel = CameraPresentationModel::GetInstance();
- TryCatch(pCameraPresentationModel != null, r = GetLastResult(), "pCameraPresentationModel is null");
-
pCameraAppFrame->SetName(STRING_FRAME_NAME);
r = AddFrame(*pCameraAppFrame);
TryCatch(r == E_SUCCESS, , "UiApp::AddFrame() fail[%s]", GetErrorMessage(r));
+ pCameraPresentationModel = CameraPresentationModel::GetInstance();
+ TryCatch(pCameraPresentationModel != null, r = GetLastResult(), "pCameraPresentationModel is null");
+
r = pCameraPresentationModel->GetValue(CURRENT_MODE, mode);
AppLogDebug("Registry :GetvalueResult : %s", GetErrorMessage(r));
errorMessage =L"Camera can't launch due to unknown exception, try again!!!";
}
- TryCatch(r == E_SUCCESS, , "Read register GetValue() fail[%s]", GetErrorMessage(r));
r = pCameraAppFrame->Initialize(mode);
TryCatch(r == E_SUCCESS, , "MainFrame::Initialize() fail[%s]", GetErrorMessage(r));
return true;
CATCH:
- r = notiMgr.Construct();
- badgeNumber = notiMgr.GetBadgeNumber();
- badgeNumber++;
-
- notiMgr.Notify(errorMessage, 1);
-
- errorMsgBox.Construct(L"Camera launch failed", errorMessage, MSGBOX_STYLE_NONE, 3000);
- errorMsgBox.ShowAndWait(modResult);
if ( GetAppControlType() == APP_CONTROL_TYPE_REQUESET)
AppControlProviderManager::GetInstance()->SendAppControlResult(__requestId, APP_CTRL_RESULT_FAILED, null);
return switchEnabled;
AppLogDebug("Exit");
}
-
-long long
-CameraApp::GetAvailableMemory(void)
-{
- result r = E_SUCCESS;
-
- String key(L"http://tizen.org/runtime/storage.available.internal");
- long long allocatedMemory = 0;
-
- r = RuntimeInfo::GetValue(key, allocatedMemory);
- TryCatch(r == E_SUCCESS, , "MyRuntimeInfo: Failed to get value");
-
- return allocatedMemory;
-
- CATCH:
- return 0;
-}
bool isInitCameraStaus = false;
bool isCharging = false;
BatteryLevel batteryLevel = BATTERY_FULL;
+ int mem = 0;
__formStatusFrameDeattivated = false;
isCharging = _pCameraPresentationModel->IsCharging();
AppLogDebug("batteryLevel = %d", batteryLevel);
+
+ if(mem < MIN_MEMORY_NEEDED)
+ {
+ ShowMemoryFullPopup();
+ return;
+ }
if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY)
{
bool
CameraPresentationModel::GetMemoryFullExceptionStatus(void)
{
- String key(L"http://tizen.org/runtime/storage.available.internal");
long long allocatedMemory = 0;
bool memoryStatus = false;
- result r = E_SUCCESS;
- r = RuntimeInfo::GetValue(key, allocatedMemory);
- AppLogDebug("available memory is %lld",allocatedMemory);
+ allocatedMemory = CmUtility::GetAvailableMemory();
if (__memoryFullException && allocatedMemory < MIN_MEMORY_NEEDED)
{
using namespace Tizen::Io;
using namespace Tizen::Media;
using namespace Tizen::Graphics;
+using namespace Tizen::System;
static const int DEFAULT_VALUE_ZERO = 0;
static const int DEFAULT_VALUE_ONE = 1;
r = __pDefaultCameraRegistry->AddValue(SECTION_CAMCORDER, OVERLAY_HELP_ENABLE, DEFAULT_VALUE_ZERO);
TryCatch(r == E_SUCCESS, , "Registry::AddValue() failed[%s]", GetErrorMessage(r));
- r = __pDefaultCameraRegistry->Flush();
- TryCatch(r == E_SUCCESS, , "Registry::Flush() failed[%s]", GetErrorMessage(r));
-
+ if (!(CmUtility::GetAvailableMemory() < MIN_MEMORY_NEEDED))
+ {
+ r = __pDefaultCameraRegistry->Flush();
+ TryCatch(r == E_SUCCESS, , "Registry::Flush() failed[%s]", GetErrorMessage(r));
+ }
AppLogDebug("Exit");
return r;
--- /dev/null
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.1 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file: MfUtility.cpp
+ * @brief: This file contains the implementation of MfUtility class, which is a common utility function class and
+ * contains helper functions which are used throughout the Application.
+ */
+
+#include "CmUtility.h"
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::System;
+
+long long
+CmUtility::GetAvailableMemory(void)
+{
+ result r = E_SUCCESS;
+
+ String key(L"http://tizen.org/runtime/storage.available.internal");
+ long long allocatedMemory = 0;
+
+ r = RuntimeInfo::GetValue(key, allocatedMemory);
+ TryCatch(r == E_SUCCESS, , "MyRuntimeInfo: Failed to get value");
+
+ return allocatedMemory;
+
+CATCH:
+ return 0;
+}