platform/core/api/webapi-plugins.git
3 years ago[Metadata] Fixes for implementation 41/248441/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Thu, 26 Nov 2020 12:19:24 +0000 (13:19 +0100)]
[Metadata] Fixes for implementation

[Verification] Code works as expected by documentation, fixed crash
when calling api without arguments. Verified in chrome console

Change-Id: I80a021d1804d2b0ac55279df1d3d4cc699bc0a8b

3 years ago[Metadata] Add getSyncLyrics to MetadataHandle 23/248423/3
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Thu, 26 Nov 2020 08:55:11 +0000 (09:55 +0100)]
[Metadata] Add getSyncLyrics to MetadataHandle

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271

[Verification] Code compiles withotu errors.
Works well for mp3 file with SYLT data.

// Prectondition - file preparation (with python code)
// important - SYLT need to be UTF-8 or ISO-8859 encoded to be supported on Tizen device
from mutagen.id3 import ID3, SYLT, Encoding

tag = ID3("sample.mp3")
sync_lrc = [("TEST lyrics 1", 100),
            ("another TEST lyrics - 2", 2000),
            ("yet another TEST lyrics", 4000)]  # [(lrc, millisecond), ]
tag.setall("SYLT", [SYLT(encoding=Encoding.UTF8, lang='eng', format=2, type=1, text=sync_lrc)])
tag.save()

tag.getall("SYLT")

// then push file to device

// then run below code in chrome console
var path = "videos/sample.mp3";
var fileHandle = tizen.metadata.createFileHandle(path);
var lyrics_num = fileHandle.get("SYNCLYRICS_NUM");

for (var i = 0; i < lyrics_num; ++i) {
    var lyrics = fileHandle.getSyncLyrics(i);
    console.log("Lyrics " + i + " (" + lyrics.timestamp  + "ms): " + lyrics.lyrics);
}

// expected return be like
console-via-logger.js:173 Lyrics 0 (100ms): TEST lyrics 1
console-via-logger.js:173 Lyrics 1 (2000ms): another TEST lyrics - 2
console-via-logger.js:173 Lyrics 2 (4000ms): yet another TEST lyrics

Change-Id: I01a502f40655532a37fc4055480e35826bb7a697

3 years ago[Metadata] Aded getFrameAtTime method of MetadataFileHandle 90/245090/4
Piotr Kosko [Thu, 1 Oct 2020 08:10:30 +0000 (10:10 +0200)]
[Metadata] Aded getFrameAtTime method of MetadataFileHandle

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271

[Verification] Code compiles without errors.
Works well for mp4 video.
var path = "videos/sample_video.mp4";
function showBlob(bbb) {
    var elem = document.getElementById("blobImage") || document.createElement("img");
    elem.setAttribute("id", "blobImage");
    elem.setAttribute("height", "240");
    elem.setAttribute("width", "240");
    elem.setAttribute("alt", "invalid frame");
    document.getElementById("test").appendChild(elem)

    var objectURL = URL.createObjectURL(bbb);
    elem.src = objectURL;
}
var fileHandle = tizen.metadata.createFileHandle(path);
var frame = fileHandle.getFrameAtTime(2000, true);
console.log(frame);
showBlob(frame)

Change-Id: Ib39c32566fe1d63711d7ce5ce991f216d7a84389

3 years ago[Metadata] Aded getFrame method of MetadataFileHandle 71/245071/7
Piotr Kosko [Thu, 1 Oct 2020 06:02:45 +0000 (08:02 +0200)]
[Metadata] Aded getFrame method of MetadataFileHandle

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271

[Verification] Code compiles withotu errors.
Works well for mp4 video.
var path = "videos/sample_video.mp4";
function showBlob(bbb) {
    var elem = document.getElementById("blobImage") || document.createElement("img");
    elem.setAttribute("id", "blobImage");
    elem.setAttribute("height", "240");
    elem.setAttribute("width", "240");
    elem.setAttribute("alt", "invalid frame");
    document.getElementById("test").appendChild(elem)

    var objectURL = URL.createObjectURL(bbb);
    elem.src = objectURL;
}
var fileHandle = tizen.metadata.createFileHandle(path);
var frame = fileHandle.getFrame();
console.log(frame);
showBlob(frame)

Change-Id: I2d5e81b19d7f11ff2c08a0096a0b58fb7e3bfc48

3 years ago[Metadata] Added getArtwork method of MetadataFileHandle 64/245064/6
Piotr Kosko [Wed, 30 Sep 2020 06:23:20 +0000 (08:23 +0200)]
[Metadata] Added getArtwork method of MetadataFileHandle

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271

[Verification]
Code compiles without errors.
Checked in chrome console with below code.
Precondition: sample.mp3 with artwork need to be pushed on device

// test artwork
var path = "videos/sample.mp3";
function showBlob(bbb) {
    var elem = document.getElementById("blobImage") || document.createElement("img");
    elem.setAttribute("id", "blobImage");
    elem.setAttribute("height", "240");
    elem.setAttribute("width", "240");
    elem.setAttribute("alt", "invalid blob");
    document.getElementById("test").appendChild(elem)

    var objectURL = URL.createObjectURL(bbb);
    elem.src = objectURL;
}
var fileHandle = tizen.metadata.createFileHandle(path);
var artwork = fileHandle.getArtwork();
console.log(artwork);
showBlob(artwork)

Change-Id: Ia0cbe5ade542ad71224a91c0c1a4618072b5538e

3 years agoMerge branch 'tizen_6.0' into tizen 30/247930/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:28:05 +0000 (12:28 +0100)]
Merge branch 'tizen_6.0' into tizen

Change-Id: I2d08f181e8b6b7f3673d959c22f17cc67e8358f1

3 years agoMerge branch 'tizen_5.5' into tizen_6.0 29/247929/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:27:12 +0000 (12:27 +0100)]
Merge branch 'tizen_5.5' into tizen_6.0

Change-Id: If24e8f3bf63cc1315e49ea67801d2742b8f7eb55

3 years agoMerge branch 'tizen_5.0' into tizen_5.5 27/247927/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:25:23 +0000 (12:25 +0100)]
Merge branch 'tizen_5.0' into tizen_5.5

Change-Id: I813db4cffb3862ced142c7a94e62679259f53c6d

3 years agoMerge branch 'tizen_4.0' into tizen_5.0 26/247926/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:21:12 +0000 (12:21 +0100)]
Merge branch 'tizen_4.0' into tizen_5.0

Change-Id: I660b3b2b74fb33acbb89b9d06b7a230abee28315

3 years agoMerge branch 'tizen_3.0' into tizen_4.0 24/247924/4
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:15:48 +0000 (12:15 +0100)]
Merge branch 'tizen_3.0' into tizen_4.0

Change-Id: Ia0f2c393b1aa339c1881c084636dbfb91245602d

3 years ago[version] 2.45 35/247935/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 11:13:52 +0000 (12:13 +0100)]
[version] 2.45

Change-Id: I96f465c583720abbb514635a56adf50988bdac4f

3 years ago[Filesystem] Fix the position property when writing non-single-byte-signs 18/247918/3
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 18 Nov 2020 08:15:07 +0000 (09:15 +0100)]
[Filesystem] Fix the position property when writing non-single-byte-signs

[Bug] When FileStream object writes non-single-byte-signs, position members
was not properly updated.

[Verification] TCT filesystem - 100%
Below code:
(function writeKoreanOldAPI(fileName) {
    var dirPath = "documents/";
    var fullPath = dirPath + fileName;
    console.log("fullPath : " + fullPath);
    console.log("fileName : " + fileName);

    tizen.filesystem.resolve(fullPath, function (fileResult) {
        fileResult.openStream("w", function (fileStream) {
            fileStream.write("한글 확인 파일입니다\n");
            fileStream.write("한글111 확인 파일입니다\n");
            fileStream.write("한글22222 확인 파일입니다\n");

            fileStream.write("한글 확인 파일입니다\n");
            fileStream.write("한글 확인111 파일입니다\n");
            fileStream.write("한글 확인22222 파일입니다\n");

            fileStream.write("한글 확인 파일입니다\n");
            fileStream.write("한글 확인 파일입니다111\n");
            fileStream.write("한글 확인 파일입니다22222\n");
            fileStream.write("겆\n");
            fileStream.write("돐\n");

            fileStream.close();
        },
            function (e) {
                console.log("Error " + e.message);
            }, "UTF-8");

        fileResult.readAsText(
            function (str) {
                console.log("The file content:\n" + str);
                oldAPIResult = str;
            },
            function (e) {
                console.log("Error " + e.message);
            },
            "UTF-8");
    },
        function (e) {
            console.log("Error:" + e + " Create a file.");
            tizen.filesystem.resolve(dirPath, (dir) => { newFile = dir.createFile(fileName); });
            writeKoreanOldAPI(fileName);
        }, "rw");

})("test")

