├── .editorconfig ├── .gitignore ├── LICENSE ├── README.md ├── examples ├── arduino-examples │ ├── gps-test │ │ └── gps-test.ino │ ├── libraries │ │ ├── Adafruit_Unified_Sensor.zip │ │ ├── ArduinoHaberGSM.zip │ │ └── DHT_sensor_library.zip │ ├── mqtt_arduino_dht11 │ │ ├── fonahelper.cpp │ │ └── mqtt_arduino_dht11.ino │ ├── mqtt_arduino_gps │ │ ├── fonahelper.cpp │ │ └── mqtt_arduino_gps.ino │ └── mqtt_arduino_led │ │ ├── fonahelper.cpp │ │ └── mqtt_arduino_led.ino └── mqtt-server-example │ ├── client.js │ ├── index.html │ ├── package-lock.json │ ├── package.json │ └── server.js └── location-tracking ├── 3d-model ├── body.stl └── cover.stl ├── arduino ├── libraries │ ├── Adafruit_FONA_Library.zip │ ├── Adafruit_MQTT_Library.zip │ ├── Adafruit_SleepyDog_Library.zip │ ├── ArduinoHaberGSM.zip │ └── TinyGPS-master.zip └── mqtt_arduino_gps_retain │ ├── fonahelper.cpp │ └── mqtt_arduino_gps_retain.ino ├── cli-client ├── client.js ├── package-lock.json └── package.json ├── mobile-client └── LocationTracker │ ├── .buckconfig │ ├── .flowconfig │ ├── .gitattributes │ ├── .gitignore │ ├── .watchmanconfig │ ├── App.js │ ├── __tests__ │ └── App-test.js │ ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── build_defs.bzl │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── locationtracker │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ └── settings.gradle │ ├── app.json │ ├── assets │ └── arrow.png │ ├── babel.config.js │ ├── index.js │ ├── ios │ ├── LocationTracker-tvOS │ │ └── Info.plist │ ├── LocationTracker-tvOSTests │ │ └── Info.plist │ ├── LocationTracker.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── LocationTracker-tvOS.xcscheme │ │ │ └── LocationTracker.xcscheme │ ├── LocationTracker │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── LocationTrackerTests │ │ ├── Info.plist │ │ └── LocationTrackerTests.m │ ├── metro.config.js │ ├── package-lock.json │ ├── package.json │ └── yarn.lock ├── react-web-client ├── .gitignore ├── README.md ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt ├── src │ ├── App.css │ ├── App.js │ ├── App.test.js │ ├── MapContainer.js │ ├── index.css │ ├── index.js │ ├── logo.svg │ └── serviceWorker.js └── yarn.lock ├── server ├── package-lock.json ├── package.json └── server.js └── simple-web-client ├── car.png ├── index.html ├── script.js └── style.css /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | 7 | # Matches multiple files with brace expansion notation 8 | [*.{js,jsx,html,sass,graphql}] 9 | charset = utf-8 10 | indent_style = tab 11 | indent_size = 2 12 | trim_trailing_whitespace = true 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Arduino & Node.JS ile GSM Tabanlı Konum Takip Proje Tasarımı Eğitimi 2 | 3 | [:point_right: Kursa katılmak için tıklayın.](http://bit.ly/arduinode_) 4 | 5 | 6 | 7 | ![arduino nodejs eğitimi mehmet seven emre konca](https://mehmetseven.net/content/images/2019/11/cover-new2.jpg) 8 | 9 | 10 | ## Arduino 11 | 12 | Arduino ekosistemine hızlı bir giriş yaptıktan sonra Arduino programlamanın temellerini öğreneceksiniz. Giriş/Çıkış işlemleri, Analog/Dijital gibi kavramların dışında Arduino kartlarının enerji gereksinimleri gibi konuları da detaylı olarak izleyeceksiniz. 13 | 14 | ## GSM Shield / GSM Modülü 15 | 16 | SIM800C tabanlı GSM Shield'ı detaylıca inceleyeceğiz. SMS, arama yapma gibi konuları öğrendikten sonra gerçek zamanlı veri transferi için MQTT iletişimini öğreneceksiniz. GSM Shield/Modülü seçiminde yaşanan sorunlar konusunda farkındalık sahibi olacağınız için, doğru kart seçimi yapabileceksiniz. 17 | 18 | ## GPS Modülü 19 | 20 | Eğitimde NEO 6M tabanlı bir GPS modülü göreceksiniz. GPS modülünün  verdiği ham verileri yani NMEA verilerini inceleyip, ihtiyacınız olan bilgileri yazılım ile nasıl alacağınızı öğreneceksiniz. Bunun dışında TinyGPS kütüphanesine göz atıp kendi yazılımımıza nası entegre edeceğimizi de göreceğiz. Konum, irtifa, hız, tarih ve zaman gibi bilgileri de projemizde kullanacağız. 21 | 22 | ## Node.JS 23 | 24 | Node.JS, günümüzün en popüler yazılım geliştirme dillerinden biri . Çok geniş bir kullanım alanına sahip ve öğrenmesi oldukça kolay. Biz de kurs içerisinde hiçbir dış servise bağlı kalmadan, tüm backend işlemlerini Node.JS ile yapıyoruz. MQTT broker'ı Node.JS ile hazırlıyoruz ve tüm veri alışverişini bu server üzerinden yapıyoruz. 25 | 26 | ## React ile WEB Uygulaması Geliştirme 27 | 28 | Web sayfalarınızda güçlü kullanıcı deneyimi sunmak istediğinizde yardımınıza koşan ilk araçlardan biri React oluyor. Günümüz itibari ile mimarisini ve gücünü kanıtlamış en iyi arayüz geliştirme araçlarından birisi. Biz de kurs içerisinde konum takip projemizin web ekranını React ile geliştiriyoruz. 29 | 30 | ## React Native ile Mobil Uygulama Geliştirme 31 | 32 | React Native; mobil işletim sistemleri için kararlı ve yüksek performanslı uygulamalar geliştirmek istediğinizde aynı kod ile IOS ve Android ortamlarına uygulama çıkarabilen harika bir araç. Kurs içerisinde React Native'i kullanarak mobil uygulamalarımızı da geliştiriyoruz. Kullandığınızda çok seveceksiniz :) 33 | 34 | ![arduino nodejs eğitimi mehmet seven emre konca](https://mehmetseven.net/content/images/2019/10/arduino-nodejs-mehmet-seven-emre-konca-egitim.jpg) 35 | 36 | ## MQTT 37 | 38 | Arduino ve GSM kullanarak MQTT client'ı oluşturmanın bir çok sorunlu yanı var. Bu sorunları aşıp sorunsuz çalışan bir sistem tasarımını öğreneceksiniz. Hem donanım hem Arduino yazılımını öğreneceksiniz. 39 | 40 | ## Pil Yönetim Sistemi 41 | 42 | Elektronik devrelerinizi elektrik ile beslemeyi izleyeceksiniz. Özellikle lityum ion/polimer pillerin şarjı ve pilin gerilimini sistemin çalıştırma gerilimi olan 5V'a yükseltmeyi öğreneceksiniz. 43 | 44 | ## 3D Modelleme 45 | 46 | TinkerCAD ile hızlı bir şekilde 3 boyutlu modellemeye giriş yapacaksınız. Elektronik projelerimiz için kutu tasarımını öğreneceksiniz. 47 | 48 | ## 3D Baskı 49 | 50 | 3D modelimizi 3 boyutlu yazıcı ile basıp kullanacağız. Bu kapsamda 3D yazıcı ve 3D model arasındaki bağlantı ve tasarımda dikkat edilmesi gerekenleri öğreneceksiniz. Projemizdeki konum takip cihazına bir de kutu yapacağız. 51 | 52 | [:point_right: Kursa katılmak için tıklayın.](http://bit.ly/arduinode_) 53 | -------------------------------------------------------------------------------- /examples/arduino-examples/gps-test/gps-test.ino: -------------------------------------------------------------------------------- 1 | String saat = ""; // hhmmss.00 2 | String enlem = ""; // DDMM.MMMM Kuzey/Güney N/S 3 | String boylam = ""; // DDMM.MMMM Doğu/Batı E/W 4 | String irtifa = ""; // metre 5 | 6 | void setup() { 7 | Serial.begin(9600); 8 | Serial1.begin(9600); 9 | } 10 | 11 | void loop() { 12 | 13 | GPSdinle(); 14 | 15 | Serial.print("Saat: "); 16 | Serial.println(saat); 17 | Serial.print("Enlem: "); 18 | Serial.println(enlem); 19 | Serial.print("Boylam: "); 20 | Serial.println(boylam); 21 | Serial.print("irtifa: "); 22 | Serial.println(irtifa); 23 | Serial.println(); 24 | } 25 | 26 | void GPSdinle() { 27 | 28 | // $GPGGA arıyoruz 29 | if ( Serial1.find("$GPGGA,") ) { 30 | 31 | // Gelen veriyi parçalıyoruz 32 | saat = Serial1.readStringUntil(','); 33 | enlem = Serial1.readStringUntil(','); 34 | enlem.concat(Serial1.readStringUntil(',')); 35 | boylam = Serial1.readStringUntil(','); 36 | boylam.concat(Serial1.readStringUntil(',')); 37 | 38 | // irtifaya kadar olan kısmı atlıyoruz 39 | for ( int i = 0; i < 3; i++ ) { 40 | Serial1.readStringUntil(','); 41 | } 42 | 43 | // irtifa verisini parçalıyoruz 44 | irtifa = Serial1.readStringUntil(','); 45 | irtifa.concat(Serial1.readStringUntil(',')); 46 | 47 | // Verinin geri kalanını atlıyoruz 48 | Serial1.readStringUntil('\r'); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /examples/arduino-examples/libraries/Adafruit_Unified_Sensor.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/examples/arduino-examples/libraries/Adafruit_Unified_Sensor.zip -------------------------------------------------------------------------------- /examples/arduino-examples/libraries/ArduinoHaberGSM.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/examples/arduino-examples/libraries/ArduinoHaberGSM.zip -------------------------------------------------------------------------------- /examples/arduino-examples/libraries/DHT_sensor_library.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/examples/arduino-examples/libraries/DHT_sensor_library.zip -------------------------------------------------------------------------------- /examples/arduino-examples/mqtt_arduino_dht11/fonahelper.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Adafruit_FONA.h" 4 | 5 | #define halt(s) { Serial.println(F( s )); while(1); } 6 | 7 | extern Adafruit_FONA fona; 8 | extern SoftwareSerial fonaSS; 9 | 10 | boolean FONAconnect(const __FlashStringHelper *apn, const __FlashStringHelper *username, const __FlashStringHelper *password) { 11 | Watchdog.reset(); 12 | 13 | Serial.println(F("Initializing FONA....(May take 3 seconds)")); 14 | 15 | fonaSS.begin(9600); // if you're using software serial 16 | 17 | if (! fona.begin(fonaSS)) { // can also try fona.begin(Serial1) 18 | Serial.println(F("Couldn't find FONA")); 19 | return false; 20 | } 21 | fonaSS.println("AT+CMEE=2"); 22 | Serial.println(F("FONA is OK")); 23 | Watchdog.reset(); 24 | Serial.println(F("Checking for network...")); 25 | while (fona.getNetworkStatus() != 1) { 26 | delay(500); 27 | } 28 | 29 | Watchdog.reset(); 30 | delay(5000); // wait a few seconds to stabilize connection 31 | Watchdog.reset(); 32 | 33 | fona.setGPRSNetworkSettings(apn, username, password); 34 | 35 | Serial.println(F("Disabling GPRS")); 36 | fona.enableGPRS(false); 37 | 38 | Watchdog.reset(); 39 | delay(5000); // wait a few seconds to stabilize connection 40 | Watchdog.reset(); 41 | 42 | Serial.println(F("Enabling GPRS")); 43 | if (!fona.enableGPRS(true)) { 44 | Serial.println(F("Failed to turn GPRS on")); 45 | return false; 46 | } 47 | Watchdog.reset(); 48 | 49 | return true; 50 | } 51 | -------------------------------------------------------------------------------- /examples/arduino-examples/mqtt_arduino_dht11/mqtt_arduino_dht11.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Adafruit_FONA.h" 4 | #include "Adafruit_MQTT.h" 5 | #include "Adafruit_MQTT_FONA.h" 6 | 7 | //Kapadokya GSM Shield için pinler 8 | #define FONA_RX 11 9 | #define FONA_TX 10 10 | #define FONA_RST 4 11 | SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX); 12 | 13 | Adafruit_FONA fona = Adafruit_FONA(FONA_RST); 14 | 15 | #define FONA_APN "internet" 16 | #define FONA_USERNAME "" 17 | #define FONA_PASSWORD "" 18 | #define AIO_SERVER "157.230.113.66" 19 | #define AIO_SERVERPORT 1883 20 | 21 | Adafruit_MQTT_FONA mqtt(&fona, AIO_SERVER, AIO_SERVERPORT); 22 | #define halt(s) { Serial.println(F( s )); while(1); } 23 | boolean FONAconnect(const __FlashStringHelper *apn, const __FlashStringHelper *username, const __FlashStringHelper *password); 24 | 25 | Adafruit_MQTT_Publish tem = Adafruit_MQTT_Publish(&mqtt, "TEMP"); 26 | Adafruit_MQTT_Publish loc = Adafruit_MQTT_Publish(&mqtt, "LOCATION"); 27 | Adafruit_MQTT_Subscribe led = Adafruit_MQTT_Subscribe(&mqtt, "LED"); 28 | 29 | uint8_t txfailures = 0; 30 | #define MAXTXFAILURES 3 31 | 32 | #include "DHT.h" 33 | DHT dht(A1, DHT11); 34 | 35 | void setup() { 36 | dht.begin(); 37 | 38 | pinMode(13, OUTPUT); 39 | pinMode(A0, INPUT); 40 | 41 | Serial.begin(9600); 42 | Serial.println(F("System started.")); 43 | mqtt.subscribe(&led); 44 | 45 | Watchdog.reset(); 46 | delay(5000); 47 | Watchdog.reset(); 48 | 49 | while (! FONAconnect(F(FONA_APN), F(FONA_USERNAME), F(FONA_PASSWORD))) { 50 | Serial.println("Retrying FONA"); 51 | } 52 | Serial.println(F("Connected to Cellular!")); 53 | Watchdog.reset(); 54 | delay(5000); 55 | Watchdog.reset(); 56 | } 57 | 58 | uint32_t x = 0; 59 | 60 | void loop() { 61 | int t = dht.readTemperature(); 62 | 63 | Watchdog.reset(); 64 | MQTT_connect(); 65 | 66 | //if (digitalRead(A0)) { 67 | if (false) { 68 | Serial.println(F("\nButton Pressed ################################")); 69 | Watchdog.reset(); 70 | Serial.print(F("\nSending LOCATION val ")); Serial.print("..."); 71 | if (!loc.publish("emre,mehmet,udemy")) { 72 | Serial.println(F("Failed")); 73 | txfailures++; 74 | } else { 75 | Serial.println(F("OK!")); 76 | txfailures = 0; 77 | } 78 | } 79 | 80 | 81 | char temp2[4]; 82 | String str = String(t); 83 | str.toCharArray(temp2, 4); 84 | Serial.print(F("temp2: ")); Serial.println(temp2); 85 | 86 | Watchdog.reset(); 87 | Serial.print(F("\nSending temp2 val ")); Serial.print("..."); 88 | if (!tem.publish(temp2)) { 89 | Serial.println(F("Failed")); 90 | txfailures++; 91 | } else { 92 | Serial.println(F("OK!")); 93 | txfailures = 0; 94 | } 95 | 96 | 97 | Watchdog.reset(); 98 | 99 | Adafruit_MQTT_Subscribe *subscription; 100 | while ((subscription = mqtt.readSubscription(1000))) { 101 | if (subscription == &led) { 102 | Serial.print(F("------------------------------------------------Got: ")); 103 | String gelenVeri = String((char *)led.lastread); 104 | Serial.println(gelenVeri); 105 | if (gelenVeri == "on") { 106 | digitalWrite(13, HIGH); 107 | } 108 | else if (gelenVeri == "off") { 109 | digitalWrite(13, LOW); 110 | } 111 | else { 112 | Serial.print(F("------------------------------------------------ELSE: ")); 113 | } 114 | } 115 | } 116 | 117 | /* 118 | if (!mqtt.ping()) { 119 | Serial.println(F("MQTT Ping failed.")); 120 | } 121 | */ 122 | } 123 | 124 | void MQTT_connect() { 125 | int8_t ret; 126 | if (mqtt.connected()) { 127 | return; 128 | } 129 | Serial.print("Connecting to MQTT... "); 130 | while ((ret = mqtt.connect()) != 0) { 131 | Serial.println(mqtt.connectErrorString(ret)); 132 | Serial.println("Retrying MQTT connection in 5 seconds..."); 133 | mqtt.disconnect(); 134 | delay(5000); 135 | } 136 | Serial.println("MQTT Connected!"); 137 | } 138 | -------------------------------------------------------------------------------- /examples/arduino-examples/mqtt_arduino_gps/fonahelper.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Adafruit_FONA.h" 4 | 5 | #define halt(s) { Serial.println(F( s )); while(1); } 6 | 7 | extern Adafruit_FONA fona; 8 | extern SoftwareSerial fonaSS; 9 | 10 | boolean FONAconnect(const __FlashStringHelper *apn, const __FlashStringHelper *username, const __FlashStringHelper *password) { 11 | Watchdog.reset(); 12 | 13 | Serial.println(F("Initializing FONA....(May take 3 seconds)")); 14 | 15 | fonaSS.begin(9600); // if you're using software serial 16 | 17 | if (! fona.begin(fonaSS)) { // can also try fona.begin(Serial1) 18 | Serial.println(F("Couldn't find FONA")); 19 | return false; 20 | } 21 | fonaSS.println("AT+CMEE=2"); 22 | Serial.println(F("FONA is OK")); 23 | Watchdog.reset(); 24 | Serial.println(F("Checking for network...")); 25 | while (fona.getNetworkStatus() != 1) { 26 | delay(500); 27 | } 28 | 29 | Watchdog.reset(); 30 | delay(5000); // wait a few seconds to stabilize connection 31 | Watchdog.reset(); 32 | 33 | fona.setGPRSNetworkSettings(apn, username, password); 34 | 35 | Serial.println(F("Disabling GPRS")); 36 | fona.enableGPRS(false); 37 | 38 | Watchdog.reset(); 39 | delay(5000); // wait a few seconds to stabilize connection 40 | Watchdog.reset(); 41 | 42 | Serial.println(F("Enabling GPRS")); 43 | if (!fona.enableGPRS(true)) { 44 | Serial.println(F("Failed to turn GPRS on")); 45 | return false; 46 | } 47 | Watchdog.reset(); 48 | 49 | return true; 50 | } 51 | -------------------------------------------------------------------------------- /examples/arduino-examples/mqtt_arduino_gps/mqtt_arduino_gps.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Adafruit_FONA.h" 4 | #include "Adafruit_MQTT.h" 5 | #include "Adafruit_MQTT_FONA.h" 6 | 7 | //Kapadokya GSM Shield için pinler 8 | #define FONA_RX 11 9 | #define FONA_TX 10 10 | #define FONA_RST 4 11 | SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX); 12 | 13 | Adafruit_FONA fona = Adafruit_FONA(FONA_RST); 14 | 15 | #define FONA_APN "internet" 16 | #define FONA_USERNAME "" 17 | #define FONA_PASSWORD "" 18 | #define AIO_SERVER "157.230.113.66" 19 | #define AIO_SERVERPORT 1883 20 | 21 | Adafruit_MQTT_FONA mqtt(&fona, AIO_SERVER, AIO_SERVERPORT); 22 | #define halt(s) { Serial.println(F( s )); while(1); } 23 | boolean FONAconnect(const __FlashStringHelper *apn, const __FlashStringHelper *username, const __FlashStringHelper *password); 24 | 25 | Adafruit_MQTT_Publish loc = Adafruit_MQTT_Publish(&mqtt, "LOCATION"); 26 | Adafruit_MQTT_Subscribe led = Adafruit_MQTT_Subscribe(&mqtt, "LED"); 27 | 28 | uint8_t txfailures = 0; 29 | #define MAXTXFAILURES 3 30 | 31 | #include 32 | TinyGPS gps; 33 | #define ss Serial1 34 | 35 | void setup() { 36 | pinMode(13, OUTPUT); 37 | pinMode(A0, INPUT); 38 | 39 | ss.begin(9600); 40 | 41 | Serial.begin(9600); 42 | while (!Serial); 43 | Serial.println(F("System started.")); 44 | mqtt.subscribe(&led); 45 | 46 | while (! FONAconnect(F(FONA_APN), F(FONA_USERNAME), F(FONA_PASSWORD))) { 47 | Serial.println("Retrying FONA"); 48 | } 49 | Serial.println(F("Connected to Cellular!")); 50 | } 51 | 52 | uint32_t x = 0; 53 | 54 | void loop() { 55 | MQTT_connect(); 56 | 57 | smartdelay(1000); 58 | float flat, flon; 59 | unsigned long age; 60 | gps.f_get_position(&flat, &flon, &age); 61 | int alt = gps.f_altitude(); 62 | int spd = gps.f_speed_kmph(); 63 | int crs = gps.f_course(); 64 | 65 | String locData = String(flat, 6) + "," + String(flon, 6) + "," + String(alt) + "," + String(spd) + "," + String(crs); 66 | char locData2[100]; 67 | locData.toCharArray(locData2, 100); 68 | 69 | Serial.print(F("\nSending LOCATION val: ")); Serial.print(locData2); Serial.print(F("...")); 70 | 71 | if (!loc.publish(locData2)) { 72 | Serial.println(F("Failed")); 73 | txfailures++; 74 | } else { 75 | Serial.println(F("OK!")); 76 | txfailures = 0; 77 | } 78 | 79 | Adafruit_MQTT_Subscribe *subscription; 80 | while ((subscription = mqtt.readSubscription(1000))) { 81 | if (subscription == &led) { 82 | Serial.print(F("------------------------------------------------Got: ")); 83 | String gelenVeri = String((char *)led.lastread); 84 | Serial.println(gelenVeri); 85 | if (gelenVeri == "on") { 86 | digitalWrite(13, HIGH); 87 | } 88 | else if (gelenVeri == "off") { 89 | digitalWrite(13, LOW); 90 | } 91 | else { 92 | Serial.print(F("------------------------------------------------ELSE: ")); 93 | } 94 | } 95 | } 96 | } 97 | 98 | void MQTT_connect() { 99 | int8_t ret; 100 | if (mqtt.connected()) { 101 | return; 102 | } 103 | Serial.print("Connecting to MQTT... "); 104 | while ((ret = mqtt.connect()) != 0) { 105 | Serial.println(mqtt.connectErrorString(ret)); 106 | Serial.println("Retrying MQTT connection in 5 seconds..."); 107 | mqtt.disconnect(); 108 | delay(5000); 109 | } 110 | Serial.println("MQTT Connected!"); 111 | } 112 | 113 | static void smartdelay(unsigned long ms) { 114 | unsigned long start = millis(); 115 | do { 116 | while (ss.available()) 117 | gps.encode(ss.read()); 118 | } while (millis() - start < ms); 119 | } 120 | -------------------------------------------------------------------------------- /examples/arduino-examples/mqtt_arduino_led/fonahelper.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Adafruit_FONA.h" 4 | 5 | #define halt(s) { Serial.println(F( s )); while(1); } 6 | 7 | extern Adafruit_FONA fona; 8 | extern SoftwareSerial fonaSS; 9 | 10 | boolean FONAconnect(const __FlashStringHelper *apn, const __FlashStringHelper *username, const __FlashStringHelper *password) { 11 | Watchdog.reset(); 12 | 13 | Serial.println(F("Initializing FONA....(May take 3 seconds)")); 14 | 15 | fonaSS.begin(9600); // if you're using software serial 16 | 17 | if (! fona.begin(fonaSS)) { // can also try fona.begin(Serial1) 18 | Serial.println(F("Couldn't find FONA")); 19 | return false; 20 | } 21 | fonaSS.println("AT+CMEE=2"); 22 | Serial.println(F("FONA is OK")); 23 | Watchdog.reset(); 24 | Serial.println(F("Checking for network...")); 25 | while (fona.getNetworkStatus() != 1) { 26 | delay(500); 27 | } 28 | 29 | Watchdog.reset(); 30 | delay(5000); // wait a few seconds to stabilize connection 31 | Watchdog.reset(); 32 | 33 | fona.setGPRSNetworkSettings(apn, username, password); 34 | 35 | Serial.println(F("Disabling GPRS")); 36 | fona.enableGPRS(false); 37 | 38 | Watchdog.reset(); 39 | delay(5000); // wait a few seconds to stabilize connection 40 | Watchdog.reset(); 41 | 42 | Serial.println(F("Enabling GPRS")); 43 | if (!fona.enableGPRS(true)) { 44 | Serial.println(F("Failed to turn GPRS on")); 45 | return false; 46 | } 47 | Watchdog.reset(); 48 | 49 | return true; 50 | } 51 | -------------------------------------------------------------------------------- /examples/arduino-examples/mqtt_arduino_led/mqtt_arduino_led.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Adafruit_FONA.h" 4 | #include "Adafruit_MQTT.h" 5 | #include "Adafruit_MQTT_FONA.h" 6 | 7 | #define FONA_RX 11 8 | #define FONA_TX 10 9 | #define FONA_RST 4 10 | SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX); 11 | 12 | Adafruit_FONA fona = Adafruit_FONA(FONA_RST); 13 | 14 | #define FONA_APN "internet" 15 | #define FONA_USERNAME "" 16 | #define FONA_PASSWORD "" 17 | #define AIO_SERVER "167.71.181.108" 18 | #define AIO_SERVERPORT 1883 19 | 20 | Adafruit_MQTT_FONA mqtt(&fona, AIO_SERVER, AIO_SERVERPORT); 21 | #define halt(s) { Serial.println(F( s )); while(1); } 22 | boolean FONAconnect(const __FlashStringHelper *apn, const __FlashStringHelper *username, const __FlashStringHelper *password); 23 | 24 | Adafruit_MQTT_Publish loc = Adafruit_MQTT_Publish(&mqtt, "LOCATION"); 25 | Adafruit_MQTT_Subscribe led = Adafruit_MQTT_Subscribe(&mqtt, "LED"); 26 | 27 | uint8_t txfailures = 0; 28 | #define MAXTXFAILURES 3 29 | 30 | void setup() { 31 | pinMode(13, OUTPUT); 32 | pinMode(A0, INPUT); 33 | 34 | Serial.begin(9600); 35 | Serial.println(F("System started.")); 36 | mqtt.subscribe(&led); 37 | 38 | Watchdog.reset(); 39 | delay(5000); 40 | Watchdog.reset(); 41 | 42 | while (! FONAconnect(F(FONA_APN), F(FONA_USERNAME), F(FONA_PASSWORD))) { 43 | Serial.println("Retrying FONA"); 44 | } 45 | Serial.println(F("Connected to Cellular!")); 46 | Watchdog.reset(); 47 | delay(5000); 48 | Watchdog.reset(); 49 | } 50 | 51 | uint32_t x = 0; 52 | 53 | void loop() { 54 | 55 | Watchdog.reset(); 56 | MQTT_connect(); 57 | 58 | if (digitalRead(A0) || true) { 59 | Serial.println(F("\nBUTONA BASILDI ################################")); 60 | Watchdog.reset(); 61 | Serial.print(F("\nSending LOCATION val ")); Serial.print(x); Serial.print("..."); 62 | //if (!loc.publish(x++)) { 63 | if (!loc.publish("23.34234354,34.4564564564,4,5,emre,mehmet,udemy,01234567891011121314151617181920")) { 64 | Serial.println(F("Failed")); 65 | txfailures++; 66 | } else { 67 | Serial.println(F("OK!")); 68 | txfailures = 0; 69 | } 70 | } 71 | 72 | Watchdog.reset(); 73 | 74 | Adafruit_MQTT_Subscribe *subscription; 75 | while ((subscription = mqtt.readSubscription(1000))) { 76 | if (subscription == &led) { 77 | Serial.print(F("------------------------------------------------Got: ")); 78 | String gelenVeri = String((char *)led.lastread); 79 | Serial.println(gelenVeri); 80 | if (gelenVeri == "on") { 81 | digitalWrite(13, HIGH); 82 | } 83 | else if (gelenVeri == "off") { 84 | digitalWrite(13, LOW); 85 | } 86 | else { 87 | Serial.print(F("------------------------------------------------ELSE: ")); 88 | } 89 | } 90 | } 91 | 92 | /* 93 | if (!mqtt.ping()) { 94 | Serial.println(F("MQTT Ping failed.")); 95 | } 96 | */ 97 | } 98 | 99 | void MQTT_connect() { 100 | int8_t ret; 101 | if (mqtt.connected()) { 102 | return; 103 | } 104 | Serial.print("Connecting to MQTT... "); 105 | while ((ret = mqtt.connect()) != 0) { 106 | Serial.println(mqtt.connectErrorString(ret)); 107 | Serial.println("Retrying MQTT connection in 5 seconds..."); 108 | mqtt.disconnect(); 109 | delay(5000); 110 | } 111 | Serial.println("MQTT Connected!"); 112 | } 113 | -------------------------------------------------------------------------------- /examples/mqtt-server-example/client.js: -------------------------------------------------------------------------------- 1 | var mqtt = require('mqtt'); 2 | var client = mqtt.connect('mqtt://127.0.0.1:1883'); 3 | 4 | client.subscribe('new-user'); 5 | client.subscribe('led'); 6 | 7 | client.on('connect', function() { 8 | console.log('connected!'); 9 | 10 | client.publish('led', 'on'); 11 | client.publish('new-user', 'Mehmet-' + Math.ceil(Math.random() * 10)); 12 | }); 13 | 14 | client.on('message', function(topic, message) { 15 | console.log(topic, ' : ', message.toString()); 16 | }); 17 | -------------------------------------------------------------------------------- /examples/mqtt-server-example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | MQTT Client 8 | 9 | 38 | 39 | 40 | 41 | 42 | 43 |
Sıcaklık:
44 | 45 | 46 | -------------------------------------------------------------------------------- /examples/mqtt-server-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mqtt-server", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "nodemon server.js", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "mosca": "^2.8.3", 15 | "mqtt": "^3.0.0" 16 | } 17 | } -------------------------------------------------------------------------------- /examples/mqtt-server-example/server.js: -------------------------------------------------------------------------------- 1 | var mosca = require('mosca'); 2 | 3 | var settings = { 4 | port: 1883, 5 | http: { 6 | port: 3000, 7 | }, 8 | }; 9 | 10 | var server = new mosca.Server(settings); 11 | 12 | server.on('clientConnected', function(client) { 13 | console.log('client connected', client.id); 14 | }); 15 | 16 | server.on('clientDisconnected', function(client) { 17 | console.log('client disconnected -', client.id); 18 | }); 19 | 20 | // fired when a message is received 21 | server.on('published', function(packet, client) { 22 | console.log('Published', packet.payload.toString()); 23 | }); 24 | 25 | server.on('ready', setup); 26 | 27 | // fired when the mqtt server is ready 28 | function setup() { 29 | console.log('Mosca server is up and running'); 30 | } 31 | -------------------------------------------------------------------------------- /location-tracking/3d-model/body.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/3d-model/body.stl -------------------------------------------------------------------------------- /location-tracking/3d-model/cover.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/3d-model/cover.stl -------------------------------------------------------------------------------- /location-tracking/arduino/libraries/Adafruit_FONA_Library.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/arduino/libraries/Adafruit_FONA_Library.zip -------------------------------------------------------------------------------- /location-tracking/arduino/libraries/Adafruit_MQTT_Library.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/arduino/libraries/Adafruit_MQTT_Library.zip -------------------------------------------------------------------------------- /location-tracking/arduino/libraries/Adafruit_SleepyDog_Library.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/arduino/libraries/Adafruit_SleepyDog_Library.zip -------------------------------------------------------------------------------- /location-tracking/arduino/libraries/ArduinoHaberGSM.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/arduino/libraries/ArduinoHaberGSM.zip -------------------------------------------------------------------------------- /location-tracking/arduino/libraries/TinyGPS-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/arduino/libraries/TinyGPS-master.zip -------------------------------------------------------------------------------- /location-tracking/arduino/mqtt_arduino_gps_retain/fonahelper.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Adafruit_FONA.h" 4 | 5 | #define halt(s) { Serial.println(F( s )); while(1); } 6 | 7 | extern Adafruit_FONA fona; 8 | extern SoftwareSerial fonaSS; 9 | 10 | boolean FONAconnect(const __FlashStringHelper *apn, const __FlashStringHelper *username, const __FlashStringHelper *password) { 11 | Watchdog.reset(); 12 | 13 | Serial.println(F("Initializing FONA....(May take 3 seconds)")); 14 | 15 | fonaSS.begin(9600); // if you're using software serial 16 | 17 | if (! fona.begin(fonaSS)) { // can also try fona.begin(Serial1) 18 | Serial.println(F("Couldn't find FONA")); 19 | return false; 20 | } 21 | fonaSS.println("AT+CMEE=2"); 22 | Serial.println(F("FONA is OK")); 23 | Watchdog.reset(); 24 | Serial.println(F("Checking for network...")); 25 | while (fona.getNetworkStatus() != 1) { 26 | delay(500); 27 | } 28 | 29 | Watchdog.reset(); 30 | delay(5000); // wait a few seconds to stabilize connection 31 | Watchdog.reset(); 32 | 33 | fona.setGPRSNetworkSettings(apn, username, password); 34 | 35 | Serial.println(F("Disabling GPRS")); 36 | fona.enableGPRS(false); 37 | 38 | Watchdog.reset(); 39 | delay(5000); // wait a few seconds to stabilize connection 40 | Watchdog.reset(); 41 | 42 | Serial.println(F("Enabling GPRS")); 43 | if (!fona.enableGPRS(true)) { 44 | Serial.println(F("Failed to turn GPRS on")); 45 | return false; 46 | } 47 | Watchdog.reset(); 48 | 49 | return true; 50 | } 51 | -------------------------------------------------------------------------------- /location-tracking/arduino/mqtt_arduino_gps_retain/mqtt_arduino_gps_retain.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "Adafruit_FONA.h" 4 | #include "Adafruit_MQTT.h" 5 | #include "Adafruit_MQTT_FONA.h" 6 | 7 | //Kapadokya GSM Shield için pinler 8 | #define FONA_RX 11 9 | #define FONA_TX 10 10 | #define FONA_RST 4 11 | SoftwareSerial fonaSS = SoftwareSerial(FONA_TX, FONA_RX); 12 | 13 | Adafruit_FONA fona = Adafruit_FONA(FONA_RST); 14 | 15 | #define FONA_APN "internet" 16 | #define FONA_USERNAME "" 17 | #define FONA_PASSWORD "" 18 | #define AIO_SERVER "157.230.113.66" 19 | #define AIO_SERVERPORT 1883 20 | 21 | Adafruit_MQTT_FONA mqtt(&fona, AIO_SERVER, AIO_SERVERPORT); 22 | #define halt(s) { Serial.println(F( s )); while(1); } 23 | boolean FONAconnect(const __FlashStringHelper *apn, const __FlashStringHelper *username, const __FlashStringHelper *password); 24 | 25 | Adafruit_MQTT_Subscribe led = Adafruit_MQTT_Subscribe(&mqtt, "LED"); 26 | 27 | uint8_t txfailures = 0; 28 | #define MAXTXFAILURES 3 29 | 30 | #include 31 | TinyGPS gps; 32 | #define ss Serial1 33 | 34 | void setup() { 35 | pinMode(13, OUTPUT); 36 | pinMode(A0, INPUT); 37 | 38 | ss.begin(9600); 39 | 40 | Serial.begin(9600); 41 | //while (!Serial); 42 | Serial.println(F("System started.")); 43 | mqtt.subscribe(&led); 44 | 45 | while (! FONAconnect(F(FONA_APN), F(FONA_USERNAME), F(FONA_PASSWORD))) { 46 | Serial.println("Retrying FONA"); 47 | } 48 | Serial.println(F("Connected to Cellular!")); 49 | } 50 | 51 | uint32_t x = 0; 52 | 53 | void loop() { 54 | MQTT_connect(); 55 | 56 | smartdelay(1000); 57 | float flat, flon; 58 | unsigned long age; 59 | gps.f_get_position(&flat, &flon, &age); 60 | int alt = gps.f_altitude(); 61 | int spd = gps.f_speed_kmph(); 62 | int crs = gps.f_course(); 63 | 64 | String locData = String(flat, 6) + "," + String(flon, 6) + "," + String(alt) + "," + String(spd) + "," + String(crs); 65 | char locData2[100]; 66 | locData.toCharArray(locData2, 100); 67 | 68 | Serial.print(F("\nSending LOCATION val: ")); Serial.print(locData2); Serial.print(F("...")); 69 | 70 | #define QoS 1 71 | #define RETAIN 1 72 | 73 | if (!mqtt.publish("LOCATION", locData2, QoS , RETAIN)) { 74 | Serial.println(F("Failed")); 75 | txfailures++; 76 | } else { 77 | Serial.println(F("OK!")); 78 | txfailures = 0; 79 | } 80 | 81 | // Watchdog.reset(); 82 | Adafruit_MQTT_Subscribe *subscription; 83 | while ((subscription = mqtt.readSubscription(1000))) { 84 | if (subscription == &led) { 85 | Serial.print(F("------------------------------------------------Got: ")); 86 | String gelenVeri = String((char *)led.lastread); 87 | Serial.println(gelenVeri); 88 | if (gelenVeri == "on") { 89 | digitalWrite(13, HIGH); 90 | } 91 | else if (gelenVeri == "off") { 92 | digitalWrite(13, LOW); 93 | } 94 | else { 95 | Serial.print(F("------------------------------------------------ELSE: ")); 96 | } 97 | } 98 | } 99 | } 100 | 101 | void MQTT_connect() { 102 | int8_t ret; 103 | if (mqtt.connected()) { 104 | return; 105 | } 106 | Serial.print("Connecting to MQTT... "); 107 | while ((ret = mqtt.connect()) != 0) { 108 | Serial.println(mqtt.connectErrorString(ret)); 109 | Serial.println("Retrying MQTT connection in 5 seconds..."); 110 | mqtt.disconnect(); 111 | delay(5000); 112 | } 113 | Serial.println("MQTT Connected!"); 114 | } 115 | 116 | static void smartdelay(unsigned long ms) { 117 | unsigned long start = millis(); 118 | do { 119 | while (ss.available()) 120 | gps.encode(ss.read()); 121 | } while (millis() - start < ms); 122 | } 123 | -------------------------------------------------------------------------------- /location-tracking/cli-client/client.js: -------------------------------------------------------------------------------- 1 | var mqtt = require('mqtt'); 2 | var client = mqtt.connect('mqtt://127.0.0.1:1883'); 3 | 4 | client.subscribe('location'); 5 | 6 | client.on('connect', function() { 7 | console.log('connected!'); 8 | 9 | client.subscribe('new-user', function() { 10 | client.publish('new-user', 'Mehmet-' + Math.ceil(Math.random() * 10), { 11 | retain: true, 12 | }); 13 | }); 14 | }); 15 | 16 | client.on('message', function(topic, message) { 17 | console.log(topic, ' : ', message.toString()); 18 | }); 19 | -------------------------------------------------------------------------------- /location-tracking/cli-client/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cli-client", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "async-limiter": { 8 | "version": "1.0.1", 9 | "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", 10 | "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" 11 | }, 12 | "balanced-match": { 13 | "version": "1.0.0", 14 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 15 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" 16 | }, 17 | "base64-js": { 18 | "version": "1.3.1", 19 | "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", 20 | "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" 21 | }, 22 | "bl": { 23 | "version": "1.2.2", 24 | "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", 25 | "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", 26 | "requires": { 27 | "readable-stream": "^2.3.5", 28 | "safe-buffer": "^5.1.1" 29 | } 30 | }, 31 | "brace-expansion": { 32 | "version": "1.1.11", 33 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", 34 | "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", 35 | "requires": { 36 | "balanced-match": "^1.0.0", 37 | "concat-map": "0.0.1" 38 | } 39 | }, 40 | "buffer-from": { 41 | "version": "1.1.1", 42 | "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", 43 | "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" 44 | }, 45 | "callback-stream": { 46 | "version": "1.1.0", 47 | "resolved": "https://registry.npmjs.org/callback-stream/-/callback-stream-1.1.0.tgz", 48 | "integrity": "sha1-RwGlEmbwbgbqpx/BcjOCLYdfSQg=", 49 | "requires": { 50 | "inherits": "^2.0.1", 51 | "readable-stream": "> 1.0.0 < 3.0.0" 52 | } 53 | }, 54 | "commist": { 55 | "version": "1.1.0", 56 | "resolved": "https://registry.npmjs.org/commist/-/commist-1.1.0.tgz", 57 | "integrity": "sha512-rraC8NXWOEjhADbZe9QBNzLAN5Q3fsTPQtBV+fEVj6xKIgDgNiEVE6ZNfHpZOqfQ21YUzfVNUXLOEZquYvQPPg==", 58 | "requires": { 59 | "leven": "^2.1.0", 60 | "minimist": "^1.1.0" 61 | } 62 | }, 63 | "concat-map": { 64 | "version": "0.0.1", 65 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 66 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" 67 | }, 68 | "concat-stream": { 69 | "version": "1.6.2", 70 | "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", 71 | "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", 72 | "requires": { 73 | "buffer-from": "^1.0.0", 74 | "inherits": "^2.0.3", 75 | "readable-stream": "^2.2.2", 76 | "typedarray": "^0.0.6" 77 | } 78 | }, 79 | "core-util-is": { 80 | "version": "1.0.2", 81 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 82 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" 83 | }, 84 | "d": { 85 | "version": "1.0.1", 86 | "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", 87 | "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", 88 | "requires": { 89 | "es5-ext": "^0.10.50", 90 | "type": "^1.0.1" 91 | } 92 | }, 93 | "duplexify": { 94 | "version": "3.7.1", 95 | "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.7.1.tgz", 96 | "integrity": "sha512-07z8uv2wMyS51kKhD1KsdXJg5WQ6t93RneqRxUHnskXVtlYYkLqM0gqStQZ3pj073g687jPCHrqNfCzawLYh5g==", 97 | "requires": { 98 | "end-of-stream": "^1.0.0", 99 | "inherits": "^2.0.1", 100 | "readable-stream": "^2.0.0", 101 | "stream-shift": "^1.0.0" 102 | } 103 | }, 104 | "end-of-stream": { 105 | "version": "1.4.4", 106 | "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", 107 | "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", 108 | "requires": { 109 | "once": "^1.4.0" 110 | } 111 | }, 112 | "es5-ext": { 113 | "version": "0.10.51", 114 | "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.51.tgz", 115 | "integrity": "sha512-oRpWzM2WcLHVKpnrcyB7OW8j/s67Ba04JCm0WnNv3RiABSvs7mrQlutB8DBv793gKcp0XENR8Il8WxGTlZ73gQ==", 116 | "requires": { 117 | "es6-iterator": "~2.0.3", 118 | "es6-symbol": "~3.1.1", 119 | "next-tick": "^1.0.0" 120 | } 121 | }, 122 | "es6-iterator": { 123 | "version": "2.0.3", 124 | "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz", 125 | "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=", 126 | "requires": { 127 | "d": "1", 128 | "es5-ext": "^0.10.35", 129 | "es6-symbol": "^3.1.1" 130 | } 131 | }, 132 | "es6-map": { 133 | "version": "0.1.5", 134 | "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", 135 | "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", 136 | "requires": { 137 | "d": "1", 138 | "es5-ext": "~0.10.14", 139 | "es6-iterator": "~2.0.1", 140 | "es6-set": "~0.1.5", 141 | "es6-symbol": "~3.1.1", 142 | "event-emitter": "~0.3.5" 143 | } 144 | }, 145 | "es6-set": { 146 | "version": "0.1.5", 147 | "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", 148 | "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", 149 | "requires": { 150 | "d": "1", 151 | "es5-ext": "~0.10.14", 152 | "es6-iterator": "~2.0.1", 153 | "es6-symbol": "3.1.1", 154 | "event-emitter": "~0.3.5" 155 | }, 156 | "dependencies": { 157 | "es6-symbol": { 158 | "version": "3.1.1", 159 | "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", 160 | "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", 161 | "requires": { 162 | "d": "1", 163 | "es5-ext": "~0.10.14" 164 | } 165 | } 166 | } 167 | }, 168 | "es6-symbol": { 169 | "version": "3.1.2", 170 | "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.2.tgz", 171 | "integrity": "sha512-/ZypxQsArlv+KHpGvng52/Iz8by3EQPxhmbuz8yFG89N/caTFBSbcXONDw0aMjy827gQg26XAjP4uXFvnfINmQ==", 172 | "requires": { 173 | "d": "^1.0.1", 174 | "es5-ext": "^0.10.51" 175 | } 176 | }, 177 | "event-emitter": { 178 | "version": "0.3.5", 179 | "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", 180 | "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", 181 | "requires": { 182 | "d": "1", 183 | "es5-ext": "~0.10.14" 184 | } 185 | }, 186 | "extend": { 187 | "version": "3.0.2", 188 | "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", 189 | "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" 190 | }, 191 | "fs.realpath": { 192 | "version": "1.0.0", 193 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 194 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" 195 | }, 196 | "glob": { 197 | "version": "7.1.4", 198 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", 199 | "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", 200 | "requires": { 201 | "fs.realpath": "^1.0.0", 202 | "inflight": "^1.0.4", 203 | "inherits": "2", 204 | "minimatch": "^3.0.4", 205 | "once": "^1.3.0", 206 | "path-is-absolute": "^1.0.0" 207 | } 208 | }, 209 | "glob-parent": { 210 | "version": "3.1.0", 211 | "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", 212 | "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", 213 | "requires": { 214 | "is-glob": "^3.1.0", 215 | "path-dirname": "^1.0.0" 216 | } 217 | }, 218 | "glob-stream": { 219 | "version": "6.1.0", 220 | "resolved": "https://registry.npmjs.org/glob-stream/-/glob-stream-6.1.0.tgz", 221 | "integrity": "sha1-cEXJlBOz65SIjYOrRtC0BMx73eQ=", 222 | "requires": { 223 | "extend": "^3.0.0", 224 | "glob": "^7.1.1", 225 | "glob-parent": "^3.1.0", 226 | "is-negated-glob": "^1.0.0", 227 | "ordered-read-streams": "^1.0.0", 228 | "pumpify": "^1.3.5", 229 | "readable-stream": "^2.1.5", 230 | "remove-trailing-separator": "^1.0.1", 231 | "to-absolute-glob": "^2.0.0", 232 | "unique-stream": "^2.0.2" 233 | } 234 | }, 235 | "help-me": { 236 | "version": "1.1.0", 237 | "resolved": "https://registry.npmjs.org/help-me/-/help-me-1.1.0.tgz", 238 | "integrity": "sha1-jy1QjQYAtKRW2i8IZVbn5cBWo8Y=", 239 | "requires": { 240 | "callback-stream": "^1.0.2", 241 | "glob-stream": "^6.1.0", 242 | "through2": "^2.0.1", 243 | "xtend": "^4.0.0" 244 | } 245 | }, 246 | "inflight": { 247 | "version": "1.0.6", 248 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 249 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 250 | "requires": { 251 | "once": "^1.3.0", 252 | "wrappy": "1" 253 | } 254 | }, 255 | "inherits": { 256 | "version": "2.0.4", 257 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", 258 | "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" 259 | }, 260 | "is-absolute": { 261 | "version": "1.0.0", 262 | "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-1.0.0.tgz", 263 | "integrity": "sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA==", 264 | "requires": { 265 | "is-relative": "^1.0.0", 266 | "is-windows": "^1.0.1" 267 | } 268 | }, 269 | "is-extglob": { 270 | "version": "2.1.1", 271 | "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", 272 | "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" 273 | }, 274 | "is-glob": { 275 | "version": "3.1.0", 276 | "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", 277 | "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", 278 | "requires": { 279 | "is-extglob": "^2.1.0" 280 | } 281 | }, 282 | "is-negated-glob": { 283 | "version": "1.0.0", 284 | "resolved": "https://registry.npmjs.org/is-negated-glob/-/is-negated-glob-1.0.0.tgz", 285 | "integrity": "sha1-aRC8pdqMleeEtXUbl2z1oQ/uNtI=" 286 | }, 287 | "is-relative": { 288 | "version": "1.0.0", 289 | "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-1.0.0.tgz", 290 | "integrity": "sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA==", 291 | "requires": { 292 | "is-unc-path": "^1.0.0" 293 | } 294 | }, 295 | "is-unc-path": { 296 | "version": "1.0.0", 297 | "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", 298 | "integrity": "sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ==", 299 | "requires": { 300 | "unc-path-regex": "^0.1.2" 301 | } 302 | }, 303 | "is-windows": { 304 | "version": "1.0.2", 305 | "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", 306 | "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==" 307 | }, 308 | "isarray": { 309 | "version": "1.0.0", 310 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 311 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" 312 | }, 313 | "json-stable-stringify-without-jsonify": { 314 | "version": "1.0.1", 315 | "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", 316 | "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=" 317 | }, 318 | "leven": { 319 | "version": "2.1.0", 320 | "resolved": "https://registry.npmjs.org/leven/-/leven-2.1.0.tgz", 321 | "integrity": "sha1-wuep93IJTe6dNCAq6KzORoeHVYA=" 322 | }, 323 | "minimatch": { 324 | "version": "3.0.4", 325 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 326 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 327 | "requires": { 328 | "brace-expansion": "^1.1.7" 329 | } 330 | }, 331 | "minimist": { 332 | "version": "1.2.0", 333 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", 334 | "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" 335 | }, 336 | "mqtt": { 337 | "version": "3.0.0", 338 | "resolved": "https://registry.npmjs.org/mqtt/-/mqtt-3.0.0.tgz", 339 | "integrity": "sha512-0nKV6MAc1ibKZwaZQUTb3iIdT4NVpj541BsYrqrGBcQdQ7Jd0MnZD1/6/nj1UFdGTboK9ZEUXvkCu2nPCugHFA==", 340 | "requires": { 341 | "base64-js": "^1.3.0", 342 | "commist": "^1.0.0", 343 | "concat-stream": "^1.6.2", 344 | "end-of-stream": "^1.4.1", 345 | "es6-map": "^0.1.5", 346 | "help-me": "^1.0.1", 347 | "inherits": "^2.0.3", 348 | "minimist": "^1.2.0", 349 | "mqtt-packet": "^6.0.0", 350 | "pump": "^3.0.0", 351 | "readable-stream": "^2.3.6", 352 | "reinterval": "^1.1.0", 353 | "split2": "^3.1.0", 354 | "websocket-stream": "^5.1.2", 355 | "xtend": "^4.0.1" 356 | } 357 | }, 358 | "mqtt-packet": { 359 | "version": "6.2.1", 360 | "resolved": "https://registry.npmjs.org/mqtt-packet/-/mqtt-packet-6.2.1.tgz", 361 | "integrity": "sha512-ZxG5QVb7+gMix5n4DClym9dQoCZC6DoNEqgMkMi/GMXvIU4Wsdx+/6KBavw50HHFH9kN1lBSY7phxNlAS2+jnw==", 362 | "requires": { 363 | "bl": "^1.2.2", 364 | "inherits": "^2.0.3", 365 | "process-nextick-args": "^2.0.0", 366 | "safe-buffer": "^5.1.2" 367 | } 368 | }, 369 | "next-tick": { 370 | "version": "1.0.0", 371 | "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", 372 | "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" 373 | }, 374 | "once": { 375 | "version": "1.4.0", 376 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 377 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 378 | "requires": { 379 | "wrappy": "1" 380 | } 381 | }, 382 | "ordered-read-streams": { 383 | "version": "1.0.1", 384 | "resolved": "https://registry.npmjs.org/ordered-read-streams/-/ordered-read-streams-1.0.1.tgz", 385 | "integrity": "sha1-d8DLN8QVJdZBZtmQ/61+xqDhNj4=", 386 | "requires": { 387 | "readable-stream": "^2.0.1" 388 | } 389 | }, 390 | "path-dirname": { 391 | "version": "1.0.2", 392 | "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", 393 | "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=" 394 | }, 395 | "path-is-absolute": { 396 | "version": "1.0.1", 397 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 398 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" 399 | }, 400 | "process-nextick-args": { 401 | "version": "2.0.1", 402 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", 403 | "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" 404 | }, 405 | "pump": { 406 | "version": "3.0.0", 407 | "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", 408 | "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", 409 | "requires": { 410 | "end-of-stream": "^1.1.0", 411 | "once": "^1.3.1" 412 | } 413 | }, 414 | "pumpify": { 415 | "version": "1.5.1", 416 | "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", 417 | "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", 418 | "requires": { 419 | "duplexify": "^3.6.0", 420 | "inherits": "^2.0.3", 421 | "pump": "^2.0.0" 422 | }, 423 | "dependencies": { 424 | "pump": { 425 | "version": "2.0.1", 426 | "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", 427 | "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", 428 | "requires": { 429 | "end-of-stream": "^1.1.0", 430 | "once": "^1.3.1" 431 | } 432 | } 433 | } 434 | }, 435 | "readable-stream": { 436 | "version": "2.3.6", 437 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", 438 | "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", 439 | "requires": { 440 | "core-util-is": "~1.0.0", 441 | "inherits": "~2.0.3", 442 | "isarray": "~1.0.0", 443 | "process-nextick-args": "~2.0.0", 444 | "safe-buffer": "~5.1.1", 445 | "string_decoder": "~1.1.1", 446 | "util-deprecate": "~1.0.1" 447 | } 448 | }, 449 | "reinterval": { 450 | "version": "1.1.0", 451 | "resolved": "https://registry.npmjs.org/reinterval/-/reinterval-1.1.0.tgz", 452 | "integrity": "sha1-M2Hs+jymwYKDOA3Qu5VG85D17Oc=" 453 | }, 454 | "remove-trailing-separator": { 455 | "version": "1.1.0", 456 | "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", 457 | "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" 458 | }, 459 | "safe-buffer": { 460 | "version": "5.1.2", 461 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 462 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 463 | }, 464 | "split2": { 465 | "version": "3.1.1", 466 | "resolved": "https://registry.npmjs.org/split2/-/split2-3.1.1.tgz", 467 | "integrity": "sha512-emNzr1s7ruq4N+1993yht631/JH+jaj0NYBosuKmLcq+JkGQ9MmTw1RB1fGaTCzUuseRIClrlSLHRNYGwWQ58Q==", 468 | "requires": { 469 | "readable-stream": "^3.0.0" 470 | }, 471 | "dependencies": { 472 | "readable-stream": { 473 | "version": "3.4.0", 474 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", 475 | "integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", 476 | "requires": { 477 | "inherits": "^2.0.3", 478 | "string_decoder": "^1.1.1", 479 | "util-deprecate": "^1.0.1" 480 | } 481 | } 482 | } 483 | }, 484 | "stream-shift": { 485 | "version": "1.0.0", 486 | "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", 487 | "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=" 488 | }, 489 | "string_decoder": { 490 | "version": "1.1.1", 491 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", 492 | "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", 493 | "requires": { 494 | "safe-buffer": "~5.1.0" 495 | } 496 | }, 497 | "through2": { 498 | "version": "2.0.5", 499 | "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", 500 | "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", 501 | "requires": { 502 | "readable-stream": "~2.3.6", 503 | "xtend": "~4.0.1" 504 | } 505 | }, 506 | "through2-filter": { 507 | "version": "3.0.0", 508 | "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz", 509 | "integrity": "sha512-jaRjI2WxN3W1V8/FMZ9HKIBXixtiqs3SQSX4/YGIiP3gL6djW48VoZq9tDqeCWs3MT8YY5wb/zli8VW8snY1CA==", 510 | "requires": { 511 | "through2": "~2.0.0", 512 | "xtend": "~4.0.0" 513 | } 514 | }, 515 | "to-absolute-glob": { 516 | "version": "2.0.2", 517 | "resolved": "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz", 518 | "integrity": "sha1-GGX0PZ50sIItufFFt4z/fQ98hJs=", 519 | "requires": { 520 | "is-absolute": "^1.0.0", 521 | "is-negated-glob": "^1.0.0" 522 | } 523 | }, 524 | "type": { 525 | "version": "1.2.0", 526 | "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", 527 | "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" 528 | }, 529 | "typedarray": { 530 | "version": "0.0.6", 531 | "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", 532 | "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" 533 | }, 534 | "ultron": { 535 | "version": "1.1.1", 536 | "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", 537 | "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" 538 | }, 539 | "unc-path-regex": { 540 | "version": "0.1.2", 541 | "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", 542 | "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=" 543 | }, 544 | "unique-stream": { 545 | "version": "2.3.1", 546 | "resolved": "https://registry.npmjs.org/unique-stream/-/unique-stream-2.3.1.tgz", 547 | "integrity": "sha512-2nY4TnBE70yoxHkDli7DMazpWiP7xMdCYqU2nBRO0UB+ZpEkGsSija7MvmvnZFUeC+mrgiUfcHSr3LmRFIg4+A==", 548 | "requires": { 549 | "json-stable-stringify-without-jsonify": "^1.0.1", 550 | "through2-filter": "^3.0.0" 551 | } 552 | }, 553 | "util-deprecate": { 554 | "version": "1.0.2", 555 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 556 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" 557 | }, 558 | "websocket-stream": { 559 | "version": "5.5.0", 560 | "resolved": "https://registry.npmjs.org/websocket-stream/-/websocket-stream-5.5.0.tgz", 561 | "integrity": "sha512-EXy/zXb9kNHI07TIMz1oIUIrPZxQRA8aeJ5XYg5ihV8K4kD1DuA+FY6R96HfdIHzlSzS8HiISAfrm+vVQkZBug==", 562 | "requires": { 563 | "duplexify": "^3.5.1", 564 | "inherits": "^2.0.1", 565 | "readable-stream": "^2.3.3", 566 | "safe-buffer": "^5.1.2", 567 | "ws": "^3.2.0", 568 | "xtend": "^4.0.0" 569 | } 570 | }, 571 | "wrappy": { 572 | "version": "1.0.2", 573 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 574 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" 575 | }, 576 | "ws": { 577 | "version": "3.3.3", 578 | "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", 579 | "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", 580 | "requires": { 581 | "async-limiter": "~1.0.0", 582 | "safe-buffer": "~5.1.0", 583 | "ultron": "~1.1.0" 584 | } 585 | }, 586 | "xtend": { 587 | "version": "4.0.2", 588 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", 589 | "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" 590 | } 591 | } 592 | } 593 | -------------------------------------------------------------------------------- /location-tracking/cli-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cli-client", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "client.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "mqtt": "^3.0.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | ; Ignore metro 20 | .*/node_modules/metro/.* 21 | 22 | [include] 23 | 24 | [libs] 25 | node_modules/react-native/Libraries/react-native/react-native-interface.js 26 | node_modules/react-native/flow/ 27 | 28 | [options] 29 | emoji=true 30 | 31 | esproposal.optional_chaining=enable 32 | esproposal.nullish_coalescing=enable 33 | 34 | module.system=haste 35 | module.system.haste.use_name_reducers=true 36 | # get basename 37 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' 38 | # strip .js or .js.flow suffix 39 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' 40 | # strip .ios suffix 41 | module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' 42 | module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' 43 | module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' 44 | module.system.haste.paths.blacklist=.*/__tests__/.* 45 | module.system.haste.paths.blacklist=.*/__mocks__/.* 46 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* 47 | module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* 48 | 49 | munge_underscores=true 50 | 51 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 52 | 53 | module.file_ext=.js 54 | module.file_ext=.jsx 55 | module.file_ext=.json 56 | module.file_ext=.native.js 57 | 58 | suppress_type=$FlowIssue 59 | suppress_type=$FlowFixMe 60 | suppress_type=$FlowFixMeProps 61 | suppress_type=$FlowFixMeState 62 | 63 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 64 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 65 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 66 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 67 | 68 | [version] 69 | ^0.92.0 70 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react'; 2 | import { StyleSheet, Text, View } from 'react-native'; 3 | import MapView, { Marker } from 'react-native-maps'; 4 | 5 | import mqtt from 'mqtt/dist/mqtt'; 6 | 7 | export default class App extends Component { 8 | state = { 9 | lat: -34.397, 10 | lng: 150.644, 11 | altitude: 0, 12 | speed: 0, 13 | course: 0, 14 | }; 15 | 16 | updateMap(message) { 17 | var [lat, lng, altitude, speed, course] = message.toString().split(','); 18 | 19 | this.setState({ 20 | lat: parseFloat(lat), 21 | lng: parseFloat(lng), 22 | altitude, 23 | speed, 24 | course, 25 | }); 26 | } 27 | 28 | componentDidMount() { 29 | var client = mqtt.connect('ws://157.230.113.66:3000'); 30 | 31 | client.subscribe('LOCATION'); 32 | 33 | client.on('connect', function() { 34 | console.log('connected!'); 35 | }); 36 | 37 | client.on('message', (topic, message) => { 38 | console.log(topic, ' : ', message.toString()); 39 | switch (topic) { 40 | case 'LOCATION': 41 | this.updateMap(message); 42 | break; 43 | } 44 | }); 45 | } 46 | 47 | render() { 48 | const { lat, lng, altitude, speed, course } = this.state; 49 | 50 | return ( 51 | 52 | 67 | 81 | 82 | 83 | 84 | 85 | {speed} 86 | km/h 87 | 88 | 89 | {altitude} 90 | msl 91 | 92 | 93 | 94 | ); 95 | } 96 | } 97 | 98 | const styles = StyleSheet.create({ 99 | container: { 100 | flex: 1, 101 | }, 102 | info: { 103 | backgroundColor: '#e1e1e1', 104 | position: 'absolute', 105 | padding: 25, 106 | opacity: 0.5, 107 | left: 0, 108 | bottom: 100, 109 | }, 110 | value: { 111 | fontSize: 30, 112 | }, 113 | msl: { 114 | fontSize: 18, 115 | }, 116 | text: { 117 | fontSize: 14, 118 | }, 119 | }); 120 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/__tests__/App-test.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import 'react-native'; 6 | import React from 'react'; 7 | import App from '../App'; 8 | 9 | // Note: test renderer must be required after react-native. 10 | import renderer from 'react-test-renderer'; 11 | 12 | it('renders correctly', () => { 13 | renderer.create(); 14 | }); 15 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | load(":build_defs.bzl", "create_aar_targets", "create_jar_targets") 12 | 13 | lib_deps = [] 14 | 15 | create_aar_targets(glob(["libs/*.aar"])) 16 | 17 | create_jar_targets(glob(["libs/*.jar"])) 18 | 19 | android_library( 20 | name = "all-libs", 21 | exported_deps = lib_deps, 22 | ) 23 | 24 | android_library( 25 | name = "app-code", 26 | srcs = glob([ 27 | "src/main/java/**/*.java", 28 | ]), 29 | deps = [ 30 | ":all-libs", 31 | ":build_config", 32 | ":res", 33 | ], 34 | ) 35 | 36 | android_build_config( 37 | name = "build_config", 38 | package = "com.locationtracker", 39 | ) 40 | 41 | android_resource( 42 | name = "res", 43 | package = "com.locationtracker", 44 | res = "src/main/res", 45 | ) 46 | 47 | android_binary( 48 | name = "app", 49 | keystore = "//android/keystores:debug", 50 | manifest = "src/main/AndroidManifest.xml", 51 | package_type = "debug", 52 | deps = [ 53 | ":app-code", 54 | ], 55 | ) 56 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 37 | * // for example: to disable dev mode in the staging build type (if configured) 38 | * devDisabledInStaging: true, 39 | * // The configuration property can be in the following formats 40 | * // 'devDisabledIn${productFlavor}${buildType}' 41 | * // 'devDisabledIn${buildType}' 42 | * 43 | * // the root of your project, i.e. where "package.json" lives 44 | * root: "../../", 45 | * 46 | * // where to put the JS bundle asset in debug mode 47 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 48 | * 49 | * // where to put the JS bundle asset in release mode 50 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 51 | * 52 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 53 | * // require('./image.png')), in debug mode 54 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 55 | * 56 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 57 | * // require('./image.png')), in release mode 58 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 59 | * 60 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 61 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 62 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 63 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 64 | * // for example, you might want to remove it from here. 65 | * inputExcludes: ["android/**", "ios/**"], 66 | * 67 | * // override which node gets called and with what additional arguments 68 | * nodeExecutableAndArgs: ["node"], 69 | * 70 | * // supply additional arguments to the packager 71 | * extraPackagerArgs: [] 72 | * ] 73 | */ 74 | 75 | project.ext.react = [ 76 | entryFile: "index.js" 77 | ] 78 | 79 | apply from: "../../node_modules/react-native/react.gradle" 80 | 81 | /** 82 | * Set this to true to create two separate APKs instead of one: 83 | * - An APK that only works on ARM devices 84 | * - An APK that only works on x86 devices 85 | * The advantage is the size of the APK is reduced by about 4MB. 86 | * Upload all the APKs to the Play Store and people will download 87 | * the correct one based on the CPU architecture of their device. 88 | */ 89 | def enableSeparateBuildPerCPUArchitecture = false 90 | 91 | /** 92 | * Run Proguard to shrink the Java bytecode in release builds. 93 | */ 94 | def enableProguardInReleaseBuilds = false 95 | 96 | android { 97 | compileSdkVersion rootProject.ext.compileSdkVersion 98 | 99 | compileOptions { 100 | sourceCompatibility JavaVersion.VERSION_1_8 101 | targetCompatibility JavaVersion.VERSION_1_8 102 | } 103 | 104 | defaultConfig { 105 | applicationId "com.locationtracker" 106 | minSdkVersion rootProject.ext.minSdkVersion 107 | targetSdkVersion rootProject.ext.targetSdkVersion 108 | versionCode 1 109 | versionName "1.0" 110 | } 111 | splits { 112 | abi { 113 | reset() 114 | enable enableSeparateBuildPerCPUArchitecture 115 | universalApk false // If true, also generate a universal APK 116 | include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" 117 | } 118 | } 119 | buildTypes { 120 | release { 121 | minifyEnabled enableProguardInReleaseBuilds 122 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 123 | } 124 | } 125 | // applicationVariants are e.g. debug, release 126 | applicationVariants.all { variant -> 127 | variant.outputs.each { output -> 128 | // For each separate APK per architecture, set a unique version code as described here: 129 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 130 | def versionCodes = ["armeabi-v7a":1, "x86":2, "arm64-v8a": 3, "x86_64": 4] 131 | def abi = output.getFilter(OutputFile.ABI) 132 | if (abi != null) { // null for the universal-debug, universal-release variants 133 | output.versionCodeOverride = 134 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 135 | } 136 | } 137 | } 138 | } 139 | 140 | dependencies { 141 | implementation project(':react-native-maps') 142 | implementation fileTree(dir: "libs", include: ["*.jar"]) 143 | implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" 144 | implementation "com.facebook.react:react-native:+" // From node_modules 145 | } 146 | 147 | // Run this once to be able to run the application with BUCK 148 | // puts all compile dependencies into folder libs for BUCK to use 149 | task copyDownloadableDepsToLibs(type: Copy) { 150 | from configurations.compile 151 | into 'libs' 152 | } 153 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/build_defs.bzl: -------------------------------------------------------------------------------- 1 | """Helper definitions to glob .aar and .jar targets""" 2 | 3 | def create_aar_targets(aarfiles): 4 | for aarfile in aarfiles: 5 | name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] 6 | lib_deps.append(":" + name) 7 | android_prebuilt_aar( 8 | name = name, 9 | aar = aarfile, 10 | ) 11 | 12 | def create_jar_targets(jarfiles): 13 | for jarfile in jarfiles: 14 | name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] 15 | lib_deps.append(":" + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/java/com/locationtracker/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.locationtracker; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "LocationTracker"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/java/com/locationtracker/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.locationtracker; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.airbnb.android.react.maps.MapsPackage; 7 | import com.facebook.react.ReactNativeHost; 8 | import com.facebook.react.ReactPackage; 9 | import com.facebook.react.shell.MainReactPackage; 10 | import com.facebook.soloader.SoLoader; 11 | 12 | import java.util.Arrays; 13 | import java.util.List; 14 | 15 | public class MainApplication extends Application implements ReactApplication { 16 | 17 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 18 | @Override 19 | public boolean getUseDeveloperSupport() { 20 | return BuildConfig.DEBUG; 21 | } 22 | 23 | @Override 24 | protected List getPackages() { 25 | return Arrays.asList( 26 | new MainReactPackage(), 27 | new MapsPackage() 28 | ); 29 | } 30 | 31 | @Override 32 | protected String getJSMainModuleName() { 33 | return "index"; 34 | } 35 | }; 36 | 37 | @Override 38 | public ReactNativeHost getReactNativeHost() { 39 | return mReactNativeHost; 40 | } 41 | 42 | @Override 43 | public void onCreate() { 44 | super.onCreate(); 45 | SoLoader.init(this, /* native exopackage */ false); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | LocationTracker 3 | 4 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "28.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 28 8 | targetSdkVersion = 28 9 | supportLibVersion = "28.0.0" 10 | } 11 | repositories { 12 | google() 13 | jcenter() 14 | } 15 | dependencies { 16 | classpath("com.android.tools.build:gradle:3.4.0") 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | allprojects { 24 | repositories { 25 | mavenLocal() 26 | google() 27 | jcenter() 28 | maven { 29 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 30 | url "$rootDir/../node_modules/react-native/android" 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin, switch paths to Windows format before running java 129 | if $cygwin ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=$((i+1)) 158 | done 159 | case $i in 160 | (0) set -- ;; 161 | (1) set -- "$args0" ;; 162 | (2) set -- "$args0" "$args1" ;; 163 | (3) set -- "$args0" "$args1" "$args2" ;; 164 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=$(save "$@") 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 184 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 185 | cd "$(dirname "$0")" 186 | fi 187 | 188 | exec "$JAVACMD" "$@" 189 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem http://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 33 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 34 | 35 | @rem Find java.exe 36 | if defined JAVA_HOME goto findJavaFromJavaHome 37 | 38 | set JAVA_EXE=java.exe 39 | %JAVA_EXE% -version >NUL 2>&1 40 | if "%ERRORLEVEL%" == "0" goto init 41 | 42 | echo. 43 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 44 | echo. 45 | echo Please set the JAVA_HOME variable in your environment to match the 46 | echo location of your Java installation. 47 | 48 | goto fail 49 | 50 | :findJavaFromJavaHome 51 | set JAVA_HOME=%JAVA_HOME:"=% 52 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 53 | 54 | if exist "%JAVA_EXE%" goto init 55 | 56 | echo. 57 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 58 | echo. 59 | echo Please set the JAVA_HOME variable in your environment to match the 60 | echo location of your Java installation. 61 | 62 | goto fail 63 | 64 | :init 65 | @rem Get command-line arguments, handling Windows variants 66 | 67 | if not "%OS%" == "Windows_NT" goto win9xME_args 68 | 69 | :win9xME_args 70 | @rem Slurp the command line arguments. 71 | set CMD_LINE_ARGS= 72 | set _SKIP=2 73 | 74 | :win9xME_args_slurp 75 | if "x%~1" == "x" goto execute 76 | 77 | set CMD_LINE_ARGS=%* 78 | 79 | :execute 80 | @rem Setup the command line 81 | 82 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 83 | 84 | @rem Execute Gradle 85 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 86 | 87 | :end 88 | @rem End local scope for the variables with windows NT shell 89 | if "%ERRORLEVEL%"=="0" goto mainEnd 90 | 91 | :fail 92 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 93 | rem the _cmd.exe /c_ return code! 94 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 95 | exit /b 1 96 | 97 | :mainEnd 98 | if "%OS%"=="Windows_NT" endlocal 99 | 100 | :omega 101 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'LocationTracker' 2 | include ':react-native-maps' 3 | project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android') 4 | 5 | include ':app' 6 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "LocationTracker", 3 | "displayName": "LocationTracker" 4 | } -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/assets/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/mobile-client/LocationTracker/assets/arrow.png -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:metro-react-native-babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @format 3 | */ 4 | 5 | import {AppRegistry} from 'react-native'; 6 | import App from './App'; 7 | import {name as appName} from './app.json'; 8 | 9 | AppRegistry.registerComponent(appName, () => App); 10 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTracker-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTracker-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTracker.xcodeproj/xcshareddata/xcschemes/LocationTracker-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTracker.xcodeproj/xcshareddata/xcschemes/LocationTracker.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTracker/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (nonatomic, strong) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTracker/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; 19 | RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 20 | moduleName:@"LocationTracker" 21 | initialProperties:nil]; 22 | 23 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 24 | 25 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 26 | UIViewController *rootViewController = [UIViewController new]; 27 | rootViewController.view = rootView; 28 | self.window.rootViewController = rootViewController; 29 | [self.window makeKeyAndVisible]; 30 | return YES; 31 | } 32 | 33 | - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge 34 | { 35 | #if DEBUG 36 | return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 37 | #else 38 | return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; 39 | #endif 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTracker/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTracker/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTracker/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTracker/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | LocationTracker 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSExceptionDomains 32 | 33 | localhost 34 | 35 | NSExceptionAllowsInsecureHTTPLoads 36 | 37 | 38 | 39 | 40 | NSLocationWhenInUseUsageDescription 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UIViewControllerBasedStatusBarAppearance 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTracker/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTrackerTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/ios/LocationTrackerTests/LocationTrackerTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) Facebook, Inc. and its affiliates. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 16 | 17 | @interface LocationTrackerTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation LocationTrackerTests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 44 | if (level >= RCTLogLevelError) { 45 | redboxError = message; 46 | } 47 | }); 48 | 49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 52 | 53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 55 | return YES; 56 | } 57 | return NO; 58 | }]; 59 | } 60 | 61 | RCTSetLogFunction(RCTDefaultLogFunction); 62 | 63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/metro.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Metro configuration for React Native 3 | * https://github.com/facebook/react-native 4 | * 5 | * @format 6 | */ 7 | 8 | module.exports = { 9 | transformer: { 10 | getTransformOptions: async () => ({ 11 | transform: { 12 | experimentalImportSupport: false, 13 | inlineRequires: false, 14 | }, 15 | }), 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /location-tracking/mobile-client/LocationTracker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "LocationTracker", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start", 7 | "test": "jest" 8 | }, 9 | "dependencies": { 10 | "mqtt": "^3.0.0", 11 | "react": "16.8.3", 12 | "react-native": "0.59.9", 13 | "react-native-maps": "^0.25.0" 14 | }, 15 | "devDependencies": { 16 | "@babel/core": "^7.6.2", 17 | "@babel/runtime": "^7.6.2", 18 | "babel-jest": "^24.9.0", 19 | "jest": "^24.9.0", 20 | "metro-react-native-babel-preset": "^0.56.0", 21 | "react-test-renderer": "16.8.3" 22 | }, 23 | "jest": { 24 | "preset": "react-native" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/README.md: -------------------------------------------------------------------------------- 1 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 2 | 3 | ## Available Scripts 4 | 5 | In the project directory, you can run: 6 | 7 | ### `npm start` 8 | 9 | Runs the app in the development mode.
10 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 11 | 12 | The page will reload if you make edits.
13 | You will also see any lint errors in the console. 14 | 15 | ### `npm test` 16 | 17 | Launches the test runner in the interactive watch mode.
18 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 19 | 20 | ### `npm run build` 21 | 22 | Builds the app for production to the `build` folder.
23 | It correctly bundles React in production mode and optimizes the build for the best performance. 24 | 25 | The build is minified and the filenames include the hashes.
26 | Your app is ready to be deployed! 27 | 28 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 29 | 30 | ### `npm run eject` 31 | 32 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 33 | 34 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 35 | 36 | Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 37 | 38 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 39 | 40 | ## Learn More 41 | 42 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 43 | 44 | To learn React, check out the [React documentation](https://reactjs.org/). 45 | 46 | ### Code Splitting 47 | 48 | This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting 49 | 50 | ### Analyzing the Bundle Size 51 | 52 | This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size 53 | 54 | ### Making a Progressive Web App 55 | 56 | This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app 57 | 58 | ### Advanced Configuration 59 | 60 | This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration 61 | 62 | ### Deployment 63 | 64 | This section has moved here: https://facebook.github.io/create-react-app/docs/deployment 65 | 66 | ### `npm run build` fails to minify 67 | 68 | This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify 69 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-web-client", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "google-maps-react": "^2.0.2", 7 | "mqtt": "^3.0.0", 8 | "react": "^16.10.1", 9 | "react-dom": "^16.10.1", 10 | "react-scripts": "3.1.2" 11 | }, 12 | "scripts": { 13 | "start": "react-scripts start", 14 | "build": "react-scripts build", 15 | "test": "react-scripts test", 16 | "eject": "react-scripts eject" 17 | }, 18 | "eslintConfig": { 19 | "extends": "react-app" 20 | }, 21 | "browserslist": { 22 | "production": [ 23 | ">0.2%", 24 | "not dead", 25 | "not op_mini all" 26 | ], 27 | "development": [ 28 | "last 1 chrome version", 29 | "last 1 firefox version", 30 | "last 1 safari version" 31 | ] 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/react-web-client/public/favicon.ico -------------------------------------------------------------------------------- /location-tracking/react-web-client/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | React App 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/react-web-client/public/logo192.png -------------------------------------------------------------------------------- /location-tracking/react-web-client/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/react-web-client/public/logo512.png -------------------------------------------------------------------------------- /location-tracking/react-web-client/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/src/App.css: -------------------------------------------------------------------------------- 1 | .App { 2 | text-align: center; 3 | } 4 | 5 | .App-logo { 6 | height: 40vmin; 7 | } 8 | 9 | .App-header { 10 | background-color: #282c34; 11 | min-height: 100vh; 12 | display: flex; 13 | flex-direction: column; 14 | align-items: center; 15 | justify-content: center; 16 | font-size: calc(10px + 2vmin); 17 | color: white; 18 | } 19 | 20 | .App-link { 21 | color: #09d3ac; 22 | } 23 | 24 | #info { 25 | position: absolute; 26 | text-align: center; 27 | bottom: 5%; 28 | left: 0; 29 | background-color: aliceblue; 30 | padding: 10px; 31 | opacity: 0.9; 32 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 33 | } 34 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/src/App.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import './App.css'; 3 | 4 | import MapContainer from './MapContainer' 5 | 6 | function App() { 7 | return ( 8 |
9 | 10 |
11 | ); 12 | } 13 | 14 | export default App; 15 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/src/App.test.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | 5 | it('renders without crashing', () => { 6 | const div = document.createElement('div'); 7 | ReactDOM.render(, div); 8 | ReactDOM.unmountComponentAtNode(div); 9 | }); 10 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/src/MapContainer.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {GoogleApiWrapper, Map, Marker} from 'google-maps-react'; 3 | 4 | import mqtt from 'mqtt'; 5 | 6 | export class MapContainer extends React.Component { 7 | state = { 8 | lat: -34.397, 9 | lng: 150.644, 10 | altitude: 0, 11 | speed: 0, 12 | course: 0 13 | } 14 | 15 | updateMap(message){ 16 | var [lat, lng, altitude, speed, course] = message.toString().split(','); 17 | 18 | this.setState({ 19 | lat, 20 | lng, 21 | altitude, 22 | speed, 23 | course 24 | }) 25 | } 26 | 27 | componentDidMount() { 28 | var client = mqtt.connect('ws://157.230.113.66:3000'); 29 | 30 | client.subscribe('LOCATION'); 31 | 32 | client.on('connect', function() { 33 | console.log('connected!'); 34 | }); 35 | 36 | client.on('message', (topic, message) => { 37 | console.log(topic, ' : ', message.toString()); 38 | switch (topic) { 39 | case 'LOCATION': 40 | this.updateMap(message); 41 | break; 42 | } 43 | }); 44 | } 45 | 46 | render(){ 47 | const {lat,lng, altitude, speed, course } = this.state; 48 | return( 49 |
50 | 62 | 73 | 74 | 75 |
76 |

{speed} km/h

77 |

{altitude} msl

78 |
79 |
80 | ) 81 | } 82 | } 83 | 84 | export default GoogleApiWrapper({ 85 | apiKey: ("AIzaSyAEAVPs6jLAgdIGk58JSMG5GO0jHICT40Q") 86 | })(MapContainer) -------------------------------------------------------------------------------- /location-tracking/react-web-client/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", 4 | "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import './index.css'; 4 | import App from './App'; 5 | import * as serviceWorker from './serviceWorker'; 6 | 7 | ReactDOM.render(, document.getElementById('root')); 8 | 9 | // If you want your app to work offline and load faster, you can change 10 | // unregister() to register() below. Note this comes with some pitfalls. 11 | // Learn more about service workers: https://bit.ly/CRA-PWA 12 | serviceWorker.unregister(); 13 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /location-tracking/react-web-client/src/serviceWorker.js: -------------------------------------------------------------------------------- 1 | // This optional code is used to register a service worker. 2 | // register() is not called by default. 3 | 4 | // This lets the app load faster on subsequent visits in production, and gives 5 | // it offline capabilities. However, it also means that developers (and users) 6 | // will only see deployed updates on subsequent visits to a page, after all the 7 | // existing tabs open on the page have been closed, since previously cached 8 | // resources are updated in the background. 9 | 10 | // To learn more about the benefits of this model and instructions on how to 11 | // opt-in, read https://bit.ly/CRA-PWA 12 | 13 | const isLocalhost = Boolean( 14 | window.location.hostname === 'localhost' || 15 | // [::1] is the IPv6 localhost address. 16 | window.location.hostname === '[::1]' || 17 | // 127.0.0.1/8 is considered localhost for IPv4. 18 | window.location.hostname.match( 19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 20 | ) 21 | ); 22 | 23 | export function register(config) { 24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { 25 | // The URL constructor is available in all browsers that support SW. 26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href); 27 | if (publicUrl.origin !== window.location.origin) { 28 | // Our service worker won't work if PUBLIC_URL is on a different origin 29 | // from what our page is served on. This might happen if a CDN is used to 30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374 31 | return; 32 | } 33 | 34 | window.addEventListener('load', () => { 35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; 36 | 37 | if (isLocalhost) { 38 | // This is running on localhost. Let's check if a service worker still exists or not. 39 | checkValidServiceWorker(swUrl, config); 40 | 41 | // Add some additional logging to localhost, pointing developers to the 42 | // service worker/PWA documentation. 43 | navigator.serviceWorker.ready.then(() => { 44 | console.log( 45 | 'This web app is being served cache-first by a service ' + 46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA' 47 | ); 48 | }); 49 | } else { 50 | // Is not localhost. Just register service worker 51 | registerValidSW(swUrl, config); 52 | } 53 | }); 54 | } 55 | } 56 | 57 | function registerValidSW(swUrl, config) { 58 | navigator.serviceWorker 59 | .register(swUrl) 60 | .then(registration => { 61 | registration.onupdatefound = () => { 62 | const installingWorker = registration.installing; 63 | if (installingWorker == null) { 64 | return; 65 | } 66 | installingWorker.onstatechange = () => { 67 | if (installingWorker.state === 'installed') { 68 | if (navigator.serviceWorker.controller) { 69 | // At this point, the updated precached content has been fetched, 70 | // but the previous service worker will still serve the older 71 | // content until all client tabs are closed. 72 | console.log( 73 | 'New content is available and will be used when all ' + 74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' 75 | ); 76 | 77 | // Execute callback 78 | if (config && config.onUpdate) { 79 | config.onUpdate(registration); 80 | } 81 | } else { 82 | // At this point, everything has been precached. 83 | // It's the perfect time to display a 84 | // "Content is cached for offline use." message. 85 | console.log('Content is cached for offline use.'); 86 | 87 | // Execute callback 88 | if (config && config.onSuccess) { 89 | config.onSuccess(registration); 90 | } 91 | } 92 | } 93 | }; 94 | }; 95 | }) 96 | .catch(error => { 97 | console.error('Error during service worker registration:', error); 98 | }); 99 | } 100 | 101 | function checkValidServiceWorker(swUrl, config) { 102 | // Check if the service worker can be found. If it can't reload the page. 103 | fetch(swUrl) 104 | .then(response => { 105 | // Ensure service worker exists, and that we really are getting a JS file. 106 | const contentType = response.headers.get('content-type'); 107 | if ( 108 | response.status === 404 || 109 | (contentType != null && contentType.indexOf('javascript') === -1) 110 | ) { 111 | // No service worker found. Probably a different app. Reload the page. 112 | navigator.serviceWorker.ready.then(registration => { 113 | registration.unregister().then(() => { 114 | window.location.reload(); 115 | }); 116 | }); 117 | } else { 118 | // Service worker found. Proceed as normal. 119 | registerValidSW(swUrl, config); 120 | } 121 | }) 122 | .catch(() => { 123 | console.log( 124 | 'No internet connection found. App is running in offline mode.' 125 | ); 126 | }); 127 | } 128 | 129 | export function unregister() { 130 | if ('serviceWorker' in navigator) { 131 | navigator.serviceWorker.ready.then(registration => { 132 | registration.unregister(); 133 | }); 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /location-tracking/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "location-tracking", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "mosca": "^2.8.3", 14 | "redis": "^2.8.0" 15 | } 16 | } -------------------------------------------------------------------------------- /location-tracking/server/server.js: -------------------------------------------------------------------------------- 1 | var mosca = require('mosca') 2 | 3 | var ascoltatore = { 4 | type: 'redis', 5 | redis: require('redis'), 6 | db: 12, 7 | port: 6379, 8 | return_buffers: true, // to handle binary payloads 9 | host: "localhost" 10 | }; 11 | 12 | var moscaSettings = { 13 | port: 1883, 14 | backend: ascoltatore, 15 | persistence: { 16 | factory: mosca.persistence.Redis 17 | } 18 | }; 19 | 20 | var server = new mosca.Server(moscaSettings); 21 | server.on('ready', setup); 22 | 23 | server.on('clientConnected', function(client) { 24 | console.log('client connected', client.id); 25 | }); 26 | 27 | // fired when a message is received 28 | server.on('published', function(packet, client) { 29 | console.log('Published', packet.topic, packet.payload); 30 | }); 31 | 32 | // fired when the mqtt server is ready 33 | function setup() { 34 | console.log('Mosca server is up and running') 35 | } -------------------------------------------------------------------------------- /location-tracking/simple-web-client/car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/meseven/arduino-nodejs-egitimi/a9b791c6b351c7c208618782cc26c8468a78ae4a/location-tracking/simple-web-client/car.png -------------------------------------------------------------------------------- /location-tracking/simple-web-client/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | MQTT Client 8 | 9 | 10 | 15 | 16 | 17 | 18 |
19 |
20 |
21 |

