Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BackPort] chore: update uplaod-artifact version #82

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
run: |
gbs -c .github/gbs.conf build -A armv7l -P profile.${{ matrix.profile }} --include-all --incremental --define 'lib_type shared'
- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: tizen_std_${{ matrix.profile }}
path: /home/runner/GBS-ROOT/${{ matrix.profile }}/local/repos/${{ matrix.profile }}/armv7l/RPMS/
Expand Down
10 changes: 10 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ def main(opts):
# 3. prepare gyp arguments
target_os = ('tizen' if opts.tizen else 'linux')
gen_build_dir = os.path.join(ROOT_DIR, 'out', target_os)
if opts.tizen:
gen_build_dir = os.path.join(gen_build_dir, opts.arch)
gyp_args += ['--depth=.']
gyp_args += ['--generator-output=' + gen_build_dir]
gyp_args += ['-Goutput_dir=' + gen_build_dir]
Expand Down Expand Up @@ -255,6 +257,14 @@ def setupCLIOptions(parser):
help='Debug build (%default)',
)

lwnode_optgroup.add_option(
'--arch',
dest='arch',
choices=['arm', 'x32', 'x64'],
default='x64',
help='Target architecture (%default)',
)

lwnode_optgroup.add_option(
'-v',
'--verbose',
Expand Down
2 changes: 1 addition & 1 deletion deps/node-bindings/src/gmainloop_node_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ void GmainLoopInit(GmainLoopNodeBindings* self) {
((SourceData*)uvsource)->node_bindings = self;

g_source_attach(uvsource, gcontext);
g_source_unref(uvsource);
}

void GmainLoopStart() {
Expand All @@ -111,6 +110,7 @@ void GmainLoopStart() {
void GmainLoopExit() {
if (uvsource) {
g_source_destroy(uvsource);
g_source_unref(uvsource);
}
if (gmainLoop) {
g_main_loop_unref(gmainLoop);
Expand Down
6 changes: 6 additions & 0 deletions include/lwnode/lwnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ class LWNODE_EXPORT Utils {
static v8::Local<v8::Value> NewLocal(v8::Isolate* isolate,
Escargot::ValueRef* ptr);

static bool CompileRun(Escargot::ContextRef* context,
const char* source,
bool isModule = false);

static bool IsRunningIsolate(Escargot::ContextRef* context);

static std::string trimLastNewLineIfNeeded(std::string&& str);
};

Expand Down
8 changes: 5 additions & 3 deletions modules/packages/device-api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
cmake_minimum_required(VERSION 2.8)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD 14)
project (device-api)

find_package (PkgConfig REQUIRED)
pkg_check_modules(PACKAGES REQUIRED dlog glib-2.0 pkgmgr-info tpk-manifest-handlers)
pkg_check_modules(PACKAGES REQUIRED dlog glib-2.0 pkgmgr-info tpk-manifest-handlers libevdev)

set(CMAKE_C_FLAGS "-std=gnu++14 -fPIE -Wno-invalid-offsetof -Wno-error=format=")

Expand All @@ -15,11 +15,13 @@ include_directories(
${PROJECT_ROOT_PATH}/deps/escargot/src/api
${PROJECT_ROOT_PATH}/deps/escargot/third_party/GCutil
${PROJECT_ROOT_PATH}/deps/escargot/third_party/GCutil/bdwgc/include
${PROJECT_ROOT_PATH}/deps/node/deps/uv/include
${PROJECT_ROOT_PATH}/src
include
${PACKAGES_INCLUDE_DIRS}
)


add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
target_link_libraries(${PROJECT_NAME} ${PACKAGES_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${PACKAGES_LIBRARIES} udev)
7 changes: 7 additions & 0 deletions modules/packages/device-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,10 @@ Support tizen device api.

let adapter = tizen.bluetooth.getDefaultAdapter();
```

## Requirements

### tvinputdevice
* When using tvinputdevice api in tpk package, you should add the following privilege to `tizen-manifest.xml`.
* `http://tizen.org/privilege/tv.inputdevice`
* `http://developer.samsung.com/privilege/inputdevice`
5 changes: 5 additions & 0 deletions modules/packages/device-api/src/Extension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <dlfcn.h>

#include "TizenDeviceAPIBase.h"
#include "TizenInputDeviceManager.h"
#include "ExtensionAdapter.h"
#include "EscargotPublic.h"
#include "TizenDeviceAPILoaderForEscargot.h"
Expand Down Expand Up @@ -93,6 +94,10 @@ bool Extension::Initialize() {
return false;
}

if (name_ == "tizen.tvinputdevice") {
DeviceAPI::TizenInputDeviceManager::getInstance()->start();
}

initialized_ = true;
DEVICEAPI_LOG_INFO("========== << Initialize >> END ==========");
return true;
Expand Down
43 changes: 42 additions & 1 deletion modules/packages/device-api/src/ExtensionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
#include <memory>
#include <iostream>
#include <fstream>

#include "lwnode/lwnode.h"
#include "TizenInputDeviceManager.h"
// #include "runtime_variable_provider.h"
// #include "picojson.h"
#include "TizenDeviceAPILoaderForEscargot.h"

using namespace DeviceAPI;

namespace wrt {
namespace xwalk {

Expand Down Expand Up @@ -179,5 +182,43 @@ void ExtensionManager::RegisterExtensionsByMetadata(
}
}

std::string ExtensionManager::HandleRuntimeSyncMessage(
Escargot::ContextRef* contextRef,
const std::string& type,
const std::string& value) {
if (!LWNode::Utils::IsRunningIsolate(contextRef)) {
return "error";
}

if (type == "tizen://api/inputdevice/registerKey") {
if (!TizenInputDeviceManager::getInstance()->registerKey(contextRef,
value)) {
return "error";
}
} else if (type == "tizen://api/inputdevice/unregisterKey") {
if (!TizenInputDeviceManager::getInstance()->unregisterKey(contextRef,
value)) {
return "error";
}
} else if (type == "tizen://api/inputdevice/registerKeyBatch") {
if (!TizenInputDeviceManager::getInstance()->registerKeyBatch(
contextRef, value)) {
return "error";
}
} else if (type == "tizen://api/inputdevice/unregisterKeyBatch") {
if (!TizenInputDeviceManager::getInstance()->unregisterKeyBatch(
contextRef, value)) {
return "error";
}

} else {
DEVICEAPI_LOG_ERROR("NOT IMPLEMENTED: HandleRuntimeSyncMessage(%s)",
type.c_str());
return "error";
}

return "success";
}

} // namespace xwalk
} // namespace wrt
10 changes: 9 additions & 1 deletion modules/packages/device-api/src/ExtensionManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
#include "XW_Extension_SyncMessage.h"
#include "Extension.h"

namespace Escargot {
class ContextRef;
}

namespace wrt {
namespace xwalk {

Expand All @@ -39,7 +43,11 @@ namespace xwalk {
void AddRuntimeVariable(const std::string& key, const std::string& value);
void GetRuntimeVariable(const char* key, char* value, size_t value_len) override;

private:
std::string HandleRuntimeSyncMessage(Escargot::ContextRef* contextRef,
const std::string& type,
const std::string& value);

private:
ExtensionManager();
virtual ~ExtensionManager();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
#include <dlfcn.h>
#include "ExtensionAdapter.h"
#include "ExtensionManager.h"

#include "TizenInputDeviceManager.h"

using namespace Escargot;
using namespace wrt::xwalk;

namespace DeviceAPI {

Expand Down Expand Up @@ -498,11 +499,38 @@ ObjectRef* ExtensionManagerInstance::createExtensionObject(
m_strings->sendRuntimeSyncMessage,
[](ExecutionStateRef* state, ValueRef* thisValue, size_t argc,
ValueRef** argv, bool isNewExpression) -> ValueRef* {
DEVICEAPI_LOG_ERROR(
"extension.sendRuntimeSyncMessage UNIMPLEMENTED");
printArguments(state->context(), argc, argv);
DEVICEAPI_ASSERT_SHOULD_NOT_BE_HERE();
return ValueRef::createUndefined();

ExtensionManagerInstance* extensionManagerInstance =
get(state->context());
ExtensionInstance* extensionInstance =
extensionManagerInstance
->getExtensionInstanceFromCallingContext(
state->context(), thisValue);

if (!extensionInstance || argc < 1) {
return ValueRef::createUndefined();
}

ValueRef* typeValue = argv[0];
if (!typeValue->isString()) {
return ValueRef::createUndefined();
}

std::string dataString;
if (argc > 1) {
dataString = argv[1]->isString()
? argv[1]->asString()->toStdUTF8String()
: std::string();
}

std::string reply =
ExtensionManager::GetInstance()->HandleRuntimeSyncMessage(
state->context(),
typeValue->asString()->toStdUTF8String(),
dataString);

return StringRef::createFromUTF8(reply.data(), reply.length());
},
0, true, true));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class ESPostListener;
F(tvaudiocontrol) \
F(preference) \
F(power) \
F(time)
F(time) \
F(tvinputdevice)

#define SUPPORTED_TIZEN_ENTRYPOINTS(F) \
F(ApplicationControl) \
Expand Down
73 changes: 73 additions & 0 deletions modules/packages/device-api/src/TizenInputDeviceKeyMap.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (c) 2024-present Samsung Electronics Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/

#ifndef __TizenInputDeviceKeyMap__
#define __TizenInputDeviceKeyMap__

namespace DeviceAPI {

// tizen, kernal, webapi name, webapi code
#define FOR_EACH_TIZEN_KEY_MAP_TV(F) \
F("0", 11, "0", 48) \
F("1", 2, "1", 49) \
F("2", 3, "2", 50) \
F("3", 4, "3", 51) \
F("4", 5, "4", 52) \
F("5", 6, "5", 53) \
F("6", 7, "6", 54) \
F("7", 8, "7", 55) \
F("8", 9, "8", 56) \
F("9", 10, "9", 57) \
F("Minus", 22, "minus", 189) \
F("XF86AudioRaiseVolume", 68, "VolumeUp", 447) \
F("XF86AudioLowerVolume", 67, "VolumeDown", 448) \
F("XF86AudioMute", 66, "VolumeMute", 449) \
F("XF86RaiseChannel", 88, "ChannelUp", 427) \
F("XF86LowerChannel", 87, "ChannelDown", 428) \
F("XF86Red", 59, "ColorF0Red", 403) \
F("XF86Green", 60, "ColorF1Green", 404) \
F("XF86Yellow", 61, "ColorF2Yellow", 405) \
F("XF86Blue", 62, "ColorF3Blue", 406) \
F("XF86SysMenu", 125, "Menu", 10133) \
F("XF86SimpleMenu", 127, "Tools", 10135) \
F("XF86Info", 188, "Info", 457) \
F("XF86Exit", 174, "Exit", 10182) \
F("XF86Search", 217, "Search", 10225) \
F("XF86ChannelGuide", 130, "Guide", 458) \
F("XF86AudioRewind", 168, "MediaRewind", 412) \
F("XF86AudioPause", 201, "MediaPause", 19) \
F("XF86AudioNext", 208, "MediaFastForward", 417) \
F("XF86AudioRecord", 167, "MediaRecord", 416) \
F("XF86AudioPlay", 200, "MediaPlay", 415) \
F("XF86AudioStop", 166, "MediaStop", 413) \
F("XF86PlayBack", 244, "MediaPlayPause", 10252) \
F("XF86PreviousChapter", 224, "MediaTrackPrevious", 10232) \
F("XF86NextChapter", 225, "MediaTrackNext", 10233) \
F("XF86Display", 64, "Source", 10072) \
F("XF86PictureSize", 132, "PictureSize", 10140) \
F("XF86PreviousChannel", 182, "PreviousChannel", 10190) \
F("XF86ChannelList", 65, "ChannelList", 10073) \
F("XF86EManual", 138, "E-Manual", 10146) \
F("XF86MTS", 187, "MTS", 10195) \
F("XF863D", 191, "3D", 10199) \
F("XF86SoccerMode", 220, "Soccer", 10228) \
F("XF86Caption", 213, "Caption", 10221) \
F("XF86TTXMIX", 192, "Teletext", 10200) \
F("XF86ExtraApp", 245, "Extra", 10253)

} // namespace DeviceAPI

#endif
Loading
Loading