creates file with size of 302 bytes and content:
한글 확인 파일입니다
한글111 확인 파일입니다
한글22222 확인 파일입니다
한글 확인 파일입니다
한글 확인111 파일입니다
한글 확인22222 파일입니다
한글 확인 파일입니다
한글 확인 파일입니다111
한글 확인 파일입니다22222



Change-Id: I8ff3c158ed2b284e1cdeaa93c339952fef6915b0

3 years ago[Filesystem] Add support for ISO-8859-1 23/247923/2
Jakub Skowron [Tue, 23 Jan 2018 12:19:10 +0000 (13:19 +0100)]
[Filesystem] Add support for ISO-8859-1

Latin-1 encoding in FileReadString and FileWriteString

Change-Id: I2cd7942481619989891c3019d3f7d4325b962892
Signed-off-by: Jakub Skowron <j.skowron@samsung.com>
3 years ago[NBS] Add validation of instance to prevent crash 57/247857/1
Piotr Kosko [Thu, 5 Nov 2020 11:20:21 +0000 (12:20 +0100)]
[NBS] Add validation of instance to prevent crash

[Bug] In case of destroying instance before the operation:
* requestRouteToHost
* releaseRouteToHost
is finished, invalidated instance was used in code.

[Reproduction] In my case it was execution of below code max 10 times:
function crashApplicationWithNBS() {
    try {
        tizen.networkbearerselection.releaseRouteToHost(
            "CELLULAR", "www.onet.pl", addRouteAndReload, addRouteAndReload);
    } catch (e) {
        addRouteAndReload();
    }
}

function addRouteAndReload() {
    var statuscb =
    {
        onsuccess: function () {
            console.log("onsuccess func is called");
        },
        ondisconnected: function () {
            console.log("ondisconnected func is called");
        }
    };
    function ecb(e) {
        console.log("error callback is called: " + e.message + ": " + e.code);
    }
    setTimeout(() => {
        try {
            tizen.networkbearerselection.requestRouteToHost(
                "CELLULAR", "www.onet.pl", statuscb, ecb)
        } catch (e) { console.log(e) }
    }, 500);
    setTimeout(() => { location.href = "index.html"; }, 490);
}

[Verification]
* Crash does not occur. Crash situation is only signalled
with log:
DoAndPostMessage(264) > Trying to post message to non-existing instance: [0xb8cb1730], ignoring
* Success and error callbacks are properly triggered

Change-Id: I6adac13a8a99dbc114102bbd2ffced6bf012cfce

3 years agoMerge "[Systeminfo] Refactor for getCapability" into tizen
Piotr Kosko [Tue, 17 Nov 2020 07:15:06 +0000 (07:15 +0000)]
Merge "[Systeminfo] Refactor for getCapability" into tizen

3 years ago[Systeminfo] Refactor for getCapability 16/247416/5
Piotr Kosko [Tue, 10 Nov 2020 13:26:25 +0000 (14:26 +0100)]
[Systeminfo] Refactor for getCapability

The goal of this change is to avoid some strange error logs when 'trying' to gather
each type in the pipeline one after another. Now the type is checked first, then the value
is gathered.

[Verification] Code compiles without errors.
TCT passrate 100%.
Below calls behaviour didn't change (all capabilities listed in Web API documentation):

