diff --git a/invehicle-apps/.gitignore b/invehicle-apps/.gitignore new file mode 100644 index 0000000..18e097c --- /dev/null +++ b/invehicle-apps/.gitignore @@ -0,0 +1 @@ +/*/build diff --git a/invehicle-apps/kuksa-cloud-dashboard/CMakeLists.txt b/invehicle-apps/kuksa-cloud-dashboard/CMakeLists.txt index e50a474..73cec72 100644 --- a/invehicle-apps/kuksa-cloud-dashboard/CMakeLists.txt +++ b/invehicle-apps/kuksa-cloud-dashboard/CMakeLists.txt @@ -20,7 +20,8 @@ message(STATUS ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -add_executable(${PROJECT_NAME} "src/main.cpp" "src/honoMqtt.cpp" "src/emailHTTP.cpp" ) + +add_executable(${PROJECT_NAME} "src/main.cpp" "src/honoMqtt.cpp" "src/emailHTTP.cpp") target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/../3rd-party-libs ${CMAKE_CURRENT_SOURCE_DIR}/../3rd-party-libs/Simple-WebSocket-Server ${CMAKE_CURRENT_SOURCE_DIR}/../3rd-party-libs/jsoncons ${CMAKE_CURRENT_SOURCE_DIR}/../3rd-party-libs/paho.mqtt.c/src ${CMAKE_CURRENT_SOURCE_DIR}/../3rd-party-libs/paho.mqtt.cpp/src) add_library(simple-websocket-server INTERFACE) diff --git a/invehicle-apps/kuksa-cloud-dashboard/README.md b/invehicle-apps/kuksa-cloud-dashboard/README.md index 3708ea5..ed06d42 100644 --- a/invehicle-apps/kuksa-cloud-dashboard/README.md +++ b/invehicle-apps/kuksa-cloud-dashboard/README.md @@ -2,17 +2,17 @@ This is a kuksa demo-app which connects to the w3c-visserver service via Websocket and talks to the Eclipse Hono MQTT adapter and sends telemetry data to Hono. This app reads the RPM, Speed, Fuel status and also custom DTC drom the w3c-visserver. This app also requires the following signal in the w3c-vis server tree. -`Signal.OBD.DTC1` +`Vehicle.OBD.DTC1` -`Signal.OBD.DTC2` +`Vehicle.OBD.DTC2` -`Signal.OBD.DTC3` +`Vehicle.OBD.DTC3` -`Signal.OBD.DTC4` +`Vehicle.OBD.DTC4` -`Signal.OBD.DTC5` +`Vehicle.OBD.DTC5` -To add this signal to the vss-tree, please modify the vss_rel_1.0.json file used in the w3c-vis-server. +To add this signal to the vss-tree, please modify the vss_rel_2.0.json file used in the w3c-vis-server. ### Build docker image @@ -22,3 +22,9 @@ use the instructions available in the docker folder to build the docker image. use the kuksa-publisher to publish the app in the kuksa-appstore. +### Publish app on kuksa-appstore + +use the kuksa app-publisher to publish the app on the kuksa-appstore. The configuration for the publisher is found in kuksa-dashboard.yaml file. +Check the docs of app-publisher for more info. + + diff --git a/invehicle-apps/kuksa-cloud-dashboard/docker/Dockerfile b/invehicle-apps/kuksa-cloud-dashboard/docker/Dockerfile index 2757e48..b8c50e8 100644 --- a/invehicle-apps/kuksa-cloud-dashboard/docker/Dockerfile +++ b/invehicle-apps/kuksa-cloud-dashboard/docker/Dockerfile @@ -3,7 +3,7 @@ FROM arm64v8/alpine:3.8 AS build-env COPY kuksa-cloud-dashboard/docker/qemu-aarch64-static /usr/bin/qemu-aarch64-static -RUN apk update && apk add cmake alpine-sdk boost-dev boost-system boost-thread openssl-dev libstdc++ +RUN apk update && apk add curl cmake alpine-sdk boost-dev boost-system boost-thread openssl-dev libstdc++ ADD . /app WORKDIR /app/kuksa-cloud-dashboard @@ -14,7 +14,7 @@ RUN cd build && make #Transferring build artifacts to minimal docker -FROM arm64v8/alpine:3.8 +FROM arm64v8/alpine:3.8 #For debugging uncomment, and replae copy with real install to see what is missing... #RUN apk update && apk add openssl boost-system boost-thread libstdc++ COPY --from=build-env /lib/libssl.so.1.0.0 /lib/ diff --git a/invehicle-apps/kuksa-cloud-dashboard/docker/build.sh b/invehicle-apps/kuksa-cloud-dashboard/docker/build.sh index 0ee33e0..912ad3d 100755 --- a/invehicle-apps/kuksa-cloud-dashboard/docker/build.sh +++ b/invehicle-apps/kuksa-cloud-dashboard/docker/build.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -VERSION="0.1.0" +VERSION="0.1.3" NAME="cloud-dashboard" if [ -z "$VERSION" ]; then diff --git a/invehicle-apps/kuksa-cloud-dashboard/docker/dockerentry.sh b/invehicle-apps/kuksa-cloud-dashboard/docker/dockerentry.sh index cd4c543..b314d0c 100755 --- a/invehicle-apps/kuksa-cloud-dashboard/docker/dockerentry.sh +++ b/invehicle-apps/kuksa-cloud-dashboard/docker/dockerentry.sh @@ -11,5 +11,6 @@ # # Contributors: Robert Bosch GmbH -./dashboard $HONOIP $HONOPORT $HONOPW $HONODEVICE $TOKEN $EMAIL_SERVER $EMAIL_PORT +apk update && apk add curl +./dashboard $HONOIP $HONOPORT $HONODEVICE $HONOPW $BUFFER_SIZE $BUFFER_TIME $TOKEN $EMAIL_SERVER $EMAIL_PORT diff --git a/invehicle-apps/kuksa-cloud-dashboard/include/emailHTTP.hpp b/invehicle-apps/kuksa-cloud-dashboard/include/emailHTTP.hpp index 17c85df..99e9ca3 100755 --- a/invehicle-apps/kuksa-cloud-dashboard/include/emailHTTP.hpp +++ b/invehicle-apps/kuksa-cloud-dashboard/include/emailHTTP.hpp @@ -20,3 +20,4 @@ using namespace std; int sendEmail (string emailid, string dtccode); + diff --git a/invehicle-apps/kuksa-cloud-dashboard/include/honoMqtt.hpp b/invehicle-apps/kuksa-cloud-dashboard/include/honoMqtt.hpp index 66142d8..262dd49 100644 --- a/invehicle-apps/kuksa-cloud-dashboard/include/honoMqtt.hpp +++ b/invehicle-apps/kuksa-cloud-dashboard/include/honoMqtt.hpp @@ -30,11 +30,12 @@ class HonoMqtt : public virtual mqtt::callback, public virtual mqtt::iaction_lis mqtt::async_client* p_Client; void(*onMsg)(string); + mqtt::topic* top; public: - void connect (string honoAddr , string clientID, string userName, string password); - void publish (string topic, string data); + void connect (string honoAddr , string clientID, string userName, string password, int offlineBufferSize, int connAlive); + void publish (string data); void disconnect(); void setMessageCB(void(*)(string)); diff --git a/invehicle-apps/kuksa-cloud-dashboard/kuksa-dashboard.yaml b/invehicle-apps/kuksa-cloud-dashboard/kuksa-dashboard.yaml new file mode 100644 index 0000000..480bce8 --- /dev/null +++ b/invehicle-apps/kuksa-cloud-dashboard/kuksa-dashboard.yaml @@ -0,0 +1,37 @@ +# Make sure you donot use tabs for indentation +# Put all app related infos here +docker : + image : "arm32v6/cloud-dashboard:0.1.0" + name : "Dashboard-W3C-Version2" + version : "0.1.0" + owner : "Company name" + description : "This is a cloud dashboard app" + config : + network_mode : "host" + volumes: + /tmp/: + bind: '/mnt/' + mode: 'rw' + environment: + HONOIP: "" + HONOPORT: "1883" + HONODEVICE: "sensor1" + HONOPW: "hono-secret" + BUFFER_SIZE: 1024000 + BUFFER_TIME: 600 + TOKEN: "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJFeGFtcGxlIEpXVCIsImlzcyI6IkVjbGlwc2Uga3Vrc2EiLCJhZG1pbiI6dHJ1ZSwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE2MDkzNzI4MDAsInczYy12c3MiOnsiVmVoaWNsZS5PQkQuKiI6InJ3IiwiVmVoaWNsZS5DYWJpbi5JbmZvdGFpbm1lbnQuTmF2aWdhdGlvbi5DdXJyZW50TG9jYXRpb24uKiI6InJ3In19.QYs78CwwyOPnzXUZdHYbWzD7hwMWuNJWuNBTNYIBQqvkM7Df5CsIV_CvfiozSQybSPwlthnm4yJ7xgyC2yQTLh6vKKEIAlNjFcOep39b3fGEDDrRHkOyMJQuxYD5ELALKEPbakITi4QfqWozcZQNY9AdyYROKJqmTPlaYZmT0_mAQQFCIk7ji-udxtqTGtO6-WW5cDPkp0cqaDy1ZJusVUsRJGUkd942jgqbcVp98n7j4o8NvSQhZ6wGrG8Nc1tpTMUdXQmuMPA3Iv2P3cSMuBrHAY5I8511OFgIpB51gydKF4PaqTpirxCswm85iZq6so9CnMwh9I7VBO5GI6Nz_lnFfyeg1NEdRmSTEI6ucqLhjx54R2cT-fa6KIHcDKw63ZrXGT-dNyhX2px0Q5zM2zuy8phwLj6cXujCS8-uOmlysvmxwgh3oIUmtmP47x5ZLkFqaYuU2Ue-kiSr1lyleaEhQxSGykCJr6OibQ4gA6b5VIXn3mfkMWF8fse3Xm1D8jJ6UyE9zl55GhgvcAX9AlQYuqRTcaSvhZbzDmSO4pMda0wuHyHnB1DBiFcV9AtbPQsLraP2VVNGlKiWQkiJp66H0fkj1NPmQvCbbQ9v8YT-_DmAEvwnY9Mcx26FYodzC055lny4ThRXTCSmnJdxA05Av-BCjAGxPTinYxKCA1c" + EMAIL_SERVER: "" + EMAIL_PORT: "9020" + +# Put all the hawkbit related infos here +hawkbit : + url: "http://hawkbit.com:8080" + target : "kuksa_Donglev2" + user : "admin" + password : "admin" + +# Put all appstore infos here +appstore : + url : "https://kuksa-appstore.org:8443" + category : "kuksa-test" + auth : "Basic YWRtaW46YWRtaW4=" diff --git a/invehicle-apps/kuksa-cloud-dashboard/src/honoMqtt.cpp b/invehicle-apps/kuksa-cloud-dashboard/src/honoMqtt.cpp index 2b80717..32d868d 100644 --- a/invehicle-apps/kuksa-cloud-dashboard/src/honoMqtt.cpp +++ b/invehicle-apps/kuksa-cloud-dashboard/src/honoMqtt.cpp @@ -14,7 +14,11 @@ #include "honoMqtt.hpp" using namespace std; +using namespace std::chrono; +#define QOS 1 + +const string PUB_TOPIC = "telemetry"; /** * A base action listener for pub. @@ -51,42 +55,42 @@ class action_listener_sub : public virtual mqtt::iaction_listener }; -void HonoMqtt::connect (string honoAddr , string clientID, string userName, string password) { - - p_Client = new mqtt::async_client (honoAddr, clientID); +void HonoMqtt::connect (string honoAddr , string clientID, string userName, string password, int offlineBufferSize , int connAlive) { + + cout << "Creating async mqtt client with persist of max msg = "<< offlineBufferSize << endl; + p_Client = new mqtt::async_client (honoAddr, clientID, offlineBufferSize, nullptr); p_Client->set_callback(*this); mqtt::connect_options connOpts; - connOpts.set_connection_timeout(3); - connOpts.set_keep_alive_interval(20); - connOpts.set_automatic_reconnect(true); + connOpts.set_keep_alive_interval(seconds(connAlive)); // keep alive for seconds passed connOpts.set_clean_session(true); connOpts.set_user_name(userName); connOpts.set_password(password); + connOpts.set_automatic_reconnect(true); // reconnects automatically. + top = new mqtt::topic(*p_Client, PUB_TOPIC, QOS, false); try { cout << "Connecting..." << endl; - mqtt::token_ptr conntok = p_Client->connect(connOpts, nullptr, *this); - cout << "Waiting for the connection..." << endl; - conntok->wait(); + p_Client->connect(connOpts)->wait(); cout << "Connected." << endl; } catch (const mqtt::exception& exc) { + cout << "Exception occured while connecting to hono"<< endl; cerr << exc.what() << endl; throw exc; } } -void HonoMqtt::publish (string topic, string data) { +void HonoMqtt::publish (string data) { + try { cout << "Sending next message..." << endl; action_listener_pub listener; - mqtt::message_ptr pubmsg = mqtt::make_message(topic, data); - mqtt::delivery_token_ptr pubtok; - try { - pubtok = p_Client->publish(pubmsg, nullptr, listener); - pubtok->wait(); - cout << "Published." << endl; + top->publish(std::move(data)); + cout << "Published." << endl; } catch (const mqtt::exception& exc) { + cout << "Exception occured while publishing data"<< endl; cerr << exc.what() << endl; - } + throw exc; + } + } void HonoMqtt::disconnect() { diff --git a/invehicle-apps/kuksa-cloud-dashboard/src/main.cpp b/invehicle-apps/kuksa-cloud-dashboard/src/main.cpp index de6df03..21bfeb2 100755 --- a/invehicle-apps/kuksa-cloud-dashboard/src/main.cpp +++ b/invehicle-apps/kuksa-cloud-dashboard/src/main.cpp @@ -11,70 +11,70 @@ * Robert Bosch GmbH - initial API and functionality * ***************************************************************************** */ - -#include #include #include #include +#include #include -#include #include +#include +#include #include "client_wss.hpp" #include "honoMqtt.hpp" #include "emailHTTP.hpp" + // delay between sending each signals in microseconds #define SENDDELAY 50000 - #define MAX_ERRORS 10 -#define USER_EMAIL_FILE "/mnt/email" - - - using namespace std; using WssClient = SimpleWeb::SocketClient; using namespace jsoncons; using jsoncons::json; +const std::string CLIENT_ID = "cloud-dashboard"; +const string PUB_TOPIC = "telemetry"; + std::string query; +// WSS connection to w3c-server settings +shared_ptr connection = NULL; string url = "localhost:8090/vss"; -bool honoConnect = true; - +// CMD line args char honoAddress[256]; char honoPort[32]; char honoDevice[256]; char honoPassword[256]; - - char TOKEN[2048]; -shared_ptr connection = NULL; +char emailServerAddress[256]; +char emailServerPort[64]; -// email settings +// E-mail settings +#define USER_EMAIL_FILE "/mnt/email" bool mailsent[MAX_ERRORS]; string emailID =""; -char emailServerAddress[256]; -char emailServerPort[64]; string emailTemplate; +// MQTT Buffer settings +int offlineBufferSize = 1024; // Max number of msgs to be buffered. This is default can be modified using cml line +int connAlive = 10 * 60; // keep connection alive for 10 mins this also means the bufferening will happen for max 10 mins. Can be modified useing cmd line -const std::string CLIENT_ID { "cloud-dashboard" }; - -const string PUB_TOPIC {"telemetry"}; -string fullTopic; - -const int QOS = 0; - -const auto TIMEOUT = std::chrono::seconds(10); - -class HonoMqtt* honoConn; +// MQTT Adapter connection for Hono. +HonoMqtt* honoConn; // callback method for receiving messages from hono. void onMessageFromHono(string message) { - cout<<"Publish msg from Hono = " << message << endl; + cout<<"Publish msg from Hono = " << message << endl; +} + +// get current time in ms +long int currentTimeMillis() { + struct timeval tp; + gettimeofday(&tp , NULL); + return ((tp.tv_sec*1000) + (tp.tv_usec / 1000)); } @@ -176,13 +176,16 @@ void sendEmailToOwner( string resp) { } } + + +// Send msgs to Hono void sendToHono( string resp) { cout << "Response >> " << resp << endl; json root; root = json::parse(resp); string action = root["action"].as(); - + if( action == "authorize") { return; } else if ( root.has_key("error")) { @@ -203,12 +206,16 @@ void sendToHono( string resp) { return; } - std::string value = root["value"].as(); int reqID = root["requestId"].as(); string signal; json valJson; + + + long int now = currentTimeMillis(); + cout << "timestamp "<< now << endl; + valJson["time"] = now; if(reqID == 1234) { signal = "RPM"; @@ -218,40 +225,52 @@ void sendToHono( string resp) { signal = "SPEED"; int val = stoi(value, nullptr, 10); valJson[signal] = val; - } else if (reqID == 1236) { - signal = "ERROR"; - int val = 0; - if(value == "true") { - val = 1; - } - valJson[signal] = val; - } else if (reqID == 1237) { - signal = "ERROR2"; - int val = 0; - if(value == "true") { - val = 1; - } - valJson[signal] = val; - } else if (reqID == 1238) { - signal = "ERROR3"; - int val = 0; - if(value == "true") - val = 1; - valJson[signal] = val; } else if (reqID == 1239) { signal = "FUEL"; int val = stoi(value, nullptr, 10); valJson[signal] = val; + } else if (reqID == 2222) { + signal = "CATTEMP"; + std::string::size_type sz; + float val = stof(value, &sz); + valJson[signal] = val; + } else if (reqID == 2223) { + signal = "COOLTEMP"; + int val = stoi(value, nullptr, 10); + valJson[signal] = val; + } else if (reqID == 2224) { + signal = "THROTTLEPOS"; + int val = stoi(value, nullptr, 10); + valJson[signal] = val; + } else if (reqID == 2225) { + signal = "ACCPEDALPOS"; + int val = stoi(value, nullptr, 10); + valJson[signal] = val; + } + else if (reqID == 1240) { + signal = "GPS"; + json gps_value = json::parse(value); + value = gps_value["Vehicle.Cabin.Infotainment.Navigation.CurrentLocation.Latitude"].as(); + if (value == "---") { + return; + } + value = value + ","; + value = value + gps_value["Vehicle.Cabin.Infotainment.Navigation.CurrentLocation.Longitude"].as(); + valJson[signal] = value; + cout << "GPS data = " << value << endl; } - honoConn->publish(PUB_TOPIC, valJson.as()); - + + try { + honoConn->publish(valJson.as()); + } catch ( mqtt::exception& e) { + cout << "Exception occured while publishing msg " << e.what() << endl; + } } void* sendSensorValues (void* arg) { - - if(honoConnect) { + usleep(SENDDELAY); auto send_stream = make_shared(); @@ -272,7 +291,7 @@ void* sendSensorValues (void* arg) { cout << honoAddr << endl; string userName = string(honoDevice) + "@DEFAULT_TENANT"; string password(honoPassword); - honoConn->connect(honoAddr, CLIENT_ID, userName, password); + honoConn->connect(honoAddr, CLIENT_ID, userName, password, offlineBufferSize, connAlive); honoConn->setMessageCB(onMessageFromHono); } catch ( mqtt::exception& e) { @@ -280,7 +299,7 @@ void* sendSensorValues (void* arg) { // send data to hono instance. while(1) { - string rpm_req = "{\"action\": \"get\", \"path\": \"Signal.OBD.RPM\", \"requestId\": 1234 }"; + string rpm_req = "{\"action\": \"get\", \"path\": \"Vehicle.OBD.EngineSpeed\", \"requestId\": 1234 }"; *send_stream << rpm_req; @@ -288,45 +307,57 @@ void* sendSensorValues (void* arg) { usleep(SENDDELAY); - string vSpeed_req = "{\"action\": \"get\", \"path\": \"Signal.OBD.Speed\", \"requestId\": 1235 }"; + string vSpeed_req = "{\"action\": \"get\", \"path\": \"Vehicle.OBD.Speed\", \"requestId\": 1235 }"; *send_stream << vSpeed_req; connection->send(send_stream); - - usleep(SENDDELAY); - string dtc2_req = "{\"action\": \"get\", \"path\": \"Signal.OBD.DTC2\", \"requestId\": 1236 }"; + usleep(SENDDELAY); + + string fuel_req = "{\"action\": \"get\", \"path\": \"Vehicle.OBD.FuelLevel\", \"requestId\": 1239 }"; - *send_stream << dtc2_req; + *send_stream << fuel_req; connection->send(send_stream); usleep(SENDDELAY); - string dtc3_req = "{\"action\": \"get\", \"path\": \"Signal.OBD.DTC3\", \"requestId\": 1237 }"; - - *send_stream << dtc3_req; + string vlat_req = "{\"action\": \"get\", \"path\": \"Vehicle.Cabin.Infotainment.Navigation.CurrentLocation\", \"requestId\": 1240 }"; + *send_stream << vlat_req; connection->send(send_stream); - usleep(SENDDELAY); + usleep(SENDDELAY); - string dtc4_req = "{\"action\": \"get\", \"path\": \"Signal.OBD.DTC4\", \"requestId\": 1238 }"; + string cat_req = "{\"action\": \"get\", \"path\": \"Vehicle.OBD.Catalyst.Bank1.Temperature1\", \"requestId\": 2222 }"; - *send_stream << dtc4_req; - connection->send(send_stream); + *send_stream << cat_req; + connection->send(send_stream); - usleep(SENDDELAY); - string fuel_req = "{\"action\": \"get\", \"path\": \"Signal.OBD.FuelLevel\", \"requestId\": 1239 }"; + usleep(SENDDELAY); + string coolant_req = "{\"action\": \"get\", \"path\": \"Vehicle.OBD.CoolantTemperature\", \"requestId\": 2223 }"; - *send_stream << fuel_req; - connection->send(send_stream); + *send_stream << coolant_req; + connection->send(send_stream); - usleep(SENDDELAY); + + usleep(SENDDELAY); + string throttle_req = "{\"action\": \"get\", \"path\": \"Vehicle.OBD.ThrottlePosition\", \"requestId\": 2224 }"; + + *send_stream << throttle_req; + connection->send(send_stream); + + + + usleep(SENDDELAY); + string accPos_req = "{\"action\": \"get\", \"path\": \"Vehicle.OBD.AcceleratorPositionD\", \"requestId\": 2225 }"; + + *send_stream << accPos_req; + connection->send(send_stream); } - } } + void* startWSClient(void * arg) { WssClient client(url , true, "Client.pem", "Client.key", "CA.pem"); @@ -364,9 +395,6 @@ void* startWSClient(void * arg) { } - - - /** * @brief Test main. * @return @@ -374,34 +402,30 @@ void* startWSClient(void * arg) { int main(int argc, char* argv[]) { - if(argc == 8) { - strcpy(honoAddress , argv[1]); - char honoPortStr[16]; - strcpy(honoPort , argv[2]); - strcpy(honoPassword , argv[3]); - strcpy(honoDevice , argv[4]); - strcpy(TOKEN, argv[5]); - strcpy(emailServerAddress , argv[6]); - strcpy(emailServerPort , argv[7]); - } else { - cerr<<"Usage ./dashboard "< "< + + + + + + + + + + + + + \ No newline at end of file diff --git a/kuksa-android/.idea/gradle.xml b/kuksa-android/.idea/gradle.xml new file mode 100644 index 0000000..7ac24c7 --- /dev/null +++ b/kuksa-android/.idea/gradle.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/kuksa-android/.idea/misc.xml b/kuksa-android/.idea/misc.xml new file mode 100644 index 0000000..c0f68ed --- /dev/null +++ b/kuksa-android/.idea/misc.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/kuksa-android/.idea/runConfigurations.xml b/kuksa-android/.idea/runConfigurations.xml new file mode 100644 index 0000000..7f68460 --- /dev/null +++ b/kuksa-android/.idea/runConfigurations.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/kuksa-android/.idea/vcs.xml b/kuksa-android/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/kuksa-android/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/kuksa-android/LICENSE b/kuksa-android/LICENSE new file mode 100644 index 0000000..e48e096 --- /dev/null +++ b/kuksa-android/LICENSE @@ -0,0 +1,277 @@ +Eclipse Public License - v 2.0 + + THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE + PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION + OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + +1. DEFINITIONS + +"Contribution" means: + + a) in the case of the initial Contributor, the initial content + Distributed under this Agreement, and + + b) in the case of each subsequent Contributor: + i) changes to the Program, and + ii) additions to the Program; + where such changes and/or additions to the Program originate from + and are Distributed by that particular Contributor. A Contribution + "originates" from a Contributor if it was added to the Program by + such Contributor itself or anyone acting on such Contributor's behalf. + Contributions do not include changes or additions to the Program that + are not Modified Works. + +"Contributor" means any person or entity that Distributes the Program. + +"Licensed Patents" mean patent claims licensable by a Contributor which +are necessarily infringed by the use or sale of its Contribution alone +or when combined with the Program. + +"Program" means the Contributions Distributed in accordance with this +Agreement. + +"Recipient" means anyone who receives the Program under this Agreement +or any Secondary License (as applicable), including Contributors. + +"Derivative Works" shall mean any work, whether in Source Code or other +form, that is based on (or derived from) the Program and for which the +editorial revisions, annotations, elaborations, or other modifications +represent, as a whole, an original work of authorship. + +"Modified Works" shall mean any work in Source Code or other form that +results from an addition to, deletion from, or modification of the +contents of the Program, including, for purposes of clarity any new file +in Source Code form that contains any contents of the Program. Modified +Works shall not include works that contain only declarations, +interfaces, types, classes, structures, or files of the Program solely +in each case in order to link to, bind by name, or subclass the Program +or Modified Works thereof. + +"Distribute" means the acts of a) distributing or b) making available +in any manner that enables the transfer of a copy. + +"Source Code" means the form of a Program preferred for making +modifications, including but not limited to software source code, +documentation source, and configuration files. + +"Secondary License" means either the GNU General Public License, +Version 2.0, or any later versions of that license, including any +exceptions or additional permissions as identified by the initial +Contributor. + +2. GRANT OF RIGHTS + + a) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free copyright + license to reproduce, prepare Derivative Works of, publicly display, + publicly perform, Distribute and sublicense the Contribution of such + Contributor, if any, and such Derivative Works. + + b) Subject to the terms of this Agreement, each Contributor hereby + grants Recipient a non-exclusive, worldwide, royalty-free patent + license under Licensed Patents to make, use, sell, offer to sell, + import and otherwise transfer the Contribution of such Contributor, + if any, in Source Code or other form. This patent license shall + apply to the combination of the Contribution and the Program if, at + the time the Contribution is added by the Contributor, such addition + of the Contribution causes such combination to be covered by the + Licensed Patents. The patent license shall not apply to any other + combinations which include the Contribution. No hardware per se is + licensed hereunder. + + c) Recipient understands that although each Contributor grants the + licenses to its Contributions set forth herein, no assurances are + provided by any Contributor that the Program does not infringe the + patent or other intellectual property rights of any other entity. + Each Contributor disclaims any liability to Recipient for claims + brought by any other entity based on infringement of intellectual + property rights or otherwise. As a condition to exercising the + rights and licenses granted hereunder, each Recipient hereby + assumes sole responsibility to secure any other intellectual + property rights needed, if any. For example, if a third party + patent license is required to allow Recipient to Distribute the + Program, it is Recipient's responsibility to acquire that license + before distributing the Program. + + d) Each Contributor represents that to its knowledge it has + sufficient copyright rights in its Contribution, if any, to grant + the copyright license set forth in this Agreement. + + e) Notwithstanding the terms of any Secondary License, no + Contributor makes additional grants to any Recipient (other than + those set forth in this Agreement) as a result of such Recipient's + receipt of the Program under the terms of a Secondary License + (if permitted under the terms of Section 3). + +3. REQUIREMENTS + +3.1 If a Contributor Distributes the Program in any form, then: + + a) the Program must also be made available as Source Code, in + accordance with section 3.2, and the Contributor must accompany + the Program with a statement that the Source Code for the Program + is available under this Agreement, and informs Recipients how to + obtain it in a reasonable manner on or through a medium customarily + used for software exchange; and + + b) the Contributor may Distribute the Program under a license + different than this Agreement, provided that such license: + i) effectively disclaims on behalf of all other Contributors all + warranties and conditions, express and implied, including + warranties or conditions of title and non-infringement, and + implied warranties or conditions of merchantability and fitness + for a particular purpose; + + ii) effectively excludes on behalf of all other Contributors all + liability for damages, including direct, indirect, special, + incidental and consequential damages, such as lost profits; + + iii) does not attempt to limit or alter the recipients' rights + in the Source Code under section 3.2; and + + iv) requires any subsequent distribution of the Program by any + party to be under a license that satisfies the requirements + of this section 3. + +3.2 When the Program is Distributed as Source Code: + + a) it must be made available under this Agreement, or if the + Program (i) is combined with other material in a separate file or + files made available under a Secondary License, and (ii) the initial + Contributor attached to the Source Code the notice described in + Exhibit A of this Agreement, then the Program may be made available + under the terms of such Secondary Licenses, and + + b) a copy of this Agreement must be included with each copy of + the Program. + +3.3 Contributors may not remove or alter any copyright, patent, +trademark, attribution notices, disclaimers of warranty, or limitations +of liability ("notices") contained within the Program from any copy of +the Program which they Distribute, provided that Contributors may add +their own appropriate notices. + +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities +with respect to end users, business partners and the like. While this +license is intended to facilitate the commercial use of the Program, +the Contributor who includes the Program in a commercial product +offering should do so in a manner which does not create potential +liability for other Contributors. Therefore, if a Contributor includes +the Program in a commercial product offering, such Contributor +("Commercial Contributor") hereby agrees to defend and indemnify every +other Contributor ("Indemnified Contributor") against any losses, +damages and costs (collectively "Losses") arising from claims, lawsuits +and other legal actions brought by a third party against the Indemnified +Contributor to the extent caused by the acts or omissions of such +Commercial Contributor in connection with its distribution of the Program +in a commercial product offering. The obligations in this section do not +apply to any claims or Losses relating to any actual or alleged +intellectual property infringement. In order to qualify, an Indemnified +Contributor must: a) promptly notify the Commercial Contributor in +writing of such claim, and b) allow the Commercial Contributor to control, +and cooperate with the Commercial Contributor in, the defense and any +related settlement negotiations. The Indemnified Contributor may +participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those performance +claims and warranties, and if a court requires any other Contributor to +pay any damages as a result, the Commercial Contributor must pay +those damages. + +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, THE PROGRAM IS PROVIDED ON AN "AS IS" +BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR +IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF +TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR +PURPOSE. Each Recipient is solely responsible for determining the +appropriateness of using and distributing the Program and assumes all +risks associated with its exercise of rights under this Agreement, +including but not limited to the risks and costs of program errors, +compliance with applicable laws, damage to or loss of data, programs +or equipment, and unavailability or interruption of operations. + +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, AND TO THE EXTENT +PERMITTED BY APPLICABLE LAW, NEITHER RECIPIENT NOR ANY CONTRIBUTORS +SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST +PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE +EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further +action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other software +or hardware) infringes such Recipient's patent(s), then such Recipient's +rights granted under Section 2(b) shall terminate as of the date such +litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of +time after becoming aware of such noncompliance. If all Recipient's +rights under this Agreement terminate, Recipient agrees to cease use +and distribution of the Program as soon as reasonably practicable. +However, Recipient's obligations under this Agreement and any licenses +granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, +but in order to avoid inconsistency the Agreement is copyrighted and +may only be modified in the following manner. The Agreement Steward +reserves the right to publish new versions (including revisions) of +this Agreement from time to time. No one other than the Agreement +Steward has the right to modify this Agreement. The Eclipse Foundation +is the initial Agreement Steward. The Eclipse Foundation may assign the +responsibility to serve as the Agreement Steward to a suitable separate +entity. Each new version of the Agreement will be given a distinguishing +version number. The Program (including Contributions) may always be +Distributed subject to the version of the Agreement under which it was +received. In addition, after a new version of the Agreement is published, +Contributor may elect to Distribute the Program (including its +Contributions) under the new version. + +Except as expressly stated in Sections 2(a) and 2(b) above, Recipient +receives no rights or licenses to the intellectual property of any +Contributor under this Agreement, whether expressly, by implication, +estoppel or otherwise. All rights in the Program not expressly granted +under this Agreement are reserved. Nothing in this Agreement is intended +to be enforceable by any entity that is not a Contributor or Recipient. +No third-party beneficiary rights are created under this Agreement. + +Exhibit A - Form of Secondary Licenses Notice + +"This Source Code may also be made available under the following +Secondary Licenses when the conditions for such availability set forth +in the Eclipse Public License, v. 2.0 are satisfied: {name license(s), +version(s), and exceptions or additional permissions here}." + + Simply including a copy of this Agreement, including this Exhibit A + is not sufficient to license the Source Code under Secondary Licenses. + + If it is not possible or desirable to put the notice in a particular + file, then You may include the notice in a location (such as a LICENSE + file in a relevant directory) where a recipient would be likely to + look for such a notice. + + You may add additional accurate notices of copyright ownership. diff --git a/kuksa-android/README.md b/kuksa-android/README.md new file mode 100644 index 0000000..4941882 --- /dev/null +++ b/kuksa-android/README.md @@ -0,0 +1,16 @@ +## Kuksa Demo Android app + +A demo android app that showcases the capabilities of kuksa invehicle and kuksa cloud platform. + +### Basic Features involve + +1. Kuksa-Appstore access. +2. Kuksa Dashboard which shows a digital tachometer. +3. GPS tracking using google maps. + +The app works well with the Kuksa-Dongle. + +More infos to follow... + + +![Alt text](./images/app.png?raw=true "kuksa android app") diff --git a/kuksa-android/app/.gitignore b/kuksa-android/app/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/kuksa-android/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/kuksa-android/app/build.gradle b/kuksa-android/app/build.gradle new file mode 100644 index 0000000..847ad1f --- /dev/null +++ b/kuksa-android/app/build.gradle @@ -0,0 +1,33 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 28 + defaultConfig { + applicationId "demo.kuksa.eclipse.org.devdemo" + minSdkVersion 21 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'com.android.support.constraint:constraint-layout:1.1.3' + implementation 'com.android.support:design:28.0.0' + implementation 'com.google.android.gms:play-services-maps:15.0.1' + implementation 'com.android.support:support-v4:28.0.0' + implementation 'com.android.support:support-media-compat:28.0.0' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'com.android.support.test:runner:1.0.2' + androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' + implementation 'com.android.support:preference-v7:28.0.0' +} diff --git a/kuksa-android/app/proguard-rules.pro b/kuksa-android/app/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/kuksa-android/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/kuksa-android/app/src/androidTest/java/demo/kuksa/eclipse/org/devdemo/ExampleInstrumentedTest.java b/kuksa-android/app/src/androidTest/java/demo/kuksa/eclipse/org/devdemo/ExampleInstrumentedTest.java new file mode 100644 index 0000000..e79e7d6 --- /dev/null +++ b/kuksa-android/app/src/androidTest/java/demo/kuksa/eclipse/org/devdemo/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package demo.kuksa.eclipse.org.devdemo; + +import android.content.Context; +import android.support.test.InstrumentationRegistry; +import android.support.test.runner.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getTargetContext(); + + assertEquals("demo.kuksa.eclipse.org.devdemo", appContext.getPackageName()); + } +} diff --git a/kuksa-android/app/src/debug/res/values/google_maps_api.xml b/kuksa-android/app/src/debug/res/values/google_maps_api.xml new file mode 100644 index 0000000..38fd12c --- /dev/null +++ b/kuksa-android/app/src/debug/res/values/google_maps_api.xml @@ -0,0 +1,3 @@ + + AIzaSyD3d2NPZkGL2y8hYvd2uw85TTPc1ZnY6XY + diff --git a/kuksa-android/app/src/debug/res/xml/automotive_app_desc.xml b/kuksa-android/app/src/debug/res/xml/automotive_app_desc.xml new file mode 100644 index 0000000..e64f442 --- /dev/null +++ b/kuksa-android/app/src/debug/res/xml/automotive_app_desc.xml @@ -0,0 +1,4 @@ + + + + diff --git a/kuksa-android/app/src/main/AndroidManifest.xml b/kuksa-android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..f1ec62d --- /dev/null +++ b/kuksa-android/app/src/main/AndroidManifest.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/cloud-web.png b/kuksa-android/app/src/main/cloud-web.png new file mode 100644 index 0000000..f17ebab Binary files /dev/null and b/kuksa-android/app/src/main/cloud-web.png differ diff --git a/kuksa-android/app/src/main/ic_launcher-web.png b/kuksa-android/app/src/main/ic_launcher-web.png new file mode 100644 index 0000000..3db22eb Binary files /dev/null and b/kuksa-android/app/src/main/ic_launcher-web.png differ diff --git a/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/business/InfluxConnector.java b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/business/InfluxConnector.java new file mode 100644 index 0000000..e5dc116 --- /dev/null +++ b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/business/InfluxConnector.java @@ -0,0 +1,275 @@ +package demo.kuksa.eclipse.org.business; + +import android.content.SharedPreferences; +import android.util.Log; + +import org.json.JSONArray; +import org.json.JSONObject; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.HashMap; + +import android.preference.PreferenceManager; + +import static android.content.Context.MODE_PRIVATE; + +public class InfluxConnector { + + + private String influxURLRPM; + private String influxURLSpeed; + private String influxURLError; + private String influxURLFuel; + private String influxURLGPS; + + public InfluxConnector(String influxIP) { + influxURLRPM = "http://"+ influxIP +":8086/query?db=devices&u=admin&p=admin&q=SELECT%20Last(%22RPM%22)%20FROM%20%22$$$%22%20WHERE%20time%20%3E%20now()%20-%202s"; + influxURLSpeed = "http://"+ influxIP +":8086/query?db=devices&u=admin&p=admin&q=SELECT%20Last(%22SPEED%22)%20FROM%20%22$$$%22%20WHERE%20time%20%3E%20now()%20-%202s"; + influxURLError = "http://"+ influxIP +":8086/query?db=devices&u=admin&p=admin&q=SELECT%20Last(%22ERROR1%22)%20FROM%20%22$$$%22%20"; + influxURLFuel = "http://"+influxIP+":8086/query?db=devices&u=admin&p=admin&q=SELECT%20Last(%22FUEL%22)%20FROM%20%22$$$%22%20"; + influxURLGPS = "http://"+influxIP+":8086/query?db=devices&u=admin&p=admin&q=SELECT%20Last(%22GPS%22)%20FROM%20%22$$$%22%20WHERE%20time%20%3E%20now()%20-%202s"; + } + + public Double[] getGPSData ( String vehicleID ) { + HttpURLConnection urlConnection = null; + String gpsURL = influxURLGPS.replace("$$$",vehicleID); + try { + URL url = new URL(gpsURL); + urlConnection = (HttpURLConnection) url.openConnection(); + InputStream in = new BufferedInputStream(urlConnection.getInputStream()); + + // convert to string. + BufferedReader bReader = new BufferedReader(new InputStreamReader(in)); + String line = null; + JSONArray jarr = null; + JSONObject jObject = null; + + line = bReader.readLine(); + jObject = new JSONObject(line); + if(jObject != null && jObject.has("results")) { + jarr = jObject.getJSONArray("results"); + } + + Log.i("kuksa_dev","GPS Raw line from Http Call= "+line); + + + if(jarr != null) { + JSONObject results = jarr.getJSONObject(0); + JSONArray series = results.getJSONArray("series"); + JSONObject valuesObj = series.getJSONObject(0); + JSONArray values = valuesObj.getJSONArray("values").getJSONArray(0); + String rawResponse = values.toString().replace("\"", ""); + rawResponse = rawResponse.replace("]", ""); + String gpsValuesString[] = rawResponse.split(","); + Log.d("GPS Values = " , gpsValuesString[1]+", " + gpsValuesString[2]); + + Double[] gpsValues = new Double[2]; + gpsValues[0] = Double.parseDouble(gpsValuesString[1]); + gpsValues[1] = Double.parseDouble(gpsValuesString[2]); + Log.i("Kuksa-dev", "GPS Value extracted from HTTP call = " + gpsValues[0] + " " + gpsValues[1]); + return gpsValues; + } else { + return null; + } + + }catch(Exception e){ + Log.e("Exception while collecting GPS data from influxdb", e.toString()); + } finally { + if(urlConnection != null) + urlConnection.disconnect(); + } + return null; + + } + + public String getVehicleRPM ( String vehicleID ) { + HttpURLConnection urlConnection = null; + String rpmURL = influxURLRPM.replace("$$$",vehicleID); + try { + URL url = new URL(rpmURL); + urlConnection = (HttpURLConnection) url.openConnection(); + InputStream in = new BufferedInputStream(urlConnection.getInputStream()); + + // convert to string. + BufferedReader bReader = new BufferedReader(new InputStreamReader(in)); + String line = null; + JSONArray jarr = null; + JSONObject jObject = null; + + line = bReader.readLine(); + jObject = new JSONObject(line); + if(jObject != null && jObject.has("results")) { + jarr = jObject.getJSONArray("results"); + } + + Log.i("kuksa_dev","RPM Raw line from Http Call= "+line); + + + if(jarr != null) { + JSONObject results = jarr.getJSONObject(0); + JSONArray series = results.getJSONArray("series"); + JSONObject valuesObj = series.getJSONObject(0); + JSONArray values = valuesObj.getJSONArray("values").getJSONArray(0); + String value = values.getString(1); + Log.i("Kuksa-dev", "RPM Value extracted from HTTP call = " + value); + return value; + } else { + return null; + } + + }catch(Exception e){ + Log.e("Kuksa-dev", e.toString()); + } finally { + if(urlConnection != null) + urlConnection.disconnect(); + } + return null; + + } + + public String getVehicleSpeed ( String vehicleID ) { + HttpURLConnection urlConnection = null; + String speedURL = influxURLSpeed.replace("$$$",vehicleID); + try { + URL url = new URL(speedURL); + urlConnection = (HttpURLConnection) url.openConnection(); + InputStream in = new BufferedInputStream(urlConnection.getInputStream()); + + // convert to string. + BufferedReader bReader = new BufferedReader(new InputStreamReader(in)); + String line = null; + JSONArray jarr = null; + JSONObject jObject = null; + + line = bReader.readLine(); + jObject = new JSONObject(line); + if(jObject != null && jObject.has("results")) { + jarr = jObject.getJSONArray("results"); + } + + Log.i("kuksa_dev","Speed Raw line from Http Call= "+line); + + + if(jarr != null) { + JSONObject results = jarr.getJSONObject(0); + JSONArray series = results.getJSONArray("series"); + JSONObject valuesObj = series.getJSONObject(0); + JSONArray values = valuesObj.getJSONArray("values").getJSONArray(0); + String value = values.getString(1); + Log.i("Kuksa-dev", "Speed Value extracted from HTTP call = " + value); + return value; + } else { + return null; + } + + }catch(Exception e){ + Log.e("Kuksa-dev", e.toString()); + } finally { + if(urlConnection != null) + urlConnection.disconnect(); + } + return null; + + } + + public String getFuelStatus ( String vehicleID ) { + HttpURLConnection urlConnection = null; + String fuelURL = influxURLFuel.replace("$$$",vehicleID); + try { + URL url = new URL(fuelURL); + urlConnection = (HttpURLConnection) url.openConnection(); + InputStream in = new BufferedInputStream(urlConnection.getInputStream()); + + // convert to string. + BufferedReader bReader = new BufferedReader(new InputStreamReader(in)); + String line = null; + JSONArray jarr = null; + JSONObject jObject = null; + + line = bReader.readLine(); + jObject = new JSONObject(line); + if(jObject != null && jObject.has("results")) { + jarr = jObject.getJSONArray("results"); + } + + Log.i("kuksa_dev","Fuel Raw line from Http Call= "+line); + + + if(jarr != null) { + JSONObject results = jarr.getJSONObject(0); + JSONArray series = results.getJSONArray("series"); + JSONObject valuesObj = series.getJSONObject(0); + JSONArray values = valuesObj.getJSONArray("values").getJSONArray(0); + String value = values.getString(1); + Log.i("Kuksa-dev", "Fuel Value extracted from HTTP call = " + value); + return value; + } else { + return null; + } + + }catch(Exception e){ + Log.e("Kuksa-dev", e.toString()); + } finally { + if(urlConnection != null) + urlConnection.disconnect(); + } + return null; + + } + + public boolean checkDTC ( String vehicleID ) { + + HttpURLConnection urlConnection = null; + String dtcURL = influxURLError.replace("$$$",vehicleID); + try { + URL url = new URL(dtcURL); + urlConnection = (HttpURLConnection) url.openConnection(); + InputStream in = new BufferedInputStream(urlConnection.getInputStream()); + + // convert to string. + BufferedReader bReader = new BufferedReader(new InputStreamReader(in)); + String line = null; + JSONArray jarr = null; + JSONObject jObject = null; + + line = bReader.readLine(); + jObject = new JSONObject(line); + if(jObject != null && jObject.has("results")) { + jarr = jObject.getJSONArray("results"); + } + + Log.i("kuksa_dev","Speed Raw line from Http Call= "+line); + + + if(jarr != null) { + JSONObject results = jarr.getJSONObject(0); + JSONArray series = results.getJSONArray("series"); + JSONObject valuesObj = series.getJSONObject(0); + JSONArray values = valuesObj.getJSONArray("values").getJSONArray(0); + String value = values.getString(1); + Log.i("Kuksa-dev", "Speed Value extracted from HTTP call = " + value); + if("1".equals(value)){ + return true; + } else { + return false; + } + + } else { + return false; + } + + }catch(Exception e){ + Log.e("Kuksa-dev", e.toString()); + } finally { + if(urlConnection != null) + urlConnection.disconnect(); + } + return false; + + } +} diff --git a/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/AppstoreActivity.java b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/AppstoreActivity.java new file mode 100644 index 0000000..d7c9cd5 --- /dev/null +++ b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/AppstoreActivity.java @@ -0,0 +1,52 @@ +package demo.kuksa.eclipse.org.devdemo; + +import android.os.AsyncTask; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.webkit.WebView; + +import java.net.URL; + +public class AppstoreActivity extends AppCompatActivity { + + + + WebView appstoreView; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_appstore); + //super.onCreate(savedInstanceState); + + + appstoreView = (WebView) findViewById(R.id.appstoreView); + appstoreView.getSettings().setLoadWithOverviewMode(true); + appstoreView.getSettings().setUseWideViewPort(true); + + /*try { + new GrafTask().execute(new URL("https://developer.mozilla.org")); + } catch (MalformedURLException e) { + Log.e("kuksa-dev","URL not ok!"); + }*/ + + appstoreView.getSettings().setJavaScriptEnabled(true); + String appStoreIP = getIntent().getStringExtra("APPSTORE_IP"); + + appstoreView.loadUrl("http://"+"appstacle-hot-kuksa-appstore.westeurope.cloudapp.azure.com"+":8080"); + + + } + + private class GrafTask extends AsyncTask { + + + @Override + protected Long doInBackground(URL... urls) { + + appstoreView.getSettings().setJavaScriptEnabled(true); + String appStoreIP = getIntent().getStringExtra("APPSTORE_IP"); + appstoreView.loadUrl("http://"+appStoreIP+":8082"); + return new Long(1); + } + } +} diff --git a/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/CloudActivity.java b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/CloudActivity.java new file mode 100644 index 0000000..d22e9f0 --- /dev/null +++ b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/CloudActivity.java @@ -0,0 +1,52 @@ +package demo.kuksa.eclipse.org.devdemo; + +import android.os.AsyncTask; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.webkit.WebView; + +import java.net.URL; + +public class CloudActivity extends AppCompatActivity { + + + WebView grafanaView; + + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_cloud); + //super.onCreate(savedInstanceState); + + + grafanaView = findViewById(R.id.grafView); + grafanaView.getSettings().setLoadWithOverviewMode(true); + grafanaView.getSettings().setUseWideViewPort(true); + /*try { + new GrafTask().execute(new URL("https://developer.mozilla.org")); + } catch (MalformedURLException e) { + Log.e("kuksa-dev","URL not ok!"); + }*/ + String grafanaIP = getIntent().getStringExtra("GRAFANA_IP"); + grafanaView.loadUrl("http://"+grafanaIP+":3000"); + + + } + + private class GrafTask extends AsyncTask { + + + @Override + protected Long doInBackground(URL... urls) { + + grafanaView.getSettings().setJavaScriptEnabled(true); + String grafanaIP = getIntent().getStringExtra("GRAFANA_IP"); + grafanaView.loadUrl("http://"+grafanaIP+":3000"); + return new Long(1); + } + } +} + + + diff --git a/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/FixMyCarActivity.java b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/FixMyCarActivity.java new file mode 100644 index 0000000..5bc0a71 --- /dev/null +++ b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/FixMyCarActivity.java @@ -0,0 +1,13 @@ +package demo.kuksa.eclipse.org.devdemo; + +import android.support.v7.app.AppCompatActivity; +import android.os.Bundle; + +public class FixMyCarActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_fix_my_car); + } +} diff --git a/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/MainActivity.java b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/MainActivity.java new file mode 100644 index 0000000..d7cadb0 --- /dev/null +++ b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/MainActivity.java @@ -0,0 +1,175 @@ +package demo.kuksa.eclipse.org.devdemo; + +import android.content.ActivityNotFoundException; +import android.content.ComponentName; +import android.content.Intent; +import android.content.SharedPreferences; +import android.net.Uri; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.preference.PreferenceManager; +import android.support.v7.widget.Toolbar; +import android.util.Log; +import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; +import android.view.View; +import android.widget.ImageButton; + +import java.util.HashMap; + + +public class MainActivity extends AppCompatActivity implements View.OnClickListener, SharedPreferences.OnSharedPreferenceChangeListener{ + HashMap appIps = new HashMap<>(); + ImageButton myCar_bt, appStore_bt, cloud_bt, fixCar_bt, maps_bt; + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + Toolbar toolbar = findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + myCar_bt = findViewById(R.id.mycar_button); + fixCar_bt = findViewById(R.id.fixcar_button); + cloud_bt = findViewById(R.id.cloud_button); + maps_bt = findViewById(R.id.track_button); + appStore_bt = findViewById(R.id.appstore_button); + + myCar_bt.setOnClickListener(this); + appStore_bt.setOnClickListener(this); + cloud_bt.setOnClickListener(this); + maps_bt.setOnClickListener(this); + fixCar_bt.setOnClickListener(this); + + setupSharedPreferences(); + Log.d ("kuksa-dev", " on create method called."); + } + + private void setupSharedPreferences() { + SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); + sharedPreferences.registerOnSharedPreferenceChangeListener(this); + } + + @Override + public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { + + /* if (key.equals("display_text")) { + setTextVisible(sharedPreferences.getBoolean("display_text",true)); + }*/ + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater menuInflater = getMenuInflater(); + menuInflater.inflate(R.menu.menu_main, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + if (id == R.id.action_settings) { + Intent intent = new Intent(MainActivity.this, SettingsActivity.class); + startActivity(intent); + return true; + } + return super.onOptionsItemSelected(item); + } + + @Override + protected void onStart() { + super.onStart(); + + // retrieve new preferences. + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); + // then you use + appIps.put("InfluxIP", prefs.getString("addressIF","localhost")); + appIps.put("VehicleID", prefs.getString("vehicleID","4711")); + appIps.put("DispatchIP", prefs.getString("addressDisp","localhost")); + appIps.put("AppstoreIP", prefs.getString("addressAPPS","localhost")); + appIps.put("TraccarIP", prefs.getString("addressTrac","localhost")); + + Log.d ("kuksa-dev", " on start method "); + } + + @Override + protected void onRestart() { + super.onRestart(); + Log.d ("kuksa-dev", " on restart method "); + } + + @Override + protected void onResume() { + super.onResume(); + Log.d ("kuksa-dev", " on resume method "); + } + + @Override + protected void onPause() { + super.onPause(); + Log.d ("kuksa-dev", " on pause method "); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + PreferenceManager.getDefaultSharedPreferences(this) + .unregisterOnSharedPreferenceChangeListener(this); + Log.d ("kuksa-dev", " on destroy method "); + } + + + + @Override + public void onClick(View view) { + switch (view.getId()) { + + case R.id.appstore_button: + Intent appStoreIntent = new Intent(this, AppstoreActivity.class); + appStoreIntent.putExtra("APPSTORE_IP", appIps.get("AppstoreIP")); + startActivity(appStoreIntent); + break; + + case R.id.cloud_button: + Intent cloudIntent = new Intent(this, CloudActivity.class); + cloudIntent.putExtra("GRAFANA_IP", appIps.get("GrafanaIP")); + startActivity(cloudIntent); + break; + + case R.id.track_button: + Intent mapsIntent = new Intent(this, MapsActivity.class); + mapsIntent.putExtra("INFLUXDB_IP",appIps.get("InfluxIP")); + mapsIntent.putExtra("VEHICLE_ID",appIps.get("VehicleID")); + startActivity(mapsIntent); + + /*String traccarIP = appIps.get("TraccarIP"); + String traccar_url = "http://"+traccarIP; + try { + Intent in = new Intent("android.intent.action.MAIN"); + in.setComponent(ComponentName.unflattenFromString("com.android.chrome/com.android.chrome.Main")); + in.addCategory("android.intent.category.LAUNCHER"); + in.setData(Uri.parse(traccar_url)); + startActivity(in); + } + catch(ActivityNotFoundException e) { + // Chrome is not installed + Intent in = new Intent(Intent.ACTION_VIEW, Uri.parse(traccar_url)); + startActivity(in); + }*/ + + break; + + case R.id.mycar_button: + Intent mycarIntent = new Intent(this, MycarActivity.class); + mycarIntent.putExtra("INFLUXDB_IP",appIps.get("InfluxIP")); + mycarIntent.putExtra("VEHICLE_ID",appIps.get("VehicleID")); + startActivity(mycarIntent); + break; + + case R.id.fixcar_button: + Intent fixMycarIntent = new Intent(this, FixMyCarActivity.class); + startActivity(fixMycarIntent); + break; + } + } +} diff --git a/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/MapsActivity.java b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/MapsActivity.java new file mode 100644 index 0000000..e49b5d0 --- /dev/null +++ b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/MapsActivity.java @@ -0,0 +1,122 @@ +package demo.kuksa.eclipse.org.devdemo; + +import android.os.AsyncTask; +import android.support.v4.app.FragmentActivity; +import android.os.Bundle; +import android.util.Log; +import android.view.View; + +import com.google.android.gms.maps.CameraUpdateFactory; +import com.google.android.gms.maps.GoogleMap; +import com.google.android.gms.maps.OnMapReadyCallback; +import com.google.android.gms.maps.SupportMapFragment; +import com.google.android.gms.maps.model.LatLng; +import com.google.android.gms.maps.model.MarkerOptions; + +import java.net.MalformedURLException; +import java.net.URL; + +import demo.kuksa.eclipse.org.business.InfluxConnector; + +public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { + + private GoogleMap mMap; + private volatile boolean runBG; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_maps); + // Obtain the SupportMapFragment and get notified when the map is ready to be used. + SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() + .findFragmentById(R.id.map); + mapFragment.getMapAsync(this); + } + + + /** + * Manipulates the map once available. + * This callback is triggered when the map is ready to be used. + * This is where we can add markers or lines, add listeners or move the camera. In this case, + * we just add a marker near Sydney, Australia. + * If Google Play services is not installed on the device, the user will be prompted to install + * it inside the SupportMapFragment. This method will only be triggered once the user has + * installed Google Play services and returned to the app. + */ + @Override + public void onMapReady(GoogleMap googleMap) { + mMap = googleMap; + + // Add a marker in Sydney and move the camera + LatLng sydney = new LatLng(-34, 151); + mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); + mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); + mMap.setMinZoomPreference(15.0f); + mMap.setMaxZoomPreference(30.0f); + + + } + + + @Override + protected void onStart() { + super.onStart(); + runBG = true; + try { + new MapsActivity.mapTask().execute(new URL("https://developer.mozilla.org")); + } catch (MalformedURLException e) { + Log.e("kuksa-dev","URL not ok!"); + } + } + + @Override + protected void onDestroy() { + super.onDestroy(); + runBG = false; + } + + @Override + protected void onPause() { + super.onPause(); + runBG = false; + } + + @Override + protected void onResume() { + super.onResume(); + } + + + private class mapTask extends AsyncTask { + + + @Override + protected Long doInBackground(URL... urls) { + + while (runBG) { + InfluxConnector infconn = new InfluxConnector(getIntent().getStringExtra("INFLUXDB_IP")); + String vehicleID = getIntent().getStringExtra("VEHICLE_ID"); + final Double[] gpsData = infconn.getGPSData(vehicleID); + if (gpsData != null) { + runOnUiThread(new Runnable() { + @Override + public void run() { + LatLng newPoint = new LatLng(gpsData[0], gpsData[1]); + mMap.addMarker(new MarkerOptions().position(newPoint).title("Latest")); + mMap.moveCamera(CameraUpdateFactory.newLatLng(newPoint)); + + } + }); + } + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + return new Long(1); + } + + } + +} diff --git a/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/MycarActivity.java b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/MycarActivity.java new file mode 100644 index 0000000..e605ca4 --- /dev/null +++ b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/MycarActivity.java @@ -0,0 +1,140 @@ +package demo.kuksa.eclipse.org.devdemo; + +import android.app.Activity; +import android.graphics.Color; +import android.os.AsyncTask; +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.util.Log; +import android.view.View; +import android.widget.ImageView; +import android.widget.ProgressBar; +import android.widget.RelativeLayout; +import android.widget.TextView; + + +import java.net.MalformedURLException; +import java.net.URL; + +import demo.kuksa.eclipse.org.business.InfluxConnector; + +public class MycarActivity extends AppCompatActivity { + + + TextView rpmMeter, speedometer; + ProgressBar fuelMeter; + ImageView checkEngine; + + private volatile boolean runBG; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.activity_mycar); + + RelativeLayout rl = findViewById(R.id.mycarLayout); + rl.setBackgroundColor(Color.BLACK); + speedometer = findViewById(R.id.speedView); + speedometer.setText("0"); + speedometer.setEnabled(false); + + rpmMeter = findViewById(R.id.rpmView); + rpmMeter.setText("0"); + rpmMeter.setEnabled(false); + + fuelMeter = findViewById(R.id.fuelView); + fuelMeter.setProgress(0); + fuelMeter.setMin(0); + fuelMeter.setMax(100); + + checkEngine = findViewById(R.id.checkEngine); + checkEngine.setVisibility(View.INVISIBLE); + } + + @Override + protected void onStart() { + super.onStart(); + runBG = true; + try { + new GrafTask().execute(new URL("https://developer.mozilla.org")); + } catch (MalformedURLException e) { + Log.e("kuksa-dev","URL not ok!"); + } + } + + @Override + protected void onDestroy() { + super.onDestroy(); + runBG = false; + } + + @Override + protected void onPause() { + super.onPause(); + runBG = false; + } + + @Override + protected void onResume() { + super.onResume(); + } + + private class GrafTask extends AsyncTask { + + + @Override + protected Long doInBackground(URL... urls) { + + while (runBG) { + InfluxConnector infconn = new InfluxConnector(getIntent().getStringExtra("INFLUXDB_IP")); + String vehicleID = getIntent().getStringExtra("VEHICLE_ID"); + final String rpm = infconn.getVehicleRPM(vehicleID); + final String speed = infconn.getVehicleSpeed(vehicleID); + int count = 3001; + + if( count > 3000) { + final String fuel = infconn.getFuelStatus(vehicleID); + runOnUiThread(new Runnable() { + @Override + public void run() { + if (fuel != null) { + fuelMeter.setProgress(Integer.valueOf(fuel)); + } + } + }); + count = 0; + } + final boolean engineMal = infconn.checkDTC(vehicleID); + runOnUiThread(new Runnable() { + @Override + public void run() { + if (rpm != null) { + rpmMeter.setText(rpm); + } else { + rpmMeter.setText("0"); + } + if (speed != null) { + speedometer.setText(speed); + } else { + speedometer.setText("0"); + } + if (engineMal) { + checkEngine.setVisibility(View.VISIBLE); + } else { + checkEngine.setVisibility(View.INVISIBLE); + } + } + }); + + try { + Thread.sleep(1); + count++; + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + return new Long(1); + } + } +} diff --git a/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/SettingsActivity.java b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/SettingsActivity.java new file mode 100644 index 0000000..066934f --- /dev/null +++ b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/SettingsActivity.java @@ -0,0 +1,32 @@ +package demo.kuksa.eclipse.org.devdemo; + +import android.os.Bundle; +import android.support.v4.app.NavUtils; +import android.support.v7.app.ActionBar; +import android.support.v7.app.AppCompatActivity; +import android.view.MenuItem; + +public class SettingsActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_settings); + + ActionBar actionBar = this.getSupportActionBar(); + + if (actionBar != null) { + actionBar.setDisplayHomeAsUpEnabled(true); + } + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + int id = item.getItemId(); + if (id == android.R.id.home) { + NavUtils.navigateUpFromSameTask(this); + } + return super.onOptionsItemSelected(item); + } + +} diff --git a/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/SettingsFragment.java b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/SettingsFragment.java new file mode 100644 index 0000000..2ff87af --- /dev/null +++ b/kuksa-android/app/src/main/java/demo/kuksa/eclipse/org/devdemo/SettingsFragment.java @@ -0,0 +1,12 @@ +package demo.kuksa.eclipse.org.devdemo; + +import android.os.Bundle; +import android.support.v7.preference.PreferenceFragmentCompat; + +public class SettingsFragment extends PreferenceFragmentCompat { + @Override + public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { + addPreferencesFromResource(R.xml.preferences); + + } +} \ No newline at end of file diff --git a/kuksa-android/app/src/main/my_car-web.png b/kuksa-android/app/src/main/my_car-web.png new file mode 100644 index 0000000..714062d Binary files /dev/null and b/kuksa-android/app/src/main/my_car-web.png differ diff --git a/kuksa-android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/kuksa-android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..c7bd21d --- /dev/null +++ b/kuksa-android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/kuksa-android/app/src/main/res/drawable/check_engine.jpg b/kuksa-android/app/src/main/res/drawable/check_engine.jpg new file mode 100644 index 0000000..f0281c9 Binary files /dev/null and b/kuksa-android/app/src/main/res/drawable/check_engine.jpg differ diff --git a/kuksa-android/app/src/main/res/drawable/cloud.png b/kuksa-android/app/src/main/res/drawable/cloud.png new file mode 100644 index 0000000..ef6467b Binary files /dev/null and b/kuksa-android/app/src/main/res/drawable/cloud.png differ diff --git a/kuksa-android/app/src/main/res/drawable/fixcar.png b/kuksa-android/app/src/main/res/drawable/fixcar.png new file mode 100644 index 0000000..65d0dc6 Binary files /dev/null and b/kuksa-android/app/src/main/res/drawable/fixcar.png differ diff --git a/kuksa-android/app/src/main/res/drawable/ic_info_black_24dp.xml b/kuksa-android/app/src/main/res/drawable/ic_info_black_24dp.xml new file mode 100644 index 0000000..34b8202 --- /dev/null +++ b/kuksa-android/app/src/main/res/drawable/ic_info_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/kuksa-android/app/src/main/res/drawable/ic_launcher_background.xml b/kuksa-android/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..01f0af0 --- /dev/null +++ b/kuksa-android/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kuksa-android/app/src/main/res/drawable/ic_notifications_black_24dp.xml b/kuksa-android/app/src/main/res/drawable/ic_notifications_black_24dp.xml new file mode 100644 index 0000000..e3400cf --- /dev/null +++ b/kuksa-android/app/src/main/res/drawable/ic_notifications_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/kuksa-android/app/src/main/res/drawable/ic_sync_black_24dp.xml b/kuksa-android/app/src/main/res/drawable/ic_sync_black_24dp.xml new file mode 100644 index 0000000..5a283aa --- /dev/null +++ b/kuksa-android/app/src/main/res/drawable/ic_sync_black_24dp.xml @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/drawable/kuksa_bg.png b/kuksa-android/app/src/main/res/drawable/kuksa_bg.png new file mode 100644 index 0000000..766aeaa Binary files /dev/null and b/kuksa-android/app/src/main/res/drawable/kuksa_bg.png differ diff --git a/kuksa-android/app/src/main/res/drawable/kuksa_icon.png b/kuksa-android/app/src/main/res/drawable/kuksa_icon.png new file mode 100644 index 0000000..a41080b Binary files /dev/null and b/kuksa-android/app/src/main/res/drawable/kuksa_icon.png differ diff --git a/kuksa-android/app/src/main/res/drawable/kuksa_icon_bw.png b/kuksa-android/app/src/main/res/drawable/kuksa_icon_bw.png new file mode 100644 index 0000000..1e9e3b6 Binary files /dev/null and b/kuksa-android/app/src/main/res/drawable/kuksa_icon_bw.png differ diff --git a/kuksa-android/app/src/main/res/drawable/roundcorner.xml b/kuksa-android/app/src/main/res/drawable/roundcorner.xml new file mode 100644 index 0000000..9f9308b --- /dev/null +++ b/kuksa-android/app/src/main/res/drawable/roundcorner.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/drawable/speedo.png b/kuksa-android/app/src/main/res/drawable/speedo.png new file mode 100644 index 0000000..30dd1d4 Binary files /dev/null and b/kuksa-android/app/src/main/res/drawable/speedo.png differ diff --git a/kuksa-android/app/src/main/res/drawable/track_icon.jpg b/kuksa-android/app/src/main/res/drawable/track_icon.jpg new file mode 100644 index 0000000..a6dbde5 Binary files /dev/null and b/kuksa-android/app/src/main/res/drawable/track_icon.jpg differ diff --git a/kuksa-android/app/src/main/res/layout/activity_appstore.xml b/kuksa-android/app/src/main/res/layout/activity_appstore.xml new file mode 100644 index 0000000..d593fdf --- /dev/null +++ b/kuksa-android/app/src/main/res/layout/activity_appstore.xml @@ -0,0 +1,18 @@ + + + + + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/layout/activity_cloud.xml b/kuksa-android/app/src/main/res/layout/activity_cloud.xml new file mode 100644 index 0000000..1dba14b --- /dev/null +++ b/kuksa-android/app/src/main/res/layout/activity_cloud.xml @@ -0,0 +1,17 @@ + + + + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/layout/activity_fix_my_car.xml b/kuksa-android/app/src/main/res/layout/activity_fix_my_car.xml new file mode 100644 index 0000000..0ce1af9 --- /dev/null +++ b/kuksa-android/app/src/main/res/layout/activity_fix_my_car.xml @@ -0,0 +1,9 @@ + + + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/layout/activity_main.xml b/kuksa-android/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..f3292fc --- /dev/null +++ b/kuksa-android/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/layout/activity_maps.xml b/kuksa-android/app/src/main/res/layout/activity_maps.xml new file mode 100644 index 0000000..ec352fc --- /dev/null +++ b/kuksa-android/app/src/main/res/layout/activity_maps.xml @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/layout/activity_mycar.xml b/kuksa-android/app/src/main/res/layout/activity_mycar.xml new file mode 100644 index 0000000..00d4b76 --- /dev/null +++ b/kuksa-android/app/src/main/res/layout/activity_mycar.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/layout/activity_settings.xml b/kuksa-android/app/src/main/res/layout/activity_settings.xml new file mode 100644 index 0000000..4cb0240 --- /dev/null +++ b/kuksa-android/app/src/main/res/layout/activity_settings.xml @@ -0,0 +1,7 @@ + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/layout/content_main.xml b/kuksa-android/app/src/main/res/layout/content_main.xml new file mode 100644 index 0000000..21e86b0 --- /dev/null +++ b/kuksa-android/app/src/main/res/layout/content_main.xml @@ -0,0 +1,20 @@ + + + + + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/menu/menu_main.xml b/kuksa-android/app/src/main/res/menu/menu_main.xml new file mode 100644 index 0000000..91a05e2 --- /dev/null +++ b/kuksa-android/app/src/main/res/menu/menu_main.xml @@ -0,0 +1,10 @@ + + + diff --git a/kuksa-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/kuksa-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..fc61702 --- /dev/null +++ b/kuksa-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/kuksa-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..fc61702 --- /dev/null +++ b/kuksa-android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/kuksa-android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..75f976e Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/kuksa-android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..1515665 Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/kuksa-android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..45bfba2 Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/kuksa-android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..642efe4 Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/kuksa-android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..bed277e Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/kuksa-android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..c10bf90 Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/kuksa-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..4fd12b8 Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/kuksa-android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..6392d79 Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/kuksa-android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..656d88e Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/kuksa-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..54f29b1 Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/kuksa-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..ebcfb77 Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/kuksa-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..598ae20 Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/kuksa-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..d2d1b15 Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/kuksa-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..81b8abd Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/kuksa-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/kuksa-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..816ca8b Binary files /dev/null and b/kuksa-android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/kuksa-android/app/src/main/res/values/colors.xml b/kuksa-android/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..3ab3e9c --- /dev/null +++ b/kuksa-android/app/src/main/res/values/colors.xml @@ -0,0 +1,6 @@ + + + #3F51B5 + #303F9F + #FF4081 + diff --git a/kuksa-android/app/src/main/res/values/dimens.xml b/kuksa-android/app/src/main/res/values/dimens.xml new file mode 100644 index 0000000..59a0b0c --- /dev/null +++ b/kuksa-android/app/src/main/res/values/dimens.xml @@ -0,0 +1,3 @@ + + 16dp + diff --git a/kuksa-android/app/src/main/res/values/ic_launcher_background.xml b/kuksa-android/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 0000000..c5d5899 --- /dev/null +++ b/kuksa-android/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/values/settings_background.xml b/kuksa-android/app/src/main/res/values/settings_background.xml new file mode 100644 index 0000000..7ffd591 --- /dev/null +++ b/kuksa-android/app/src/main/res/values/settings_background.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + \ No newline at end of file diff --git a/kuksa-android/app/src/main/res/values/strings.xml b/kuksa-android/app/src/main/res/values/strings.xml new file mode 100644 index 0000000..2ecc222 --- /dev/null +++ b/kuksa-android/app/src/main/res/values/strings.xml @@ -0,0 +1,89 @@ + + Kuksa-Dev-Demo + Settings + Hello world + My Car + App Store + Settings + Cloud + Actual Speed + Actual RPM + Actual Errors + Map + Settings + + + + + General + + Enable social recommendations + Recommendations for people to contact + based on your message history + + + Display name + John Smith + + Add friends to messages + + Always + When possible + Never + + + 1 + 0 + -1 + + + + Data & sync + + Sync frequency + + 15 minutes + 30 minutes + 1 hour + 3 hours + 6 hours + Never + + + 15 + 30 + 60 + 180 + 360 + -1 + + + + Entry 1 + Entry 2 + Entry 3 + + + + 1 + 2 + 3 + + + + + System sync settings + + + Notifications + + New message notifications + + Ringtone + Silent + + Vibrate + + + Hello blank fragment + diff --git a/kuksa-android/app/src/main/res/values/styles.xml b/kuksa-android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..7282618 --- /dev/null +++ b/kuksa-android/app/src/main/res/values/styles.xml @@ -0,0 +1,22 @@ + + + + + + + +