150 km/h

22 |

990 msl

23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /location-tracking/simple-web-client/script.js: -------------------------------------------------------------------------------- 1 | var map, marker; 2 | function initMap() { 3 | map = new google.maps.Map(document.getElementById('map'), { 4 | center: { lat: -34.397, lng: 150.644 }, 5 | zoom: 18, 6 | }); 7 | 8 | var symbol = { 9 | // url: 'car.png', 10 | path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW, 11 | fillColor: 'red', 12 | fillOpacity: 0.9, 13 | strokeWeight: 6, 14 | scale: 8, 15 | rotation: 0, 16 | }; 17 | 18 | marker = new google.maps.Marker({ 19 | icon: symbol, 20 | map, 21 | }); 22 | } 23 | 24 | // mqtt 25 | var client = mqtt.connect('ws://157.230.113.66:3000'); 26 | 27 | client.subscribe('LOCATION'); 28 | 29 | client.on('connect', function() { 30 | console.log('connected!'); 31 | }); 32 | 33 | client.on('message', function(topic, message) { 34 | console.log(topic, ' : ', message.toString()); 35 | switch (topic) { 36 | case 'LOCATION': 37 | updateMap(message); 38 | break; 39 | default: 40 | break; 41 | } 42 | }); 43 | 44 | function updateMap(message) { 45 | [lat, lng, altitude, speed, course] = message.toString().split(','); 46 | 47 | let position = { lat: parseFloat(lat), lng: parseFloat(lng) }; 48 | marker.setPosition(position); 49 | marker.setIcon({ ...marker.getIcon(), rotation: parseInt(course) }); 50 | map.setCenter(position); 51 | 52 | document.getElementById('km').innerHTML = speed; 53 | document.getElementById('msl').innerHTML = altitude; 54 | } 55 | -------------------------------------------------------------------------------- /location-tracking/simple-web-client/style.css: -------------------------------------------------------------------------------- 1 | #map-container { 2 | height: 100%; 3 | position: relative; 4 | } 5 | #map { 6 | height: 100%; 7 | } 8 | #info { 9 | position: absolute; 10 | text-align: center; 11 | bottom: 5%; 12 | left: 0; 13 | background-color: aliceblue; 14 | padding: 10px; 15 | opacity: 0.9; 16 | box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); 17 | } 18 | /* Optional: Makes the sample page fill the window. */ 19 | html, 20 | body { 21 | height: 100%; 22 | margin: 0; 23 | padding: 0; 24 | } 25 | --------------------------------------------------------------------------------