var caps = [
    'http://tizen.org/feature/content.scanning.others',
    'http://tizen.org/feature/datasync',
    'http://tizen.org/feature/download',
    'http://tizen.org/feature/network.telephony',
    'http://tizen.org/feature/network.wifi',
    'http://tizen.org/feature/systemsetting',
    'http://tizen.org/feature/systemsetting.home_screen',
    'http://tizen.org/feature/systemsetting.lock_screen',
    'http://tizen.org/feature/systemsetting.incoming_call',
    'http://tizen.org/feature/systemsetting.notification_email',
    'http://tizen.org/feature/network.bluetooth.audio.media',
    'http://tizen.org/feature/network.telephony',
    'http://tizen.org/feature/network.telephony.mms',
    'http://tizen.org/feature/battery',
    'http://tizen.org/feature/camera',
    'http://tizen.org/feature/camera.back',
    'http://tizen.org/feature/camera.back.flash',
    'http://tizen.org/feature/camera.front',
    'http://tizen.org/feature/camera.front.flash',
    'http://tizen.org/feature/database.encryption',
    'http://tizen.org/feature/fmradio',
    'http://tizen.org/feature/humanactivitymonitor',
    'http://tizen.org/feature/graphics.acceleration',
    'http://tizen.org/feature/led',
    'http://tizen.org/feature/input.keyboard',
    'http://tizen.org/feature/input.keyboard.layout',
    'http://tizen.org/feature/input.rotating_bezel',
    'http://tizen.org/feature/security.tee',
    'http://tizen.org/feature/location',
    'http://tizen.org/feature/location.batch',
    'http://tizen.org/feature/location.gps',
    'http://tizen.org/feature/location.wps',
    'http://tizen.org/feature/multimedia.transcoder',
    'http://tizen.org/feature/microphone',
    'http://tizen.org/feature/multi_point_touch.pinch_zoom',
    'http://tizen.org/feature/multi_point_touch.point_count',
    'http://tizen.org/feature/network.bluetooth',
    'http://tizen.org/feature/network.bluetooth.audio.call',
    'http://tizen.org/feature/network.bluetooth.audio.media',
    'http://tizen.org/feature/network.bluetooth.health',
    'http://tizen.org/feature/network.bluetooth.hid',
    'http://tizen.org/feature/network.bluetooth.le',
    'http://tizen.org/feature/network.bluetooth.opp',
    'http://tizen.org/feature/network.ethernet',
    'http://tizen.org/feature/network.internet',
    'http://tizen.org/feature/network.nfc',
    'http://tizen.org/feature/network.nfc.card_emulation',
    'http://tizen.org/feature/network.nfc.card_emulation.hce',
    'http://tizen.org/feature/network.nfc.p2p',
    'http://tizen.org/feature/network.nfc.reserved_push',
    'http://tizen.org/feature/network.nfc.tag',
    'http://tizen.org/feature/network.push',
    'http://tizen.org/feature/network.secure_element',
    'http://tizen.org/feature/network.telephony',
    'http://tizen.org/feature/network.telephony.mms',
    'http://tizen.org/feature/network.wifi',
    'http://tizen.org/feature/network.wifi.direct',
    'http://tizen.org/feature/opengles',
    'http://tizen.org/feature/opengles.texture_format',
    'http://tizen.org/feature/opengles.texture_format.3dc',
    'http://tizen.org/feature/opengles.texture_format.atc',
    'http://tizen.org/feature/opengles.texture_format.etc',
    'http://tizen.org/feature/opengles.texture_format.ptc',
    'http://tizen.org/feature/opengles.texture_format.pvrtc',
    'http://tizen.org/feature/opengles.texture_format.utc',
    'http://tizen.org/feature/opengles.version.1_1',
    'http://tizen.org/feature/opengles.version.2_0',
    'http://tizen.org/feature/platform.core.api.version',
    'http://tizen.org/feature/platform.core.cpu.arch',
    'http://tizen.org/feature/platform.core.cpu.arch.armv6',
    'http://tizen.org/feature/platform.core.cpu.arch.armv7',
    'http://tizen.org/feature/platform.core.cpu.arch.x86',
    'http://tizen.org/feature/platform.core.cpu.frequency',
    'http://tizen.org/feature/platform.core.fpu.arch',
    'http://tizen.org/feature/platform.core.fpu.arch.sse2',
    'http://tizen.org/feature/platform.core.fpu.arch.sse3',
    'http://tizen.org/feature/platform.core.fpu.arch.ssse3',
    'http://tizen.org/feature/platform.core.fpu.arch.vfpv2',
    'http://tizen.org/feature/platform.core.fpu.arch.vfpv3',
    'http://tizen.org/feature/platform.native.api.version',
    'http://tizen.org/feature/platform.native.osp_compatible',
    'http://tizen.org/feature/platform.version',
    'http://tizen.org/feature/platform.web.api.version',
    'http://tizen.org/feature/platform.version.name',
    'http://tizen.org/feature/profile',
    'http://tizen.org/feature/screen',
    'http://tizen.org/feature/screen.auto_rotation',
    'http://tizen.org/feature/screen.bpp',
    'http://tizen.org/feature/screen.coordinate_system.size.large',
    'http://tizen.org/feature/screen.coordinate_system.size.normal',
    'http://tizen.org/feature/screen.dpi',
    'http://tizen.org/feature/screen.height',
    'http://tizen.org/feature/screen.output.hdmi',
    'http://tizen.org/feature/screen.output.rca',
    'http://tizen.org/feature/screen.shape.circle',
    'http://tizen.org/feature/screen.shape.rectangle',
    'http://tizen.org/feature/screen.size.all',
    'http://tizen.org/feature/screen.size.large',
    'http://tizen.org/feature/screen.size.normal',
    'http://tizen.org/feature/screen.size.normal.240.400',
    'http://tizen.org/feature/screen.size.normal.320.320',
    'http://tizen.org/feature/screen.size.normal.320.480',
    'http://tizen.org/feature/screen.size.normal.360.360',
    'http://tizen.org/feature/screen.size.normal.360.480',
    'http://tizen.org/feature/screen.size.normal.480.800',
    'http://tizen.org/feature/screen.size.normal.540.960',
    'http://tizen.org/feature/screen.size.normal.600.1024',
    'http://tizen.org/feature/screen.size.normal.720.1280',
    'http://tizen.org/feature/screen.size.normal.1080.1920',
    'http://tizen.org/feature/screen.width',
    'http://tizen.org/feature/sensor.accelerometer',
    'http://tizen.org/feature/sensor.accelerometer.wakeup',
    'http://tizen.org/feature/sensor.activity_recognition',
    'http://tizen.org/feature/sensor.barometer',
    'http://tizen.org/feature/sensor.barometer.wakeup',
    'http://tizen.org/feature/sensor.gesture_recognition',
    'http://tizen.org/feature/sensor.gravity',
    'http://tizen.org/feature/sensor.gyroscope',
    'http://tizen.org/feature/sensor.gyroscope_rotation_vector',
    'http://tizen.org/feature/sensor.gyroscope.wakeup',
    'http://tizen.org/feature/sensor.heart_rate_monitor',
    'http://tizen.org/feature/sensor.heart_rate_monitor.led_green',
    'http://tizen.org/feature/sensor.heart_rate_monitor.led_ir',
    'http://tizen.org/feature/sensor.heart_rate_monitor.led_red',
    'http://tizen.org/feature/sensor.humidity',
    'http://tizen.org/feature/sensor.linear_acceleration',
    'http://tizen.org/feature/sensor.magnetometer',
    'http://tizen.org/feature/sensor.magnetometer.wakeup',
    'http://tizen.org/feature/sensor.pedometer',
    'http://tizen.org/feature/sensor.photometer',
    'http://tizen.org/feature/sensor.photometer.wakeup',
    'http://tizen.org/feature/sensor.proximity',
    'http://tizen.org/feature/sensor.proximity.wakeup',
    'http://tizen.org/feature/sensor.rotation_vector',
    'http://tizen.org/feature/sensor.sleep_monitor',
    'http://tizen.org/feature/sensor.temperature',
    'http://tizen.org/feature/sensor.tiltmeter',
    'http://tizen.org/feature/sensor.tiltmeter.wakeup',
    'http://tizen.org/feature/sensor.ultraviolet',
    'http://tizen.org/feature/sensor.wrist_up',
    'http://tizen.org/feature/shell.appwidget',
    'http://tizen.org/feature/sip.voip',
    'http://tizen.org/feature/speech.recognition',
    'http://tizen.org/feature/speech.synthesis',
    'http://tizen.org/feature/usb.accessory',
    'http://tizen.org/feature/usb.host',
    'http://tizen.org/feature/web.service',
    'http://tizen.org/feature/vision.face_recognition',
    'http://tizen.org/feature/vision.image_recognition',
    'http://tizen.org/feature/vision.qrcode_generation',
    'http://tizen.org/feature/vision.qrcode_recognition'
];

for (var i in caps) {
    try {
        console.log(
            'Value of ' + caps[i] + ': ' + tizen.systeminfo.getCapability(caps[i])
        );
    } catch (e) {
        console.log('Exception for ' + caps[i] + ': ' + e);
    }
}

Change-Id: Ia154396e3ec19dcb8b30f1c3b4f90a37bdd05738

3 years agoMerge "[Archive] Changing handling of Zip Path Traversal Vulnerability" into tizen
Piotr Kosko [Thu, 12 Nov 2020 13:22:01 +0000 (13:22 +0000)]
Merge "[Archive] Changing handling of Zip Path Traversal Vulnerability" into tizen

3 years ago[Archive] Changing handling of Zip Path Traversal Vulnerability 68/246868/4
Arkadiusz Pietraszek [Wed, 4 Nov 2020 18:20:42 +0000 (19:20 +0100)]
[Archive] Changing handling of Zip Path Traversal Vulnerability

This commit introduces verification of destination of extracted elements.
Before this commit ".." occurrence in archive entry resulted in
exception.

[Verification]
Manual test in developer console with prepared archive file shows
correct exception for ArchiveFile::extractAll and
ArchiveFileEntry::extract methods on TM1 and TW2.
tct-archive-tizen-tests pass rate: 100% on TM1 and TW2.

Change-Id: I823ff3d161bf1897fe98b6746cc0a1f60c874543
Signed-off-by: Arkadiusz Pietraszek <a.pietraszek@samsung.com>
4 years agoMerge "[Bluetooth] Prevent accessing inappropriate memory areas" into tizen
Piotr Kosko [Tue, 10 Nov 2020 10:26:46 +0000 (10:26 +0000)]
Merge "[Bluetooth] Prevent accessing inappropriate memory areas" into tizen

4 years ago[NBS] Add validation of instance to prevent crash 79/246979/5
Piotr Kosko [Thu, 5 Nov 2020 11:20:21 +0000 (12:20 +0100)]
[NBS] Add validation of instance to prevent crash

[Bug] In case of destroying instance before the operation:
* requestRouteToHost
* releaseRouteToHost
is finished, invalidated instance was used in code.

[Reproduction] In my case it was execution of below code max 10 times:
function crashApplicationWithNBS() {
    try {
        tizen.networkbearerselection.releaseRouteToHost(
            "CELLULAR", "www.onet.pl", addRouteAndReload, addRouteAndReload);
    } catch (e) {
        addRouteAndReload();
    }
}

function addRouteAndReload() {
    var statuscb =
    {
        onsuccess: function () {
            console.log("onsuccess func is called");
        },
        ondisconnected: function () {
            console.log("ondisconnected func is called");
        }
    };
    function ecb(e) {
        console.log("error callback is called: " + e.message + ": " + e.code);
    }
    setTimeout(() => {
        try {
            tizen.networkbearerselection.requestRouteToHost(
                "CELLULAR", "www.onet.pl", statuscb, ecb)
        } catch (e) { console.log(e) }
    }, 500);
    setTimeout(() => { location.href = "index.html"; }, 490);
}

[Verification]
* Crash does not occur. Crash situation is only signalled
with log:
DoAndPostMessage(264) > Trying to post message to non-existing instance: [0xb8cb1730], ignoring
* Success and error callbacks are properly triggered

Change-Id: I6adac13a8a99dbc114102bbd2ffced6bf012cfce

4 years ago[Bluetooth] Prevent accessing inappropriate memory areas 88/246188/10
Pawel Wasowski [Wed, 21 Oct 2020 23:13:27 +0000 (01:13 +0200)]
[Bluetooth] Prevent accessing inappropriate memory areas

