#include <dlog.h>
-#ifdef LOG_TAG
-#undef LOG_TAG
+#ifdef LOG_TAG
+#undef LOG_TAG
#endif
#define LOG_TAG "AURUM"
+#ifndef LOGI
+#define LOGI(fmt, arg...) \
+ ({ do { \
+ dlog_print(DLOG_INFO, LOG_TAG, \
+ "%s: %s(%d) > " fmt, __FILE__, __func__, __LINE__, ##arg); \
+ } while (0); })
+#endif
+
+#ifndef LOGE
+#define FONT_RED "\033[31m"
+#define FONT_RESET "\033[0m"
+#define LOGI_RED(fmt, arg...) \
+ ({ do { \
+ dlog_print(DLOG_ERROR, LOG_TAG, \
+ FONT_RED "%s: %s(%d) > " fmt FONT_RESET, \
+ __FILE__, __func__, __LINE__, ##arg); \
+ } while (0); })
+#endif
+
#include "UiDevice.h"
#include "UiObject.h"
#include "UiSelector.h"
void AccessibleNode::invalidate()
{
std::unique_lock<std::mutex> lock(mLock);
- dlog_print(DLOG_INFO, LOG_TAG, "object %p is now invalid", this);
+ LOGI("object %p is now invalid", this);
mValid = false;
}
void AccessibleNode::print(int d)
{
this->refresh();
- dlog_print(DLOG_INFO, LOG_TAG, "%s %s",std::string(d, ' ').c_str(), description().c_str());
+ LOGI("%s %s",std::string(d, ' ').c_str(), description().c_str());
}
bool AccessibleNode::isSupporting(AccessibleNodeInterface thisIface) const
char *state_name = NULL;
AtspiStateType stat;
- dlog_print(DLOG_INFO, LOG_TAG, "check ss:%p s:%p, len:%d", stateSet, states, states->len);
+ LOGI("check ss:%p s:%p, len:%d", stateSet, states, states->len);
for (int i = 0; states && (i < states->len); ++i) {
stat = g_array_index(states, AtspiStateType, i);
state_name = state_to_char(stat);
- dlog_print(DLOG_INFO, LOG_TAG, "state: %s", state_name);
+ LOGI("state: %s", state_name);
free(state_name);
}
g_array_free(states, 1);
std::vector<std::shared_ptr<AccessibleApplication>> AccessibleWatcher::getActiveApplications(void) const
{
- dlog_print(DLOG_INFO, LOG_TAG, "getActiveApplications for this(%p)", this);
+ LOGI("getActiveApplications for this(%p)", this);
std::vector<std::shared_ptr<AccessibleApplication>> ret{};
auto apps = this->getApplications();
- dlog_print(DLOG_INFO, LOG_TAG, "apps size %d", apps.size());
+ LOGI("apps size %d", apps.size());
apps.erase(std::remove_if(apps.begin(), apps.end(), [](auto app){
return !app->isActive();
}), apps.end());
- dlog_print(DLOG_INFO, LOG_TAG, "active apps size %d", apps.size());
+ LOGI("active apps size %d", apps.size());
return apps;
}
void AccessibleWatcher::attach(std::shared_ptr<IEventConsumer> source)
{
std::unique_lock<std::mutex> lock(mLock);
- dlog_print(DLOG_INFO, LOG_TAG, "source attached %p", source.get());
if (source) {
mSources.insert(source);
}
void AccessibleWatcher::detach(std::shared_ptr<IEventConsumer> source)
{
std::unique_lock<std::mutex> lock(mLock);
- dlog_print(DLOG_INFO, LOG_TAG, "source detached %p", source.get());
if (source) {
auto iter = mSources.find(source);
if (iter != mSources.end()) mSources.erase(iter);
{
Comparer comparer(device, selector, earlyReturn);
- dlog_print(DLOG_INFO, LOG_TAG, "findObjects selector(%s) from (type:%s style:%s, role:%s, text:%s) earlyReturn:%d", selector->description().c_str(), root->getType().c_str(), root->getStyle().c_str(), root->getRole().c_str(), root->getText().c_str(), earlyReturn);
+ LOGI("findObjects selector(%s) from (type:%s style:%s, role:%s, text:%s) earlyReturn:%d", selector->description().c_str(), root->getType().c_str(), root->getStyle().c_str(), root->getRole().c_str(), root->getText().c_str(), earlyReturn);
if (selector->mParent) {
auto ret = Comparer::findObjects(device, selector->mParent, root);
{
std::list<std::shared_ptr<PartialMatch>> partialList{};
std::vector<std::shared_ptr<AccessibleNode>> ret = findObjects(root, 0, 0, partialList);
- dlog_print(DLOG_INFO, LOG_TAG, "%d object(s) found", ret.size());
+ LOGI("%d object(s) found", ret.size());
return ret;
}
findObjects(childNode, i, depth + 1, partialMatches);
std::move(std::begin(childret), std::end(childret), std::back_inserter(ret));
- if (!ret.empty() && mEarlyReturn) return ret;
+ if (!ret.empty() && mEarlyReturn) {
+ LOGI("Object found and earlyReturn");
+ return ret;
+ }
}
} else {
- dlog_print(DLOG_INFO, LOG_TAG, "Abort searching! No need to search children(maxDepth limit overflow, %d < %d < %d)", mSelector->mMinDepth?*(mSelector->mMinDepth):-1, depth, mSelector->mMaxDepth?*(mSelector->mMaxDepth):9999999);
+ LOGI("Abort searching! No need to search children(maxDepth limit overflow, %d < %d < %d)", mSelector->mMinDepth?*(mSelector->mMinDepth):-1, depth, mSelector->mMaxDepth?*(mSelector->mMaxDepth):9999999);
}
if (currentMatch && currentMatch->finalizeMatch()){
- dlog_print(DLOG_INFO, LOG_TAG, "Found matched = %s with criteria %s", root->description().c_str(), currentMatch->debugPrint().c_str());
+ LOGI("Found matched = %s with criteria %s", root->description().c_str(), currentMatch->debugPrint().c_str());
ret.push_back(root);
}
watcher->attach(shared_from_this());
if (mNode) {
- /*
- GArray *ifaces = AtspiWrapper::Atspi_accessible_get_interfaces(mNode);
- if (ifaces) {
- for (unsigned int i = 0; i < ifaces->len; i++) {
- char *iface = g_array_index(ifaces, char *, i);
- if (!strcmp(iface, "Action"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::ACTION);
- else if (!strcmp(iface, "Collection"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::COLLECTION);
- else if (!strcmp(iface, "Component"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::COMPONENT);
- else if (!strcmp(iface, "Document"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::DOCUMENT);
- else if (!strcmp(iface, "EditableText"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::EDITABLETEXT);
- else if (!strcmp(iface, "Hypertext"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::HYPERTEXT);
- else if (!strcmp(iface, "Image"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::IMAGE);
- else if (!strcmp(iface, "Selection"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::SELECTION);
- else if (!strcmp(iface, "Text"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::TEXT);
- else if (!strcmp(iface, "Value"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::VALUE);
- else if (!strcmp(iface, "Accessible"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::ACCESSIBLE);
- else if (!strcmp(iface, "Table"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::TABLE);
- else if (!strcmp(iface, "TableCell"))
- mSupportingIfaces |=
- static_cast<int>(AccessibleNodeInterface::TABLECELL);
- else
- LOG_F(WARNING, "Not Supported interface found %s", iface);
-
- g_free(iface);
- }
- g_array_free(ifaces, FALSE);
- }*/
-
this->refresh();
} else {
- dlog_print(DLOG_INFO, LOG_TAG, "AtspiAccessibleNode Ctor : mNode is null");
+ LOGI("AtspiAccessibleNode Ctor : mNode is null");
}
}
AtspiWrapper::unlock();
return std::make_shared<AtspiAccessibleNode>(nullptr);
}
- dlog_print(DLOG_INFO, LOG_TAG, "getChild @ %d from node(%p)", index, mNode);
AtspiAccessible *rawChild = AtspiWrapper::Atspi_accessible_get_child_at_index(mNode, index, NULL);
AtspiWrapper::unlock();
return std::make_shared<AtspiAccessibleNode>(rawChild);
AtspiAccessible *rawParent = AtspiWrapper::Atspi_accessible_get_parent(mNode, NULL);
AtspiWrapper::unlock();
return std::make_shared<AtspiAccessibleNode>(rawParent);
-/* auto node = AccessibleNode::get(parent);
- if (parent) g_object_unref(parent);
- return node; */
}
+
bool AtspiAccessibleNode::isValid() const
{
if(!AccessibleNode::isValid()) return false;
return true;
}
-
void* AtspiAccessibleNode::getRawHandler(void) const
{
return static_cast<void*>(mNode);
}
AtspiEditableText *iface = AtspiWrapper::Atspi_accessible_get_editable_text(mNode);
- dlog_print(DLOG_INFO, LOG_TAG, "set Value iface:%p obj:%p text:%s", iface, mNode, text.c_str() );
+ LOGI("set Value iface:%p obj:%p text:%s", iface, mNode, text.c_str() );
if (iface) {
int len = getText().length();
AtspiWrapper::Atspi_editable_text_delete_text(iface, 0, len, NULL);
void AtspiAccessibleNode::setFeatureProperty(AtspiStateType type)
{
-/*
- LONGCLICKABLE = 0X0040,
- SCROLLABLE = 0X0080,
-*/
switch(type) {
case ATSPI_STATE_CHECKED:
setFeatureProperty(NodeFeatureProperties::CHECKED, true);
if (node) name = AtspiWrapper::Atspi_accessible_get_name(node, NULL);
else return false;
- dlog_print(DLOG_INFO, LOG_TAG, "isShowing %s", name);
+ LOGI("isShowing %s", name);
auto stateSet = AtspiWrapper::Atspi_accessible_get_state_set(node);
if (AtspiWrapper::Atspi_state_set_contains(stateSet, ATSPI_STATE_ACTIVE)
&& AtspiWrapper::Atspi_state_set_contains(stateSet, ATSPI_STATE_SHOWING)) {
- dlog_print(DLOG_INFO, LOG_TAG, "active and showing %p %s", node, name);
+ LOGI("active and showing %p %s", node, name);
free(name);
g_object_unref(stateSet);
return true;
findActiveNode(AtspiAccessible *node, int depth,
int max_depth)
{
- dlog_print(DLOG_INFO, LOG_TAG, "findActiveNode %p %d/%d", node, depth, max_depth);
+ LOGI("findActiveNode %p %d/%d", node, depth, max_depth);
std::vector<AtspiAccessible *> ret{};
if (iShowingNode(node)) {
char *name = AtspiWrapper::Atspi_accessible_get_name(node, NULL);
if (name) {
- dlog_print(DLOG_INFO, LOG_TAG, "%s", name);
+ LOGI("%s", name);
free(name);
}
ret.push_back(node);
int nchild = AtspiWrapper::Atspi_accessible_get_child_count(node, NULL);
if (nchild <= 0) return ret;
- dlog_print(DLOG_INFO, LOG_TAG, "findActiveNode node %p has %d children", node, nchild);
+ LOGI("findActiveNode node %p has %d children", node, nchild);
for (int i = 0; i < nchild; i++) {
AtspiAccessible* child = AtspiWrapper::Atspi_accessible_get_child_at_index(node, i, NULL);
- dlog_print(DLOG_INFO, LOG_TAG, "a child found @ %d : %p", i, child);
+ LOGI("a child found @ %d : %p", i, child);
std::vector<AtspiAccessible *> childRet = findActiveNode(child, depth + 1, max_depth);
ret.insert(ret.end(), childRet.begin(), childRet.end());
g_object_unref(child);
static gpointer _event_thread_loop (gpointer data)
{
- dlog_print(DLOG_INFO, LOG_TAG, "event thread start");
+ LOGI("event thread start");
AtspiEventListener * listener =
atspi_event_listener_new(AtspiAccessibleWatcher::onAtspiEvents, data, NULL);
atspi_event_main();
- dlog_print(DLOG_INFO, LOG_TAG, "event thread end");
+ LOGI("event thread end");
atspi_event_listener_deregister(listener, "object:", NULL);
atspi_event_listener_deregister(listener, "window:", NULL);
}
if (name) free(name);
if (pkg) free(pkg);
-/* char *name = NULL, *pname = NULL;
- AtspiAccessibleWatcher *instance = (AtspiAccessibleWatcher *)user_data;
- if (!event->source)
- {
- LOG_F(INFO, "event->source is NULL. Skip event handling");
- return;
- }
-
- name = AtspiWrapper::Atspi_accessible_get_name(event->source, NULL);
- AtspiAccessible *parent = AtspiWrapper::Atspi_accessible_get_parent(event->source, NULL);
- if (parent) {
- pname = AtspiWrapper::Atspi_accessible_get_name(parent, NULL);
- g_object_unref(parent);
- }
-
- if (!strcmp(event->type, "window:activate")) {
- instance->onWindowActivated(
- static_cast<AtspiAccessible *>(event->source),
- static_cast<WindowActivateInfoType>(event->detail1));
- } else if (!strcmp(event->type, "window:deactivate")) {
- instance->onWindowDeactivated(static_cast<AtspiAccessible *>(event->source));
- } else if (!strcmp(event->type, "window:create")) {
- instance->onWindowCreated(static_cast<AtspiAccessible *>(event->source));
- } else if (!strcmp(event->type, "window:destroy")) {
- instance->onWindowDestroyed(static_cast<AtspiAccessible *>(event->source));
- } else if (!strcmp(event->type, "object:state-changed:visible")) {
- instance->onVisibilityChanged(
- static_cast<AtspiAccessible *>(event->source),
- (event->detail1 != 0));
- } else if (!strcmp(event->type, "object:state-changed:defunct")) {
- instance->onObjectDefunct(
- static_cast<AtspiAccessible *>(event->source));
- }
- if (name) free(name);
- if (pname) free(pname);*/
AtspiWrapper::unlock();
}
void AtspiAccessibleWatcher::print_debug()
{
- dlog_print(DLOG_INFO, LOG_TAG, "activatewindowlist-------------------");
+ LOGI("activatewindowlist-------------------");
std::for_each(mActivatedWindowList.begin(), mActivatedWindowList.end(), [](auto acc){
- dlog_print(DLOG_INFO, LOG_TAG, "child:%p", acc);
+ LOGI("child:%p", acc);
});
- dlog_print(DLOG_INFO, LOG_TAG, "mActivatedApplicationList--------------------------");
+ LOGI("mActivatedApplicationList--------------------------");
std::for_each(mActivatedApplicationList.begin(), mActivatedApplicationList.end(), [](auto acc){
- dlog_print(DLOG_INFO, LOG_TAG, "child:%p", acc);
+ LOGI("child:%p", acc);
});
- dlog_print(DLOG_INFO, LOG_TAG, "mWindowSet------------------------------");
+ LOGI("mWindowSet------------------------------");
std::for_each(mWindowSet.begin(), mWindowSet.end(), [](auto acc){
- dlog_print(DLOG_INFO, LOG_TAG, "child:%p", acc);
+ LOGI("child:%p", acc);
});
- dlog_print(DLOG_INFO, LOG_TAG, "------------------------------");
+ LOGI("------------------------------");
}
void AtspiAccessibleWatcher::onWindowActivated(AtspiAccessible *node,
WindowActivateInfoType type)
{
- dlog_print(DLOG_INFO, LOG_TAG, "onWindowActivated obj:%p", node);
+ LOGI("onWindowActivated obj:%p", node);
notifyAll((int)EventType::Window, (int)WindowEventType::WindowActivated, node);
}
void AtspiAccessibleWatcher::onWindowDeactivated(AtspiAccessible *node)
{
- dlog_print(DLOG_INFO, LOG_TAG, "onWindowDeactivated obj:%p", node);
+ LOGI("onWindowDeactivated obj:%p", node);
notifyAll((int)EventType::Window, (int)WindowEventType::WindowDeactivated, node);
}
void AtspiAccessibleWatcher::onWindowCreated(AtspiAccessible *node)
{
- dlog_print(DLOG_INFO, LOG_TAG, "onWindowCreated obj:%p", node);
+ LOGI("onWindowCreated obj:%p", node);
notifyAll((int)EventType::Window, (int)WindowEventType::WindowCreated, node);
}
void AtspiAccessibleWatcher::onWindowDestroyed(AtspiAccessible *node)
{
- dlog_print(DLOG_INFO, LOG_TAG, "onWindowDestroyed obj:%p", node);
+ LOGI("onWindowDestroyed obj:%p", node);
notifyAll((int)EventType::Window, (int)WindowEventType::WindowDestroyed, node);
}
void AtspiAccessibleWatcher::onVisibilityChanged(AtspiAccessible *node, bool visible)
{
- dlog_print(DLOG_INFO, LOG_TAG, "onVisibilityChanged obj:%p", node);
+ LOGI("onVisibilityChanged obj:%p", node);
notifyAll((int)EventType::Object, (int)ObjectEventType::ObjectStateVisible, node);
}
void AtspiAccessibleWatcher::onObjectDefunct(AtspiAccessible *node)
{
- dlog_print(DLOG_INFO, LOG_TAG, "onObjectDefunct obj:%p", node);
+ LOGI("onObjectDefunct obj:%p", node);
notifyAll((int)EventType::Object, (int)ObjectEventType::ObjectStateDefunct, node);
}
std::vector<std::shared_ptr<AccessibleApplication>> AtspiAccessibleWatcher::getApplications(void) const
{
AtspiWrapper::lock();
- dlog_print(DLOG_INFO, LOG_TAG, "getApplications for this(%p)", this);
+ LOGI("getApplications for this(%p)", this);
std::vector<std::shared_ptr<AccessibleApplication>> ret{};
AtspiAccessible *root = AtspiWrapper::Atspi_get_desktop(0);
int nchild = AtspiWrapper::Atspi_accessible_get_child_count(root, NULL);
mEventQueue.clear();
AtspiWrapper::unlock();
- if (!localEvents.empty())
- {
+ if (!localEvents.empty())
+ {
for (const auto &event : localEvents) {
if (COMPARE(type, event->getEvent()))
- {
- dlog_print(DLOG_INFO, LOG_TAG, "type %d == %d name %s pkg %s",static_cast<int>(type), static_cast<int>(event->getEvent()), event->getName().c_str(), event->getPkg().c_str());
- return true;
- }
- }
- }
+ {
+ LOGI("type %d == %d name %s pkg %s",static_cast<int>(type), static_cast<int>(event->getEvent()), event->getName().c_str(), event->getPkg().c_str());
+ return true;
+ }
+ }
+ }
if ((std::chrono::system_clock::now() - start) >
std::chrono::milliseconds{timeout})
break;
bool AtspiAccessibleWatcher::removeFromActivatedList(AtspiAccessible *node)
{
- dlog_print(DLOG_INFO, LOG_TAG, "remove from activelist node %p", node);
+ LOGI("remove from activelist node %p", node);
mActivatedWindowList.remove_if([&](auto &n) { return n == node; });
AtspiAccessible *app = AtspiWrapper::Atspi_accessible_get_application(node, NULL);
- dlog_print(DLOG_INFO, LOG_TAG, "node:%p, app:%p", node, app);
+ LOGI("node:%p, app:%p", node, app);
if (app) {
mActivatedApplicationList.remove_if([&](auto &n) { return n == app; });
g_object_unref(app);
bool AtspiAccessibleWatcher::addToActivatedList(AtspiAccessible *node)
{
- dlog_print(DLOG_INFO, LOG_TAG, "add to activelist node %p", node);
+ LOGI("add to activelist node %p", node);
mActivatedWindowList.remove_if([&](auto &n) { return n == node; });
mActivatedWindowList.push_front(node);
if ( iter == mWindowSet.end()) mWindowSet.insert(node);
AtspiAccessible *app = AtspiWrapper::Atspi_accessible_get_application(node, NULL);
- dlog_print(DLOG_INFO, LOG_TAG, "node:%p, app:%p", node, app);
+ LOGI("node:%p, app:%p", node, app);
if (app) {
mActivatedApplicationList.remove_if([&](auto &n) { if(n == app) { g_object_unref(app); return true;} else return false; });
mActivatedApplicationList.push_front(app);
#include <tbm_surface.h>
#include <system_info.h>
+#define NANO_SEC 1000000000.0
+#define MICRO_SEC 1000000
+
TizenDeviceImpl::TizenDeviceImpl()
: mFakeTouchHandle{0}, mFakeKeyboardHandle{0}, mFakeWheelHandle{0}, tStart{}, isTimerStarted{false}, mTouchSeq{}
{
- dlog_print(DLOG_INFO, LOG_TAG, "device implementation init");
+ LOGI("device implementation init");
TizenDeviceImpl *obj = static_cast<TizenDeviceImpl*>(this);
obj->mFakeTouchHandle = efl_util_input_initialize_generator(EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN);
obj->mFakeKeyboardHandle =
bool TizenDeviceImpl::click(const int x, const int y, const unsigned int intv)
{
- dlog_print(DLOG_INFO, LOG_TAG, "click %d %d , intv:%d", x, y, intv);
+ LOGI("click %d %d , intv:%d", x, y, intv);
int seq = touchDown(x, y);
if (seq < 0) return false;
int TizenDeviceImpl::touchDown(const int x, const int y)
{
int seq = grabTouchSeqNumber();
- dlog_print(DLOG_INFO, LOG_TAG, "touch down %d %d , seq:%d", x, y, seq);
+ LOGI("touch down %d %d , seq:%d", x, y, seq);
if (seq >= 0) {
TizenDeviceImpl *obj = static_cast<TizenDeviceImpl*>(this);
long result = (long)efl_util_input_generate_touch(obj->mFakeTouchHandle, seq, EFL_UTIL_INPUT_TOUCH_BEGIN,
bool TizenDeviceImpl::touchMove(const int x, const int y, const int seq)
{
- dlog_print(DLOG_INFO, LOG_TAG, "touch move %d %d, seq:%d", x, y, seq);
+ LOGI("touch move %d %d, seq:%d", x, y, seq);
if (seq >= 0) {
TizenDeviceImpl *obj = static_cast<TizenDeviceImpl*>(this);
long result = (long)efl_util_input_generate_touch(obj->mFakeTouchHandle, seq, EFL_UTIL_INPUT_TOUCH_UPDATE,
bool TizenDeviceImpl::touchUp(const int x, const int y, const int seq)
{
- dlog_print(DLOG_INFO, LOG_TAG, "touch up %d %d, seq:%d", x, y, seq);
+ LOGI("touch up %d %d, seq:%d", x, y, seq);
if (seq >= 0) {
TizenDeviceImpl *obj = static_cast<TizenDeviceImpl*>(this);
long result = (long)efl_util_input_generate_touch(obj->mFakeTouchHandle, seq, EFL_UTIL_INPUT_TOUCH_END,
bool TizenDeviceImpl::wheelUp(int amount, const int durationMs)
{
- dlog_print(DLOG_INFO, LOG_TAG, "wheel up %d for %d", amount, durationMs);
+ LOGI("wheel up %d for %d", amount, durationMs);
long result = -1;
TizenDeviceImpl *obj = static_cast<TizenDeviceImpl*>(this);
obj->mFakeWheelHandle = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_POINTER, NULL);
bool TizenDeviceImpl::wheelDown(int amount, const int durationMs)
{
- dlog_print(DLOG_INFO, LOG_TAG, "wheel down %d for %d", amount, durationMs);
+ LOGI("wheel down %d for %d", amount, durationMs);
long result = -1;
TizenDeviceImpl *obj = static_cast<TizenDeviceImpl*>(this);
obj->mFakeWheelHandle = efl_util_input_initialize_generator_with_sync(EFL_UTIL_INPUT_DEVTYPE_POINTER, NULL);
if (!isTimerStarted) return 0;
isTimerStarted = false;
clock_gettime(CLOCK_MONOTONIC, &tEnd);
- return ((tEnd.tv_sec + tEnd.tv_nsec/1000000000.0) - (tStart.tv_sec + tStart.tv_nsec/1000000000.0)) * 1000000;
+ return ((tEnd.tv_sec + tEnd.tv_nsec/NANO_SEC) - (tStart.tv_sec + tStart.tv_nsec/NANO_SEC)) * MICRO_SEC;
}
bool TizenDeviceImpl::drag(const int sx, const int sy, const int ex, const int ey,
_steps = (int)(_durationUs / (INTV_MINIMUM_DRAG_MS * MSEC_PER_SEC)) - 1;
_stepUs = (INTV_MINIMUM_DRAG_MS * MSEC_PER_SEC);
}
- dlog_print(DLOG_INFO, LOG_TAG, "flicking (%d, %d) -> (%d, %d) for (%d ms)", sx, sy, ex, ey, durationMs);
+ LOGI("flicking (%d, %d) -> (%d, %d) for (%d ms)", sx, sy, ex, ey, durationMs);
startTimer();
int seq = touchDown(sx, sy);
if (seq < 0) return false;
void SendKeyRunnable::run() const
{
- dlog_print(DLOG_INFO, LOG_TAG, "sendKey %s",mKeycode.c_str());
- std::shared_ptr<UiDevice> mDevice = UiDevice::getInstance();
- mDevice->pressKeyCode(mKeycode.c_str(), KeyRequestType::PRESS);
- mDevice->pressKeyCode(mKeycode.c_str(), KeyRequestType::RELEASE);
+ LOGI("sendKey %s",mKeycode.c_str());
+ std::shared_ptr<UiDevice> mDevice = UiDevice::getInstance();
+ mDevice->pressKeyCode(mKeycode.c_str(), KeyRequestType::PRESS);
+ mDevice->pressKeyCode(mKeycode.c_str(), KeyRequestType::RELEASE);
}
auto nodes = Comparer::findObjects(mDevice, selector, getAccessibleNode());
for ( auto& node : nodes) {
if (!node) {
- dlog_print(DLOG_INFO, LOG_TAG, "Skipped! (node == nullptr)");
+ LOGI("Skipped! (node == nullptr)");
continue;
}
result.push_back(std::make_shared<UiObject>(mDevice, selector, std::move(node)));
const std::shared_ptr<UiSelector> selector)
{
return [=](const ISearchable *searchable) -> bool {
- dlog_print(DLOG_INFO, LOG_TAG, "Until::hasObject search:%p", searchable);
+ LOGI("Until::hasObject search:%p", searchable);
std::shared_ptr<UiObject> obj = searchable->findObject(selector);
return obj.get() != nullptr;
};
const std::shared_ptr<UiSelector> selector)
{
return [=](const ISearchable *searchable) -> std::shared_ptr<UiObject> {
- dlog_print(DLOG_INFO, LOG_TAG, "Until::findObject search:%p", searchable);
+ LOGI("Until::findObject search:%p", searchable);
std::shared_ptr<UiObject> obj = searchable->findObject(selector);
return obj;
};
std::function<bool(const UiObject *)> Until::checkable(const bool isCheckable)
{
return [=](const UiObject *object) -> bool {
- dlog_print(DLOG_INFO, LOG_TAG, "Until::checkable checkable:%d for obj %p", isCheckable, object);
+ LOGI("Until::checkable checkable:%d for obj %p", isCheckable, object);
return object->isClickable() == isCheckable;
};
}
template <typename R>
R Waiter::waitFor(const std::function<R(const ISearchable *)> condition) const
{
- dlog_print(DLOG_INFO, LOG_TAG, "Waiter::waitFor ISearchable");
- // startTime = currentTime();
+ LOGI("Waiter::waitFor ISearchable");
std::chrono::system_clock::time_point start =
std::chrono::system_clock::now();
R result = condition(mSearchableObject);
template <typename R>
R Waiter::waitFor(const std::function<R(const UiObject *)> condition) const
{
- dlog_print(DLOG_INFO, LOG_TAG, "Waiter::waitFor UiObject");
+ LOGI("Waiter::waitFor UiObject");
if (mUiObject) {
std::chrono::system_clock::time_point start =
std::chrono::system_clock::now();
--- /dev/null
+#ifndef _BOOTSTRAP_H_
+#define _BOOTSTRAP_H_
+
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "AURUM-BOOTSTRAP"
+
+#ifndef LOGI
+#define LOGI(fmt, arg...) \
+ ({ do { \
+ dlog_print(DLOG_INFO, LOG_TAG, \
+ "%s: %s(%d) > " fmt, __FILE__, __func__, __LINE__, ##arg); \
+ } while (0); })
+#endif
+
+#ifndef LOGE
+#define FONT_RED "\033[31m"
+#define FONT_RESET "\033[0m"
+#define LOGI_RED(fmt, arg...) \
+ ({ do { \
+ dlog_print(DLOG_ERROR, LOG_TAG, \
+ FONT_RED "%s: %s(%d) > " fmt FONT_RESET, \
+ __FILE__, __func__, __LINE__, ##arg); \
+ } while (0); })
+#endif
+
+#endif
\ No newline at end of file
#include "Commands/PreCommand.h"
#include "config.h"
-#include <loguru.hpp>
using namespace grpc;
using namespace aurum;
#include <iostream>
#include <glib.h>
+#include "bootstrap.h"
#include <service_app.h>
#include <privacy_privilege_manager.h>
#include "AurumServiceImpl.h"
#include "config.h"
-#include <loguru.hpp>
#define PRIV_MEDIASTORAGE "http://tizen.org/privilege/mediastorage"
#define PRIV_LOCATION "http://tizen.org/privilege/location"
aurumServiceImpl service;
ServerBuilder builder;
- LOG_F(INFO, "[T] Server Listening on %s", binding.c_str());
+ LOGI("[T] Server Listening on %s", binding.c_str());
builder.AddListeningPort(binding, grpc::InsecureServerCredentials());
builder.RegisterService(&service);
- //std::unique_ptr<Server> server(builder.BuildAndStart());
ctx->server = std::move(builder.BuildAndStart());
ctx->server->Wait();
const char *privilege, void *user_data)
{
if (cause == PRIVACY_PRIVILEGE_MANAGER_CALL_CAUSE_ERROR) {
- LOG_F(INFO, "PPM Error PRIVACY_PRIVILEGE_MANAGER_CALL_CAUSE_ERROR");
+ LOGI("PPM Error PRIVACY_PRIVILEGE_MANAGER_CALL_CAUSE_ERROR");
return;
}
switch (result) {
case PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_ALLOW_FOREVER:
- LOG_F(INFO, "priv:%s PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_ALLOW_FOREVER", privilege);
+ LOGI("priv:%s PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_ALLOW_FOREVER", privilege);
break;
case PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_DENY_FOREVER:
- LOG_F(INFO, "priv:%s PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_ALLOW_FOREVER", privilege);
+ LOGI("priv:%s PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_ALLOW_FOREVER", privilege);
break;
case PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_DENY_ONCE:
- LOG_F(INFO, "priv:%s PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_ALLOW_FOREVER", privilege);
+ LOGI("priv:%s PRIVACY_PRIVILEGE_MANAGER_REQUEST_RESULT_ALLOW_FOREVER", privilege);
break;
default:
- LOG_F(INFO, "priv:%s default", privilege);
+ LOGI("priv:%s default", privilege);
break;
}
}
{
ppm_check_result_e result;
int ret;
- LOG_F(INFO, "path_privilege = %s",path_privilege);
+ LOGI("path_privilege = %s",path_privilege);
ret = ppm_check_permission(path_privilege, &result);
if (ret == PRIVACY_PRIVILEGE_MANAGER_ERROR_NONE) {
break;
case PRIVACY_PRIVILEGE_MANAGER_CHECK_RESULT_DENY:
- LOG_F(INFO, "PRIVACY_PRIVILEGE_MANAGER_CHECK_RESULT_DENY");
+ LOGI("PRIVACY_PRIVILEGE_MANAGER_CHECK_RESULT_DENY");
;
break;
case PRIVACY_PRIVILEGE_MANAGER_CHECK_RESULT_ASK:
- LOG_F(INFO, "PRIVACY_PRIVILEGE_MANAGER_CHECK_RESULT_ASK");
+ LOGI("PRIVACY_PRIVILEGE_MANAGER_CHECK_RESULT_ASK");
ppm_request_permission(path_privilege, reponse_cb, NULL);
break;
break;
}
} else {
- LOG_F(INFO, "Error to check permission[0x%x]", ret);
+ LOGI("Error to check permission[0x%x]", ret);
}
}
static bool _service_app_create(void *data)
{
ServiceContext *ctx = (ServiceContext*)data;
- const char *logPath = "/tmp/ua.log";
-
-
- loguru::g_preamble = false;
- loguru::add_file(logPath, loguru::Append, loguru::Verbosity_MAX);
- LOG_SCOPE_F(INFO, "Log : %s", logPath);
ctx->loop = g_main_loop_new ( NULL , FALSE );
ctx->thread = g_thread_new("grpc_thread", _grpc_thread_func, ctx);
try {
result = service_app_main(argc, argv, &event_callback, &ctx);
} catch (const std::exception& e) {
- LOG_F(INFO, "service_app_main exception: %s", e.what());
+ LOGI("service_app_main exception: %s", e.what());
}
return result;
+#include "bootstrap.h"
#include "ClearCommand.h"
-#include <UiObject.h>
-#include <loguru.hpp>
#include <string>
ClearCommand::ClearCommand(const ::aurum::ReqClear* request,
::grpc::Status ClearCommand::execute()
{
- LOG_SCOPE_F(INFO, "Clear --------------- ");
+ LOGI("Clear --------------- ");
ObjectMapper* mObjMap = ObjectMapper::getInstance();
std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
+#include "bootstrap.h"
#include "ClickCommand.h"
-
#include "UiObject.h"
#include "UiDevice.h"
-#include <loguru.hpp>
-
ClickCommand::ClickCommand(const ::aurum::ReqClick* request,
::aurum::RspClick* response)
: mRequest{request}, mResponse{response}
{
ObjectMapper* mObjMap = ObjectMapper::getInstance();
std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
- LOG_SCOPE_F(INFO, "ClickElementCommand execute %p", obj);
+ LOGI("ClickElementCommand execute %p", obj.get());
if (obj) {
obj->click();
{
std::shared_ptr<UiDevice> obj = UiDevice::getInstance();
const ::aurum::Point& point = mRequest->coordination();
- LOG_SCOPE_F(INFO, "ClickCoordCommand execute %p @ (%d, %d)", obj.get(), point.x(), point.y());
+ LOGI("ClickCoordCommand execute %p @ (%d, %d)", obj.get(), point.x(), point.y());
obj->click(point.x(), point.y());
mResponse->set_status(::aurum::RspStatus::OK);
return grpc::Status::OK;
ObjectMapper* mObjMap = ObjectMapper::getInstance();
std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
- LOG_SCOPE_F(INFO, "ClickAtspiCommand execute %p", obj);
+ LOGI("ClickAtspiCommand execute %p", obj.get());
if (obj) {
if (obj->DoAtspiActivate()) mResponse->set_status(::aurum::RspStatus::OK);
+#include "bootstrap.h"
#include "CloseAppCommand.h"
-#include <loguru.hpp>
#include <chrono>
#include <thread>
#ifdef GBSBUILD
::grpc::Status CloseAppCommand::execute()
{
- LOG_SCOPE_F(INFO, "CloseApp --------------- ");
+ LOGI("CloseApp --------------- ");
#ifdef GBSBUILD
std::string packageName = mRequest->packagename();
app_context_h app_context = NULL;
- LOG_F(INFO, "close req : %s", packageName.c_str());
+ LOGI("close req : %s", packageName.c_str());
int ret = app_manager_get_app_context(packageName.c_str(), &app_context);
if (ret) {
- LOG_SCOPE_F(INFO, "Terminate Failed(1/2) Err Code : %d", ret);
+ LOGI("Terminate Failed(1/2) Err Code : %d", ret);
mResponse->set_status(::aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
ret = app_manager_terminate_app(app_context);
if (ret) {
- LOG_SCOPE_F(INFO, "Terminate Failed(2/2) Err Code : %d", ret);
+ LOGI("Terminate Failed(2/2) Err Code : %d", ret);
mResponse->set_status(::aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
::grpc::Status CloseAppCommand::executePost()
{
- LOG_SCOPE_F(INFO, "CloseAppCommand::executePost");
+ LOGI("CloseAppCommand::executePost");
std::this_thread::sleep_for(std::chrono::milliseconds{1500});
return grpc::Status::OK;
}
\ No newline at end of file
#include "Command.h"
-#include <loguru.hpp>
::grpc::Status Command::executePost()
{
+#include "bootstrap.h"
#include "DumpObjectTreeCommand.h"
-
-#include "ISearchable.h"
-
-#include "Sel.h"
-#include "UiDevice.h"
#include "UiObject.h"
+#include "UiDevice.h"
#include "UiSelector.h"
-
-#include <loguru.hpp>
-
+#include "Sel.h"
+#include "ISearchable.h"
DumpObjectTreeCommand::DumpObjectTreeCommand(const ::aurum::ReqDumpObjectTree* request,
::aurum::RspDumpObjectTree* response)
::grpc::Status DumpObjectTreeCommand::execute()
{
- LOG_SCOPE_F(INFO, "DumpObjectTree --------------- ");
- LOG_F(INFO, "elementid : %s", mRequest->elementid().c_str());
+ LOGI("DumpObjectTree --------------- ");
+ LOGI("elementid : %s", mRequest->elementid().c_str());
if (mRequest->elementid().length()) {
auto obj = mObjMap->getElement(mRequest->elementid());
if (!obj) return grpc::Status::OK;;
+#include "bootstrap.h"
#include "FindElementCommand.h"
-
-#include "ISearchable.h"
-
-#include "Sel.h"
-#include "UiDevice.h"
#include "UiObject.h"
+#include "UiDevice.h"
#include "UiSelector.h"
-
-#include <loguru.hpp>
+#include "Sel.h"
+#include "ISearchable.h"
FindElementCommand::FindElementCommand(const ::aurum::ReqFindElement* request,
::aurum::RspFindElement* response)
::grpc::Status FindElementCommand::execute()
{
- LOG_SCOPE_F(INFO, "findElement --------------- ");
+ LOGI("findElement --------------- ");
auto searchableObj = getSearchableTop();
auto selectors = getSelectors();
key = mObjMap->getElement(found);
if (key.length() <= 0)
key = mObjMap->addElement(std::move(found));
- LOG_F(INFO, "found object : %s key:%s",
+ LOGI("found object : %s key:%s",
obj->getAutomationId().c_str(), key.c_str());
::aurum::Element* elm = mResponse->add_elements();
elm->set_elementid(key);
+#include "bootstrap.h"
#include "FlickCommand.h"
-#include <loguru.hpp>
-
-#include <UiDevice.h>
+#include "UiDevice.h"
FlickCommand::FlickCommand(const ::aurum::ReqFlick *request,
::aurum::RspFlick * response)
::grpc::Status FlickCommand::execute()
{
- LOG_SCOPE_F(INFO, "Flick --------------- ");
+ LOGI("Flick --------------- ");
const ::aurum::Point &startPoint = mRequest->startpoint();
const ::aurum::Point &endPoint = mRequest->endpoint();
+#include "bootstrap.h"
#include "GetAppInfoCommand.h"
-#include <loguru.hpp>
#ifdef GBSBUILD
#include <app_manager_extension.h>
#include <package_manager.h>
::grpc::Status GetAppInfoCommand::execute()
{
- LOG_SCOPE_F(INFO, "GetAppInfo --------------- ");
+ LOGI("GetAppInfo --------------- ");
#ifdef GBSBUILD
std::string packageName = mRequest->packagename();
+#include "bootstrap.h"
#include "GetAttributeCommand.h"
-#include <loguru.hpp>
-
-#include <UiDevice.h>
-#include <UiObject.h>
+#include "UiObject.h"
+#include "UiDevice.h"
GetAttributeCommand::GetAttributeCommand(
const ::aurum::ReqGetAttribute* request, ::aurum::RspGetAttribute* response)
{
::aurum::ReqGetAttribute_RequestType type = request->attribute();
- LOG_SCOPE_F(INFO, "type : %d", type);
+ LOGI("type : %d", type);
if (type == ::aurum::ReqGetAttribute_RequestType::ReqGetAttribute_RequestType_VISIBLE)
return std::make_unique<GetVisibleAttributeCommand>(request, response);
+#include "bootstrap.h"
#include "GetDeviceTimeCommand.h"
#include <system_settings.h>
#include <utils_i18n.h>
-
-#include <loguru.hpp>
-
-#include "UiDevice.h"
#include <string>
+#include "UiDevice.h"
#define BUFSIZE 64
::grpc::Status GetDeviceTimeCommand::execute()
{
- LOG_SCOPE_F(INFO, "GetDeviceTime --------------- ");
+ LOGI("GetDeviceTime --------------- ");
std::shared_ptr<UiDevice> obj = UiDevice::getInstance();
::aurum::ReqGetDeviceTime_TimeType type = mRequest->type();
+#include "bootstrap.h"
#include "GetLocationCommand.h"
-#include <loguru.hpp>
GetLocationCommand::GetLocationCommand(const ::aurum::ReqGetLocation* request,
::aurum::RspGetLocation* response)
::grpc::Status GetLocationCommand::execute()
{
- LOG_SCOPE_F(INFO, "CliGetLocation --------------- ");
+ LOGI("CliGetLocation --------------- ");
// ObjectMapper *mObjMap = ObjectMapper::getInstance();
mResponse->set_alt(-1);
+#include "bootstrap.h"
#include "GetSizeCommand.h"
-#include <loguru.hpp>
-
-#include <UiObject.h>
+#include "UiObject.h"
GetSizeCommand::GetSizeCommand(const ::aurum::ReqGetSize* request,
::aurum::RspGetSize* response)
::grpc::Status GetSizeCommand::execute()
{
- LOG_SCOPE_F(INFO, "GetSize --------------- ");
+ LOGI("GetSize --------------- ");
ObjectMapper *mObjMap = ObjectMapper::getInstance();
std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
if (obj) {
+#include "bootstrap.h"
#include "GetValueCommand.h"
-#include <loguru.hpp>
-
-#include <UiObject.h>
+#include "UiObject.h"
GetValueCommand::GetValueCommand(const ::aurum::ReqGetValue* request,
::aurum::RspGetValue* response)
::grpc::Status GetValueCommand::execute()
{
- LOG_SCOPE_F(INFO, "GetValue --------------- ");
+ LOGI("GetValue --------------- ");
ObjectMapper* mObjMap = ObjectMapper::getInstance();
std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
+#include "bootstrap.h"
#include "InstallAppCommand.h"
#include <fstream>
#include <chrono>
#include <thread>
-#include <loguru.hpp>
#ifdef GBSBUILD
#include <package_manager.h>
#endif
::grpc::Status InstallAppCommand::execute()
{
- LOG_SCOPE_F(INFO, "InstallApp --------------- ");
+ LOGI("InstallApp --------------- ");
#ifdef GBSBUILD
::aurum::ReqInstallApp chunk;
::grpc::Status InstallAppCommand::executePost()
{
- LOG_SCOPE_F(INFO, "InstallAppCommand::executePost");
+ LOGI("InstallAppCommand::executePost");
std::this_thread::sleep_for(std::chrono::milliseconds{5000});
return grpc::Status::OK;
}
\ No newline at end of file
+#include "bootstrap.h"
#include "KillServerCommand.h"
-#include <loguru.hpp>
KillServerCommand::KillServerCommand(const ::aurum::ReqEmpty* request,
::aurum::RspEmpty* response)
::grpc::Status KillServerCommand::execute()
{
- LOG_SCOPE_F(INFO, "Kill Server ");
+ LOGI("Kill Server ");
exit(1);
+#include "bootstrap.h"
#include "LaunchAppCommand.h"
-#include <loguru.hpp>
#include <chrono>
#include <thread>
::grpc::Status LaunchAppCommand::execute()
{
- LOG_SCOPE_F(INFO, "LaunchApp --------------- ");
+ LOGI("LaunchApp --------------- ");
#ifdef GBSBUILD
app_control_h appControl;
std::string packageName = mRequest->packagename();
ret = app_control_create(&appControl);
if (ret) {
- LOG_SCOPE_F(INFO, "Launch Failed(1/3) Err Code : %ull", ret);
+ LOGI("Launch Failed(1/3) Err Code : %ull", ret);
mResponse->set_status(::aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
ret = app_control_set_app_id(appControl, packageName.c_str());
if (ret) {
- LOG_SCOPE_F(INFO, "Launch Failed(2/3) Err Code : %ull", ret);
+ LOGI("Launch Failed(2/3) Err Code : %ull", ret);
mResponse->set_status(::aurum::RspStatus::ERROR);
app_control_destroy(appControl);
return grpc::Status::OK;
ret = app_control_send_launch_request(appControl, NULL, NULL);
if (ret) {
- LOG_SCOPE_F(INFO, "Launch Failed(3/3) Err Code : %ull", ret);
+ LOGI("Launch Failed(3/3) Err Code : %ull", ret);
mResponse->set_status(::aurum::RspStatus::ERROR);
app_control_destroy(appControl);
return grpc::Status::OK;
}
::grpc::Status LaunchAppCommand::executePost()
{
- LOG_SCOPE_F(INFO, "LaunchAppCommand::executePost");
+ LOGI("LaunchAppCommand::executePost");
std::this_thread::sleep_for(std::chrono::milliseconds{2500});
return grpc::Status::OK;
}
+#include "bootstrap.h"
#include "LongClickCommand.h"
-#include <loguru.hpp>
-
-#include <UiObject.h>
-#include <UiDevice.h>
+#include "UiObject.h"
+#include "UiDevice.h"
LongClickCommand::LongClickCommand(const ::aurum::ReqClick* request,
::aurum::RspClick* response)
::grpc::Status LongClickCommand::execute()
{
- LOG_SCOPE_F(INFO, "LongClick --------------- ");
+ LOGI("LongClick --------------- ");
ObjectMapper* mObjMap = ObjectMapper::getInstance();
::aurum::ReqClick_RequestType type = mRequest->type();
+#include "bootstrap.h"
#include "PostCommand.h"
#include <atspi/atspi.h>
-#include <loguru.hpp>
PostCommand::PostCommand() : PostCommand(nullptr) {}
PostCommand::PostCommand(Command *cmd) : mCommand{cmd} {}
::grpc::Status PostCommand::execute()
{
::grpc::Status rst = mCommand->execute();
- LOG_SCOPE_F(INFO, "PostCommand --------------- ");
+ LOGI("PostCommand --------------- ");
mCommand->executePost();
// do post-command
+#include "bootstrap.h"
#include "PreCommand.h"
#include <atspi/atspi.h>
-#include <loguru.hpp>
#include <thread>
#include <chrono>
::grpc::Status PreCommand::execute()
{
{
- LOG_SCOPE_F(INFO, "PreCommand --------------- ");
- display_state_e state;
- if (device_display_get_state(&state) != DEVICE_ERROR_NONE) {
- LOG_F(INFO, "getting display state has failed");
- }
+ LOGI("PreCommand --------------- ");
+ display_state_e state;
+ if (device_display_get_state(&state) != DEVICE_ERROR_NONE) {
+ LOGI("getting display state has failed");
+ }
bool isDisplayOn = DISPLAY_STATE_SCREEN_OFF != state;
if (device_power_wakeup(false) != DEVICE_ERROR_NONE) {
- LOG_F(INFO, "turning on display has failed");
+ LOGI("turning on display has failed");
}
if (!isDisplayOn)
+#include "bootstrap.h"
#include "RemoveAppCommand.h"
-#include <loguru.hpp>
#include <chrono>
#include <thread>
#ifdef GBSBUILD
::grpc::Status RemoveAppCommand::execute()
{
- LOG_SCOPE_F(INFO, "RemoveAppCommand::execute");
+ LOGI("RemoveAppCommand::execute");
#ifdef GBSBUILD
package_manager_request_h pkgRequest;
std::string name = mRequest->packagename();
int id;
- LOG_F(INFO, "package name :%s", name.c_str());
+ LOGI("package name :%s", name.c_str());
if (package_manager_request_create(&pkgRequest) == PACKAGE_MANAGER_ERROR_NONE) {
if (package_manager_request_uninstall(pkgRequest, name.c_str(), &id) == PACKAGE_MANAGER_ERROR_NONE) {
::grpc::Status RemoveAppCommand::executePost()
{
- LOG_SCOPE_F(INFO, "RemoveAppCommand::executePost");
+ LOGI("RemoveAppCommand::executePost");
std::this_thread::sleep_for(std::chrono::milliseconds{5000});
return grpc::Status::OK;
}
+#include "bootstrap.h"
#include "SendKeyCommand.h"
-#include <loguru.hpp>
-
-#include <UiDevice.h>
+#include "UiDevice.h"
SendKeyCommand::SendKeyCommand(const ::aurum::ReqKey* request,
::aurum::RspKey* response)
::grpc::Status SendKeyCommand::execute()
{
- LOG_SCOPE_F(INFO, "SendKey --------------- ");
+ LOGI("SendKey --------------- ");
std::shared_ptr<UiDevice> mDevice = UiDevice::getInstance();
::aurum::ReqKey_KeyType type = mRequest->type();
::aurum::ReqKey_KeyActionType action_type = mRequest->actiontype();
+#include "bootstrap.h"
#include "SetValueCommand.h"
-#include <loguru.hpp>
SetValueCommand::SetValueCommand(const ::aurum::ReqSetValue* request,
::aurum::RspSetValue* response)
::grpc::Status SetValueCommand::execute()
{
- LOG_SCOPE_F(INFO, "SetValue (text:%s) --------------- ", mRequest->stringvalue().c_str());
+ LOGI("SetValue (text:%s) --------------- ", mRequest->stringvalue().c_str());
ObjectMapper* mObjMap = ObjectMapper::getInstance();
std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
if (obj) obj->setText(const_cast<std::string&>(mRequest->stringvalue()));
+#include "bootstrap.h"
#include "TakeScreenshotCommand.h"
-#include <loguru.hpp>
+#include <fstream>
#include "UiObject.h"
#include "UiDevice.h"
-#include <fstream>
TakeScreenshotCommand::TakeScreenshotCommand(
const ::aurum::ReqTakeScreenshot* request,
::grpc::Status TakeScreenshotCommand::execute()
{
- LOG_SCOPE_F(INFO, "TakeScreenshot --------------- ");
+ LOGI("TakeScreenshot --------------- ");
std::string path = "/tmp/screenshot.png";
std::shared_ptr<UiDevice> mDevice = UiDevice::getInstance();
+#include "bootstrap.h"
#include "TouchDownCommand.h"
-#include <UiDevice.h>
-#include <loguru.hpp>
+#include "UiDevice.h"
TouchDownCommand::TouchDownCommand(const ::aurum::ReqTouchDown* request,
::aurum::RspTouchDown* response)
::grpc::Status TouchDownCommand::execute()
{
- LOG_SCOPE_F(INFO, "TouchDown --------------- ");
+ LOGI("TouchDown --------------- ");
const aurum::Point& point_ = mRequest->coordination();
int seq = UiDevice::getInstance()
->touchDown(point_.x(), point_.y());
+#include "bootstrap.h"
#include "TouchMoveCommand.h"
-#include <UiDevice.h>
-#include <loguru.hpp>
+#include "UiDevice.h"
TouchMoveCommand::TouchMoveCommand(const ::aurum::ReqTouchMove* request,
::aurum::RspTouchMove* response)
::grpc::Status TouchMoveCommand::execute()
{
- LOG_SCOPE_F(INFO, "TouchMove --------------- ");
+ LOGI("TouchMove --------------- ");
const aurum::Point& point = mRequest->coordination();
int seq = mRequest->seqid();
UiDevice::getInstance()->touchMove(point.x(), point.y(), seq);
+#include "bootstrap.h"
#include "TouchUpCommand.h"
-#include <UiDevice.h>
-#include <loguru.hpp>
+#include "UiDevice.h"
TouchUpCommand::TouchUpCommand(const ::aurum::ReqTouchUp* request,
::aurum::RspTouchUp* response)
::grpc::Status TouchUpCommand::execute()
{
- LOG_SCOPE_F(INFO, "TouchUp --------------- ");
+ LOGI("TouchUp --------------- ");
const aurum::Point& point = mRequest->coordination();
int seq = mRequest->seqid();
UiDevice::getInstance()->touchUp(point.x(), point.y(), seq);
#include "ObjectMapper.h"
#include <memory>
-#include <loguru.hpp>
+#include "bootstrap.h"
#include <algorithm>
#include <sstream>
mObjectMap[key] = object;
std::string value = object->getId();
mObjectMapReverse[value] = key;
- LOG_SCOPE_F(INFO, "addElement %p as key %s, id %s", object.get(), key.c_str(), value.c_str());
+ LOGI("addElement %p as key %s, id %s", object.get(), key.c_str(), value.c_str());
return key;
}
std::shared_ptr<UiObject> ObjectMapper::getElement(std::string key)
{
- LOG_SCOPE_F(INFO, "getElement for key(%s)", key.c_str());
+ LOGI("getElement for key(%s)", key.c_str());
unsigned long long keyCnt = (unsigned long long)std::stoll(key); // this key is a result of calling std:to_string(mObjCounter)
if (keyCnt <= 0 || keyCnt > mObjCounter) return nullptr;
if (mObjectMap.count(key)) {
std::shared_ptr<UiObject> obj = mObjectMap[key];
obj->refresh();
- LOG_F(INFO, "succeeded");
+ LOGI("succeeded");
return obj;
}
- LOG_F(INFO, "failed(object not found)");
+ LOGI("failed(object not found)");
return nullptr;
}
std::string ObjectMapper::getElement(std::shared_ptr<UiObject> object)
{
- LOG_SCOPE_F(INFO, "getElement for object(%p)", object.get());
+ LOGI("getElement for object(%p)", object.get());
std::string value = object->getId();
if (mObjectMapReverse.count(value)) {
- LOG_F(INFO, "succeeded");
+ LOGI("succeeded");
return mObjectMapReverse[value];
}
- LOG_F(INFO, "failed(object not found)");
+ LOGI("failed(object not found)");
return std::string{""};
}
bool ObjectMapper::removeElement(const std::string key)
{
- LOG_SCOPE_F(INFO, "removeElement for key(%s)", key.c_str());
+ LOGI("removeElement for key(%s)", key.c_str());
std::shared_ptr<UiObject> obj = getElement(key);
if (obj) {
std::string value = obj->getId();
bool ObjectMapper::removeElement(std::shared_ptr<UiObject> object)
{
- LOG_SCOPE_F(INFO, "removeElement for object(%p)", object.get());
+ LOGI("removeElement for object(%p)", object.get());
std::string key = getElement(object);
if (key.empty()) return false;
return removeElement(key);
{
std::stringstream ss{};
- LOG_SCOPE_F(INFO, "clean up object map");
+ LOGI("clean up object map");
ss << "mObjectMapReverse: ";
for(auto iter = mObjectMapReverse.begin(); iter != mObjectMapReverse.end(); ) {
auto obj = mObjectMap[iter->second];
}
}
ss << std::endl;
- LOG_F(INFO, "%s", ss.str().c_str());
+ LOGI("%s", ss.str().c_str());
}
// std::remove_if(mObjectMapReverse.begin(), mObjectMapReverse.end(), [](auto& pair){return !pair.first->isValid();});