diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Hudspeed.qml (renamed from app/Hudtbt.qml) | 56 | ||||
-rw-r--r-- | app/TbtBoard.qml | 78 | ||||
-rw-r--r-- | app/app.pro | 14 | ||||
-rw-r--r-- | app/hudspeed.qrc | 5 | ||||
-rw-r--r-- | app/hudtbt.qrc | 6 | ||||
-rw-r--r-- | app/images/Thumbs.db | bin | 3584 -> 0 bytes | |||
-rw-r--r-- | app/images/arrow-l-180-full.png | bin | 21134 -> 0 bytes | |||
-rw-r--r-- | app/images/arrow-l-30-full.png | bin | 17061 -> 0 bytes | |||
-rw-r--r-- | app/images/arrow-l-45-full.png | bin | 17970 -> 0 bytes | |||
-rw-r--r-- | app/images/arrow-l-75-full.png | bin | 22426 -> 0 bytes | |||
-rw-r--r-- | app/images/arrow-r-180-full.png | bin | 21211 -> 0 bytes | |||
-rw-r--r-- | app/images/arrow-r-30-full.png | bin | 16478 -> 0 bytes | |||
-rw-r--r-- | app/images/arrow-r-45-full.png | bin | 17690 -> 0 bytes | |||
-rw-r--r-- | app/images/arrow-r-75-full.png | bin | 23047 -> 0 bytes | |||
-rw-r--r-- | app/images/destination_full.png | bin | 16658 -> 0 bytes | |||
-rw-r--r-- | app/images/images.qrc | 13 | ||||
-rw-r--r-- | app/main.cpp | 6 |
17 files changed, 49 insertions, 129 deletions
diff --git a/app/Hudtbt.qml b/app/Hudspeed.qml index 141cd71..2b72e21 100644 --- a/app/Hudtbt.qml +++ b/app/Hudspeed.qml @@ -23,19 +23,19 @@ import QtWebSockets 1.0 ApplicationWindow { id: window - title: "HUD Tbt Demo" - width: 1920 - height: 1080 + title: "HUD Speed Demo" + width: 480 + height: 180 visible: true - property string api_str: "naviapi" - property string verb_subscribe: "subscribe" - property string event_getdestdir: "naviapi/navicore_getdestdir" + property string api_str: "low-can" + property string verb_str: "subscribe" property var msgid_enu: { "call":2, "retok":3, "reterr":4, "event":5 } property string request_str: "" property string status_str: "" + + property double speed_val: 0 - property double state: 0 WebSocket { id: websocket url: bindingAddress @@ -46,7 +46,7 @@ ApplicationWindow { websocket.active = false }else if (websocket.status === WebSocket.Open){ console.log ("Socket Open") - do_subscribe("getdestdir") + do_subscribe() }else if (websocket.status === WebSocket.Closed){ console.log ("Socket closed") } @@ -59,12 +59,12 @@ ApplicationWindow { if (message_json[0] === msgid_enu.event){ - if(message_json[2].event === event_getdestdir) - { - var state = message_json[2].data.state - tbt_board.state = state - console.log ("state is ok !") - } + //get speed from low-can app + var property_name = message_json[2].event.split("/")[1] + if(property_name === "messages.vehicle.average.speed") { + speed_val = message_json[2].data.value + console.log ("speed_val: " + speed_val) + } } else{ if (message_json[0] !== msgid_enu.retok) { @@ -77,17 +77,29 @@ ApplicationWindow { active: true } //subscribe - function do_subscribe( event ) { - request_str = '[' + msgid_enu.call + ',"99999","' + api_str+'/'+verb_subscribe + '", {"value":"' + event + '"} ]' - console.log (request_str) + function do_subscribe() { + request_str ='[' + msgid_enu.call + ',"99998","' + api_str +'/'+ verb_str +'",{ \"event\" : \"vehicle.average.speed\" } ]'; websocket.sendTextMessage (request_str) } - TbtBoard { - id: tbt_board - z: 1 - visible: true + + Rectangle { + color: '#111111' anchors.fill: parent + Label { + id: speed + anchors.left: parent.left + anchors.top: parent.top + text: speed_val.toFixed(0) + font.pixelSize: parent.height*4/5 + color: "white" + } + Label { + id: unit + anchors.right: parent.right + anchors.bottom: parent.bottom + text: 'MPH' + font.pixelSize: parent.height/5 + } } - } diff --git a/app/TbtBoard.qml b/app/TbtBoard.qml deleted file mode 100644 index 333bc0e..0000000 --- a/app/TbtBoard.qml +++ /dev/null @@ -1,78 +0,0 @@ -import QtQuick 2.0 - -//turn by turn board view -Item { - id: tbt_board - - // turn direction arrow board image - Image { - id: turnDirectionBoard - visible: true - anchors.centerIn: parent - z: 3 - } - - // the cases of direction arrow board - states: [ - State { - name: "0" // NoDirection - PropertyChanges { target: turnDirectionBoard; source: "" } - }, - State { - name: "1" // DirectionForward - PropertyChanges { target: turnDirectionBoard; source: "" } - }, - State { - name: "2" // DirectionBearRight - PropertyChanges { target: turnDirectionBoard; source: "" } - }, - State { - name: "3" // DirectionLightRight - PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-30-full.png" } - }, - State { - name: "4" // DirectionRight - PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-45-full.png" } - }, - State { - name: "5" // DirectionHardRight - PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-75-full.png" } - }, - State { - name: "6" // DirectionUTurnRight - //TODO modify qtlocation U-Turn best.For test, change app source. - PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-180-full.png" } - }, - State { - name: "7" // DirectionUTurnLeft - //TODO modify qtlocation U-Turn best.For test, change app source. - PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-r-180-full.png" } - }, - State { - name: "8" // DirectionHardLeft - PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-75-full.png" } - }, - State { - name: "9" // DirectionLeft - PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-45-full.png" } - }, - State { - name: "10" // DirectionLightLeft - PropertyChanges { target: turnDirectionBoard; source: "qrc:arrow-l-30-full.png" } - }, - State { - name: "11" // DirectionBearLeft - PropertyChanges { target: turnDirectionBoard; source: "" } - }, - State { - name: "12" //arrive the destination - PropertyChanges { target: turnDirectionBoard; source: "qrc:destination_full.png" } - }, - State { - name: "invisible" - PropertyChanges { target: turnDirectionBoard; source: "" } - } - - ] - -} diff --git a/app/app.pro b/app/app.pro index d769d8f..510a921 100644 --- a/app/app.pro +++ b/app/app.pro @@ -1,10 +1,10 @@ -TARGET = hudtbt -QT += quick aglextras +TARGET = hudspeed +QT = quick aglextras -include(app.pri) - -SOURCES = main.cpp \ +SOURCES = main.cpp RESOURCES += \ - hudtbt.qrc\ - images/images.qrc + hudspeed.qrc + +include(app.pri) + diff --git a/app/hudspeed.qrc b/app/hudspeed.qrc new file mode 100644 index 0000000..8ce5dd9 --- /dev/null +++ b/app/hudspeed.qrc @@ -0,0 +1,5 @@ +<RCC> + <qresource prefix="/"> + <file>Hudspeed.qml</file> + </qresource> +</RCC> diff --git a/app/hudtbt.qrc b/app/hudtbt.qrc deleted file mode 100644 index fd5fd7f..0000000 --- a/app/hudtbt.qrc +++ /dev/null @@ -1,6 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>TbtBoard.qml</file> - <file>Hudtbt.qml</file> - </qresource> -</RCC> diff --git a/app/images/Thumbs.db b/app/images/Thumbs.db Binary files differdeleted file mode 100644 index 3ac30c1..0000000 --- a/app/images/Thumbs.db +++ /dev/null diff --git a/app/images/arrow-l-180-full.png b/app/images/arrow-l-180-full.png Binary files differdeleted file mode 100644 index 0c71027..0000000 --- a/app/images/arrow-l-180-full.png +++ /dev/null diff --git a/app/images/arrow-l-30-full.png b/app/images/arrow-l-30-full.png Binary files differdeleted file mode 100644 index de799ac..0000000 --- a/app/images/arrow-l-30-full.png +++ /dev/null diff --git a/app/images/arrow-l-45-full.png b/app/images/arrow-l-45-full.png Binary files differdeleted file mode 100644 index a3d8354..0000000 --- a/app/images/arrow-l-45-full.png +++ /dev/null diff --git a/app/images/arrow-l-75-full.png b/app/images/arrow-l-75-full.png Binary files differdeleted file mode 100644 index cd92e2d..0000000 --- a/app/images/arrow-l-75-full.png +++ /dev/null diff --git a/app/images/arrow-r-180-full.png b/app/images/arrow-r-180-full.png Binary files differdeleted file mode 100644 index d761b48..0000000 --- a/app/images/arrow-r-180-full.png +++ /dev/null diff --git a/app/images/arrow-r-30-full.png b/app/images/arrow-r-30-full.png Binary files differdeleted file mode 100644 index 0bebfb9..0000000 --- a/app/images/arrow-r-30-full.png +++ /dev/null diff --git a/app/images/arrow-r-45-full.png b/app/images/arrow-r-45-full.png Binary files differdeleted file mode 100644 index fa170f0..0000000 --- a/app/images/arrow-r-45-full.png +++ /dev/null diff --git a/app/images/arrow-r-75-full.png b/app/images/arrow-r-75-full.png Binary files differdeleted file mode 100644 index 08dc143..0000000 --- a/app/images/arrow-r-75-full.png +++ /dev/null diff --git a/app/images/destination_full.png b/app/images/destination_full.png Binary files differdeleted file mode 100644 index e5c79d9..0000000 --- a/app/images/destination_full.png +++ /dev/null diff --git a/app/images/images.qrc b/app/images/images.qrc deleted file mode 100644 index 97d193f..0000000 --- a/app/images/images.qrc +++ /dev/null @@ -1,13 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>arrow-l-30-full.png</file> - <file>arrow-l-45-full.png</file> - <file>arrow-l-75-full.png</file> - <file>arrow-l-180-full.png</file> - <file>arrow-r-30-full.png</file> - <file>arrow-r-45-full.png</file> - <file>arrow-r-75-full.png</file> - <file>arrow-r-180-full.png</file> - <file>destination_full.png</file> - </qresource> -</RCC> diff --git a/app/main.cpp b/app/main.cpp index bd136c0..7a66060 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -20,10 +20,10 @@ int main(int argc, char *argv[]) { AGLApplication app(argc, argv); - app.setApplicationName("Hudtbt"); - app.setupApplicationRole("hudtbt"); + app.setApplicationName("hudspeed"); + app.setupApplicationRole("hudspeed"); - app.load(QUrl(QStringLiteral("qrc:/Hudtbt.qml"))); + app.load(QUrl(QStringLiteral("qrc:/Hudspeed.qml"))); return app.exec(); } |