This commit prevents from accessing inappropriate memory areas,
leading to crashes.

The first crash scenario:
1. connect to a remote GATT server:
device.connect(<callbacks>) // "device" was passed as an argument to
BluetoothLEAdapter::startScan() callback
2. save one of the services to a variable:
var service = device.getService(<a UUID>);
3. disconnect from the server:
device.disconnect(<callbacks>)
4. connect to the same GATT server again:
device.connect(<callbacks>); // "device" represents the same
device as in the 1st step
5. get the same service as before:
var service_new = device.getService(<the same UUID as in 2.>)
6. access one of the "service"'s members:
service.services
7. The app has crashed

The second crash scenario has not been observed, but we anticipate that
crashes could happen if the old code were run on 64-bit CPUs
(XWALK-2106).
The old code has stored bt_gatt_h (typedef for just void*) values
from C++ in the JS layer, as "double" variables. On 32-bit architectures,
a conversion of a pointer to double (from C++ to JS) and from double to
a pointer (from JS back to C++) gives us the same pointer.
On 64-bit systems, a pointer may be greater than the greatest integer,
guaranteed to have a double representation (Number.MAX_SAFE_INTEGER
in JS) and using a memory address, casted back from double may lead to
a crash or another unpredictable behavior.

[Verification]
tct-bluetooth-tizen-tests:
        auto: 100% pass rate
        manual Bluetooth04_BLE_wearable: 100% pass rate
When the first crash scenario has been followed in ChromeDev Tools, no
crash has happened.

Change-Id: I52dead1398b2d0aaf21c34c68f6bbcb04ebd3dba
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge branch 'tizen_5.5' into tizen 54/246854/1 accepted/tizen/6.0/unified/20201109.024725 accepted/tizen/unified/20201109.123531 submit/tizen/20201104.133613 submit/tizen_6.0/20201105.091219
Piotr Kosko [Wed, 4 Nov 2020 11:38:51 +0000 (12:38 +0100)]
Merge branch 'tizen_5.5' into tizen

Change-Id: I8a11ece18424a2f71dac69b4ec9cf586bd20723f

4 years ago[version] 2.68 37/246837/1 accepted/tizen_5.5_unified accepted/tizen/5.5/unified/20201109.020201 submit/tizen_5.5/20201104.133647
Piotr Kosko [Wed, 4 Nov 2020 11:36:44 +0000 (12:36 +0100)]
[version] 2.68

Change-Id: Ic8c9c7cb091cc178e9ba51914e561ba9a61d9cab

4 years agoMerge "[Application] Add check for user_data availability in AppControl callback...
Piotr Kosko [Wed, 4 Nov 2020 11:12:36 +0000 (11:12 +0000)]
Merge "[Application] Add check for user_data availability in AppControl callback" into tizen

4 years ago[Application] Add check for user_data availability in AppControl callback 32/246832/1
Rafal Walczyna [Fri, 9 Oct 2020 11:52:55 +0000 (13:52 +0200)]
[Application] Add check for user_data availability in AppControl callback

Sometimes result_callback from app-control fires after
ApplicationInstance destructor.

[verification] Build successful

Change-Id: If60467db9e97573aedc4b888dfbe68f5e16390fc
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years agoMerge changes I2573a59c,If524bc4f into tizen
Piotr Kosko [Mon, 26 Oct 2020 12:53:23 +0000 (12:53 +0000)]
Merge changes I2573a59c,If524bc4f into tizen

* changes:
  [Datacontrol] Prevent possible race conditions
  [datacontrol] Fix a few issues

4 years ago[Datacontrol] Prevent possible race conditions 51/246051/2
Pawel Wasowski [Wed, 21 Oct 2020 03:15:01 +0000 (05:15 +0200)]
[Datacontrol] Prevent possible race conditions

DataconstrolInstance::reply_map is accessed in callbacks
that can run in threads other than that, which runs API calls.
This commit adds a mutex and proper locks to prevent race
conditions.

[Verification] tct-datacontrol-tizen-tests: 100% pass rate

Change-Id: I2573a59c36af3e12a0d5e77598b170192d24f225
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[datacontrol] Fix a few issues 14/245914/3
Pawel Wasowski [Fri, 16 Oct 2020 22:02:05 +0000 (00:02 +0200)]
[datacontrol] Fix a few issues

This commit:
- adds freeing of the result passed to MAPGetResponseCallback
TODO: after fixing this problem, the app crashes. It was reported to
native developers and we need to wait for their answer, which will tell
us, if the result should be freed or not
- removes unused DatacontrolInstance::DataControlManagerGetConsumer
method
- adds handling errors of bundle_create() and bundle_add_str()
- adds the code destroying handles created in
DatacontrolInstance::Create{MAP, SQL}Handle() methods in case of
failures
- adds missing "const" and/or "&" in one of the functions to unify the
code style in the module
- fixes a grammar issue of one log message

[Verification] tct-datacontrol-tizen-tests: 100% pass rate

Change-Id: If524bc4f733762658a07993e39b8eaa9fe59d56d
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[Application] Add check for user_data availability in AppControl callback 61/245461/10
Rafal Walczyna [Fri, 9 Oct 2020 11:52:55 +0000 (13:52 +0200)]
[Application] Add check for user_data availability in AppControl callback

Sometimes result_callback from app-control fires after
ApplicationInstance destructor.

[verification] Build successful

Change-Id: If60467db9e97573aedc4b888dfbe68f5e16390fc
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years agoMerge "[datacontrol] Fix synchronisation issue" into tizen accepted/tizen_6.0_unified_hotfix tizen_6.0_hotfix accepted/tizen/6.0/unified/20201030.122119 accepted/tizen/6.0/unified/hotfix/20201103.004423 accepted/tizen/6.0/unified/hotfix/20201103.051525 accepted/tizen/unified/20201020.101858 submit/tizen/20201020.095518 submit/tizen_6.0/20201029.205102 submit/tizen_6.0_hotfix/20201102.192502 submit/tizen_6.0_hotfix/20201103.114802 tizen_6.0.m2_release
Piotr Kosko [Tue, 20 Oct 2020 07:52:36 +0000 (07:52 +0000)]
Merge "[datacontrol] Fix synchronisation issue" into tizen

4 years ago[Utils] Remove invalid line 40/245940/1
Rafal Walczyna [Tue, 20 Oct 2020 07:43:27 +0000 (09:43 +0200)]
[Utils] Remove invalid line

Line occurred due to merge issue. It caused LightWeightWeb engine to fail.

Change-Id: I78ed5b083cfa007c2e396464b9a50ad6398f3bcc
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years ago[datacontrol] Fix synchronisation issue 87/245687/4
k2.nagaraju [Wed, 14 Oct 2020 07:58:38 +0000 (13:28 +0530)]
[datacontrol] Fix synchronisation issue

k2.nagaraju:
In |RunMAPDataControlJob| updating the |IdMap| value and same value is
used in callback function |MAPAddResponseCallback| for any request id is
added. But before |RunMAPDataControlJob| updating value of |IdMap|,
getting |MAPAddResponseCallback| which is causing the failure with
|Invalid context|. Handled this scenario.

p.wasowski2:
Changed k2.nagaraju's commit a little to conform with the coding used in
the datacontrol module implementation and Web API.

[Verification] No synchronization issues in several runs of WebService2.wgt
app, attached to the related XWALK-2183 task (before, the problem,
signalled by "Invalid context" dlog entry, was reproducible on every run).
tct-datacontrol-tizen-tests: 100% pass rate

Signed-off-by: k2.nagaraju <k2.nagaraju@samsung.com>
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Change-Id: I247aaff45071331255528a62ffc5d8afa4b8e8af

4 years ago[Mediacontroller] Added refreshing the list of handles 94/245294/1 accepted/tizen/5.5/unified/20201103.003327 submit/tizen_5.5/20201026.095948
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Thu, 3 Sep 2020 08:35:44 +0000 (10:35 +0200)]
[Mediacontroller] Added refreshing the list of handles

[Bug] If native application (e.g. service) adds the playlist,
web api is able to gather it, but cannot perform any actions on it,
because web API stores only handles to playlists created by itself.

[Solution] Added functionality of refreshing handles always when gathering
a playlists handles using native API

[Verification] Code compiles without errors.

