diff options
author | 2019-06-14 13:01:06 +0900 | |
---|---|---|
committer | 2019-06-14 13:01:06 +0900 | |
commit | 394695b24171f6709031f86cc07d0af24329d9b1 (patch) | |
tree | 3d87fa2f9736bffa1da42d507e5765ddf9232632 /app | |
parent | 9ee98a06160ee2b234e92db70eb18e128fc76e5d (diff) |
fix bug for 0614
Diffstat (limited to 'app')
-rw-r--r-- | app/Hudtbt.qml | 42 | ||||
-rw-r--r-- | app/TbtBoard.qml | 6 | ||||
-rw-r--r-- | app/app.pro | 2 | ||||
-rw-r--r-- | app/images/arrow-0-full.png | bin | 0 -> 12088 bytes | |||
-rw-r--r-- | app/images/images.qrc | 1 | ||||
-rw-r--r-- | app/main.cpp | 2 |
6 files changed, 47 insertions, 6 deletions
diff --git a/app/Hudtbt.qml b/app/Hudtbt.qml index 141cd71..8d26719 100644 --- a/app/Hudtbt.qml +++ b/app/Hudtbt.qml @@ -26,11 +26,16 @@ ApplicationWindow { title: "HUD Tbt Demo" width: 1920 height: 1080 + visible: true property string api_str: "naviapi" property string verb_subscribe: "subscribe" + property string verb_getcurretdirstate: "navicore_getcurrentdestdir" property string event_getdestdir: "naviapi/navicore_getdestdir" + property string event_cancelguidance: "naviapi/navicore_cancelguidance" + property string nodirection_str:"0" + property string arrivedirection_str:"12" property var msgid_enu: { "call":2, "retok":3, "reterr":4, "event":5 } property string request_str: "" property string status_str: "" @@ -46,7 +51,9 @@ ApplicationWindow { websocket.active = false }else if (websocket.status === WebSocket.Open){ console.log ("Socket Open") + do_getcurrentdirstate() do_subscribe("getdestdir") + do_subscribe("cancelguidance") }else if (websocket.status === WebSocket.Closed){ console.log ("Socket closed") } @@ -64,8 +71,25 @@ ApplicationWindow { var state = message_json[2].data.state tbt_board.state = state console.log ("state is ok !") - } + if (tbt_board.state === arrivedirection_str) + { + clear_timer.start() + console.log ("clear arrive direction state 12 is ok !") + } + } + else if(message_json[2].event === event_cancelguidance) + { + tbt_board.state = nodirection_str + } } + else if(message_json[0] === msgid_enu.retok){ + if (message_json[2].request.info === verb_getcurretdirstate){ + var currentdirstate = message_json[2].response[0].CurrentDirState + tbt_board.state = currentdirstate + console.log ("get current state is ok !") + } + } + else{ if (message_json[0] !== msgid_enu.retok) { console.log ("Return value is not ok !") @@ -76,6 +100,13 @@ ApplicationWindow { } active: true } + //get current direction state + function do_getcurrentdirstate() { + request_str = '[' + msgid_enu.call + ',"99999","' + api_str+'/'+verb_getcurretdirstate + '", {} ]' + console.log (request_str) + websocket.sendTextMessage (request_str) + + } //subscribe function do_subscribe( event ) { request_str = '[' + msgid_enu.call + ',"99999","' + api_str+'/'+verb_subscribe + '", {"value":"' + event + '"} ]' @@ -88,6 +119,15 @@ ApplicationWindow { visible: true anchors.fill: parent } + Timer { + id: clear_timer + repeat: false + interval: 5000 + triggeredOnStart: false + onTriggered: { + tbt_board.state = nodirection_str + } + } } diff --git a/app/TbtBoard.qml b/app/TbtBoard.qml index 333bc0e..19daad2 100644 --- a/app/TbtBoard.qml +++ b/app/TbtBoard.qml @@ -1,9 +1,9 @@ import QtQuick 2.0 //turn by turn board view -Item { +Rectangle { id: tbt_board - + color: '#111111' // turn direction arrow board image Image { id: turnDirectionBoard @@ -20,7 +20,7 @@ Item { }, State { name: "1" // DirectionForward - PropertyChanges { target: turnDirectionBoard; source: "" } + PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-0-full.png" } }, State { name: "2" // DirectionBearRight diff --git a/app/app.pro b/app/app.pro index d769d8f..5e61da7 100644 --- a/app/app.pro +++ b/app/app.pro @@ -1,5 +1,5 @@ TARGET = hudtbt -QT += quick aglextras +QT = quick aglextras include(app.pri) diff --git a/app/images/arrow-0-full.png b/app/images/arrow-0-full.png Binary files differnew file mode 100644 index 0000000..d390db7 --- /dev/null +++ b/app/images/arrow-0-full.png diff --git a/app/images/images.qrc b/app/images/images.qrc index 97d193f..1e519b9 100644 --- a/app/images/images.qrc +++ b/app/images/images.qrc @@ -9,5 +9,6 @@ <file>arrow-r-75-full.png</file> <file>arrow-r-180-full.png</file> <file>destination_full.png</file> + <file>arrow-0-full.png</file> </qresource> </RCC> diff --git a/app/main.cpp b/app/main.cpp index bd136c0..c599b39 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -20,7 +20,7 @@ int main(int argc, char *argv[]) { AGLApplication app(argc, argv); - app.setApplicationName("Hudtbt"); + app.setApplicationName("hudtbt"); app.setupApplicationRole("hudtbt"); app.load(QUrl(QStringLiteral("qrc:/Hudtbt.qml"))); |