bool wheelUp(int amount, const int durationMs) override;
bool wheelDown(int amount, const int durationMs) override;
- bool pressBack() override;
- bool pressHome() override;
- bool pressMenu() override;
- bool pressVolUp() override;
- bool pressVolDown() override;
- bool pressPower() override;
- bool pressKeyCode(std::string keycode) override;
+ bool pressBack(KeyRequestType type) override;
+ bool pressHome(KeyRequestType type) override;
+ bool pressMenu(KeyRequestType type) override;
+ bool pressVolUp(KeyRequestType type) override;
+ bool pressVolDown(KeyRequestType type) override;
+ bool pressPower(KeyRequestType type) override;
+ bool pressKeyCode(std::string keycode, KeyRequestType type) override;
bool takeScreenshot(std::string path, float scale, int quality) override;
- long long getSystemTime(TypeRequestType type) override;
+ long long getSystemTime(TimeRequestType type) override;
protected:
- bool pressKeyCode(std::string keycode, unsigned int intv);
+ bool strokeKeyCode(std::string keycode, unsigned int intv);
+ bool pressKeyCode(std::string keycode);
+ bool releaseKeyCode(std::string keycode);
private:
void startTimer(void);
efl_util_inputgen_h mFakeKeyboardHandle;
efl_util_inputgen_h mFakeWheelHandle;
static const unsigned int INTV_CLICK = 5;
- static const unsigned int INTV_KEYPRESS = 10;
+ static const unsigned int INTV_SHORTSTROKE = 100;
+ static const unsigned int INTV_LONGSTROKE = 2000;
+
static const unsigned int INTV_MINIMUM_DRAG_MS = 25;
static const unsigned int INTV_MINIMUM_USLEEP = 1000;
static const unsigned int MINIMUM_DURATION_DRAG = 100;
#include "config.h"
#include <string>
+
/**
- * @brief TypeRequestType enum class
+ * @brief TimeRequestType enum class
* @since_tizen 5.5
*/
-enum class TypeRequestType {
+enum class TimeRequestType {
WALLCLOCK,
MONOTONIC,
};
+
+/**
+ * @brief KeyRequestType enum class
+ * @since_tizen 5.5
+ */
+enum class KeyRequestType {
+ STROKE,
+ LONG_STROKE,
+ PRESS,
+ RELEASE,
+};
+
/**
* @brief IDevice interface
* @since_tizen 5.5
* @brief TBD
* @since_tizen 5.5
*/
- virtual bool pressBack() = 0;
+ virtual bool pressBack(KeyRequestType type) = 0;
/**
* @brief TBD
* @since_tizen 5.5
*/
- virtual bool pressHome() = 0;
+ virtual bool pressHome(KeyRequestType type) = 0;
/**
* @brief TBD
* @since_tizen 5.5
*/
- virtual bool pressMenu() = 0;
+ virtual bool pressMenu(KeyRequestType type) = 0;
/**
* @brief TBD
* @since_tizen 5.5
*/
- virtual bool pressVolUp() = 0;
+ virtual bool pressVolUp(KeyRequestType type) = 0;
/**
* @brief TBD
* @since_tizen 5.5
*/
- virtual bool pressVolDown() = 0;
+ virtual bool pressVolDown(KeyRequestType type) = 0;
/**
* @brief TBD
* @since_tizen 5.5
*/
- virtual bool pressPower() = 0;
+ virtual bool pressPower(KeyRequestType type) = 0;
/**
* @brief TBD
* @since_tizen 5.5
*/
- virtual bool pressKeyCode(std::string keycode) = 0;
+ virtual bool pressKeyCode(std::string keycode, KeyRequestType type) = 0;
/**
* @brief TBD
* @brief TBD
* @since_tizen 5.5
*/
- virtual long long getSystemTime(TypeRequestType type) = 0;
+ virtual long long getSystemTime(TimeRequestType type) = 0;
};
#endif
\ No newline at end of file
* @brief TBD
* @since_tizen 5.5
*/
- bool pressBack() override;
+ bool pressBack(KeyRequestType type) override;
/**
* @brief TBD
* @since_tizen 5.5
*/
- bool pressHome() override;
+ bool pressHome(KeyRequestType type) override;
/**
* @brief TBD
* @since_tizen 5.5
*/
- bool pressMenu() override;
+ bool pressMenu(KeyRequestType type) override;
/**
* @brief TBD
* @since_tizen 5.5
*/
- bool pressVolUp() override;
+ bool pressVolUp(KeyRequestType type) override;
/**
* @brief TBD
* @since_tizen 5.5
*/
- bool pressVolDown() override;
+ bool pressVolDown(KeyRequestType type) override;
/**
* @brief TBD
* @since_tizen 5.5
*/
- bool pressPower() override;
+ bool pressPower(KeyRequestType type) override;
/**
* @brief TBD
* @since_tizen 5.5
*/
- bool pressKeyCode(std::string keycode) override;
+ bool pressKeyCode(std::string keycode, KeyRequestType type) override;
/**
* @brief TBD
* @brief TBD
* @since_tizen 5.5
*/
- long long getSystemTime(TypeRequestType type) override;
+ long long getSystemTime(TimeRequestType type) override;
public:
return true;
}
-bool TizenImpl::pressBack()
+bool TizenImpl::pressBack(KeyRequestType type)
{
- return pressKeyCode("XF86Back");
+ return pressKeyCode("XF86Back", type);
}
-bool TizenImpl::pressHome()
+bool TizenImpl::pressHome(KeyRequestType type)
{
- return pressKeyCode("XF86Home");
+ return pressKeyCode("XF86Home", type);
}
-bool TizenImpl::pressMenu()
+bool TizenImpl::pressMenu(KeyRequestType type)
{
- return pressKeyCode("XF86Menu");
+ return pressKeyCode("XF86Menu", type);
}
-bool TizenImpl::pressVolUp()
+bool TizenImpl::pressVolUp(KeyRequestType type)
{
- return pressKeyCode("XF86AudioRaiseVolume");
+ return pressKeyCode("XF86AudioRaiseVolume", type);
}
-bool TizenImpl::pressVolDown()
+bool TizenImpl::pressVolDown(KeyRequestType type)
{
- return pressKeyCode("XF86AudioLowerVolume");
+ return pressKeyCode("XF86AudioLowerVolume", type);
}
-bool TizenImpl::pressPower()
+bool TizenImpl::pressPower(KeyRequestType type)
{
- return pressKeyCode("XF86PowerOff");
+ return pressKeyCode("XF86PowerOff", type);
}
-bool TizenImpl::pressKeyCode(std::string keycode)
+bool TizenImpl::pressKeyCode(std::string keycode, KeyRequestType type)
+{
+ if (type == KeyRequestType::STROKE)
+ return strokeKeyCode(keycode, INTV_SHORTSTROKE);
+ else if (type == KeyRequestType::LONG_STROKE)
+ return strokeKeyCode(keycode, INTV_LONGSTROKE);
+ else if (type == KeyRequestType::PRESS)
+ return pressKeyCode(keycode);
+ else if (type == KeyRequestType::RELEASE)
+ return releaseKeyCode(keycode);
+ return false;
+}
+
+bool TizenImpl::strokeKeyCode(std::string keycode, unsigned int intv)
{
- return pressKeyCode(keycode, INTV_KEYPRESS);
+ pressKeyCode(keycode);
+ usleep(intv * 1000);
+ releaseKeyCode(keycode);
+ return true;
}
-bool TizenImpl::pressKeyCode(std::string keycode, unsigned int intv)
+bool TizenImpl::pressKeyCode(std::string keycode)
{
auto args = std::make_tuple(this, keycode);
ecore_main_loop_thread_safe_call_sync([](void *data)->void*{
efl_util_input_generate_key(obj->mFakeKeyboardHandle, keycode.c_str(), 1);
return NULL;
}, (void*)(&args));
-
ecore_main_loop_thread_safe_call_sync([](void *data)->void*{return NULL;}, NULL);
- usleep(intv * 1000);
+ return true;
+}
+bool TizenImpl::releaseKeyCode(std::string keycode)
+{
+ auto args = std::make_tuple(this, keycode);
ecore_main_loop_thread_safe_call_sync([](void *data)->void*{
TizenImpl *obj;
std::string keycode;
efl_util_input_generate_key(obj->mFakeKeyboardHandle, keycode.c_str(), 0);
return NULL;
}, (void*)(&args));
-
+ ecore_main_loop_thread_safe_call_sync([](void *data)->void*{return NULL;}, NULL);
return true;
}
}
};
-long long TizenImpl::getSystemTime(TypeRequestType type)
+long long TizenImpl::getSystemTime(TimeRequestType type)
{
std::unique_ptr<Clock> clock;
- if (type == TypeRequestType::MONOTONIC)
+ if (type == TimeRequestType::MONOTONIC)
clock = std::make_unique<MonotonicClock>();
- else if (type == TypeRequestType::WALLCLOCK)
+ else if (type == TimeRequestType::WALLCLOCK)
clock = std::make_unique<WallClock>();
return clock->getTime();
return result;
}
-bool UiDevice::pressBack()
+bool UiDevice::pressBack(KeyRequestType type)
{
- bool result = mDeviceImpl->pressBack();
+ bool result = mDeviceImpl->pressBack(type);
waitForIdle();
return result;
}
-bool UiDevice::pressHome()
+bool UiDevice::pressHome(KeyRequestType type)
{
- bool result = mDeviceImpl->pressHome();
+ bool result = mDeviceImpl->pressHome(type);
waitForIdle();
return result;
}
-bool UiDevice::pressMenu()
+bool UiDevice::pressMenu(KeyRequestType type)
{
- bool result = mDeviceImpl->pressMenu();
+ bool result = mDeviceImpl->pressMenu(type);
waitForIdle();
return result;
}
-bool UiDevice::pressVolUp()
+bool UiDevice::pressVolUp(KeyRequestType type)
{
- bool result = mDeviceImpl->pressVolUp();
+ bool result = mDeviceImpl->pressVolUp(type);
waitForIdle();
return result;
}
-bool UiDevice::pressVolDown()
+bool UiDevice::pressVolDown(KeyRequestType type)
{
- bool result = mDeviceImpl->pressVolDown();
+ bool result = mDeviceImpl->pressVolDown(type);
waitForIdle();
return result;
}
-bool UiDevice::pressPower()
+bool UiDevice::pressPower(KeyRequestType type)
{
- bool result = mDeviceImpl->pressPower();
+ bool result = mDeviceImpl->pressPower(type);
waitForIdle();
return result;
}
-bool UiDevice::pressKeyCode(std::string keycode)
+bool UiDevice::pressKeyCode(std::string keycode, KeyRequestType type)
{
- bool result = mDeviceImpl->pressKeyCode(keycode);
+ bool result = mDeviceImpl->pressKeyCode(keycode, type);
waitForIdle();
return result;
}
return mDeviceImpl->takeScreenshot(path, scale, quality);
}
-long long UiDevice::getSystemTime(TypeRequestType type)
+long long UiDevice::getSystemTime(TimeRequestType type)
{
return mDeviceImpl->getSystemTime(type);
}
switch (type) {
case ::aurum::ReqGetDeviceTime_TimeType::ReqGetDeviceTime_TimeType_WALLCLOCK:
- utcStampMs = obj->getSystemTime(TypeRequestType::WALLCLOCK);
+ utcStampMs = obj->getSystemTime(TimeRequestType::WALLCLOCK);
mResponse->set_localedatetime(
TizenLocaleTimeConverter::convert(utcStampMs, "EEE, MMM d, yyyy 'at' HH:mm:ss zzz").c_str()
);
case ::aurum::ReqGetDeviceTime_TimeType::ReqGetDeviceTime_TimeType_SYSTEM:
default:
- utcStampMs = obj->getSystemTime(TypeRequestType::MONOTONIC);
+ utcStampMs = obj->getSystemTime(TimeRequestType::MONOTONIC);
mResponse->set_timestamputc(utcStampMs);
break;
}
LOG_SCOPE_F(INFO, "SendKey --------------- ");
UiDevice* mDevice = UiDevice::getInstance(DeviceType::DEFAULT);
::aurum::ReqKey_KeyType type = mRequest->type();
+ ::aurum::ReqKey_KeyActionType action_type = mRequest->actiontype();
+ KeyRequestType actionType = static_cast<KeyRequestType>(action_type);
if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_BACK)
- mDevice->pressBack();
+ mDevice->pressBack(actionType);
else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_HOME)
- mDevice->pressHome();
+ mDevice->pressHome(actionType);
else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_MENU)
- mDevice->pressMenu();
+ mDevice->pressMenu(actionType);
else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_VOLUP)
- mDevice->pressVolUp();
+ mDevice->pressVolUp(actionType);
else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_VOLDOWN)
- mDevice->pressVolDown();
+ mDevice->pressVolDown(actionType);
else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_POWER)
- mDevice->pressPower();
+ mDevice->pressPower(actionType);
else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_WHEELUP)
- mDevice->wheelUp(1,167);
+ mDevice->wheelUp(1, 167);
else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_WHEELDOWN)
- mDevice->wheelDown(1,167);
- else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_KEY) {
- ; // TODO
- }
+ mDevice->wheelDown(1, 167);
else if (type == ::aurum::ReqKey_KeyType::ReqKey_KeyType_XF86) {
- ; // TODO
+ mDevice->pressKeyCode(mRequest->xf86keycode(), actionType);
}
return grpc::Status::OK;
}
\ No newline at end of file
::grpc::Status SyncCommand::execute()
{
UiDevice *obj = UiDevice::getInstance(DeviceType::DEFAULT);
- long long timeMs = obj->getSystemTime(TypeRequestType::WALLCLOCK);
+ long long timeMs = obj->getSystemTime(TimeRequestType::WALLCLOCK);
LOG_SCOPE_F(INFO, "Sync Command @ %f", timeMs/1000.0);
// do post-command
return grpc::Status::OK;
VOLUP = 3;
VOLDOWN = 4;
POWER = 5;
- KEY = 6;
+ //KEY = 6;
XF86 = 7;
WHEELUP = 8;
WHEELDOWN = 9;
}
enum KeyActionType{
- PRESS = 0;
- RELEASE = 1;
- STROKE = 2;
- LONG_STROKE = 3;
+ STROKE = 0;
+ LONG_STROKE = 1;
+ PRESS = 2;
+ RELEASE = 3;
}
KeyType type = 1;
KeyActionType actionType = 2;
- oneof keys {
- uint32 keyCode = 3;
- string XF86keyCode = 4;
- }
+ //oneof keys {
+ //uint32 keyCode = 3;
+ string XF86keyCode = 4;
+ //}
}
message RspKey{
RspStatus status = 1;