Change-Id: I9bb757f50c3bc4167b0a97c923d49a1ccbbe0195

4 years ago[Mediacontroller] Added refreshing the list of handles 23/243123/12 accepted/tizen/unified/20201007.090611 submit/tizen/20201006.121826
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Thu, 3 Sep 2020 08:35:44 +0000 (10:35 +0200)]
[Mediacontroller] Added refreshing the list of handles

[Bug] If native application (e.g. service) adds the playlist,
web api is able to gather it, but cannot perform any actions on it,
because web API stores only handles to playlists created by itself.

[Solution] Added functionality of refreshing handles always when gathering
a playlists handles using native API

[Verification] Code compiles without errors.

Change-Id: I9bb757f50c3bc4167b0a97c923d49a1ccbbe0195

4 years ago[Bluetooth][bugfix] Call success callbacks in registerService() 40/245140/1 submit/tizen/20201005.050422
Pawel Wasowski [Fri, 2 Oct 2020 16:28:27 +0000 (18:28 +0200)]
[Bluetooth][bugfix] Call success callbacks in registerService()

registerService() used to call successCallback only when registered
service had at least 1 component with read/write value request callback.
Now, the function will call successCallback even, if the service
has no components with such read/write value request calbacks.

[Verification] registerService() calls successCallback when no
read/write value request callbacks are registered

Change-Id: I4f4af260179fb21ac785dc1ccb0f5dab6d986496
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge branch tizen_5.5 into tizen 35/245135/4
Piotr Kosko [Fri, 2 Oct 2020 15:36:00 +0000 (17:36 +0200)]
Merge branch tizen_5.5 into tizen

Change-Id: I24dccce98a2419a5e75f16b446f450820bb792a7
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge branch 'tizen_5.0' into tizen_5.5 34/245134/3
Piotr Kosko [Fri, 2 Oct 2020 11:32:28 +0000 (13:32 +0200)]
Merge branch 'tizen_5.0' into tizen_5.5

Change-Id: I9a43855f32b1354ddbce403583d949e675c58073

4 years agoMerge branch 'tizen_4.0' into tizen_5.0 32/245132/1
Piotr Kosko [Fri, 2 Oct 2020 11:07:26 +0000 (13:07 +0200)]
Merge branch 'tizen_4.0' into tizen_5.0

Change-Id: Ic5b2736ab945e3c39cea6f32aae8d5532dd74558

4 years agoMerge branch 'tizen_3.0' into tizen_4.0 31/245131/1
Piotr Kosko [Fri, 2 Oct 2020 10:39:10 +0000 (12:39 +0200)]
Merge branch 'tizen_3.0' into tizen_4.0

Change-Id: I5424b41f13b345d9ff8b831f99b884f4a541b882

4 years ago[version] 2.45 27/245127/1
Piotr Kosko [Fri, 2 Oct 2020 10:20:21 +0000 (12:20 +0200)]
[version] 2.45

Change-Id: Ib116dd26b482abb5892e894f280141787f978435

4 years ago[Common] Fixed possible memory leak 26/245126/1
Piotr Kosko [Fri, 2 Oct 2020 10:19:32 +0000 (12:19 +0200)]
[Common] Fixed possible memory leak

[verification] Code compiles without errors

Change-Id: Ib8c7843461a575fd05d3b28e4db1fab35cc08ccb

4 years ago[version] 2.75 07/245107/1
Piotr Kosko [Fri, 2 Oct 2020 07:11:47 +0000 (09:11 +0200)]
[version] 2.75

Change-Id: Iadceec85547a133bfac39c77a6737714ea54a779

4 years ago[Bluetooth] Fixed code formatting 06/245106/1
Piotr Kosko [Fri, 2 Oct 2020 06:42:31 +0000 (08:42 +0200)]
[Bluetooth] Fixed code formatting

Change-Id: I2770d3735b9d606c5dd64fec877070b85942025c

4 years ago[Common] Applied some modifications from vd_fork 05/245105/1
Piotr Kosko [Fri, 2 Oct 2020 06:36:28 +0000 (08:36 +0200)]
[Common] Applied some modifications from vd_fork

* deprecation warninig mechanism
* systeminfo string keys

Change-Id: Iaaf87a0ab4e8a9b1d37628c21b5b6e339e81f982

4 years agoMerge "[Bluetooth] Add callbacks registering to GATTServer::registerService" into... accepted/tizen/unified/20200923.142546 submit/tizen/20200923.101308
Piotr Kosko [Wed, 23 Sep 2020 09:18:58 +0000 (09:18 +0000)]
Merge "[Bluetooth] Add callbacks registering to GATTServer::registerService" into tizen

4 years ago[Bluetooth] Add callbacks registering to GATTServer::registerService 48/244548/7
Rafal Walczyna [Mon, 21 Sep 2020 09:44:22 +0000 (11:44 +0200)]
[Bluetooth] Add callbacks registering to GATTServer::registerService

Register BluetoothGATT{Characteristic, Descriptor}::{read, write}ValueRequestCallbacks
in BluetoothGATTServer::registerService()

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-263
[TASK] https://code.sec.samsung.net/jira/browse/XWALK-2166

[Verification] Tested in Chrome developer console

Change-Id: Iee9a9b03627c5fb3d2b3c7941b128c4483953535
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years agoMerge branch 'tizen_5.5' into tizen 00/244700/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 23 Sep 2020 08:37:15 +0000 (10:37 +0200)]
Merge branch 'tizen_5.5' into tizen

Change-Id: I8883a87450ef33eb55f363ce3841dc8a9861657e

4 years agoMerge branch 'tizen_5.0' into tizen_5.5 99/244699/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 23 Sep 2020 08:27:57 +0000 (10:27 +0200)]
Merge branch 'tizen_5.0' into tizen_5.5

Change-Id: Ie3cfe5484b05a717edc31754efab8cf54faef126

4 years agoMerge branch 'tizen_4.0' into tizen_5.0 98/244698/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 23 Sep 2020 08:26:55 +0000 (10:26 +0200)]
Merge branch 'tizen_4.0' into tizen_5.0

Change-Id: I2d5d3c4758a7181f8b66dce90a67485083866ed0

4 years ago[version] 2.44 95/244695/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 23 Sep 2020 07:38:14 +0000 (09:38 +0200)]
[version] 2.44

Change-Id: I0caaa6af3791ad65fa165c45dfe37e5e01239b1b

4 years ago[Humanactivitymonitor] Fixed wrong behaviour of isGestureSupported() 96/244696/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Wed, 23 Sep 2020 07:32:14 +0000 (09:32 +0200)]
[Humanactivitymonitor] Fixed wrong behaviour of  isGestureSupported()

https://code.sec.samsung.net/jira/browse/XWALK-2175

Implementation should not throw NotSupportedError, but return true/false

[Verification] Code compiles without errors.

Change-Id: Ia19893338f9b573a29639b667b3b0b52c6584554

4 years ago[Bluetooth] Prevent crash in BLE advertising 26/244626/1
Pawel Wasowski [Wed, 16 Sep 2020 18:02:29 +0000 (20:02 +0200)]
[Bluetooth] Prevent crash in BLE advertising

bt_advertiser_h pointer was freed twice in some cases, which lead to
crashes. Setting it to a nullptr after the first destruction fixes the
problem.

