return;
}
+bool
+CameraCaptureForm::IsBatteryLevelLow(void)
+{
+ Tizen::System::BatteryLevel batteryLevel;
+ Tizen::System::Battery::GetCurrentLevel(batteryLevel);
+
+ if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY || batteryLevel == BATTERY_LOW)
+ {
+ bool isCharging = false;
+ Tizen::System::RuntimeInfo::GetValue(String(L"IsCharging"), isCharging);
+ if (isCharging == false)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
result
CameraCaptureForm::Activate(void* pActivateParam)
{
Tizen::Graphics::PixelFormat pixFormat = PIXEL_FORMAT_YCbCr420_PLANAR;
int tempQuality = CAMERA_QUALITY_SUPER_FINE;
- Tizen::System::BatteryLevel batteryLevel;
- Tizen::System::Battery::GetCurrentLevel(batteryLevel);
-
- if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY || batteryLevel == BATTERY_LOW)
+ if (IsBatteryLevelLow() == true)
{
- bool isCharging = false;
- Tizen::System::RuntimeInfo::GetValue(String(L"IsCharging"), isCharging);
- if (isCharging == false)
- {
- MessageBox msgBox;
- int reslut_a;
- msgBox.Construct("Info", "Please Charge the Battery to use camera", MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT);
- msgBox.ShowAndWait(reslut_a);
- EnableFooterItem(ID_BUTTON_SETTING, false);
- EnableFooterItem(ID_BUTTON_CAPTURE, false);
- __batteryLevelFlag = true;
-
- //Free the resource and go back to previous form
- FreeResources();
- Deactivate();
+ MessageBox msgBox;
+ int reslut_a;
+ msgBox.Construct("Info", "Please Charge the Battery to use camera", MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT);
+ msgBox.ShowAndWait(reslut_a);
- return E_SUCCESS;
- }
- else
- {
- ShowFooterItems();
- }
+ __batteryLevelFlag = true;
+
+ ShowFooterItems();
+
+ //Free the resource and go back to previous form
+ FreeResources();
+ Deactivate();
+
+ return E_SUCCESS;
}
else
{
ShowFooterItems();
}
+
__batteryLevelFlag = false;
Tizen::System::PowerManager::KeepScreenOnState(true, false);
__background = false;
case ID_BUTTON_SETTING:
{
+ if (IsBatteryLevelLow() == true)
+ {
+ MessageBox msgBox;
+ int outResult;
+ msgBox.Construct("Info", "Please Charge the Battery to use the recorder", MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT);
+ msgBox.ShowAndWait(outResult);
+
+ FreeResources();
+ Deactivate();
+ return;
+ }
+
CreateSettingPopUp();
ShowPopUp(__pPopupSetting);
}
case ID_BUTTON_CAPTURE:
{
+ if (IsBatteryLevelLow() == true)
+ {
+ MessageBox msgBox;
+ int outResult;
+ msgBox.Construct("Info", "Please Charge the Battery to use the recorder", MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT);
+ msgBox.ShowAndWait(outResult);
+
+ FreeResources();
+ Deactivate();
+ return;
+ }
+
//disable all the buttons once capture is pressed
Footer* pFotter = null;
EnableFooterItem(ID_BUTTON_SETTING, false);
Tizen::Graphics::Bitmap* CreateBitmapFromByteBufferN(ByteBuffer* pBuffer, const int& width, const int& height);
void ShowCapturedImageThumbnail(String* pFileName);
Tizen::Graphics::PixelFormat GetPreviewFormat(const int& previewFormatValue);
+
+ bool IsBatteryLevelLow(void);
private:
//Do not change the e-num order, if any new things are to be added add to the end of the list
enum
static int _CONTEXT_MENU_Y = 700;
static const int ENABLE_AUDIO_STREAM = 0;
static const int DISABLE_AUDIO_STREAM = 1;
+static const int MESSAGE_BOX_TIMEOUT = 10000;
static const String SECTION = L"AudioRecorder";
static const String KEY_QUALITY = L"quality";
return;
}
+bool
+AudioRecorderForm::IsBatteryLevelLow(void)
+{
+ Tizen::System::BatteryLevel batteryLevel;
+ Tizen::System::Battery::GetCurrentLevel(batteryLevel);
+
+ if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY || batteryLevel == BATTERY_LOW)
+ {
+ bool isCharging = false;
+ Tizen::System::RuntimeInfo::GetValue(String(L"IsCharging"), isCharging);
+ if (isCharging == false)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
result
AudioRecorderForm::Activate(void* pActivateParam)
FreeResources();
- Tizen::System::BatteryLevel batteryLevel;
- Tizen::System::Battery::GetCurrentLevel(batteryLevel);
-
- if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY || batteryLevel == BATTERY_LOW)
+ if (IsBatteryLevelLow() == true)
{
- bool isCharging = false;
- Tizen::System::RuntimeInfo::GetValue(String(L"IsCharging"), isCharging);
- if (isCharging == false)
- {
- //Free the resource and go back to previous form
- FreeResources();
- Deactivate();
- return E_SUCCESS;
- }
+ MessageBox msgBox;
+ int reslut_a;
+ msgBox.Construct("Info", "Please Charge the Battery to use camera", MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT);
+ msgBox.ShowAndWait(reslut_a);
+
+ Deactivate();
+ return E_SUCCESS;
}
if (__pProgress != null)
case ID_SETTING:
{
+ if (IsBatteryLevelLow() == true)
+ {
+ MessageBox msgBox;
+ int outResult;
+ msgBox.Construct("Info", "Please Charge the Battery to use the recorder", MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT);
+ msgBox.ShowAndWait(outResult);
+
+ FreeResources();
+ Deactivate();
+ return;
+ }
+
if (RECORDER_STATE_RECORDING != __pAudioRecorder->GetState())
{
__pContextMenu->SetPosition(Point(0, __contextMenuYCoordinate));
case ID_START:
{
+ if (IsBatteryLevelLow() == true)
+ {
+ MessageBox msgBox;
+ int outResult;
+ msgBox.Construct("Info", "Please Charge the Battery to use the recorder", MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT);
+ msgBox.ShowAndWait(outResult);
+
+ FreeResources();
+ Deactivate();
+ return;
+ }
+
+ TryReturnVoid(__pAudioRecorder != null, "__pAudioRecorder handle is null");
+
Footer* pFotter = null;
//Disable Start/Stop button until OnAudioRecorderStarted/OnAudioRecorderStopped is called
ShowFooterItem(0, false);
AudioRecorderForm::OnFormBackRequested(Tizen::Ui::Controls::Form& source)
{
AppLog("AudioRecorderForm::OnFormBackRequested called");
- TryReturnVoid(__pAudioRecorder != null, "AudioRecorder handle is null");
- //If its recording, then cancle it, else delete safely recorder handle
- if (__pAudioRecorder->GetState() == RECORDER_STATE_RECORDING)
+ if (__pAudioRecorder != null)
{
- CancelAudioRecording();
- SetFooterItem(1, String(L"Start"), ID_START);
- __pProgress->SetValue(0);
- __backKeyPressed = true;
+ //If its recording, then cancle it, else delete safely recorder handle
+ if (__pAudioRecorder->GetState() == RECORDER_STATE_RECORDING)
+ {
+ CancelAudioRecording();
+ SetFooterItem(1, String(L"Start"), ID_START);
+ __pProgress->SetValue(0);
+ __backKeyPressed = true;
+ }
}
else
{
result AddListView(ListView** pListView, Popup* pPopup, int id);
void DeletePopup(Popup* pPopup);
bool CheckCallInProgress(void);
+ bool IsBatteryLevelLow(void);
void ReadAudioPreProcessedFile(String fileName);
void DeletePopup(Popup** pPopup);
return true;
}
+bool
+VideoRecorderForm::IsBatteryLevelLow(void)
+{
+ Tizen::System::BatteryLevel batteryLevel;
+ Tizen::System::Battery::GetCurrentLevel(batteryLevel);
+
+ if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY || batteryLevel == BATTERY_LOW)
+ {
+ bool isCharging = false;
+ Tizen::System::RuntimeInfo::GetValue(String(L"IsCharging"), isCharging);
+ if (isCharging == false)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
result
VideoRecorderForm::Activate(void* pActivateParam)
{
AppLog("VideoRecorderForm::Activate enter CAM TYPE = %d", __camType);
- Tizen::System::BatteryLevel batteryLevel;
- Tizen::System::Battery::GetCurrentLevel(batteryLevel);
-
- if (batteryLevel == BATTERY_CRITICAL || batteryLevel == BATTERY_EMPTY || batteryLevel == BATTERY_LOW)
+ if (IsBatteryLevelLow() == true)
{
- bool isCharging = false;
- Tizen::System::RuntimeInfo::GetValue(String(L"IsCharging"), isCharging);
- if (isCharging == false)
- {
- MessageBox msgBox;
- int outResult;
- msgBox.Construct("Info", "Please Charge the Battery to use the recorder", MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT);
- msgBox.ShowAndWait(outResult);
- __pProgress->SetValue(0);
- __pProgress->Draw();
- __pElapsedTimeLable->SetText(__startTime);
- __pElapsedRecordSizeLable->SetText(__startSize);
-
- __pElapsedTimeLable->RequestRedraw();
- __pElapsedRecordSizeLable->RequestRedraw();
+ MessageBox msgBox;
+ int outResult;
+ msgBox.Construct("Info", "Please Charge the Battery to use the recorder", MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT);
+ msgBox.ShowAndWait(outResult);
- EnableFooterItem(ID_SETTING, false);
- EnableFooterItem(ID_TOGGLE_CAMERA_TYPE, false);
- EnableFooterItem(ID_START, false);
- __batteryLevelFlag = true;
+ __pProgress->SetValue(0);
+ __pProgress->Draw();
+ __pElapsedTimeLable->SetText(__startTime);
+ __pElapsedRecordSizeLable->SetText(__startSize);
- //Free the resource and go back to previous form
- FreeResources();
- Deactivate();
+ __pElapsedTimeLable->RequestRedraw();
+ __pElapsedRecordSizeLable->RequestRedraw();
+ __batteryLevelFlag = true;
- return E_SUCCESS;
- }
- else
- {
- EnableFooterItem(ID_SETTING, true);
- EnableFooterItem(ID_START, true);
- }
+ //Free the resource and go back to previous form
+ FreeResources();
+ Deactivate();
+ return E_SUCCESS;
}
else
{
EnableFooterItem(ID_SETTING, true);
EnableFooterItem(ID_START, true);
}
+
__batteryLevelFlag = false;
__backGround = false;
__cameraError = CAMERA_ERROR_NONE;
{
case ID_BACK:
{
-
TryReturnVoid(__pVideoRecorder != null, "__pVideoRecorder handle is null");
__pTimer->Cancel();
if (__pVideoRecorder->GetState() == RECORDER_STATE_RECORDING)
case ID_TOGGLE_CAMERA_TYPE:
{
- TryReturnVoid(__pVideoRecorder != null, "__pVideoRecorder handle is null");
- if (RECORDER_STATE_RECORDING != __pVideoRecorder->GetState())
+ if (__pVideoRecorder != null)
{
- ShowFooterItem(0, false);
- ShowFooterItem(1, false);
- ShowFooterItem(2, false);
- SendUserEvent(RECORDER_TOGGLE_CAMERA, null);
+ if (RECORDER_STATE_RECORDING != __pVideoRecorder->GetState())
+ {
+ ShowFooterItem(0, false);
+ ShowFooterItem(1, false);
+ ShowFooterItem(2, false);
+ SendUserEvent(RECORDER_TOGGLE_CAMERA, null);
+ }
+ else
+ {
+ MessageBox msgBox;
+ int modalResult = 0;
+ msgBox.Construct(L"Error", L"Operation not allowed", MSGBOX_STYLE_NONE, 3000);
+ msgBox.ShowAndWait(modalResult);
+ }
}
else
{
- MessageBox msgBox;
- int modalResult = 0;
- msgBox.Construct(L"Error", L"Operation not allowed", MSGBOX_STYLE_NONE, 3000);
- msgBox.ShowAndWait(modalResult);
+ if (IsBatteryLevelLow() == true)
+ {
+ MessageBox msgBox;
+ int outResult;
+ msgBox.Construct("Info", "Please Charge the Battery to use the recorder", MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT);
+ msgBox.ShowAndWait(outResult);
+
+ FreeResources();
+ Deactivate();
+ }
}
}
break;
{
result r = E_SUCCESS;
AppLog("VideoRecorderForm::OnUserEventReceivedN : request id = %d", requestId);
+
+ if (IsBatteryLevelLow() == true)
+ {
+ MessageBox msgBox;
+ int outResult;
+ msgBox.Construct("Info", "Please Charge the Battery to use the recorder", MSGBOX_STYLE_OK, MESSAGE_BOX_TIMEOUT);
+ msgBox.ShowAndWait(outResult);
+
+ FreeResources();
+ Deactivate();
+ return;
+ }
+
switch (requestId)
{
case RECORDER_START_STOP:
void ReadAudioPreProcessedFile(String fileName);
bool ConvertPixelFormatToString(Tizen::Graphics::PixelFormat &pixFormat, String& strString);
+ bool IsBatteryLevelLow(void);
+
private:
//Do not change the order of the e-nums, if a new e-num is to be added add it at the end
enum