[Verification] Tested crashing scenario in Chrome DevTools Console and
no crashes occurred with the change.
tct-tizen-bluetooth-tests: 100 % pass rate (auto; manual were not run,
because they don't test BluetoothLEAdapter APIs)

Change-Id: Ie0d3de744075a4c08e5266fed274e98a0d9567b8
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[Bluetooth] Stop server after unregistering last service 70/244470/3
Rafal Walczyna [Fri, 18 Sep 2020 13:10:28 +0000 (15:10 +0200)]
[Bluetooth] Stop server after unregistering last service

GATTServer has to be stopped in case of last service unregistration.

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-263
[TASK] https://code.sec.samsung.net/jira/browse/XWALK-2163

[Verification] Build successful. Tested in Chrome Console.
               Server stops when last service is unregistered.

Change-Id: I756bf9d944937e03f7e808c929e31140f4145add
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years agoImplement BluetoothGATTServer::unregisterAllServices() 74/244474/4
Dawid Juszczak [Fri, 18 Sep 2020 15:09:15 +0000 (17:09 +0200)]
Implement BluetoothGATTServer::unregisterAllServices()

[ACR]
https://code.sec.samsung.net/jira/browse/TWDAPI-263

[Verification]
Tested manually on chrome console

Change-Id: Ice5bfbd3fa4a8da75119db6b8e47849ca4259c26
Signed-off-by: Dawid Juszczak <d.juszczak@samsung.com>
4 years ago[Bluetooth] Reregister read/write value request callbacks on server start 81/244281/6
Pawel Wasowski [Wed, 16 Sep 2020 04:04:54 +0000 (06:04 +0200)]
[Bluetooth] Reregister read/write value request callbacks on server start

This commit implements reregistering read/write value callbacks,
that were once registered before a BluetoothGATTServer::stop() call.

[Verification] Tested in Chrome DevTools, callbacks are reregistered
after restarting the server

Change-Id: If67ee9ccf56b1aaac65a6c830b0b24ddf6e39b36
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge "[Bluetooth] Clear all GATT data after unregistering all services" into tizen
Piotr Kosko [Mon, 21 Sep 2020 08:14:55 +0000 (08:14 +0000)]
Merge "[Bluetooth] Clear all GATT data after unregistering all services" into tizen

4 years ago[Bluetooth] Clear all GATT data after unregistering all services 73/244473/3
Pawel Wasowski [Wed, 16 Sep 2020 10:03:50 +0000 (12:03 +0200)]
[Bluetooth] Clear all GATT data after unregistering all services

This commit clears_id->gatt_h and _id->callback names mappings from
BluetoothGATTServerService when the server is stopped.

[Verification] This change is tested together with the commit
implementing reregistration of read/write callbacks and works fine.

Change-Id: I4c16674f4856bb1fa74f4db74b6bbe9119f3b29f
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge "[Bluetooth] Bugfix: prevent memory leak" into tizen
Piotr Kosko [Mon, 21 Sep 2020 08:01:28 +0000 (08:01 +0000)]
Merge "[Bluetooth] Bugfix: prevent memory leak" into tizen

4 years agoMerge "[Bluetooth] Remove redundant Destroy* functions" into tizen
Piotr Kosko [Mon, 21 Sep 2020 08:01:22 +0000 (08:01 +0000)]
Merge "[Bluetooth] Remove redundant Destroy* functions" into tizen

4 years ago[Bluetooth] Bugfix: prevent memory leak 81/244481/2
Pawel Wasowski [Wed, 16 Sep 2020 14:11:26 +0000 (16:11 +0200)]
[Bluetooth] Bugfix: prevent memory leak

In the previous implementation if a service was successfully created,
but its registration failed, the resources associated with its handle
were not released.
Such a situation has occurred when Bluetooth was disabled and
BluetoothGATTServer::registerService() was called.
This commit adds the missing line that destroys the handle.

[Verification] The code compiles.
Tested in chrome console - server is successfully created and reports
errors in case of disabled bluetooth adapter. No crash or other issues observed.

Change-Id: I85741e51638abd6b5443d7f7ce5d84e9279fc498
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[Bluetooth] Remove redundant Destroy* functions 80/244480/3
Pawel Wasowski [Wed, 16 Sep 2020 14:03:51 +0000 (16:03 +0200)]
[Bluetooth] Remove redundant Destroy* functions

Destroy* functions from BluetoothGATTServer class were removed, because
they internally destroyed nested GATT objects.
Such behavior is safe, but redundant, because the native methods already
destroy nested objects.
Their usages were replaced by their counterparts from
BluetoothGATTServerService class.

[Verification] The code compiles. Tested in chrome console together with
https://review.tizen.org/gerrit/#/c/platform/core/api/webapi-plugins/+/244481/
No issues observed.

Change-Id: Ied428687fd4467fe9418afa9f87446c3a9b5b147
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge branch 'tizen_5.0' into tizen_5.5 69/244469/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Fri, 18 Sep 2020 12:55:00 +0000 (14:55 +0200)]
Merge branch 'tizen_5.0' into tizen_5.5

Change-Id: Id032af991b0670d09d5ff35aa4c142669cd26959

4 years agoMerge branch 'tizen_4.0' into tizen_5.0 64/244464/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Fri, 18 Sep 2020 12:51:12 +0000 (14:51 +0200)]
Merge branch 'tizen_4.0' into tizen_5.0

Change-Id: I5f25a22be8b2092b9f290b916bd3e47aa61828ab

4 years agoMerge "[Bluetooth] Add bluetooth power off listener for GATTServer" into tizen accepted/tizen/unified/20200921.042427 submit/tizen/20200918.124009
Piotr Kosko [Fri, 18 Sep 2020 12:32:29 +0000 (12:32 +0000)]
Merge "[Bluetooth] Add bluetooth power off listener for GATTServer" into tizen

4 years agoMerge branch 'tizen_3.0' into tizen_4.0 60/244460/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Fri, 18 Sep 2020 12:14:28 +0000 (14:14 +0200)]
Merge branch 'tizen_3.0' into tizen_4.0

Change-Id: I0abc0ed3a4c04aa1df20e4ef1b804cad4aed2088

4 years ago[version] 2.43 59/244459/1
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Fri, 18 Sep 2020 12:08:38 +0000 (14:08 +0200)]
[version] 2.43

Change-Id: I1f760b29b975107288cf2b5595f94db168148f4e

4 years ago[Bluetooth][Pre-6.0] Fix BluetoothLEDevice::getServiceAllUuids() 58/244458/1
Pawel Wasowski [Wed, 5 Feb 2020 13:00:47 +0000 (14:00 +0100)]
[Bluetooth][Pre-6.0] Fix BluetoothLEDevice::getServiceAllUuids()

[Bug] When some remote device advertises non-standard UUID, it was invalidly
translated to 16bit UUID. Which caused "NotFoundError: Service not found" error
in case of reading this service.

Inlcudes:
* fix for BluetoothLEDevice::getServiceAllUuids based on 6.0 implementation
* moving toLowerCase() from messaging to common module (needed for a fix)

[Verification]
Auto TCT 100% pass.

Tested in console:

Precondition:
Remote device need to have a GATT server advertising some non-standard UUID service, e.g.
"12341234-1234-1234-1234-123412341234". Below code should work if your remote device "MyDevice"
has proper service with a characteristic.

Last result will be something like "Value read from 1 characteristic -> 116,101,115,116"

var testDeviceName = "MyDevice";
var nonStandardUUID = "12341234-1234-1234-1234-123412341234";

var device;
function testBle(name) {
    var adapter = tizen.bluetooth.getLEAdapter();

    adapter.startScan(function (device_) {
        device = device_;
        //Item one occurs here:
        if (device.name)
            console.log("Found: " + JSON.stringify(device))
        if (device.name === name) {
            console.log("[Found device] address: " + JSON.stringify(device));
            adapter.stopScan();

            device.connect(function () {
                console.log("[Connected]");
                uuids = device.getServiceAllUuids();
                console.log("all UUIDS\n" + JSON.stringify(uuids))

                if (uuids.includes(nonStandardUUID)) {
                    console.log("Reading: " + nonStandardUUID);
                    var service = device.getService(nonStandardUUID);
                    if (service.characteristics.length > 0) {
                        for (j = 0; j < service.characteristics.length; ++j) {
                            var characteristic = service.characteristics[j];
                            characteristic.readValue(function (val) {
                                console.log("Value read from " + j + " characteristic -> " + val);
                            });
                        }
                    } else {
                        console.log("no characteristics found for service: " + uuid)
                    }
                } else {
                    console.error("UUID " + nonStandardUUID + " not found ");
                }
            }, (e) => console.log(e));
        }
    }, (e) => console.log(e))
}
testBle(testDeviceName)

Change-Id: I38494b6b5037cf06ee7c4bc32d2f8f5e8e6ce97e

4 years ago[Bluetooth] Add bluetooth power off listener for GATTServer 54/244454/2
Rafal Walczyna [Fri, 18 Sep 2020 11:25:33 +0000 (13:25 +0200)]
[Bluetooth] Add bluetooth power off listener for GATTServer

GATTServer has to be stopped in case of bluetooth power off.

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-263
[TASK] https://code.sec.samsung.net/jira/browse/XWALK-2161

[Verification] Tested in Chrome developer console

Change-Id: I92cca9dec5b7847b5073e88845846ce5e8446474
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years ago[Bluetooth] Implement BluetoothGATTServerCharacteristic::notifyAboutValueChange() 94/242894/12
Dawid Juszczak [Tue, 1 Sep 2020 18:43:19 +0000 (20:43 +0200)]
[Bluetooth] Implement BluetoothGATTServerCharacteristic::notifyAboutValueChange()
https://code.sec.samsung.net/jira/browse/TWDAPI-263

[Verification]
TODO

Change-Id: Id8e09ed2adee2c1e400c0979672569ae6f3f49c2
Signed-off-by: Dawid Juszczak <d.juszczak@samsung.com>
4 years ago[Spec] Fixing conditional statement while generate rpm 07/244407/1
Lukasz Bardeli [Fri, 4 Sep 2020 10:39:26 +0000 (12:39 +0200)]
[Spec] Fixing conditional statement while generate rpm

At begining of spec file emulator feature flags are defined.
If any profile parameter was passed to spec file from command line then if statement
with emultor feature flag were always true.

[Verification] Code compiles without error

Change-Id: I83a82334e9f4655590fd96c1fc558e1888cb928d
(cherry picked from commit 46ed227bbc81256cc3d88fed2995e70f2659131e)

4 years ago[Spec] Fixing conditional statement while generate rpm 03/244403/1
Lukasz Bardeli [Fri, 4 Sep 2020 10:39:26 +0000 (12:39 +0200)]
[Spec] Fixing conditional statement while generate rpm

At begining of spec file emulator feature flags are defined.
If any profile parameter was passed to spec file from command line then if statement
with emultor feature flag were always true.

[Verification] Code compiles without error

Change-Id: I83a82334e9f4655590fd96c1fc558e1888cb928d
(cherry picked from commit 46ed227bbc81256cc3d88fed2995e70f2659131e)

4 years ago[Bluetooth] Make error message more precise 79/244479/2
Pawel Wasowski [Wed, 16 Sep 2020 13:51:09 +0000 (15:51 +0200)]
[Bluetooth] Make error message more precise

[Verification] Code compiles

Change-Id: I252f82a0aede03297b852b9ad1e17bf5c71ec1b6
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[Bluetooth] Change default error used by server's getConnectionMtu() 09/244409/2
Pawel Wasowski [Wed, 16 Sep 2020 05:26:14 +0000 (07:26 +0200)]
[Bluetooth] Change default error used by server's getConnectionMtu()

According to the API reference, the default error used by
BluetoothGATTServer::getConnectionMtu() should be AbortError and
not UnknownError.
This commit fixes that.

[Verification] Code compiles, getConnectionMtu() works fine in console.

Change-Id: Ice6c7ac1a75418069ede94c3d8203cbb781f3d57
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years agoMerge "[Bluetooth] Added servicesData to BluetoothLEAdvertiseData" into tizen
Lukasz Bardeli [Fri, 18 Sep 2020 07:45:41 +0000 (07:45 +0000)]
Merge "[Bluetooth] Added servicesData to BluetoothLEAdvertiseData" into tizen

4 years ago[Bluetooth] Added servicesData to BluetoothLEAdvertiseData 38/244338/2
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Thu, 17 Sep 2020 09:01:43 +0000 (11:01 +0200)]
[Bluetooth] Added servicesData to BluetoothLEAdvertiseData

servicesData has a higher priority of usage over serviceData.
To avoid problems with duplicated datas in both sets, deprecated member
serviceData is used only if servicesData is null or undefined.

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-267

[Verification] Auto Bluetooth TCTs pass.

Change-Id: I4bb9e9a5e953a660f60d8e2b863291f848eae38f

4 years agoAdd BluetoothGATTServer::isRunning implementation 17/244317/3
Rafal Walczyna [Thu, 17 Sep 2020 07:32:14 +0000 (09:32 +0200)]
Add BluetoothGATTServer::isRunning implementation

Property isRunning has been added to JS BluetoothGATTServer
Changes of property are handled by C++ function
BluetoothGATTServer::SetRunningState. It should be called instead
of changing BluetoothGATTServer::running_ value manually.

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-263

[Verification] Tested in Chrome developer console

Change-Id: I423dee736624df61d2cd98096407f33e6003e6ea
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years agoMerge "[Bluetooth] Fix writeValue method from BluetoothGATT" into tizen
Piotr Kosko [Wed, 16 Sep 2020 11:32:34 +0000 (11:32 +0000)]
Merge "[Bluetooth] Fix writeValue method from BluetoothGATT" into tizen

4 years ago[Bluetooth] Implement BluetoothGATTServer{Characteristic|Descriptor}::setWriteValueRe... 68/243868/6
Arkadiusz Pietraszek [Thu, 10 Sep 2020 16:59:10 +0000 (18:59 +0200)]
[Bluetooth] Implement BluetoothGATTServer{Characteristic|Descriptor}::setWriteValueRequestCallback

[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-263

[Verification] Basic use cases were tested in Chrome Dev Tools and run
               properly. More thorough verification should yet be done.

Change-Id: I676dd8f06f8a9b19c2c98ffeaf21cfc9e3fd19d3
Signed-off-by: Arkadiusz Pietraszek <a.pietraszek@samsung.com>
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[Bluetooth] Implement BluetoothGATTServerDescriptor::setReadValueRequestCallback() 86/244186/3
Pawel Wasowski [Tue, 15 Sep 2020 14:37:55 +0000 (16:37 +0200)]
[Bluetooth] Implement BluetoothGATTServerDescriptor::setReadValueRequestCallback()

This commit isolates the implementation of setReadValueRequestCallback,
which is common for GATT characteristic and descriptor and adds it to
both these interfaces.

[Verification] Tested manually in Chrome DevTools. It works fine

Change-Id: I721db57deb597634dedad3b947590ad7a6e116b7
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[Bluetooth][Bugfix] Copy value we don't own before passing to a worker 85/244185/1
Pawel Wasowski [Tue, 15 Sep 2020 15:24:04 +0000 (17:24 +0200)]
[Bluetooth][Bugfix] Copy value we don't own before passing to a worker

const char *remote_address is passed as an argument from
Native API to our callback, that adds a job to the Bluetooth's
worker.
Previously, the remote_address pointer was passed straight
to the worker. When referenced, it was already garbage.
This commit adds a copy of this value, so that the worker gets
proper data.

[Validation] Tested in Chrome DevTools. remoteAddress in JS is
a valid MAC address.

Change-Id: Id571296861775fee70d93ca94c4da0b496f9d3c8
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[Bluetooth] Fix writeValue method from BluetoothGATT 84/244184/1
Rafal Walczyna [Tue, 15 Sep 2020 13:27:31 +0000 (15:27 +0200)]
[Bluetooth] Fix writeValue method from BluetoothGATT

There was an exception when user has not provided callbacks parameters.
successCallback and errorCallback was set to undefined, what caused
validator to fail.

Added array validate to toDOMString method of BluetoothManager

[Verification] tct-bluetooth auto: 100% pass
BluetoothGATTCombined: 100% pass

Change-Id: If0aa54fee7f19850d3bc94d8936476c0b322dc39
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years ago[Bluetooth] Implement BluetoothGATTServerCharacteristic::setReadValueRequestCallback 83/241383/16
Pawel Wasowski [Tue, 18 Aug 2020 15:17:01 +0000 (17:17 +0200)]
[Bluetooth] Implement BluetoothGATTServerCharacteristic::setReadValueRequestCallback

[Verification] Basic use cases were tested in Chrome Dev Tools and run
               properly. More thorough verification should yet be done.

Change-Id: I4d59ac356889c132fc0901435a2fd0d7e7c5c9df
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Signed-off-by: Arkadiusz Pietraszek <a.pietraszek@samsung.com>
4 years ago[Bluetooth] BLEAdapter isScanning and BLEDevice new functions. 35/235535/19
Arkadiusz Pietraszek [Mon, 13 Jul 2020 12:20:35 +0000 (14:20 +0200)]
[Bluetooth] BLEAdapter isScanning and BLEDevice new functions.

[ACR] TWDAPI-264

Bluetooth module can be upgraded with these functions provided by native layer:
BluetoothLEAdapter
bool isScanning ()

BluetoothLEDevice
bool isConnected ()
unsigned long getAttMtu ()
void requestAttMtuChange (unsigned long newAttMtu)
long addAttMtuChangeListener (ConnectionMTUCallback callback)
void removeAttMtuChangeListener (long watchId)

[Verification] New functionality has been tested on TW2 device in
developer console.

Change-Id: Id5f56ee4d67591b6d917552c6b7a09d2a5a06386
Signed-off-by: Arkadiusz Pietraszek <a.pietraszek@samsung.com>
4 years ago[Bluetooth] Implement BluetoothGATTServerService::unregister() 09/241209/10
Pawel Wasowski [Tue, 18 Aug 2020 03:08:55 +0000 (05:08 +0200)]
[Bluetooth] Implement BluetoothGATTServerService::unregister()

This commit implements Implement BluetoothGATTServerService::unregister()
in JS and native layers.

[Verification] Basic tests in Chrome Dev Tools have shown that it works.
               More thorough tests may be needed.

Change-Id: I0d0cd99ea2e11337ac19970d07ec92730c1cb2a0
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[Bluetooth] Representation of binary data unification - exceptions fix 84/243984/1
Arkadiusz Pietraszek [Fri, 11 Sep 2020 17:18:59 +0000 (19:18 +0200)]
[Bluetooth] Representation of binary data unification - exceptions fix

Fixed misarg case. Before TypeError was thrown.
Corrected to TypeMismachError.

[Verification] Errors tested in developer console.

[ACR] TWDAPI-259

Change-Id: Ifdfc9682ed31f2cbb9f16d0d63cb2056412a9236
Signed-off-by: Arkadiusz Pietraszek <a.pietraszek@samsung.com>
4 years ago[Bluetooth] Added checking for null data 26/243826/1 accepted/tizen/unified/20200911.143315 submit/tizen/20200911.055107
Piotr Kosko/Native/Web API (PLT) /SRPOL/Engineer/Samsung Electronics [Thu, 10 Sep 2020 09:10:18 +0000 (11:10 +0200)]
[Bluetooth] Added checking for null data

[Verification] BT auto 100%
Manual test BluetoothSocket - subtest BluetoothSocket_writeData_misarg fixed.

Change-Id: I44f27a5f5bee1dae73017ce736709b4c464471c2

4 years agoMerge "[Utils] Change Utils.prototype.assert method to more generic" into tizen
Piotr Kosko [Wed, 9 Sep 2020 10:07:18 +0000 (10:07 +0000)]
Merge "[Utils] Change Utils.prototype.assert method to more generic" into tizen

4 years ago[Utils] Change Utils.prototype.assert method to more generic 22/243722/1
Rafal Walczyna [Wed, 9 Sep 2020 09:44:46 +0000 (11:44 +0200)]
[Utils] Change Utils.prototype.assert method to more generic

Starfish engine, which is used in WebWidgets, does not support console.assert

[Verification] WebWidgetTCT runs succesfully

Change-Id: I6286537c6bc8995b5fd3c0a60f22b2d2595ed787
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years ago[version] 2.73 97/243697/1 accepted/tizen/unified/20200910.123927 submit/tizen/20200909.074050
Piotr Kosko [Wed, 9 Sep 2020 07:28:28 +0000 (09:28 +0200)]
[version] 2.73

Change-Id: I18dd6d47c83cafcfad79fd56688e263457a65bd7

4 years ago[Bluetooth] Implement re-registering GATT services on server start 87/240887/14
Pawel Wasowski [Wed, 12 Aug 2020 10:48:16 +0000 (12:48 +0200)]
[Bluetooth] Implement re-registering GATT services on server start

The services, that are once successfully registered on the local GATT
server will be present on it and re-registered on each start() call.
This commit implements re-registering services on start.

[Verification] Reregistering works - services that were present before
stop() are reregistered in the server after start().

Change-Id: I973ab73f652a8faa72fa2c933ae27666e1fe611a
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
4 years ago[HAM] Remove WRIST_UP gesture 83/243583/2
Rafal Walczyna [Tue, 8 Sep 2020 08:37:44 +0000 (10:37 +0200)]
[HAM] Remove WRIST_UP gesture

WRIST_UP is not supported natively since Tizen 6.0.

TWDAPI-269

[Verification] Build successful
Two tests fails - start and stop WRIST_UP (TypeMismatchError)

Change-Id: If09be9c1ce578adab1ec518b03be2884ea07ed51
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years agoMerge "[HAM] Deprecate gesture and activity methods" into tizen
Piotr Kosko [Tue, 8 Sep 2020 07:21:54 +0000 (07:21 +0000)]
Merge "[HAM] Deprecate gesture and activity methods" into tizen

4 years ago[Spec] Fixing conditional statement while generate rpm 95/243295/2
Lukasz Bardeli [Fri, 4 Sep 2020 10:39:26 +0000 (12:39 +0200)]
[Spec] Fixing conditional statement while generate rpm

At begining of spec file emulator feature flags are defined.
If any profile parameter was passed to spec file from command line then if statement
with emultor feature flag were always true.

[Verification] Code compiles without error

Change-Id: I83a82334e9f4655590fd96c1fc558e1888cb928d

4 years ago[HAM] Deprecate gesture and activity methods 15/243015/2
Rafal Walczyna [Wed, 2 Sep 2020 11:36:33 +0000 (13:36 +0200)]
[HAM] Deprecate gesture and activity methods

Native function are deprecated.

[ACR] TWDAPI-268

Change-Id: I4146362481542c47879413abc59aa2850eb17095
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years ago[MediaController] Add locks for variable used in different threads 43/242843/1
Rafal Walczyna [Tue, 25 Aug 2020 07:29:53 +0000 (09:29 +0200)]
[MediaController] Add locks for variable used in different threads

Handles for client and server can be used in different threads.
It may cause segmentation fault when already freed handle will be used.

Verification: Build successful

Change-Id: Iba90d1a85be51710ccda169389ce393f5ce1d1a3
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years ago[MediaController] Add locks for variable used in different threads 42/242842/1
Rafal Walczyna [Tue, 25 Aug 2020 07:29:53 +0000 (09:29 +0200)]
[MediaController] Add locks for variable used in different threads

Handles for client and server can be used in different threads.
It may cause segmentation fault when already freed handle will be used.

Verification: Build successful

Change-Id: Iba90d1a85be51710ccda169389ce393f5ce1d1a3
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years ago[MediaController] Add locks for variable used in different threads 37/242837/1
Rafal Walczyna [Tue, 25 Aug 2020 07:29:53 +0000 (09:29 +0200)]
[MediaController] Add locks for variable used in different threads

Handles for client and server can be used in different threads.
It may cause segmentation fault when already freed handle will be used.

Verification: Build successful

Change-Id: Iba90d1a85be51710ccda169389ce393f5ce1d1a3
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years ago[MediaController] Add locks for variable used in different threads 33/242833/2
Rafal Walczyna [Tue, 25 Aug 2020 07:29:53 +0000 (09:29 +0200)]
[MediaController] Add locks for variable used in different threads

Handles for client and server can be used in different threads.
It may cause segmentation fault when already freed handle will be used.

Verification: Build successful

Change-Id: Iba90d1a85be51710ccda169389ce393f5ce1d1a3
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
4 years agoMerge "[MediaController] Add locks for variable used in different threads" into tizen accepted/tizen/unified/20200901.160650 submit/tizen/20200831.125703
Piotr Kosko [Thu, 27 Aug 2020 10:07:17 +0000 (10:07 +0000)]
Merge "[MediaController] Add locks for variable used in different threads" into tizen

4 years ago[MediaController] Add locks for variable used in different threads 49/242249/4
Rafal Walczyna [Tue, 25 Aug 2020 07:29:53 +0000 (09:29 +0200)]
[MediaController] Add locks for variable used in different threads

Handles for client and server can be used in different threads.
It may cause segmentation fault when already freed handle will be used.

Verification: tct-mediacontroller 100% pass

Change-Id: Iba90d1a85be51710ccda169389ce393f5ce1d1a3
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>