├── .gitignore ├── .gitmodules ├── Application ├── .vscode │ └── c_cpp_properties.json ├── README.md ├── project │ ├── arm5_no_packs │ │ ├── JLinkSettings.ini │ │ ├── RTE │ │ │ ├── Device │ │ │ │ └── nRF51422_xxAC │ │ │ │ │ ├── arm_startup_nrf51.s │ │ │ │ │ └── system_nrf51.c │ │ │ ├── _flash_s110_nrf51_8.0.0_softdevice │ │ │ │ └── RTE_Components.h │ │ │ └── _nrf51422_xxac_s110 │ │ │ │ └── RTE_Components.h │ │ ├── ble_app_template_s110_pca10028.uvguix │ │ ├── ble_app_template_s110_pca10028.uvoptx │ │ └── ble_app_template_s110_pca10028.uvprojx │ └── armgcc │ │ ├── Makefile │ │ └── ble_app_template_gcc_nrf51.ld └── src │ ├── AlgorithmLibFornrf51.lib │ ├── Font.h │ ├── Font16.h │ ├── acc-algorithm.c │ ├── acc-algorithm.h │ ├── alarm_app.c │ ├── alarm_app.h │ ├── app_page.c │ ├── app_page.h │ ├── app_timer.h │ ├── bas_app.c │ ├── bas_app.h │ ├── ble_nus.c │ ├── charge_app.c │ ├── charge_app.h │ ├── comm_protocol.c │ ├── comm_protocol.h │ ├── config │ ├── device_manager_cnfg.h │ ├── nrf_drv_config.h │ ├── pstorage_platform.h │ └── twi_master_config.h │ ├── config_storage.c │ ├── config_storage.h │ ├── crc16.c │ ├── crc16.h │ ├── dfu_app.c │ ├── dfu_app.h │ ├── disp_app.c │ ├── disp_app.h │ ├── health-algorithm.h │ ├── icons.h │ ├── key_app.c │ ├── key_app.h │ ├── main.c │ ├── main.h │ ├── mma8452.c │ ├── mma8452.h │ ├── rtc_app.c │ ├── rtc_app.h │ ├── ssd1306_app.c │ ├── ssd1306_app.h │ ├── step_counter.c │ ├── step_counter.h │ ├── temp_app.c │ ├── temp_app.h │ ├── twi_master.h │ ├── twi_sw_master.c │ ├── viber_app.c │ └── viber_app.h ├── Bootloader ├── README.md ├── project │ ├── arm5_no_packs │ │ ├── JLinkSettings.ini │ │ ├── RTE │ │ │ ├── Device │ │ │ │ ├── nRF51422_xxAC │ │ │ │ │ ├── arm_startup_nrf51.s │ │ │ │ │ └── system_nrf51.c │ │ │ │ └── nRF51822_xxAC │ │ │ │ │ ├── arm_startup_nrf51.s │ │ │ │ │ └── system_nrf51.c │ │ │ └── _nrf51422_xxac │ │ │ │ └── RTE_Components.h │ │ ├── dfu_dual_bank_ble_s110_pca10028.uvguix │ │ ├── dfu_dual_bank_ble_s110_pca10028.uvoptx │ │ └── dfu_dual_bank_ble_s110_pca10028.uvprojx │ └── armgcc │ │ └── Makefile └── src │ ├── app_timer.c │ ├── app_timer.h │ ├── config │ ├── hci_mem_pool_internal.h │ └── pstorage_platform.h │ ├── dfu_ble_svc.c │ ├── dfu_gcc_nrf51.ld │ ├── dfu_gcc_nrf52.ld │ ├── main.c │ ├── ssd1306_mini.c │ └── ssd1306_mini.h ├── Hardware ├── blewatch-cache.lib ├── blewatch.csv ├── blewatch.kicad_pcb ├── blewatch.net ├── blewatch.pro └── blewatch.sch ├── README.md ├── Release ├── Application.hex ├── Bootloader.hex ├── Softdevice.hex └── app.apk └── app-js ├── README.md ├── android-apk ├── android-debug.apk ├── android-release-unsigned.apk └── release.apk ├── build.json ├── config.xml ├── hooks └── README.md ├── net.coconauts.notification-listener ├── CHANGES.txt ├── LICENSE.txt ├── README.md ├── package.json ├── plugin.xml ├── src │ └── android │ │ ├── NotificationCommands.java │ │ └── NotificationService.java └── www │ └── notification-listener.js ├── plugins ├── android.json ├── browser.json ├── cordova-plugin-app-event │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── plugin.xml │ └── src │ │ └── ios │ │ ├── APPAppEventDelegate.h │ │ ├── AppDelegate+APPAppEvent.h │ │ ├── AppDelegate+APPAppEvent.m │ │ ├── CDVPlugin+APPAppEvent.h │ │ └── CDVPlugin+APPAppEvent.m ├── cordova-plugin-background-mode │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── appbeep.wav │ ├── appbeep.wma │ ├── package.json │ ├── plugin.xml │ ├── src │ │ ├── android │ │ │ ├── BackgroundExt.java │ │ │ ├── BackgroundMode.java │ │ │ └── ForegroundService.java │ │ ├── browser │ │ │ └── BackgroundModeProxy.js │ │ ├── ios │ │ │ ├── APPBackgroundMode.h │ │ │ ├── APPBackgroundMode.m │ │ │ ├── APPMethodMagic.h │ │ │ └── APPMethodMagic.m │ │ └── windows │ │ │ └── BackgroundModeProxy.js │ └── www │ │ └── background-mode.js ├── cordova-plugin-ble-central │ ├── CHANGES.txt │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── battery │ │ │ ├── .npmignore │ │ │ ├── README.md │ │ │ ├── config.xml │ │ │ ├── hooks │ │ │ │ └── README.md │ │ │ └── www │ │ │ │ ├── css │ │ │ │ └── index.css │ │ │ │ ├── index.html │ │ │ │ └── js │ │ │ │ └── index.js │ │ ├── bluefruitle │ │ │ ├── .npmignore │ │ │ ├── README.md │ │ │ ├── config.xml │ │ │ ├── hooks │ │ │ │ └── README.md │ │ │ └── www │ │ │ │ ├── css │ │ │ │ └── index.css │ │ │ │ ├── index.html │ │ │ │ └── js │ │ │ │ └── index.js │ │ ├── heartrate │ │ │ ├── README.md │ │ │ ├── config.xml │ │ │ ├── hooks │ │ │ │ └── README.md │ │ │ └── www │ │ │ │ ├── css │ │ │ │ └── index.css │ │ │ │ ├── index.html │ │ │ │ └── js │ │ │ │ └── index.js │ │ ├── metawear │ │ │ ├── .npmignore │ │ │ ├── README.md │ │ │ ├── config.xml │ │ │ ├── hooks │ │ │ │ └── README.md │ │ │ └── www │ │ │ │ ├── css │ │ │ │ └── index.css │ │ │ │ ├── index.html │ │ │ │ └── js │ │ │ │ └── index.js │ │ ├── redbearlab │ │ │ ├── .npmignore │ │ │ ├── README.md │ │ │ ├── config.xml │ │ │ ├── hooks │ │ │ │ └── README.md │ │ │ └── www │ │ │ │ ├── css │ │ │ │ └── index.css │ │ │ │ ├── index.html │ │ │ │ └── js │ │ │ │ └── index.js │ │ ├── rfduinoLedButton │ │ │ ├── .npmignore │ │ │ ├── README.md │ │ │ ├── config.xml │ │ │ ├── hooks │ │ │ │ └── README.md │ │ │ └── www │ │ │ │ ├── css │ │ │ │ └── index.css │ │ │ │ ├── index.html │ │ │ │ └── js │ │ │ │ └── index.js │ │ ├── robosmart │ │ │ ├── .npmignore │ │ │ ├── README.md │ │ │ ├── config.xml │ │ │ ├── hooks │ │ │ │ └── README.md │ │ │ └── www │ │ │ │ ├── css │ │ │ │ └── index.css │ │ │ │ ├── index.html │ │ │ │ └── js │ │ │ │ └── index.js │ │ ├── sensortag │ │ │ ├── .npmignore │ │ │ ├── README.md │ │ │ ├── config.xml │ │ │ ├── hooks │ │ │ │ └── README.md │ │ │ └── www │ │ │ │ ├── css │ │ │ │ └── index.css │ │ │ │ ├── index.html │ │ │ │ └── js │ │ │ │ └── index.js │ │ └── sensortag_cc2650 │ │ │ ├── .npmignore │ │ │ ├── README.md │ │ │ ├── config.xml │ │ │ ├── hooks │ │ │ └── README.md │ │ │ └── www │ │ │ ├── css │ │ │ └── index.css │ │ │ ├── index.html │ │ │ └── js │ │ │ └── index.js │ ├── package.json │ ├── plugin.xml │ ├── src │ │ ├── android │ │ │ ├── BLECentralPlugin.java │ │ │ ├── BLECommand.java │ │ │ ├── Helper.java │ │ │ ├── Peripheral.java │ │ │ └── UUIDHelper.java │ │ ├── browser │ │ │ └── BLECentralPlugin.js │ │ ├── ios │ │ │ ├── BLECentralPlugin.h │ │ │ ├── BLECentralPlugin.m │ │ │ ├── BLECommandContext.h │ │ │ ├── BLECommandContext.m │ │ │ ├── CBPeripheral+Extensions.h │ │ │ └── CBPeripheral+Extensions.m │ │ └── wp │ │ │ └── BLECentralPlugin.cs │ ├── tests │ │ ├── plugin.xml │ │ └── tests.js │ └── www │ │ └── ble.js ├── cordova-plugin-compat │ ├── README.md │ ├── RELEASENOTES.md │ ├── package.json │ ├── plugin.xml │ └── src │ │ └── android │ │ ├── BuildHelper.java │ │ └── PermissionHelper.java ├── cordova-plugin-device │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── RELEASENOTES.md │ ├── doc │ │ ├── de │ │ │ ├── README.md │ │ │ └── index.md │ │ ├── es │ │ │ ├── README.md │ │ │ └── index.md │ │ ├── fr │ │ │ ├── README.md │ │ │ └── index.md │ │ ├── it │ │ │ ├── README.md │ │ │ └── index.md │ │ ├── ja │ │ │ ├── README.md │ │ │ └── index.md │ │ ├── ko │ │ │ ├── README.md │ │ │ └── index.md │ │ ├── pl │ │ │ ├── README.md │ │ │ └── index.md │ │ ├── ru │ │ │ └── index.md │ │ └── zh │ │ │ ├── README.md │ │ │ └── index.md │ ├── package.json │ ├── plugin.xml │ ├── src │ │ ├── android │ │ │ └── Device.java │ │ ├── blackberry10 │ │ │ └── index.js │ │ ├── browser │ │ │ └── DeviceProxy.js │ │ ├── firefoxos │ │ │ └── DeviceProxy.js │ │ ├── ios │ │ │ ├── CDVDevice.h │ │ │ └── CDVDevice.m │ │ ├── osx │ │ │ ├── CDVDevice.h │ │ │ └── CDVDevice.m │ │ ├── tizen │ │ │ └── DeviceProxy.js │ │ ├── ubuntu │ │ │ ├── device.cpp │ │ │ ├── device.h │ │ │ └── device.js │ │ ├── windows │ │ │ └── DeviceProxy.js │ │ └── wp │ │ │ └── Device.cs │ ├── tests │ │ ├── package.json │ │ ├── plugin.xml │ │ └── tests.js │ ├── types │ │ └── index.d.ts │ └── www │ │ └── device.js ├── cordova-plugin-whitelist │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── NOTICE │ ├── README.md │ ├── RELEASENOTES.md │ ├── doc │ │ ├── de │ │ │ └── README.md │ │ ├── es │ │ │ └── README.md │ │ ├── fr │ │ │ └── README.md │ │ ├── it │ │ │ └── README.md │ │ ├── ja │ │ │ └── README.md │ │ ├── ko │ │ │ └── README.md │ │ ├── pl │ │ │ └── README.md │ │ └── zh │ │ │ └── README.md │ ├── package.json │ ├── plugin.xml │ └── src │ │ └── android │ │ └── WhitelistPlugin.java ├── cordova-plugin-x-toast │ ├── LICENSE │ ├── README.md │ ├── issue_template.md │ ├── package.json │ ├── plugin.xml │ ├── screenshots │ │ ├── screenshot-android-toast.png │ │ ├── screenshot-ios-toast.png │ │ ├── screenshot-wp8.jpg │ │ ├── styling-green.png │ │ └── styling-red.png │ ├── src │ │ ├── android │ │ │ └── nl │ │ │ │ └── xservices │ │ │ │ └── plugins │ │ │ │ └── Toast.java │ │ ├── blackberry10 │ │ │ ├── index.js │ │ │ └── native │ │ │ │ ├── .cproject │ │ │ │ ├── .project │ │ │ │ ├── device │ │ │ │ ├── libToast.so │ │ │ │ ├── public │ │ │ │ │ ├── json_reader.o │ │ │ │ │ ├── json_value.o │ │ │ │ │ ├── json_writer.o │ │ │ │ │ ├── plugin.o │ │ │ │ │ └── tokenizer.o │ │ │ │ └── src │ │ │ │ │ ├── Logger.o │ │ │ │ │ ├── toast_js.o │ │ │ │ │ └── toast_ndk.o │ │ │ │ ├── public │ │ │ │ ├── json │ │ │ │ │ ├── autolink.h │ │ │ │ │ ├── config.h │ │ │ │ │ ├── features.h │ │ │ │ │ ├── forwards.h │ │ │ │ │ ├── json.h │ │ │ │ │ ├── reader.h │ │ │ │ │ ├── value.h │ │ │ │ │ └── writer.h │ │ │ │ ├── json_batchallocator.h │ │ │ │ ├── json_internalarray.inl │ │ │ │ ├── json_internalmap.inl │ │ │ │ ├── json_reader.cpp │ │ │ │ ├── json_value.cpp │ │ │ │ ├── json_valueiterator.inl │ │ │ │ ├── json_writer.cpp │ │ │ │ ├── plugin.cpp │ │ │ │ ├── plugin.h │ │ │ │ ├── tokenizer.cpp │ │ │ │ └── tokenizer.h │ │ │ │ ├── simulator │ │ │ │ ├── libToast.so │ │ │ │ ├── public │ │ │ │ │ ├── json_reader.o │ │ │ │ │ ├── json_value.o │ │ │ │ │ ├── json_writer.o │ │ │ │ │ ├── plugin.o │ │ │ │ │ └── tokenizer.o │ │ │ │ └── src │ │ │ │ │ ├── Logger.o │ │ │ │ │ ├── toast_js.o │ │ │ │ │ └── toast_ndk.o │ │ │ │ └── src │ │ │ │ ├── Logger.cpp │ │ │ │ ├── Logger.hpp │ │ │ │ ├── toast_js.cpp │ │ │ │ ├── toast_js.hpp │ │ │ │ ├── toast_ndk.cpp │ │ │ │ └── toast_ndk.hpp │ │ ├── ios │ │ │ ├── Toast+UIView.h │ │ │ ├── Toast+UIView.m │ │ │ ├── Toast.h │ │ │ └── Toast.m │ │ ├── windows │ │ │ └── toastProxy.js │ │ └── wp8 │ │ │ └── Toast.cs │ ├── test │ │ └── tests.js │ └── www │ │ └── Toast.js ├── de.appplant.cordova.plugin.local-notification │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── plugin.xml │ ├── src │ │ ├── android │ │ │ ├── ClearReceiver.java │ │ │ ├── ClickActivity.java │ │ │ ├── LocalNotification.java │ │ │ ├── RestoreReceiver.java │ │ │ ├── TriggerReceiver.java │ │ │ └── notification │ │ │ │ ├── AbstractClearReceiver.java │ │ │ │ ├── AbstractClickActivity.java │ │ │ │ ├── AbstractRestoreReceiver.java │ │ │ │ ├── AbstractTriggerReceiver.java │ │ │ │ ├── AssetUtil.java │ │ │ │ ├── Builder.java │ │ │ │ ├── ClearReceiver.java │ │ │ │ ├── ClickActivity.java │ │ │ │ ├── Manager.java │ │ │ │ ├── Notification.java │ │ │ │ ├── Options.java │ │ │ │ └── TriggerReceiver.java │ │ ├── ios │ │ │ ├── APPLocalNotification.h │ │ │ ├── APPLocalNotification.m │ │ │ ├── APPLocalNotificationOptions.h │ │ │ ├── APPLocalNotificationOptions.m │ │ │ ├── UIApplication+APPLocalNotification.h │ │ │ ├── UIApplication+APPLocalNotification.m │ │ │ ├── UILocalNotification+APPLocalNotification.h │ │ │ └── UILocalNotification+APPLocalNotification.m │ │ └── windows │ │ │ ├── LocalNotificationCore.js │ │ │ ├── LocalNotificationProxy.js │ │ │ └── LocalNotificationUtil.js │ └── www │ │ ├── local-notification-core.js │ │ ├── local-notification-util.js │ │ └── local-notification.js ├── fetch.json └── net.coconauts.notification-listener │ ├── CHANGES.txt │ ├── LICENSE.txt │ ├── README.md │ ├── package.json │ ├── plugin.xml │ ├── src │ └── android │ │ ├── NotificationCommands.java │ │ └── NotificationService.java │ └── www │ └── notification-listener.js ├── release-key.keystore └── www ├── css ├── MaterialIcons.css ├── chat.css ├── font-awesome.min.css ├── index.css ├── logo-transparent.png ├── materialize.min.css └── mdDateTimePicker.min.css ├── demo.html ├── fonts ├── FontAwesome.otf ├── fontawesome-webfont.eot ├── fontawesome-webfont.svg ├── fontawesome-webfont.ttf ├── fontawesome-webfont.woff ├── fontawesome-webfont.woff2 ├── material-design-icons │ ├── LICENSE.txt │ ├── Material-Design-Icons.eot │ ├── Material-Design-Icons.svg │ ├── Material-Design-Icons.ttf │ ├── Material-Design-Icons.woff │ └── Material-Design-Icons.woff2 └── roboto │ ├── Roboto-Bold.woff │ ├── Roboto-Bold.woff2 │ ├── Roboto-Light.woff │ ├── Roboto-Light.woff2 │ ├── Roboto-Medium.woff │ ├── Roboto-Medium.woff2 │ ├── Roboto-Regular.woff │ ├── Roboto-Regular.woff2 │ ├── Roboto-Thin.woff │ └── Roboto-Thin.woff2 ├── img ├── background.jpg ├── ic_keyboard_arrow_left_black_24px.svg ├── ic_keyboard_arrow_left_black_disabled_24px.svg ├── ic_keyboard_arrow_left_white_24px.svg ├── ic_keyboard_arrow_left_white_disabled_24px.svg ├── ic_keyboard_arrow_right_black_24px.svg ├── ic_keyboard_arrow_right_black_disabled_24px.svg ├── ic_keyboard_arrow_right_white_24px.svg ├── ic_keyboard_arrow_right_white_disabled_24px.svg └── logo.png ├── index.html ├── js ├── actions.js ├── battery.js ├── bluetooth │ ├── bluetooth.js │ └── receive.js ├── controls.js ├── cordova │ ├── dialog.js │ ├── notification.js │ └── start.js ├── index.js ├── settings.js ├── utils.js └── ux │ ├── chat.js │ ├── draggabilly.pkgd.min.js │ ├── jquery-3.2.1.min.js │ ├── jquery.min.js │ ├── lang │ └── zh-cn.js │ ├── macarons.js │ ├── materialize.min.js │ ├── mdDateTimePicker.min.js │ ├── moment.min.js │ └── mustache.min.js └── new.html /.gitignore: -------------------------------------------------------------------------------- 1 | JLinkLog.txt 2 | *.uvguix.* 3 | _build/*.* 4 | _build 5 | EventRecorderStub.scvd 6 | /app-js/platforms 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/.gitmodules -------------------------------------------------------------------------------- /Application/README.md: -------------------------------------------------------------------------------- 1 | # Application 2 | 3 | 主程序部分。 4 | 5 | ## 目前功能 6 | 7 | - 时间显示 8 | - 闹钟震动 9 | - 消息通知 10 | - 计步器 11 | - 电量显示 12 | - 通信及数据交换 13 | 14 | ## 通信协议 15 | 16 | 类似串口通信。详见comm_protocol中的相关代码。 17 | 18 | ### 包格式 19 | 20 | 0x55 TYPE [DATA] -------------------------------------------------------------------------------- /Application/project/arm5_no_packs/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ForceImpTypeAny = 0 3 | ShowInfoWin = 1 4 | EnableFlashBP = 2 5 | BPDuringExecution = 0 6 | [CFI] 7 | CFISize = 0x00 8 | CFIAddr = 0x00 9 | [CPU] 10 | MonModeVTableAddr = 0xFFFFFFFF 11 | MonModeDebug = 0 12 | MaxNumAPs = 0 13 | LowPowerHandlingMode = 0 14 | OverrideMemMap = 0 15 | AllowSimulation = 1 16 | ScriptFile="" 17 | [FLASH] 18 | CacheExcludeSize = 0x00 19 | CacheExcludeAddr = 0x00 20 | MinNumBytesFlashDL = 0 21 | SkipProgOnCRCMatch = 1 22 | VerifyDownload = 1 23 | AllowCaching = 1 24 | EnableFlashDL = 2 25 | Override = 0 26 | Device="ARM7" 27 | [GENERAL] 28 | WorkRAMSize = 0x00 29 | WorkRAMAddr = 0x00 30 | RAMUsageLimit = 0x00 31 | [SWO] 32 | SWOLogFile="" 33 | [MEM] 34 | RdOverrideOrMask = 0x00 35 | RdOverrideAndMask = 0xFFFFFFFF 36 | RdOverrideAddr = 0xFFFFFFFF 37 | WrOverrideOrMask = 0x00 38 | WrOverrideAndMask = 0xFFFFFFFF 39 | WrOverrideAddr = 0xFFFFFFFF 40 | -------------------------------------------------------------------------------- /Application/project/arm5_no_packs/RTE/_flash_s110_nrf51_8.0.0_softdevice/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'ble_app_template_s110_pca10028' 7 | * Target: 'flash_s110_nrf51_8.0.0_softdevice' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "nrf.h" 18 | 19 | 20 | #endif /* RTE_COMPONENTS_H */ 21 | -------------------------------------------------------------------------------- /Application/project/arm5_no_packs/RTE/_nrf51422_xxac_s110/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'ble_app_template_s110_pca10028' 7 | * Target: 'nrf51422_xxac_s110' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "nrf.h" 18 | 19 | 20 | #endif /* RTE_COMPONENTS_H */ 21 | -------------------------------------------------------------------------------- /Application/project/arm5_no_packs/ble_app_template_s110_pca10028.uvguix: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -5.1 5 | 6 |
### uVision Project, (C) Keil Software
7 | 8 | 9 | 10 | 11 | 1 12 | 0 13 | 14 | 100 15 | 0 16 | 17 | ..\..\..\..\..\..\components\softdevice\s110\doc\s110_nrf51_8.0.0_licence-agreement.txt 18 | 0 19 | 1 20 | 1 21 | 1 22 | 23 | 0 24 | 25 | 26 | 27 | 28 |
-------------------------------------------------------------------------------- /Application/project/armgcc/ble_app_template_gcc_nrf51.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | FLASH (rx) : ORIGIN = 0x18000, LENGTH = 0x28000 9 | RAM (rwx) : ORIGIN = 0x20002000, LENGTH = 0x6000 10 | } 11 | 12 | SECTIONS 13 | { 14 | .fs_data_out ALIGN(4): 15 | { 16 | PROVIDE( __start_fs_data = .); 17 | KEEP(*(fs_data)) 18 | PROVIDE( __stop_fs_data = .); 19 | } = 0 20 | } 21 | 22 | INCLUDE "nrf5x_common.ld" -------------------------------------------------------------------------------- /Application/src/AlgorithmLibFornrf51.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/Application/src/AlgorithmLibFornrf51.lib -------------------------------------------------------------------------------- /Application/src/acc-algorithm.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/Application/src/acc-algorithm.c -------------------------------------------------------------------------------- /Application/src/acc-algorithm.h: -------------------------------------------------------------------------------- 1 | #ifndef __ACC_ALGORITHM__ 2 | #define __ACC_ALGORITHM__ 3 | 4 | #include 5 | 6 | #define ACC_ALGO_WINDOW_SIZE 8 7 | #define ACC_ALGO_BUFFER_SIZE 128 8 | #define ACC_ALGO_TIME_WINDOW_MIN 5 9 | #define ACC_ALGO_TIME_WINDOW_MAX 50 10 | 11 | typedef struct acc_data 12 | { 13 | int16_t x; 14 | int16_t y; 15 | int16_t z; 16 | uint16_t total; 17 | } acc_data; 18 | 19 | 20 | void acc_algo_add(int16_t x, int16_t y, int16_t z); 21 | extern volatile acc_data acc_window_buffer[ACC_ALGO_WINDOW_SIZE]; 22 | extern volatile uint8_t acc_window_pt; 23 | extern volatile acc_data acc_sport_buffer[ACC_ALGO_BUFFER_SIZE]; 24 | extern volatile uint8_t acc_buffer_pt; 25 | 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Application/src/alarm_app.h: -------------------------------------------------------------------------------- 1 | #ifndef _ALARM_APP_ 2 | #define _ALARM_APP_ 3 | 4 | #include 5 | #include "rtc_app.h" 6 | 7 | typedef struct alarm_data{ 8 | uint8_t hour; 9 | uint8_t minute; 10 | uint8_t repeat; 11 | } alarm_data_item; 12 | 13 | 14 | //#define ALARM_DELAY_MINUTES 1 15 | //#define ALARM_DELAY_TIMES 3 16 | 17 | /** 18 | * Function: Check if there is an alarm and alarm it 19 | * Params: date_t *date; 20 | * Return: none 21 | **/ 22 | void alarm_check(date_t * date); 23 | 24 | void alarm_timer_handler(void *p_context); 25 | /** 26 | * Function: Init alarm timeout timer 27 | * Params: 28 | * Return: 29 | **/ 30 | void alarm_timer_init(void); 31 | /** 32 | * Function: Trig an alarm 33 | * Params: 34 | * Return: 35 | **/ 36 | void alarm_enter(void); 37 | /** 38 | * Function: exit alarm state 39 | * Params: 40 | * Return: 41 | **/ 42 | void alarm_exit(void); 43 | /** 44 | * Function: alarm on the next X minute 45 | * Params: 46 | * Return: 47 | **/ 48 | void alarm_delay_action(void); 49 | /** 50 | * Function: for test only 51 | * Params: 52 | * Return: 53 | **/ 54 | void alarm_test(void); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /Application/src/app_page.h: -------------------------------------------------------------------------------- 1 | #ifndef _APP_PAGE_ 2 | #define _APP_PAGE_ 3 | 4 | #include 5 | 6 | enum app_page_screen { 7 | CLOCK_PAGE = 0x80, 8 | MESSAGE_PAGE = 0x81, 9 | WALK_COUNTER_PAGE, 10 | ALARM_CLOCK_PAGE, 11 | ALARM_DISP_PAGE, 12 | CONN_PASS_PAGE, 13 | CHARGING_PAGE, 14 | DEBUG_PAGE = 0x87, 15 | ACC_PRINT_PAGE 16 | }; 17 | 18 | void page_disp_current(void); 19 | #endif 20 | -------------------------------------------------------------------------------- /Application/src/bas_app.h: -------------------------------------------------------------------------------- 1 | #ifndef _BAS_APP_ 2 | #define _BAS_APP_ 3 | 4 | //#include "app_scheduler.h" 5 | #include "main.h" 6 | #include "ble_bas.h" 7 | 8 | #define ADC_INPUT_CHANNEL NRF_ADC_CONFIG_INPUT_5 9 | #define ADC_REF_VOLTAGE_IN_MILLIVOLTS 1200 /**< Reference voltage (in milli volts) used by ADC while doing conversion. */ 10 | #define ADC_HW_PRE_SCALING_COMPENSATION 4 11 | 12 | #define BATTERY_ADC_RESOLUTION ( NRF_ADC_CONFIG_RES_10BIT ) 13 | #define BATTERY_ADC_DIV (1023) 14 | 15 | #define MIN_BAT_MV (3600) 16 | 17 | void bas_update_measure_data(void); 18 | uint16_t bas_get_cur_bat_vot(void); 19 | uint8_t bas_get_cur_bat_lvl(void); 20 | 21 | void bas_app_init(void); 22 | void adc_tick(void); 23 | uint8_t bas_vot2lvl(uint16_t lvl); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /Application/src/charge_app.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "charge_app.h" 3 | 4 | void charge_init(void){ 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Application/src/charge_app.h: -------------------------------------------------------------------------------- 1 | #ifndef _CHARGE_APP_ 2 | #define _CHARGE_APP_ 3 | 4 | 5 | #define CHARGER_CHECK_INTERVAL_MS (APP_TIMER_TICKS(1000, APP_TIMER_PRESCALER)) 6 | 7 | void charge_init(void); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /Application/src/config/twi_master_config.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | #ifndef TWI_MASTER_CONFIG 13 | #define TWI_MASTER_CONFIG 14 | 15 | #include "mma8452.h" 16 | 17 | #define TWI_MASTER_CONFIG_CLOCK_PIN_NUMBER (SCL_PIN) 18 | #define TWI_MASTER_CONFIG_DATA_PIN_NUMBER (SDA_PIN) 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /Application/src/config_storage.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/Application/src/config_storage.h -------------------------------------------------------------------------------- /Application/src/crc16.h: -------------------------------------------------------------------------------- 1 | #ifndef _CRC16_CUSTOM_ 2 | #define _CRC16_CUSTOM_ 3 | 4 | #include 5 | /** 6 | * crc16 - compute the CRC-16 for the data buffer 7 | * @crc: previous CRC value 8 | * @buffer: data pointer 9 | * @len: number of bytes in the buffer 10 | * 11 | * Returns the updated CRC value. 12 | */ 13 | uint16_t crc16( uint8_t const *buffer, uint16_t len, uint16_t crc); 14 | uint8_t checksum8(uint8_t *buffer, uint16_t len); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /Application/src/dfu_app.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DFU 相关服务 3 | */ 4 | 5 | #ifndef _DFU_APP_ 6 | #define _DFU_APP_ 7 | 8 | #include "ble_dfu.h" 9 | #include "dfu_app_handler.h" 10 | 11 | #define DFU_REV_MAJOR 0x00 /** DFU Major revision number to be exposed. */ 12 | #define DFU_REV_MINOR 0x01 /** DFU Minor revision number to be exposed. */ 13 | #define DFU_REVISION ((DFU_REV_MAJOR << 8) | DFU_REV_MINOR) /** DFU Revision number to be exposed. Combined of major and minor versions. */ 14 | #define APP_SERVICE_HANDLE_START 0x000C /**< Handle of first application specific service when when service changed characteristic is present. */ 15 | #define BLE_HANDLE_MAX 0xFFFF /**< Max handle value in BLE. */ 16 | 17 | void dfu_serv_init(dm_application_instance_t * m_app_handle); 18 | void dfu_ble_evt_dispatch(ble_evt_t * p_ble_evt); 19 | void dfu_device_manager_event_handler(dm_handle_t const * p_handle, dm_event_t const * p_event); 20 | 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Application/src/disp_app.h: -------------------------------------------------------------------------------- 1 | #ifndef _DISP_APP_ 2 | #define _DISP_APP_ 3 | 4 | #include 5 | enum icons_type{ 6 | ICON_LOCK, 7 | ICON_ALARM, 8 | ICON_QQ, 9 | ICON_PHONE, 10 | ICON_MESSAGE, 11 | ICON_WECHAT, 12 | ICON_WALK_SLOW, 13 | ICON_WALK_FAST, 14 | ICON_RUN, 15 | 16 | }; 17 | void ssd1306_draw5x7Font(uint8_t x, uint8_t y, char * string); 18 | void ssd1306_draw48Font(char * string); 19 | void ssd1306_draw16Font(char * string, uint8_t x, uint8_t y); 20 | void ssd1306_drawAlarmIcon48(uint8_t y); 21 | void ssd1306_drawChargingIcon48(uint8_t y); 22 | void ssd1306_drawIcon16(enum icons_type type, uint8_t x, uint8_t y); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /Application/src/key_app.h: -------------------------------------------------------------------------------- 1 | #ifndef _KEY_APP_H 2 | #define _KEY_APP_H 3 | #include 4 | 5 | //#define KEY_PIN 17 6 | #define INT_PIN 16 7 | #define INT2_PIN 15 8 | 9 | #define CHRG_PIN_2 8 10 | #define CHRG_PIN 9 11 | #define STDBY_PIN 10 12 | #define STDBY_PIN_2 11 13 | 14 | extern _Bool charge_charging; 15 | extern _Bool charge_fulled; 16 | 17 | enum key_evt_type{ 18 | TOUCH_KEY_EVENT=0xC0, 19 | TAP_ONCE_EVENT, 20 | TAP_TWICE_EVENT, 21 | WRIST_ROTATE_EVENT, 22 | CHARGING_EVENT, 23 | NOT_CHARGING_EVENT=0xc5, 24 | FULLED_EVENT, 25 | NOT_FULLED_EVENT, 26 | PASSCODE_DISP_EVENT, 27 | ALARM_DISP_EVENT, 28 | NORMAL_DISP_EVENT=0xca, 29 | }; 30 | 31 | void key_init(void); 32 | void key_set_evt_handler(void (*evt)(uint8_t)); 33 | void key_generate_evt(enum key_evt_type event); 34 | 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /Application/src/main.h: -------------------------------------------------------------------------------- 1 | #ifndef _MAIN_H_ 2 | #define _MAIN_H_ 3 | 4 | #include 5 | #include "nordic_common.h" 6 | #include "nrf.h" 7 | #include "app_scheduler.h" 8 | 9 | #define APP_TIMER_PRESCALER 0 /**< Value of the RTC1 PRESCALER register. */ 10 | #define APP_TIMER_OP_QUEUE_SIZE 8 /**< Size of timer operation queues. */ 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /Application/src/mma8452.h: -------------------------------------------------------------------------------- 1 | #ifndef _MMA8452_APP_ 2 | #define _MMA8452_APP_ 3 | 4 | #include 5 | 6 | #define SDA_PIN 14 7 | #define SCL_PIN 13 8 | 9 | #define I2C_SLAVE_ADDRESS 0x38 10 | 11 | typedef struct mma8452_acc_data{ 12 | int16_t x; 13 | int16_t y; 14 | int16_t z; 15 | } mma8452_acc_data; 16 | 17 | void mma8452_init(void); 18 | _Bool mma8452_chip_test(void); 19 | void mma8452_read_acc(mma8452_acc_data * data); 20 | uint8_t mma8452_read_int(void); 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Application/src/rtc_app.h: -------------------------------------------------------------------------------- 1 | #ifndef _RTC_APP_ 2 | #define _RTC_APP_ 3 | 4 | #include 5 | 6 | #define RTC_UNIX_TS_BASE 1483200000 7 | #define RTC_WEEK_BASE 0 8 | 9 | typedef struct time_t{ 10 | uint32_t year; 11 | uint8_t month; 12 | uint8_t day; 13 | uint8_t hour; 14 | uint8_t minute; 15 | uint8_t second; 16 | uint8_t week; 17 | } date_t; 18 | 19 | void rtc_init(void); 20 | void rtc_setTime(date_t * date); 21 | void rtc_getTime(date_t * date); 22 | void rtc_setTimeUnix(uint32_t unixts); 23 | uint32_t rtc_getTimeUnix(void); 24 | void rtc_getWeekStr(char * string, uint8_t week); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /Application/src/step_counter.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "step_counter.h" 3 | 4 | #include "app_error.h" 5 | #include "app_timer.h" 6 | #include "mma8452.h" 7 | #include "rtc_app.h" 8 | #include "config_storage.h" 9 | #include "acc-algorithm.h" 10 | 11 | APP_TIMER_DEF(m_acc_timer_meas_id); /**< Battery timer. */ 12 | uint8_t ms_counter; 13 | 14 | volatile _Bool isInit = false; 15 | 16 | 17 | void step_counter_timer_handler(void *p_context) 18 | { 19 | UNUSED_PARAMETER(p_context); 20 | if(!isInit) 21 | return; 22 | ms_counter ++; 23 | ms_counter %= ACC_MEASURE_HZ; 24 | mma8452_acc_data acc_data; 25 | mma8452_read_acc(&acc_data); 26 | 27 | acc_algo_add(acc_data.x, acc_data.y, acc_data.z); 28 | if(wchData.persist.config.debug_enable) 29 | comm_send_acc_data(acc_data); 30 | } 31 | 32 | void step_counter_timer_init(void) 33 | { 34 | uint8_t err_code = app_timer_create(&m_acc_timer_meas_id, 35 | APP_TIMER_MODE_REPEATED, 36 | step_counter_timer_handler); 37 | APP_ERROR_CHECK(err_code); 38 | } 39 | 40 | void step_counter_timer_start(void) 41 | { 42 | uint32_t err_code = app_timer_start(m_acc_timer_meas_id, ACC_MEASURE_TIMER_MS, NULL); 43 | APP_ERROR_CHECK(err_code); 44 | } 45 | 46 | void step_health_algorithm_init(void) 47 | { 48 | isInit = true; 49 | } 50 | 51 | void step_health_algorithm_reload(void) 52 | { 53 | isInit = false; 54 | } 55 | 56 | void step_counter_init(void) 57 | { 58 | step_health_algorithm_init(); 59 | step_counter_timer_init(); 60 | step_counter_timer_start(); 61 | } 62 | 63 | 64 | void step_nextday(void) 65 | { 66 | //TODO: add some event to inform mobile phone this data; 67 | wchData.temporary.step_lastday = wchData.persist.step_walkdata; 68 | 69 | wchData.persist.step_walkdata.walking = 0; 70 | } 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /Application/src/step_counter.h: -------------------------------------------------------------------------------- 1 | #ifndef _STEP_COUNTER_ 2 | #define _STEP_COUNTER_ 3 | 4 | #include 5 | #define ACC_MEASURE_HZ 25 6 | #define ACC_MEASURE_TIMER_MS (APP_TIMER_TICKS(1000/ACC_MEASURE_HZ, APP_TIMER_PRESCALER)) //10hz 7 | #define SLEEP_DATA_COUNT 10 8 | 9 | typedef struct packet_sleepdata { 10 | uint8_t type; 11 | uint32_t timestamp; 12 | } packet_sleepdata; 13 | 14 | typedef struct packet_walkdata { 15 | uint32_t walking; 16 | } packet_walkdata; 17 | 18 | 19 | void step_counter_init(void); 20 | void step_nextday(void); 21 | void step_health_algorithm_reload(void); 22 | 23 | //extern packet_sleepdata step_sleepdata[SLEEP_DATA_COUNT]; 24 | //extern packet_walkdata step_walkdata; 25 | //extern uint8_t step_sleepdata_index; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /Application/src/temp_app.c: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "temp_app.h" 3 | #include "nrf_temp.h" 4 | #include "config_storage.h" 5 | 6 | void temp_get_real(void) 7 | { 8 | 9 | NRF_TEMP->TASKS_START = 1; /** Start the temperature measurement. */ 10 | 11 | /* Busy wait while temperature measurement is not finished, you can skip waiting if you enable interrupt for DATARDY event and read the result in the interrupt. */ 12 | /*lint -e{845} // A zero has been given as right argument to operator '|'" */ 13 | while (NRF_TEMP->EVENTS_DATARDY == 0) 14 | { 15 | // Do nothing. 16 | } 17 | NRF_TEMP->EVENTS_DATARDY = 0; 18 | 19 | /**@note Workaround for PAN_028 rev2.0A anomaly 29 - TEMP: Stop task clears the TEMP register. */ 20 | wchData.temporary.temp_current_temp = (nrf_temp_read() / 4.0f); 21 | 22 | /**@note Workaround for PAN_028 rev2.0A anomaly 30 - TEMP: Temp module analog front end does not power down when DATARDY event occurs. */ 23 | NRF_TEMP->TASKS_STOP = 1; /** Stop the temperature measurement. */ 24 | } 25 | void temp_get(void) 26 | { 27 | //do nothing 28 | 29 | } 30 | 31 | void temp_init(void) 32 | { 33 | //nrf_temp_init(); 34 | } 35 | -------------------------------------------------------------------------------- /Application/src/temp_app.h: -------------------------------------------------------------------------------- 1 | #ifndef _TEMP_APP_ 2 | #define _TEMP_APP_ 3 | 4 | void temp_get(void); 5 | void temp_init(void); 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Application/src/viber_app.h: -------------------------------------------------------------------------------- 1 | #ifndef _VIBER_APP_H_ 2 | #define _VIBER_APP_H_ 3 | 4 | #include 5 | 6 | #define VIBER_PIN 19 7 | 8 | void viber_init(void); 9 | void viber_action(uint16_t length); 10 | void viber_weak(void); 11 | void viber_mid(void); 12 | void viber_strong(void); 13 | void viber_start(void); 14 | void viber_stop(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /Bootloader/README.md: -------------------------------------------------------------------------------- 1 | # Bootloader 2 | 3 | 一个简单的使用蓝牙OTA的Bootloader。 -------------------------------------------------------------------------------- /Bootloader/project/arm5_no_packs/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ForceImpTypeAny = 0 3 | ShowInfoWin = 1 4 | EnableFlashBP = 2 5 | BPDuringExecution = 0 6 | [CFI] 7 | CFISize = 0x00 8 | CFIAddr = 0x00 9 | [CPU] 10 | MonModeVTableAddr = 0xFFFFFFFF 11 | MonModeDebug = 0 12 | MaxNumAPs = 0 13 | LowPowerHandlingMode = 0 14 | OverrideMemMap = 0 15 | AllowSimulation = 1 16 | ScriptFile="" 17 | [FLASH] 18 | CacheExcludeSize = 0x00 19 | CacheExcludeAddr = 0x00 20 | MinNumBytesFlashDL = 0 21 | SkipProgOnCRCMatch = 1 22 | VerifyDownload = 1 23 | AllowCaching = 1 24 | EnableFlashDL = 2 25 | Override = 0 26 | Device="ARM7" 27 | [GENERAL] 28 | WorkRAMSize = 0x00 29 | WorkRAMAddr = 0x00 30 | RAMUsageLimit = 0x00 31 | [SWO] 32 | SWOLogFile="" 33 | [MEM] 34 | RdOverrideOrMask = 0x00 35 | RdOverrideAndMask = 0xFFFFFFFF 36 | RdOverrideAddr = 0xFFFFFFFF 37 | WrOverrideOrMask = 0x00 38 | WrOverrideAndMask = 0xFFFFFFFF 39 | WrOverrideAddr = 0xFFFFFFFF 40 | -------------------------------------------------------------------------------- /Bootloader/project/arm5_no_packs/RTE/_nrf51422_xxac/RTE_Components.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Auto generated Run-Time-Environment Component Configuration File 4 | * *** Do not modify ! *** 5 | * 6 | * Project: 'dfu_dual_bank_ble_s110_pca10028' 7 | * Target: 'nrf51422_xxac' 8 | */ 9 | 10 | #ifndef RTE_COMPONENTS_H 11 | #define RTE_COMPONENTS_H 12 | 13 | 14 | /* 15 | * Define the Device Header File: 16 | */ 17 | #define CMSIS_device_header "nrf.h" 18 | 19 | 20 | #endif /* RTE_COMPONENTS_H */ 21 | -------------------------------------------------------------------------------- /Bootloader/project/arm5_no_packs/dfu_dual_bank_ble_s110_pca10028.uvguix: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -5.1 5 | 6 |
### uVision Project, (C) Keil Software
7 | 8 | 9 | 10 | 11 | 1 12 | 0 13 | 14 | 100 15 | 0 16 | 17 | ..\..\..\..\..\..\components\softdevice\s110\doc\s110_nrf51_8.0.0_licence-agreement.txt 18 | 0 19 | 1 20 | 1 21 | 1 22 | 23 | 0 24 | 25 | 26 | 27 | 28 |
-------------------------------------------------------------------------------- /Bootloader/src/config/hci_mem_pool_internal.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. 2 | * 3 | * The information contained herein is property of Nordic Semiconductor ASA. 4 | * Terms and conditions of usage are described in detail in NORDIC 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 6 | * 7 | * Licensees are granted free, non-transferable use of the information. NO 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 9 | * the file. 10 | * 11 | */ 12 | 13 | /** @file 14 | * 15 | * @defgroup memory_pool_internal Memory Pool Internal 16 | * @{ 17 | * @ingroup memory_pool 18 | * 19 | * @brief Memory pool internal definitions 20 | */ 21 | 22 | #ifndef MEM_POOL_INTERNAL_H__ 23 | #define MEM_POOL_INTERNAL_H__ 24 | 25 | #define TX_BUF_SIZE 4u /**< TX buffer size in bytes. */ 26 | #define RX_BUF_SIZE 32u /**< RX buffer size in bytes. */ 27 | 28 | #define RX_BUF_QUEUE_SIZE 8u /**< RX buffer element size. */ 29 | 30 | #endif // MEM_POOL_INTERNAL_H__ 31 | 32 | /** @} */ 33 | -------------------------------------------------------------------------------- /Bootloader/src/dfu_gcc_nrf51.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | /** Flash start address for the bootloader. This setting will also be stored in UICR to allow the 9 | * MBR to init the bootloader when starting the system. This value must correspond to 10 | * BOOTLOADER_REGION_START found in dfu_types.h. The system is prevented from starting up if 11 | * those values do not match. The check is performed in main.c, see 12 | * APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START); 13 | */ 14 | FLASH (rx) : ORIGIN = 0x3C000, LENGTH = 0x3C00 15 | 16 | /** RAM Region for bootloader. This setting is suitable when used with s110, s120, s130, s310. */ 17 | RAM (rwx) : ORIGIN = 0x20002C00, LENGTH = 0x1380 18 | 19 | /** Location of non initialized RAM. Non initialized RAM is used for exchanging bond information 20 | * from application to bootloader when using buttonluss DFU OTA. 21 | */ 22 | NOINIT (rwx) : ORIGIN = 0x20003F80, LENGTH = 0x80 23 | 24 | /** Location of bootloader setting in at the last flash page. */ 25 | BOOTLOADER_SETTINGS (rw) : ORIGIN = 0x0003FC00, LENGTH = 0x0400 26 | 27 | /** Location in UICR where bootloader start address is stored. */ 28 | UICR_BOOTLOADER (r) : ORIGIN = 0x10001014, LENGTH = 0x04 29 | } 30 | 31 | SECTIONS 32 | { 33 | /* Ensures the bootloader settings are placed at the last flash page. */ 34 | .bootloaderSettings(NOLOAD) : 35 | { 36 | 37 | } > BOOTLOADER_SETTINGS 38 | 39 | /* Ensures the Bootloader start address in flash is written to UICR when flashing the image. */ 40 | .uicrBootStartAddress : 41 | { 42 | KEEP(*(.uicrBootStartAddress)) 43 | } > UICR_BOOTLOADER 44 | 45 | /* No init RAM section in bootloader. Used for bond information exchange. */ 46 | .noinit(NOLOAD) : 47 | { 48 | 49 | } > NOINIT 50 | /* other placements follow here... */ 51 | } 52 | 53 | INCLUDE "nrf51_common.ld" 54 | -------------------------------------------------------------------------------- /Bootloader/src/dfu_gcc_nrf52.ld: -------------------------------------------------------------------------------- 1 | /* Linker script to configure memory regions. */ 2 | 3 | SEARCH_DIR(.) 4 | GROUP(-lgcc -lc -lnosys) 5 | 6 | MEMORY 7 | { 8 | /** Flash start address for the bootloader. This setting will also be stored in UICR to allow the 9 | * MBR to init the bootloader when starting the system. This value must correspond to 10 | * BOOTLOADER_REGION_START found in dfu_types.h. The system is prevented from starting up if 11 | * those values do not match. The check is performed in main.c, see 12 | * APP_ERROR_CHECK_BOOL(*((uint32_t *)NRF_UICR_BOOT_START_ADDRESS) == BOOTLOADER_REGION_START); 13 | */ 14 | FLASH (rx) : ORIGIN = 0x7B000, LENGTH = 0x4000 15 | 16 | /** RAM Region for bootloader. This setting is suitable when used with s132. */ 17 | RAM (rwx) : ORIGIN = 0x20002C00, LENGTH = 0x5380 18 | 19 | /** Location of non initialized RAM. Non initialized RAM is used for exchanging bond information 20 | * from application to bootloader when using buttonluss DFU OTA. 21 | */ 22 | NOINIT (rwx) : ORIGIN = 0x20007F80, LENGTH = 0x80 23 | 24 | /** Location of bootloader setting in at the last flash page. */ 25 | BOOTLOADER_SETTINGS (rw) : ORIGIN = 0x0007F000, LENGTH = 0x1000 26 | 27 | /** Location in UICR where bootloader start address is stored. */ 28 | UICR_BOOTLOADER (r) : ORIGIN = 0x10001014, LENGTH = 0x04 29 | } 30 | 31 | SECTIONS 32 | { 33 | /* Ensures the bootloader settings are placed at the last flash page. */ 34 | .bootloaderSettings(NOLOAD) : 35 | { 36 | 37 | } > BOOTLOADER_SETTINGS 38 | 39 | /* Ensures the Bootloader start address in flash is written to UICR when flashing the image. */ 40 | .uicrBootStartAddress : 41 | { 42 | KEEP(*(.uicrBootStartAddress)) 43 | } > UICR_BOOTLOADER 44 | 45 | /* No init RAM section in bootloader. Used for bond information exchange. */ 46 | .noinit(NOLOAD) : 47 | { 48 | 49 | } > NOINIT 50 | /* other placements follow here... */ 51 | } 52 | 53 | INCLUDE "nrf52_common.ld" 54 | -------------------------------------------------------------------------------- /Hardware/blewatch.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/Hardware/blewatch.csv -------------------------------------------------------------------------------- /Hardware/blewatch.pro: -------------------------------------------------------------------------------- 1 | update=2017-05-28 10:56:41 2 | version=1 3 | last_client=kicad 4 | [pcbnew] 5 | version=1 6 | LastNetListRead= 7 | UseCmpFile=1 8 | PadDrill=0.600000000000 9 | PadDrillOvalY=0.600000000000 10 | PadSizeH=1.500000000000 11 | PadSizeV=1.500000000000 12 | PcbTextSizeV=1.500000000000 13 | PcbTextSizeH=1.500000000000 14 | PcbTextThickness=0.300000000000 15 | ModuleTextSizeV=1.000000000000 16 | ModuleTextSizeH=1.000000000000 17 | ModuleTextSizeThickness=0.150000000000 18 | SolderMaskClearance=0.000000000000 19 | SolderMaskMinWidth=0.000000000000 20 | DrawSegmentWidth=0.200000000000 21 | BoardOutlineThickness=0.100000000000 22 | ModuleOutlineThickness=0.150000000000 23 | [cvpcb] 24 | version=1 25 | NetIExt=net 26 | [general] 27 | version=1 28 | [eeschema] 29 | version=1 30 | LibDir=../OSU_bd;../OSU_bd/custom.pretty;../BLE-4100 31 | [eeschema/libraries] 32 | LibName1=power 33 | LibName2=device 34 | LibName3=transistors 35 | LibName4=conn 36 | LibName5=linear 37 | LibName6=regul 38 | LibName7=74xx 39 | LibName8=cmos4000 40 | LibName9=adc-dac 41 | LibName10=memory 42 | LibName11=xilinx 43 | LibName12=microcontrollers 44 | LibName13=dsp 45 | LibName14=microchip 46 | LibName15=analog_switches 47 | LibName16=motorola 48 | LibName17=texas 49 | LibName18=intel 50 | LibName19=audio 51 | LibName20=interface 52 | LibName21=digital-audio 53 | LibName22=philips 54 | LibName23=display 55 | LibName24=cypress 56 | LibName25=siliconi 57 | LibName26=opto 58 | LibName27=atmel 59 | LibName28=contrib 60 | LibName29=valves 61 | LibName30=lib/aker 62 | LibName31=lib/atmega32u4 63 | LibName32=lib/conn 64 | LibName33=lib/device 65 | LibName34=lib/dtsjw 66 | LibName35=lib/mx1a-simple 67 | LibName36=lib/oupiin_usb 68 | LibName37=lib/power 69 | LibName38=D:/Work/ELE/BLE-4100/ble4100-nrf-cache 70 | LibName39=D:/Work/ELE/BLE-4100/ble4100-nrf-rescue 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LotWatch 2 | 3 | LotWatch是一个自制的蓝牙手表项目。它使用了nRF51822作为核心,mma8452为加速度计。 4 | 5 | 使用[nRF SDK V10.0](https://developer.nordicsemi.com/nRF5_SDK/nRF51_SDK_v10.x.x/nRF51_SDK_10.0.0_dc26b5e.zip)开发,并在Keil MDK v5下编译通过。 6 | 7 | ## 文件结构 8 | 9 | - app-js:手机端应用程序,使用Cordova编写 10 | - Application:手表的主程序部分 11 | - Bootloader:手表的Bootloader,用于OTA 12 | - Hardware:硬件设计 13 | - Release:编译好的各个程序,可以直接使用。 14 | 15 | 其余事项见各文件夹下的说明。 -------------------------------------------------------------------------------- /Release/app.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/Release/app.apk -------------------------------------------------------------------------------- /app-js/README.md: -------------------------------------------------------------------------------- 1 | # app-js 2 | 3 | Cordova应用程序。 4 | 5 | ## 当前功能 6 | 7 | - 搜索与连接 8 | - 自动校正时间 9 | 10 | ## 缺失功能 11 | 12 | - 闹钟设置 13 | - 蓝牙名称设置 14 | - 显示配置等设置 15 | - 步数回传 16 | - 消息通知 -------------------------------------------------------------------------------- /app-js/android-apk/android-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/android-apk/android-debug.apk -------------------------------------------------------------------------------- /app-js/android-apk/android-release-unsigned.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/android-apk/android-release-unsigned.apk -------------------------------------------------------------------------------- /app-js/android-apk/release.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/android-apk/release.apk -------------------------------------------------------------------------------- /app-js/build.json: -------------------------------------------------------------------------------- 1 | { 2 | "android": { 3 | "release": { 4 | "keystore": "release-key.keystore", 5 | "alias": "lotlab" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /app-js/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | LotWatch 4 | 5 | LotWatch Android Application 6 | 7 | 8 | Jim Jiang 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app-js/hooks/README.md: -------------------------------------------------------------------------------- 1 | 21 | # Cordova Hooks 22 | 23 | Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. See Hooks Guide for more details: http://cordova.apache.org/docs/en/edge/guide_appdev_hooks_index.md.html#Hooks%20Guide. 24 | -------------------------------------------------------------------------------- /app-js/net.coconauts.notification-listener/CHANGES.txt: -------------------------------------------------------------------------------- 1 | = 0.0.1 = 2 | 3 | In progress 4 | -------------------------------------------------------------------------------- /app-js/net.coconauts.notification-listener/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2015 Javier Rengel (Coconauts) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /app-js/net.coconauts.notification-listener/README.md: -------------------------------------------------------------------------------- 1 | ## In progress 2 | -------------------------------------------------------------------------------- /app-js/net.coconauts.notification-listener/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.0.1", 3 | "name": "net.coconauts.notification-listener", 4 | "cordova_name": "Notification-listener", 5 | "description": "Notification listener Plugin for Android", 6 | "license": "Apache 2.0", 7 | "repo": "https://github.com/coconauts/watchduino2", 8 | "issue": "https://github.com/coconauts/watchduino2/issues", 9 | "keywords": [ 10 | "notification", 11 | "listener", 12 | "android" 13 | ], 14 | "platforms": [ 15 | "android" 16 | ], 17 | "engines": [ 18 | { 19 | "name": "cordova", 20 | "version": ">=3.1.0" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /app-js/net.coconauts.notification-listener/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Notification-listener 9 | Notification listener Plugin for Android 10 | Apache 2.0 11 | notification, listener, android 12 | 13 | https://github.com/coconauts/watchduino2 14 | https://github.com/coconauts/watchduino2/issues 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app-js/net.coconauts.notification-listener/www/notification-listener.js: -------------------------------------------------------------------------------- 1 | // (c) 2015 Javier Rengel (Coconauts) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | "use strict"; 16 | 17 | module.exports = { 18 | 19 | // value must be an ArrayBuffer 20 | listen: function (success, failure) { 21 | console.log("Calling cordova listen method"); 22 | cordova.exec(success, failure, 'NotificationListener', 'listen', []); 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /app-js/plugins/android.json: -------------------------------------------------------------------------------- 1 | { 2 | "prepare_queue": { 3 | "installed": [], 4 | "uninstalled": [] 5 | }, 6 | "config_munge": { 7 | "files": {} 8 | }, 9 | "installed_plugins": { 10 | "cordova-plugin-whitelist": { 11 | "PACKAGE_NAME": "io.cordova.hellocordova" 12 | }, 13 | "cordova-plugin-device": { 14 | "PACKAGE_NAME": "io.cordova.hellocordova" 15 | }, 16 | "cordova-plugin-background-mode": { 17 | "PACKAGE_NAME": "io.cordova.hellocordova" 18 | }, 19 | "de.appplant.cordova.plugin.local-notification": { 20 | "PACKAGE_NAME": "io.cordova.hellocordova" 21 | }, 22 | "cordova-plugin-x-toast": { 23 | "PACKAGE_NAME": "io.cordova.hellocordova" 24 | }, 25 | "cordova-plugin-ble-central": { 26 | "PACKAGE_NAME": "io.cordova.hellocordova" 27 | }, 28 | "net.coconauts.notification-listener": { 29 | "PACKAGE_NAME": "io.cordova.hellocordova" 30 | } 31 | }, 32 | "dependent_plugins": { 33 | "cordova-plugin-app-event": { 34 | "PACKAGE_NAME": "io.cordova.hellocordova" 35 | }, 36 | "cordova-plugin-compat": { 37 | "PACKAGE_NAME": "io.cordova.hellocordova" 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /app-js/plugins/browser.json: -------------------------------------------------------------------------------- 1 | { 2 | "prepare_queue": { 3 | "installed": [], 4 | "uninstalled": [] 5 | }, 6 | "config_munge": { 7 | "files": {} 8 | }, 9 | "installed_plugins": { 10 | "cordova-plugin-whitelist": { 11 | "PACKAGE_NAME": "io.cordova.hellocordova" 12 | }, 13 | "cordova-plugin-device": { 14 | "PACKAGE_NAME": "io.cordova.hellocordova" 15 | }, 16 | "cordova-plugin-background-mode": { 17 | "PACKAGE_NAME": "io.cordova.hellocordova" 18 | }, 19 | "de.appplant.cordova.plugin.local-notification": { 20 | "PACKAGE_NAME": "io.cordova.hellocordova" 21 | }, 22 | "cordova-plugin-x-toast": { 23 | "PACKAGE_NAME": "io.cordova.hellocordova" 24 | }, 25 | "cordova-plugin-ble-central": { 26 | "PACKAGE_NAME": "io.cordova.hellocordova" 27 | }, 28 | "net.coconauts.notification-listener": { 29 | "PACKAGE_NAME": "io.cordova.hellocordova" 30 | } 31 | }, 32 | "dependent_plugins": { 33 | "cordova-plugin-app-event": { 34 | "PACKAGE_NAME": "io.cordova.hellocordova" 35 | }, 36 | "cordova-plugin-compat": { 37 | "PACKAGE_NAME": "io.cordova.hellocordova" 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-app-event/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ChangeLog 2 | --------- 3 | 4 | #### Version 1.2.0 (17.02.2016) 5 | - White-list swizzling through APPAppEventDelegate protocol (#5) 6 | - Finally fixed `EXC_BAD_ACCESS error` (#4) 7 | - Removed usage of `nullable` to prevent build failures 8 | 9 | #### Version 1.1.0 (02.01.2016) 10 | - Fixed `EXC_BAD_ACCESS error` 11 | 12 | #### Version 1.0.0 (01.01.2016) 13 | - Initial version 14 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-app-event/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-app-event", 3 | "version": "1.2.0", 4 | "description": "Broadcasts UIApplicationDelegate events", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/katzer/cordova-plugin-app-event.git" 12 | }, 13 | "keywords": [ 14 | "appplant", 15 | "UIApplicationDelegate", 16 | "didRegisterUserNotificationSettings", 17 | "didReceiveLocalNotification", 18 | "didFinishLaunchingWithOptions", 19 | "cordova", 20 | "ecosystem:cordova" 21 | ], 22 | "platforms": [ 23 | "ios" 24 | ], 25 | "engines": [ 26 | { 27 | "name": "cordova", 28 | "version": ">=3.6.0" 29 | } 30 | ], 31 | "author": "Sebastián Katzer", 32 | "license": "Apache-2.0", 33 | "bugs": { 34 | "url": "https://github.com/katzer/cordova-plugin-app-event/issues" 35 | }, 36 | "homepage": "https://github.com/katzer/cordova-plugin-app-event#readme" 37 | } 38 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-app-event/src/ios/APPAppEventDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013-2016 appPlant UG 3 | 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | @protocol APPAppEventDelegate 23 | 24 | /* 25 | By implementing the interface the plugin indicates interest 26 | to receive app events. 27 | */ 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-app-event/src/ios/AppDelegate+APPAppEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016 by appPlant UG. All rights reserved. 3 | * 4 | * @APPPLANT_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apache License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://opensource.org/licenses/Apache-2.0/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPPLANT_LICENSE_HEADER_END@ 22 | */ 23 | 24 | #import "AppDelegate.h" 25 | 26 | extern NSString* const UIApplicationRegisterUserNotificationSettings; 27 | 28 | @interface AppDelegate (APPAppEvent) 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-app-event/src/ios/CDVPlugin+APPAppEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2016 by appPlant UG. All rights reserved. 3 | * 4 | * @APPPLANT_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apache License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://opensource.org/licenses/Apache-2.0/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPPLANT_LICENSE_HEADER_END@ 22 | */ 23 | 24 | #import "Cordova/CDVPlugin.h" 25 | 26 | @interface CDVPlugin (APPAppEvent) 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-background-mode/appbeep.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-background-mode/appbeep.wav -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-background-mode/appbeep.wma: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-background-mode/appbeep.wma -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-background-mode/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-background-mode", 3 | "version": "0.7.2", 4 | "description": "Prevent app from going to sleep in background.", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/katzer/cordova-plugin-background-mode.git" 8 | }, 9 | "keywords": [ 10 | "appplant", 11 | "background", 12 | "cordova", 13 | "ecosystem:cordova" 14 | ], 15 | "platforms": [ 16 | "ios", 17 | "android" 18 | ], 19 | "engines": [ 20 | { 21 | "name": "cordova", 22 | "version": ">=6.0.0" 23 | } 24 | ], 25 | "author": "Sebastián Katzer", 26 | "license": "Apache 2.0", 27 | "bugs": { 28 | "url": "https://github.com/katzer/cordova-plugin-background-mode/issues" 29 | }, 30 | "homepage": "https://github.com/katzer/cordova-plugin-background-mode#readme" 31 | } 32 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-background-mode/src/browser/BackgroundModeProxy.js: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013-2017 appPlant GmbH 3 | 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | /** 23 | * Activates the background mode. When activated the application 24 | * will be prevented from going to sleep while in background 25 | * for the next time. 26 | * 27 | * @param [ Function ] success The success callback to use. 28 | * @param [ Function ] error The error callback to use. 29 | * 30 | * @return [ Void ] 31 | */ 32 | exports.enable = function (success, error) { 33 | success(); 34 | }; 35 | 36 | /** 37 | * Deactivates the background mode. When deactivated the application 38 | * will not stay awake while in background. 39 | * 40 | * @param [ Function ] success The success callback to use. 41 | * @param [ Function ] error The error callback to use. 42 | * 43 | * @return [ Void ] 44 | */ 45 | exports.disable = function (success, error) { 46 | success(); 47 | }; 48 | 49 | cordova.commandProxy.add('BackgroundMode', exports); 50 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-background-mode/src/ios/APPBackgroundMode.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013-2017 appPlant GmbH 3 | 4 | Licensed to the Apache Software Foundation (ASF) under one 5 | or more contributor license agreements. See the NOTICE file 6 | distributed with this work for additional information 7 | regarding copyright ownership. The ASF licenses this file 8 | to you under the Apache License, Version 2.0 (the 9 | "License"); you may not use this file except in compliance 10 | with the License. You may obtain a copy of the License at 11 | 12 | http://www.apache.org/licenses/LICENSE-2.0 13 | 14 | Unless required by applicable law or agreed to in writing, 15 | software distributed under the License is distributed on an 16 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 | KIND, either express or implied. See the License for the 18 | specific language governing permissions and limitations 19 | under the License. 20 | */ 21 | 22 | #import 23 | #import 24 | 25 | @interface APPBackgroundMode : CDVPlugin { 26 | AVAudioPlayer* audioPlayer; 27 | BOOL enabled; 28 | } 29 | 30 | // Activate the background mode 31 | - (void) enable:(CDVInvokedUrlCommand*)command; 32 | // Deactivate the background mode 33 | - (void) disable:(CDVInvokedUrlCommand*)command; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2014-2016 Don Coleman 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/battery/.npmignore: -------------------------------------------------------------------------------- 1 | platforms 2 | plugins 3 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/battery/README.md: -------------------------------------------------------------------------------- 1 | ## Battery 2 | 3 | Read the Battery Level from the [Battery Service 0x180](https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml) 4 | 5 | * Read Battery Level 6 | 7 | Hardware 8 | 9 | * Any peripheral with Battery Service 10 | 11 | Install 12 | 13 | $ cordova platform add android ios 14 | $ cordova plugin add cordova-plugin-ble-central 15 | $ cordova run 16 | 17 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/battery/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Battery Test 4 | 5 | Cordova Bluetooth Plugin to read Battery Service 6 | 7 | 8 | Don Coleman 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/battery/www/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Helvetica Neue"; 3 | font-weight: lighter; 4 | color: #2a2a2a; 5 | background-color: #f0f0ff; 6 | 7 | -webkit-appearance: none; 8 | -webkit-touch-callout: none; 9 | -webkit-tap-highlight-color: rgba(0,0,0,0); 10 | 11 | -webkit-touch-callout: none; -webkit-user-select: none; 12 | } 13 | 14 | h1 { 15 | text-align: center; 16 | } 17 | 18 | button { 19 | margin: 15px; 20 | -webkit-appearance:none; 21 | font-size: 1.2em; 22 | } 23 | 24 | #mainPage { 25 | text-align:center; 26 | } 27 | 28 | #detailPage { 29 | text-align:center; 30 | font-size: 2em; 31 | } 32 | 33 | #detailPage div { 34 | margin: 20px; 35 | } 36 | 37 | #detailPage button { 38 | margin-top: 40px; 39 | font-size: 0.6em; /* undo 2em from parent */ 40 | } 41 | 42 | ul { 43 | list-style: none; 44 | border-bottom: 1px solid #d3d3d3; 45 | text-align: left; 46 | } 47 | 48 | li { 49 | margin-left: -40px; 50 | padding: 5px; 51 | padding-top: 10px; 52 | min-height: 50px; 53 | border-top: 1px solid #d3d3d3; 54 | font-size: 0.9em; 55 | } 56 | 57 | button { 58 | -webkit-appearance: none; 59 | font-size: 1.5em; 60 | border-radius: 0; 61 | } -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/battery/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | SensorTag 10 | 11 | 12 |
13 |

Choose a peripheral with a battery service

14 |
15 |
    16 |
17 | 18 |
19 |
20 |
21 | 22 | 23 |
24 |
25 | 26 | 27 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/bluefruitle/.npmignore: -------------------------------------------------------------------------------- 1 | platforms 2 | plugins 3 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/bluefruitle/README.md: -------------------------------------------------------------------------------- 1 | ## Adafruit UART 2 | 3 | UART example using an Arduino and [Adafruit's Bluefruit LE](http://www.adafruit.com/products/1697) breakout board. 4 | 5 | Use the [callbackEcho sketch](https://github.com/adafruit/Adafruit_nRF8001/blob/master/examples/callbackEcho/callbackEcho.ino) and see [Adafruit's tutorial](https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout/software-uart-service) for setting up the hardware and Arduino code. 6 | 7 | Hardware 8 | 9 | * [Arduino](http://www.adafruit.com/products/50) 10 | * [BluefruitLE](http://www.adafruit.com/products/1697) 11 | 12 | This example will also connect to the [Adafruit Bluefruit LE Friend](https://www.adafruit.com/products/2267). 13 | 14 | Install 15 | 16 | $ cordova platform add android ios 17 | $ cordova plugin add cordova-plugin-ble-central 18 | $ cordova run 19 | 20 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/bluefruitle/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | BluefruitLE 4 | 5 | A sample Apache Cordova application that responds to the deviceready event. 6 | 7 | 8 | Apache Cordova Team 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/bluefruitle/www/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Helvetica Neue"; 3 | font-weight: lighter; 4 | color: #2a2a2a; 5 | background-color: #f0f0ff; 6 | 7 | -webkit-appearance: none; 8 | -webkit-touch-callout: none; 9 | -webkit-tap-highlight-color: rgba(0,0,0,0); 10 | 11 | -webkit-touch-callout: none; -webkit-user-select: none; 12 | } 13 | 14 | h1 { 15 | text-align: center; 16 | } 17 | 18 | button { 19 | margin: 15px; 20 | -webkit-appearance:none; 21 | font-size: 1.2em; 22 | } 23 | 24 | /* TODO */ 25 | input[type=range] { 26 | width: 100%; 27 | } 28 | 29 | #mainPage { 30 | text-align:center; 31 | } 32 | 33 | #detailPage { 34 | text-align:center; 35 | font-size: 2em; 36 | } 37 | 38 | #detailPage div { 39 | margin: 20px; 40 | } 41 | 42 | #detailPage button { 43 | margin-top: 40px; 44 | font-size: 0.6em; /* undo 2em from parent */ 45 | } 46 | 47 | ul { 48 | list-style: none; 49 | border-bottom: 1px solid #d3d3d3; 50 | text-align: left; 51 | } 52 | 53 | li { 54 | margin-left: -40px; 55 | padding: 5px; 56 | padding-top: 10px; 57 | min-height: 50px; 58 | border-top: 1px solid #d3d3d3; 59 | font-size: 0.9em; 60 | } 61 | 62 | button { 63 | -webkit-appearance: none; 64 | font-size: 1.5em; 65 | border-radius: 0; 66 | } 67 | 68 | #resultDiv { 69 | font: 16px "Source Sans", helvetica, arial, sans-serif; 70 | font-weight: 200; 71 | display: block; 72 | -webkit-border-radius: 6px; 73 | width: 100%; 74 | height: 140px; 75 | text-align: left; 76 | overflow: auto; 77 | } -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/bluefruitle/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | BluefruitLE 10 | 11 | 12 |
13 |

BluefruitLE

14 |
15 |
    16 |
17 | 18 |
19 |
20 |
21 |
22 | 23 | 24 |
25 | 26 |
27 |
28 | 29 | 30 | 33 | 34 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/heartrate/README.md: -------------------------------------------------------------------------------- 1 | BLE Heart Rate Demo 2 | 3 | Connects to a peripherial providing the [Heart Rate Service](http://goo.gl/wKH3X7). 4 | 5 | Works with iOS or Android 4.3+. 6 | 7 | $ cordova platform add android 8 | $ cordova plugin add cordova-plugin-ble-central 9 | $ cordova run 10 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/heartrate/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | HeartRate 4 | 5 | BLE Heart Rate Monitor Demo 6 | 7 | 8 | Don Coleman 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/heartrate/www/css/index.css: -------------------------------------------------------------------------------- 1 | * { 2 | -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */ 3 | } 4 | 5 | body { 6 | -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ 7 | -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ 8 | -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */ 9 | font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif; 10 | height:100%; 11 | margin:0px; 12 | padding:0px; 13 | width:100%; 14 | text-align: center; 15 | } 16 | 17 | div { 18 | padding: 20px; 19 | } 20 | 21 | h1 { 22 | font-size:3em; 23 | } 24 | 25 | h2 { 26 | font-size:2em; 27 | } 28 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/heartrate/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Heart Rate 10 | 11 | 12 |
13 |

BLE Heart Rate Demo

14 |

...

15 |
16 |
17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/metawear/.npmignore: -------------------------------------------------------------------------------- 1 | platforms 2 | plugins 3 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/metawear/README.md: -------------------------------------------------------------------------------- 1 | ## MetaWare 2 | 3 | Example using mbientlab's [MetaWare](http://mbientlab.com/product/). 4 | 5 | Read values from the button press on the MetaWear. 6 | 7 | Operate the Motor and Buzzer on the MetaWare. 8 | 9 | Hardware 10 | 11 | * [MetaWare](http://mbientlab.com/product/) 12 | 13 | Install 14 | 15 | $ cordova platform add android ios 16 | $ cordova plugin add cordova-plugin-ble-central 17 | $ cordova run 18 | 19 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/metawear/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MetaWear 4 | 5 | A sample Apache Cordova application that connects to mbientlab's MetaWear. 6 | 7 | 8 | Don Coleman 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/metawear/www/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Helvetica Neue"; 3 | font-weight: lighter; 4 | color: #2a2a2a; 5 | background-color: #f0f0ff; 6 | 7 | -webkit-appearance: none; 8 | -webkit-touch-callout: none; 9 | -webkit-tap-highlight-color: rgba(0,0,0,0); 10 | 11 | -webkit-touch-callout: none; -webkit-user-select: none; 12 | } 13 | 14 | h1 { 15 | text-align: center; 16 | } 17 | 18 | button { 19 | margin: 15px; 20 | -webkit-appearance:none; 21 | font-size: 1.2em; 22 | } 23 | 24 | /* TODO */ 25 | input[type=range] { 26 | width: 100%; 27 | } 28 | 29 | #mainPage { 30 | text-align:center; 31 | } 32 | 33 | #detailPage { 34 | text-align:center; 35 | font-size: 2em; 36 | } 37 | 38 | #detailPage div { 39 | margin: 20px; 40 | } 41 | 42 | #detailPage button { 43 | margin-top: 40px; 44 | font-size: 0.6em; /* undo 2em from parent */ 45 | } 46 | 47 | ul { 48 | list-style: none; 49 | border-bottom: 1px solid #d3d3d3; 50 | text-align: left; 51 | } 52 | 53 | li { 54 | margin-left: -40px; 55 | padding: 5px; 56 | padding-top: 10px; 57 | min-height: 50px; 58 | border-top: 1px solid #d3d3d3; 59 | font-size: 0.9em; 60 | } 61 | 62 | button { 63 | -webkit-appearance: none; 64 | font-size: 1.5em; 65 | border-radius: 0; 66 | } 67 | 68 | #resultDiv { 69 | font: 16px "Source Sans", helvetica, arial, sans-serif; 70 | font-weight: 200; 71 | display: block; 72 | -webkit-border-radius: 6px; 73 | width: 100%; 74 | height: 140px; 75 | text-align: left; 76 | overflow: auto; 77 | } 78 | 79 | .haptic { 80 | font-size: 0.5em; 81 | } 82 | 83 | .buttonDiv { 84 | padding: 0px; 85 | margin: 0px; 86 | font-size: 2em; 87 | } 88 | 89 | #detailPage .haptic button { 90 | margin-top: 15px; 91 | } 92 | 93 | input[type="number"] { 94 | width:50px; 95 | } -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/metawear/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | MetaWear 10 | 11 | 12 |
13 |

MetaWear

14 |
15 |
    16 |
17 | 18 |
19 |
20 |
21 |
22 |  ms 23 |
24 | 25 | 26 |
27 |
28 | 29 |
30 |
31 | 32 | 33 | 36 | 37 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/redbearlab/.npmignore: -------------------------------------------------------------------------------- 1 | platforms 2 | plugins 3 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/redbearlab/README.md: -------------------------------------------------------------------------------- 1 | ## RedBearLab UART 2 | 3 | UART example using an Arduino and [RedBear Lab's Bluetooth Shield](http://redbearlab.com/bleshield/) or any of the RedBear Lab boards: [Blend](http://redbearlab.com/blend/), [Blend Micro](http://redbearlab.com/blendmicro/), [nRF51822](http://redbearlab.com/redbearlab-nrf51822/), or [BLE Nano](http://redbearlab.com/blenano/). 4 | 5 | Use the [SimpleChat sketch](https://codebender.cc/sketch:37518) on your Arduino hardware. 6 | 7 | Hardware 8 | 9 | * [Arduino Uno](http://www.makershed.com/products/arduino-uno-revision-3) 10 | * [BLE Shield](http://www.makershed.com/products/bluetooth-low-energy-ble-shield-for-arduino-2-0) 11 | 12 | Install 13 | 14 | $ cordova platform add android ios 15 | $ cordova plugin add cordova-plugin-ble-central 16 | $ cordova run 17 | 18 | Once the app is running. Open the serial console to your Arduino. Data sent from the phone will show up in the serial console. Data sent from the Arduino will show up in on the phone. 19 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/redbearlab/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | RedBear Chat 4 | 5 | A sample app from a phone to RedBear Labs BLE hardware. 6 | 7 | 8 | Don Coleman 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/redbearlab/www/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Helvetica Neue"; 3 | font-weight: lighter; 4 | color: #2a2a2a; 5 | background-color: #f0f0ff; 6 | 7 | -webkit-appearance: none; 8 | -webkit-touch-callout: none; 9 | -webkit-tap-highlight-color: rgba(0,0,0,0); 10 | 11 | -webkit-touch-callout: none; -webkit-user-select: none; 12 | } 13 | 14 | h1 { 15 | text-align: center; 16 | } 17 | 18 | button { 19 | margin: 15px; 20 | -webkit-appearance:none; 21 | font-size: 1.2em; 22 | } 23 | 24 | /* TODO */ 25 | input[type=range] { 26 | width: 100%; 27 | } 28 | 29 | #mainPage { 30 | text-align:center; 31 | } 32 | 33 | #detailPage { 34 | text-align:center; 35 | font-size: 2em; 36 | } 37 | 38 | #detailPage div { 39 | margin: 20px; 40 | } 41 | 42 | #detailPage button { 43 | margin-top: 40px; 44 | font-size: 0.6em; /* undo 2em from parent */ 45 | } 46 | 47 | ul { 48 | list-style: none; 49 | border-bottom: 1px solid #d3d3d3; 50 | text-align: left; 51 | } 52 | 53 | li { 54 | margin-left: -40px; 55 | padding: 5px; 56 | padding-top: 10px; 57 | min-height: 50px; 58 | border-top: 1px solid #d3d3d3; 59 | font-size: 0.9em; 60 | } 61 | 62 | button { 63 | -webkit-appearance: none; 64 | font-size: 1.5em; 65 | border-radius: 0; 66 | } 67 | 68 | #resultDiv { 69 | font: 16px "Source Sans", helvetica, arial, sans-serif; 70 | font-weight: 200; 71 | display: block; 72 | -webkit-border-radius: 6px; 73 | width: 100%; 74 | height: 140px; 75 | text-align: left; 76 | overflow: auto; 77 | } -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/redbearlab/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | RedBearLab Chat 10 | 11 | 12 |
13 |

RedBearLab

14 |
15 |
    16 |
17 | 18 |
19 |
20 |
21 |
22 | 23 | 24 |
25 | 26 |
27 |
28 | 29 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/rfduinoLedButton/.npmignore: -------------------------------------------------------------------------------- 1 | platforms 2 | plugins 3 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/rfduinoLedButton/README.md: -------------------------------------------------------------------------------- 1 | ## RFduino LED Button 2 | 3 | Requires an [RFduino](http://rfudino.com) running the [LED Button sketch](https://github.com/RFduino/RFduino/blob/cfe1a448524f2dafc25f62cccd900484925bba8a/libraries/RFduinoBLE/examples/LedButton/LedButton.ino). 4 | 5 | Hardware 6 | 7 | * [RFduino](http://www.rfduino.com/product/rfd22102-rfduino-dip/) 8 | * [Button Shield](http://www.rfduino.com/product/rfd22122-rgb-button-shield-for-rfduino/) 9 | * [USB Shield](http://www.rfduino.com/product/rfd22124-pcb-usb-shield-for-rfduino/) 10 | 11 | 12 | Install 13 | 14 | $ cordova platform add android ios 15 | $ cordova plugin add cordova-plugin-ble-central 16 | $ cordova run 17 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/rfduinoLedButton/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | RFduinoLedButton 4 | 5 | Use Cordova Bluetooth Plugin to control RFduino LED Button Sketch 6 | 7 | 8 | Don Coleman 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/rfduinoLedButton/www/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Helvetica Neue"; 3 | font-weight: lighter; 4 | color: #2a2a2a; 5 | background-color: #f0f0ff; 6 | 7 | -webkit-appearance: none; 8 | -webkit-touch-callout: none; 9 | -webkit-tap-highlight-color: rgba(0,0,0,0); 10 | 11 | -webkit-touch-callout: none; -webkit-user-select: none; 12 | } 13 | 14 | h1 { 15 | text-align: center; 16 | } 17 | 18 | button { 19 | margin: 15px; 20 | -webkit-appearance:none; 21 | font-size: 1.2em; 22 | } 23 | 24 | #mainPage { 25 | text-align:center; 26 | } 27 | 28 | #detailPage { 29 | text-align:center; 30 | font-size: 2em; 31 | } 32 | 33 | #detailPage div { 34 | margin: 20px; 35 | } 36 | 37 | #detailPage button { 38 | margin-top: 40px; 39 | font-size: 0.6em; /* undo 2em from parent */ 40 | } 41 | 42 | ul { 43 | list-style: none; 44 | border-bottom: 1px solid #d3d3d3; 45 | text-align: left; 46 | } 47 | 48 | li { 49 | margin-left: -40px; 50 | padding: 5px; 51 | padding-top: 10px; 52 | min-height: 50px; 53 | border-top: 1px solid #d3d3d3; 54 | font-size: 0.9em; 55 | } 56 | 57 | button { 58 | -webkit-appearance: none; 59 | font-size: 1.5em; 60 | border-radius: 0; 61 | } -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/rfduinoLedButton/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | RFduino LED Button 10 | 11 | 12 |
13 |

RFduino LED Button

14 |
15 |
    16 |
17 | 18 |
19 |
20 |
Button Released
21 |
Hold for LED
22 | 23 |
24 |
25 | 26 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/robosmart/.npmignore: -------------------------------------------------------------------------------- 1 | platforms 2 | plugins 3 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/robosmart/README.md: -------------------------------------------------------------------------------- 1 | # RoboSmart 2 | 3 | Control a [SmartBotics](http://www.smartbotics.com/) RoboSmart Lightbulb from your phone. 4 | 5 | Hardware 6 | 7 | * [RoboSmart Lightbulb](http://www.smartbotics.com/#!where-to-buy/c1kf9) 8 | 9 | Install 10 | 11 | $ cordova platform add android ios 12 | $ cordova plugin add cordova-plugin-ble-central 13 | $ cordova run 14 | 15 | 16 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/robosmart/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | RoboSmart 4 | 5 | Use Cordova Bluetooth Plugin to control Smartbotics RoboSmart lightbulb 6 | 7 | 8 | Don Coleman 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/robosmart/www/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Helvetica Neue"; 3 | font-weight: lighter; 4 | color: #2a2a2a; 5 | background-color: #f0f0ff; 6 | 7 | -webkit-appearance: none; 8 | -webkit-touch-callout: none; 9 | -webkit-tap-highlight-color: rgba(0,0,0,0); 10 | 11 | -webkit-touch-callout: none; -webkit-user-select: none; 12 | } 13 | 14 | h1 { 15 | text-align: center; 16 | } 17 | 18 | button { 19 | margin: 15px; 20 | -webkit-appearance:none; 21 | font-size: 1.2em; 22 | } 23 | 24 | /* TODO */ 25 | input[type=range] { 26 | width: 100%; 27 | } 28 | 29 | #mainPage { 30 | text-align:center; 31 | } 32 | 33 | #detailPage { 34 | text-align:center; 35 | font-size: 2em; 36 | } 37 | 38 | #detailPage div { 39 | margin: 20px; 40 | } 41 | 42 | #detailPage button { 43 | margin-top: 40px; 44 | font-size: 0.6em; /* undo 2em from parent */ 45 | } 46 | 47 | ul { 48 | list-style: none; 49 | border-bottom: 1px solid #d3d3d3; 50 | text-align: left; 51 | } 52 | 53 | li { 54 | margin-left: -40px; 55 | padding: 5px; 56 | padding-top: 10px; 57 | min-height: 50px; 58 | border-top: 1px solid #d3d3d3; 59 | font-size: 0.9em; 60 | } 61 | 62 | button { 63 | -webkit-appearance: none; 64 | font-size: 1.5em; 65 | border-radius: 0; 66 | } -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/robosmart/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | RoboSmart 10 | 11 | 12 |
13 |

RoboSmart

14 |
15 |
    16 |
17 | 18 |
19 |
20 | 21 |
22 | 23 | 24 |
25 |
26 | 27 |
28 | 29 |
30 |
31 | 32 | 33 | 36 | 37 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/sensortag/.npmignore: -------------------------------------------------------------------------------- 1 | platforms 2 | plugins 3 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/sensortag/README.md: -------------------------------------------------------------------------------- 1 | ## SensorTag 2 | 3 | Interact with the [TI SensorTag](http://www.ti.com/tool/cc2541dk-sensor) 4 | 5 | * Read Button Presses 6 | * Read Accelerometer Data 7 | 8 | Hardware 9 | 10 | * [TI SensorTag](http://www.ti.com/tool/cc2541dk-sensor) 11 | 12 | Install 13 | 14 | $ cordova platform add android ios 15 | $ cordova plugin add cordova-plugin-ble-central 16 | $ cordova run 17 | 18 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/sensortag/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | SensorTag 4 | 5 | Use Cordova Bluetooth Plugin to read values from TI SensorTag 6 | 7 | 8 | Don Coleman 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/sensortag/www/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Helvetica Neue"; 3 | font-weight: lighter; 4 | color: #2a2a2a; 5 | background-color: #f0f0ff; 6 | 7 | -webkit-appearance: none; 8 | -webkit-touch-callout: none; 9 | -webkit-tap-highlight-color: rgba(0,0,0,0); 10 | 11 | -webkit-touch-callout: none; -webkit-user-select: none; 12 | } 13 | 14 | h1 { 15 | text-align: center; 16 | } 17 | 18 | button { 19 | margin: 15px; 20 | -webkit-appearance:none; 21 | font-size: 1.2em; 22 | } 23 | 24 | #mainPage { 25 | text-align:center; 26 | } 27 | 28 | #detailPage { 29 | text-align:center; 30 | font-size: 2em; 31 | } 32 | 33 | #detailPage div { 34 | margin: 20px; 35 | } 36 | 37 | #detailPage button { 38 | margin-top: 40px; 39 | font-size: 0.6em; /* undo 2em from parent */ 40 | } 41 | 42 | ul { 43 | list-style: none; 44 | border-bottom: 1px solid #d3d3d3; 45 | text-align: left; 46 | } 47 | 48 | li { 49 | margin-left: -40px; 50 | padding: 5px; 51 | padding-top: 10px; 52 | min-height: 50px; 53 | border-top: 1px solid #d3d3d3; 54 | font-size: 0.9em; 55 | } 56 | 57 | button { 58 | -webkit-appearance: none; 59 | font-size: 1.5em; 60 | border-radius: 0; 61 | } -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/sensortag/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | SensorTag 10 | 11 | 12 |
13 |

SensorTag

14 |
15 |
    16 |
17 | 18 |
19 |
20 |
waiting...
21 |
22 | 23 |
24 |
25 | 26 | 27 | 30 | 31 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/sensortag_cc2650/.npmignore: -------------------------------------------------------------------------------- 1 | platforms 2 | plugins 3 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/sensortag_cc2650/README.md: -------------------------------------------------------------------------------- 1 | ## SensorTag 2 | 3 | Interact with the [TI CC2650 SensorTag](http://www.ti.com/tool/CC2650STK) 4 | 5 | * Read Button Presses 6 | * Read Accelerometer/Magnetometer/Gyroscope Data 7 | * Read Barometer/Temperature Data 8 | 9 | Hardware 10 | 11 | * [TI CC2650 SensorTag](http://www.ti.com/tool/CC2650STK) 12 | 13 | Install 14 | 15 | $ cordova platform add android ios 16 | $ cordova plugin add cordova-plugin-ble-central 17 | $ cordova run 18 | 19 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/sensortag_cc2650/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | CC2650 SensorTag 4 | 5 | Use Cordova Bluetooth Plugin to read values from TI CC2650 SensorTag 6 | 7 | 8 | Trey German 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/sensortag_cc2650/www/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Helvetica Neue"; 3 | font-weight: lighter; 4 | color: #2a2a2a; 5 | background-color: #f0f0ff; 6 | 7 | -webkit-appearance: none; 8 | -webkit-touch-callout: none; 9 | -webkit-tap-highlight-color: rgba(0,0,0,0); 10 | 11 | -webkit-touch-callout: none; -webkit-user-select: none; 12 | } 13 | 14 | h1 { 15 | text-align: center; 16 | } 17 | 18 | button { 19 | margin: 15px; 20 | -webkit-appearance:none; 21 | font-size: 1.2em; 22 | } 23 | 24 | #mainPage { 25 | text-align:center; 26 | } 27 | 28 | #detailPage { 29 | text-align:center; 30 | font-size: 1em; 31 | } 32 | 33 | #detailPage div { 34 | margin: 20px; 35 | } 36 | 37 | #detailPage button { 38 | margin-top: 40px; 39 | font-size: 0.6em; /* undo 2em from parent */ 40 | } 41 | 42 | ul { 43 | list-style: none; 44 | border-bottom: 1px solid #d3d3d3; 45 | text-align: left; 46 | } 47 | 48 | li { 49 | margin-left: -40px; 50 | padding: 5px; 51 | padding-top: 10px; 52 | min-height: 50px; 53 | border-top: 1px solid #d3d3d3; 54 | font-size: 0.9em; 55 | } 56 | 57 | button { 58 | -webkit-appearance: none; 59 | font-size: 1.5em; 60 | border-radius: 0; 61 | } 62 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/examples/sensortag_cc2650/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | SensorTag 10 | 11 | 12 |
13 |

SensorTag

14 |
15 |
    16 |
17 | 18 |
19 |
20 |
waiting...
21 |
waiting...
22 |
23 | 24 |
25 |
26 | 27 | 28 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-ble-central", 3 | "version": "1.1.4", 4 | "description": "Bluetooth Low Energy (BLE) Central Plugin", 5 | "cordova": { 6 | "id": "cordova-plugin-ble-central", 7 | "platforms": [ 8 | "ios", 9 | "android", 10 | "wp8" 11 | ] 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/don/cordova-plugin-ble-central.git" 16 | }, 17 | "keywords": [ 18 | "cordova", 19 | "bluetooth", 20 | "ble", 21 | "bluetoothle", 22 | "bluetooth le", 23 | "low energy", 24 | "smart", 25 | "ecosystem:cordova", 26 | "cordova-ios", 27 | "cordova-android" 28 | ], 29 | "author": "Don Coleman ", 30 | "license": "Apache-2.0", 31 | "bugs": { 32 | "url": "https://github.com/don/cordova-plugin-ble-central/issues" 33 | }, 34 | "homepage": "https://github.com/don/cordova-plugin-ble-central#readme" 35 | } 36 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/src/android/BLECommand.java: -------------------------------------------------------------------------------- 1 | package com.megster.cordova.ble.central; 2 | 3 | import org.apache.cordova.CallbackContext; 4 | 5 | import java.util.UUID; 6 | 7 | /** 8 | * Android BLE stack is async but doesn't queue commands, so it ignore additional commands when processing. WTF? 9 | * This is an object to encapsulate the command data for queuing 10 | */ 11 | class BLECommand { 12 | // Types 13 | public static int READ = 10000; 14 | public static int REGISTER_NOTIFY = 10001; 15 | public static int REMOVE_NOTIFY = 10002; 16 | public static int READ_RSSI = 10003; 17 | // BluetoothGattCharacteristic.WRITE_TYPE_NO_RESPONSE 18 | // BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT 19 | 20 | private CallbackContext callbackContext; 21 | private UUID serviceUUID; 22 | private UUID characteristicUUID; 23 | private byte[] data; 24 | private int type; 25 | 26 | 27 | public BLECommand(CallbackContext callbackContext, UUID serviceUUID, UUID characteristicUUID, int type) { 28 | this.callbackContext = callbackContext; 29 | this.serviceUUID = serviceUUID; 30 | this.characteristicUUID = characteristicUUID; 31 | this.type = type; 32 | } 33 | 34 | public BLECommand(CallbackContext callbackContext, UUID serviceUUID, UUID characteristicUUID, byte[] data, int type) { 35 | this.callbackContext = callbackContext; 36 | this.serviceUUID = serviceUUID; 37 | this.characteristicUUID = characteristicUUID; 38 | this.data = data; 39 | this.type = type; 40 | } 41 | 42 | public int getType() { 43 | return type; 44 | } 45 | 46 | public CallbackContext getCallbackContext() { 47 | return callbackContext; 48 | } 49 | 50 | public UUID getServiceUUID() { 51 | return serviceUUID; 52 | } 53 | 54 | public UUID getCharacteristicUUID() { 55 | return characteristicUUID; 56 | } 57 | 58 | public byte[] getData() { 59 | return data; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/src/android/UUIDHelper.java: -------------------------------------------------------------------------------- 1 | // (c) 2104 Don Coleman 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | package com.megster.cordova.ble.central; 16 | 17 | import java.util.UUID; 18 | import java.util.regex.Matcher; 19 | import java.util.regex.Pattern; 20 | 21 | public class UUIDHelper { 22 | 23 | // base UUID used to build 128 bit Bluetooth UUIDs 24 | public static final String UUID_BASE = "0000XXXX-0000-1000-8000-00805f9b34fb"; 25 | 26 | // handle 16 and 128 bit UUIDs 27 | public static UUID uuidFromString(String uuid) { 28 | 29 | if (uuid.length() == 4) { 30 | uuid = UUID_BASE.replace("XXXX", uuid); 31 | } 32 | return UUID.fromString(uuid); 33 | } 34 | 35 | // return 16 bit UUIDs where possible 36 | public static String uuidToString(UUID uuid) { 37 | String longUUID = uuid.toString(); 38 | Pattern pattern = Pattern.compile("0000(.{4})-0000-1000-8000-00805f9b34fb", Pattern.CASE_INSENSITIVE); 39 | Matcher matcher = pattern.matcher(longUUID); 40 | if (matcher.matches()) { 41 | // 16 bit UUID 42 | return matcher.group(1); 43 | } else { 44 | return longUUID; 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/src/ios/BLECommandContext.h: -------------------------------------------------------------------------------- 1 | // 2 | // BLECommandContext 3 | // Holds peripherial, service and characteristic 4 | // 5 | 6 | #import 7 | #import 8 | 9 | @interface BLECommandContext : NSObject 10 | 11 | @property CBPeripheral *peripheral; 12 | @property CBService *service; 13 | @property CBCharacteristic *characteristic; 14 | 15 | @end 16 | 17 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/src/ios/BLECommandContext.m: -------------------------------------------------------------------------------- 1 | // 2 | // BLECommandContext.m 3 | // Holds peripherial, service and characteristic 4 | // 5 | 6 | #import "BLECommandContext.h" 7 | 8 | @implementation BLECommandContext 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/src/ios/CBPeripheral+Extensions.h: -------------------------------------------------------------------------------- 1 | // 2 | // CBPeripheral+Extensions.h 3 | // BLE Central Cordova Plugin 4 | // 5 | // (c) 2104 Don Coleman 6 | // 7 | // Licensed under the Apache License, Version 2.0 (the "License"); 8 | // you may not use this file except in compliance with the License. 9 | // You may obtain a copy of the License at 10 | // 11 | // http://www.apache.org/licenses/LICENSE-2.0 12 | // 13 | // Unless required by applicable law or agreed to in writing, software 14 | // distributed under the License is distributed on an "AS IS" BASIS, 15 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | // See the License for the specific language governing permissions and 17 | // limitations under the License. 18 | 19 | #import 20 | #import 21 | #import 22 | #import 23 | 24 | 25 | @interface CBPeripheral(com_megster_ble_extension) 26 | 27 | @property (nonatomic, retain) NSDictionary *advertising; 28 | @property (nonatomic, retain) NSNumber *advertisementRSSI; 29 | 30 | -(void)setAdvertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber*)rssi; 31 | -(NSDictionary *)asDictionary; 32 | -(NSString *)uuidAsString; 33 | 34 | @end 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/tests/plugin.xml: -------------------------------------------------------------------------------- 1 | 6 | Bluetooth Low Energy Plugin Tests 7 | Apache 2.0 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-ble-central/tests/tests.js: -------------------------------------------------------------------------------- 1 | exports.defineAutoTests = function () { 2 | 3 | describe('BLE object', function () { 4 | it("ble should exist", function () { 5 | expect(ble).toBeDefined(); 6 | }); 7 | 8 | it("should contain a startScan function", function () { 9 | expect(typeof ble.startScan).toBeDefined(); 10 | expect(typeof ble.startScan).toBe("function"); 11 | }); 12 | }); 13 | 14 | }; 15 | 16 | exports.defineManualTests = function (contentEl, createActionButton) { 17 | 18 | createActionButton('Is Bluetooth Enabled?', function() { 19 | 20 | ble.isEnabled( 21 | function() { 22 | console.log("Bluetooth is enabled"); 23 | }, 24 | function() { 25 | console.log("Bluetooth is *not* enabled"); 26 | } 27 | ); 28 | }); 29 | 30 | 31 | if (cordova.platformId !== 'ios') { 32 | 33 | // not supported on iOS 34 | createActionButton('Show Bluetooth Settings', function() { 35 | ble.showBluetoothSettings(); 36 | }); 37 | 38 | // not supported on iOS 39 | createActionButton('Enable Bluetooth', function() { 40 | 41 | ble.enable( 42 | function() { 43 | console.log("Bluetooth is enabled"); 44 | }, 45 | function() { 46 | console.log("The user did *not* enable Bluetooth"); 47 | } 48 | ); 49 | }); 50 | 51 | } 52 | 53 | createActionButton('Scan', function() { 54 | 55 | var scanSeconds = 5; 56 | console.log("Scanning for BLE peripherals for " + scanSeconds + " seconds."); 57 | ble.startScan([], function(device) { 58 | console.log(JSON.stringify(device)); 59 | }, function(reason) { 60 | console.log("BLE Scan failed " + reason); 61 | }); 62 | 63 | setTimeout(ble.stopScan, 64 | scanSeconds * 1000, 65 | function() { console.log("Scan complete"); }, 66 | function() { console.log("stopScan failed"); } 67 | ); 68 | 69 | }); 70 | 71 | }; 72 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-compat/README.md: -------------------------------------------------------------------------------- 1 | 21 | 22 | cordova-plugin-compat 23 | ------------------------ 24 | 25 | This repo is for remaining backwards compatible with previous versions of Cordova. 26 | 27 | ## USAGE 28 | 29 | Your plugin can depend on this plugin and use it to handle the new run time permissions Android 6.0.0 (cordova-android 5.0.0) introduced. 30 | 31 | View [this commit](https://github.com/apache/cordova-plugin-camera/commit/a9c18710f23e86f5b7f8918dfab7c87a85064870) to see how to depend on `cordova-plugin-compat`. View [this file](https://github.com/apache/cordova-plugin-camera/blob/master/src/android/CameraLauncher.java) to see how `PermissionHelper` is being used to request and store permissions. Read more about Android permissions at http://cordova.apache.org/docs/en/latest/guide/platforms/android/plugin.html#android-permissions. 32 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-compat/RELEASENOTES.md: -------------------------------------------------------------------------------- 1 | 21 | # Release Notes 22 | 23 | ### 1.1.0 (Nov 02, 2016) 24 | * [CB-11625](https://issues.apache.org/jira/browse/CB-11625) Adding the `BuildConfig` fetching code as a backup to using a new preference 25 | * Add github pull request template 26 | 27 | ### 1.0.0 (Apr 15, 2016) 28 | * Initial release 29 | * Moved `PermissionHelper.java` into `src` 30 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-compat/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-compat", 3 | "description": "This repo is for remaining backwards compatible with previous versions of Cordova.", 4 | "version": "1.1.0", 5 | "homepage": "http://github.com/apache/cordova-plugin-compat#readme", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/apache/cordova-plugin-compat.git" 9 | }, 10 | "bugs": { 11 | "url": "https://github.com/apache/cordova-plugin-compat/issues" 12 | }, 13 | "cordova": { 14 | "id": "cordova-plugin-compat", 15 | "platforms": [ 16 | "android" 17 | ] 18 | }, 19 | "keywords": [ 20 | "ecosystem:cordova", 21 | "ecosystem:phonegap", 22 | "cordova-android" 23 | ], 24 | "engines": [ 25 | { 26 | "name": "cordova", 27 | "version": ">=5.0.0" 28 | } 29 | ], 30 | "author": "Apache Software Foundation", 31 | "license": "Apache-2.0" 32 | } 33 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-compat/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | 22 | 25 | Compat 26 | Cordova Compatibility Plugin 27 | Apache 2.0 28 | cordova,compat 29 | https://git-wip-us.apache.org/repos/asf/cordova-plugin-compat.git 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 21 | 22 | # Contributing to Apache Cordova 23 | 24 | Anyone can contribute to Cordova. And we need your contributions. 25 | 26 | There are multiple ways to contribute: report bugs, improve the docs, and 27 | contribute code. 28 | 29 | For instructions on this, start with the 30 | [contribution overview](http://cordova.apache.org/contribute/). 31 | 32 | The details are explained there, but the important items are: 33 | - Sign and submit an Apache ICLA (Contributor License Agreement). 34 | - Have a Jira issue open that corresponds to your contribution. 35 | - Run the tests so your patch doesn't break existing functionality. 36 | 37 | We look forward to your contributions! 38 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/NOTICE: -------------------------------------------------------------------------------- 1 | Apache Cordova 2 | Copyright 2012 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-device", 3 | "version": "1.1.6", 4 | "description": "Cordova Device Plugin", 5 | "types": "./types/index.d.ts", 6 | "cordova": { 7 | "id": "cordova-plugin-device", 8 | "platforms": [ 9 | "firefoxos", 10 | "tizen", 11 | "android", 12 | "amazon-fireos", 13 | "ubuntu", 14 | "ios", 15 | "blackberry10", 16 | "wp7", 17 | "wp8", 18 | "windows8", 19 | "windows", 20 | "browser", 21 | "osx" 22 | ] 23 | }, 24 | "repository": { 25 | "type": "git", 26 | "url": "https://github.com/apache/cordova-plugin-device" 27 | }, 28 | "keywords": [ 29 | "cordova", 30 | "device", 31 | "ecosystem:cordova", 32 | "cordova-firefoxos", 33 | "cordova-tizen", 34 | "cordova-android", 35 | "cordova-amazon-fireos", 36 | "cordova-ubuntu", 37 | "cordova-ios", 38 | "cordova-blackberry10", 39 | "cordova-wp7", 40 | "cordova-wp8", 41 | "cordova-windows8", 42 | "cordova-windows", 43 | "cordova-browser", 44 | "cordova-osx" 45 | ], 46 | "scripts": { 47 | "test": "npm run jshint", 48 | "jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests" 49 | }, 50 | "author": "Apache Software Foundation", 51 | "license": "Apache-2.0", 52 | "engines": { 53 | "cordovaDependencies": { 54 | "2.0.0": { 55 | "cordova": ">100" 56 | } 57 | } 58 | }, 59 | "devDependencies": { 60 | "jshint": "^2.6.0" 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/src/ios/CDVDevice.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. 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, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | #import 22 | 23 | @interface CDVDevice : CDVPlugin 24 | {} 25 | 26 | + (NSString*)cordovaVersion; 27 | 28 | - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/src/osx/CDVDevice.h: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. 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, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | #import 21 | 22 | @interface CDVDevice : CDVPlugin 23 | 24 | + (NSString*) cordovaVersion; 25 | 26 | - (void) getDeviceInfo:(CDVInvokedUrlCommand*)command; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/src/tizen/DeviceProxy.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | * 20 | */ 21 | 22 | var tizen = require('cordova/platform'); 23 | 24 | module.exports = { 25 | getDeviceInfo: function(success, error) { 26 | setTimeout(function () { 27 | success({ 28 | cordova: tizen.cordovaVersion, 29 | platform: 'tizen', 30 | model: null, 31 | version: null, 32 | uuid: null 33 | }); 34 | }, 0); 35 | } 36 | }; 37 | 38 | require("cordova/tizen/commandProxy").add("Device", module.exports); 39 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/src/ubuntu/device.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Wolfgang Koller - http://www.gofg.at/ 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include"device.h" 21 | 22 | #define CORDOVA "3.0.0" 23 | 24 | Device::Device(Cordova *cordova) : CPlugin(cordova) { 25 | } 26 | 27 | static QString getOSName() { 28 | #ifdef Q_OS_SYMBIAN 29 | QString platform = "Symbian"; 30 | #endif 31 | #ifdef Q_OS_WIN 32 | QString platform = "Windows"; 33 | #endif 34 | #ifdef Q_OS_WINCE 35 | QString platform = "Windows CE"; 36 | #endif 37 | #ifdef Q_OS_LINUX 38 | QString platform = "Linux"; 39 | #endif 40 | return platform; 41 | } 42 | 43 | void Device::getInfo(int scId, int ecId) { 44 | Q_UNUSED(ecId) 45 | 46 | QDeviceInfo systemDeviceInfo; 47 | QDeviceInfo systemInfo; 48 | 49 | QString platform = getOSName(); 50 | 51 | QString uuid = systemDeviceInfo.uniqueDeviceID(); 52 | if (uuid.isEmpty()) { 53 | QString deviceDescription = systemInfo.imei(0) + ";" + systemInfo.manufacturer() + ";" + systemInfo.model() + ";" + systemInfo.productName() + ";" + platform; 54 | QString user = qgetenv("USER"); 55 | if (user.isEmpty()) { 56 | user = qgetenv("USERNAME"); 57 | if (user.isEmpty()) 58 | user = QDir::homePath(); 59 | } 60 | uuid = QString(QCryptographicHash::hash((deviceDescription + ";" + user).toUtf8(), QCryptographicHash::Md5).toHex()); 61 | } 62 | 63 | this->cb(scId, systemDeviceInfo.model(), CORDOVA, platform, uuid, systemInfo.version(QDeviceInfo::Os)); 64 | } 65 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/src/ubuntu/device.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2011 Wolfgang Koller - http://www.gofg.at/ 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef DEVICE_H_FDSAFAS 18 | #define DEVICE_H_FDSAFAS 19 | 20 | #include 21 | 22 | #include 23 | 24 | class Device: public CPlugin { 25 | Q_OBJECT 26 | public: 27 | explicit Device(Cordova *cordova); 28 | 29 | virtual const QString fullName() override { 30 | return Device::fullID(); 31 | } 32 | 33 | virtual const QString shortName() override { 34 | return "Device"; 35 | } 36 | 37 | static const QString fullID() { 38 | return "com.cordova.Device"; 39 | } 40 | 41 | signals: 42 | 43 | public slots: 44 | void getInfo(int scId, int ecId); 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/src/ubuntu/device.js: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * Licensed to the Apache Software Foundation (ASF) under one 4 | * or more contributor license agreements. See the NOTICE file 5 | * distributed with this work for additional information 6 | * regarding copyright ownership. The ASF licenses this file 7 | * to you under the Apache License, Version 2.0 (the 8 | * "License"); you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | * 20 | */ 21 | 22 | /* global Cordova */ 23 | 24 | module.exports = { 25 | getInfo:function(win,fail,args) { 26 | Cordova.exec(function (model, cordova, platform, uuid, version) { 27 | win({name: name, model: model, cordova: cordova, 28 | platform: platform, uuid: uuid, version: version}); 29 | }, null, "com.cordova.Device", "getInfo", []); 30 | } 31 | }; 32 | 33 | require("cordova/exec/proxy").add("Device", module.exports); 34 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-device-tests", 3 | "version": "1.1.6-dev", 4 | "description": "", 5 | "cordova": { 6 | "id": "cordova-plugin-device-tests", 7 | "platforms": [] 8 | }, 9 | "keywords": [ 10 | "ecosystem:cordova" 11 | ], 12 | "author": "", 13 | "license": "Apache 2.0" 14 | } 15 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/tests/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 26 | Cordova Device Plugin Tests 27 | Apache 2.0 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-device/types/index.d.ts: -------------------------------------------------------------------------------- 1 | // Type definitions for Apache Cordova Device plugin 2 | // Project: https://github.com/apache/cordova-plugin-device 3 | // Definitions by: Microsoft Open Technologies Inc 4 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped 5 | // 6 | // Copyright (c) Microsoft Open Technologies Inc 7 | // Licensed under the MIT license 8 | 9 | /** 10 | * This plugin defines a global device object, which describes the device's hardware and software. 11 | * Although the object is in the global scope, it is not available until after the deviceready event. 12 | */ 13 | interface Device { 14 | /** Get the version of Cordova running on the device. */ 15 | cordova: string; 16 | /** Indicates that Cordova initialize successfully. */ 17 | available: boolean; 18 | /** 19 | * The device.model returns the name of the device's model or product. The value is set 20 | * by the device manufacturer and may be different across versions of the same product. 21 | */ 22 | model: string; 23 | /** Get the device's operating system name. */ 24 | platform: string; 25 | /** Get the device's Universally Unique Identifier (UUID). */ 26 | uuid: string; 27 | /** Get the operating system version. */ 28 | version: string; 29 | /** Get the device's manufacturer. */ 30 | manufacturer: string; 31 | /** Whether the device is running on a simulator. */ 32 | isVirtual: boolean; 33 | /** Get the device hardware serial number. */ 34 | serial: string;} 35 | 36 | declare var device: Device; -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-whitelist/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | 21 | 22 | # Contributing to Apache Cordova 23 | 24 | Anyone can contribute to Cordova. And we need your contributions. 25 | 26 | There are multiple ways to contribute: report bugs, improve the docs, and 27 | contribute code. 28 | 29 | For instructions on this, start with the 30 | [contribution overview](http://cordova.apache.org/contribute/). 31 | 32 | The details are explained there, but the important items are: 33 | - Sign and submit an Apache ICLA (Contributor License Agreement). 34 | - Have a Jira issue open that corresponds to your contribution. 35 | - Run the tests so your patch doesn't break existing functionality. 36 | 37 | We look forward to your contributions! 38 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-whitelist/NOTICE: -------------------------------------------------------------------------------- 1 | Apache Cordova 2 | Copyright 2012 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-whitelist/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-whitelist", 3 | "version": "1.3.2", 4 | "description": "Cordova Whitelist Plugin", 5 | "cordova": { 6 | "platforms": [ 7 | "android" 8 | ] 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/apache/cordova-plugin-whitelist" 13 | }, 14 | "keywords": [ 15 | "cordova", 16 | "whitelist", 17 | "ecosystem:cordova", 18 | "cordova-android" 19 | ], 20 | "engines": { 21 | "cordovaDependencies": { 22 | "0.0.0": { 23 | "cordova-android": ">=4.0.0" 24 | }, 25 | "2.0.0": { 26 | "cordova": ">100" 27 | } 28 | } 29 | }, 30 | "author": "Apache Software Foundation", 31 | "license": "Apache-2.0" 32 | } 33 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-whitelist/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 24 | Whitelist 25 | Cordova Network Whitelist Plugin 26 | Apache 2.0 27 | cordova,whitelist,policy 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in. 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/LICENSE: -------------------------------------------------------------------------------- 1 | [The MIT License (MIT)](http://www.opensource.org/licenses/mit-license.html) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/issue_template.md: -------------------------------------------------------------------------------- 1 | ### Expected behaviour 2 | Tell us what should happen. 3 | 4 | ### Actual behaviour 5 | Tell us what happens instead. Provide a log message if relevant. 6 | 7 | ### I'm seeing this behaviour on 8 | _Remove this hint: these checkboxes can be checked like this: [x]_ 9 | 10 | - [ ] iOS device 11 | - [ ] iOS sim 12 | - [ ] Android device 13 | - [ ] Android sim 14 | 15 | #### Hardware models 16 | Example: Samsung Galaxy S6, iPhone 6s 17 | 18 | #### OS versions 19 | Example: Android 4.4.2, iOS 9.2 20 | 21 | ### I'm not a dummy, so I've checked these 22 | - [ ] It happens on a fresh Cordova CLI project as well. 23 | - [ ] I'm waiting for `deviceready` to fire. 24 | - [ ] My JavaScript has no errors (`window.onerror` catches nothing). 25 | 26 | ### So how can we reproduce this? 27 | _Remove this hint: Pick one of these - use the Preview feature of this editor to get a sense which option we like best_ 28 | 29 | #### Awesome :star::star::star::star::star: 30 | Provide a (link to a) minimal demo app showing the faulty behaviour. 31 | 32 | #### Sweet :star::star::star::star: 33 | Provide a concise code sample which can be dropped into a freshly created Cordova CLI app. 34 | 35 | #### Good :star::star::star: 36 | Provide your own app and instructions how to reproduce the issue. 37 | 38 | #### Meh :star::star: 39 | Provide a code sample with a bunch of magic parameters which I need to interpolate by guessing to reconstruct the actual runtime code. 40 | 41 | #### Worst :poop: 42 | Say the source code can't be disclosed and refuse to provide any of the above. Expect this issue to be closed by a bunch of angry aliens :alien::alien::alien::alien::alien: that will hunt you down and :fire: your :computer:. You've been warned. :fire_engine: 43 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cordova-plugin-x-toast", 3 | "version": "2.6.0", 4 | "description": "This plugin allows you to show a Toast. A Toast is a little non intrusive buttonless popup which automatically disappears.", 5 | "cordova": { 6 | "id": "cordova-plugin-x-toast", 7 | "platforms": [ 8 | "ios", 9 | "android", 10 | "wp8", 11 | "windows", 12 | "blackberry10" 13 | ] 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "git+https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git" 18 | }, 19 | "keywords": [ 20 | "Toast", 21 | "Notification", 22 | "Message", 23 | "Alert", 24 | "ecosystem:cordova", 25 | "cordova-ios", 26 | "cordova-android", 27 | "cordova-wp8", 28 | "cordova-windows", 29 | "cordova-blackberry10" 30 | ], 31 | "engines": [ 32 | { 33 | "name": "cordova", 34 | "version": ">=3.0.0" 35 | } 36 | ], 37 | "author": "Eddy Verbruggen (https://github.com/EddyVerbruggen)", 38 | "license": "MIT", 39 | "bugs": { 40 | "url": "https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin/issues" 41 | }, 42 | "homepage": "https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin#readme" 43 | } 44 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/screenshots/screenshot-android-toast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/screenshots/screenshot-android-toast.png -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/screenshots/screenshot-ios-toast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/screenshots/screenshot-ios-toast.png -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/screenshots/screenshot-wp8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/screenshots/screenshot-wp8.jpg -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/screenshots/styling-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/screenshots/styling-green.png -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/screenshots/styling-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/screenshots/styling-red.png -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/index.js: -------------------------------------------------------------------------------- 1 | var toast, 2 | resultObjs = {}, 3 | threadCallback = null, 4 | _utils = require("../../lib/utils"); 5 | 6 | module.exports = { 7 | 8 | show: function (success, fail, args, env) { 9 | var result = new PluginResult(args, env); 10 | resultObjs[result.callbackId] = result; 11 | 12 | var message = JSON.parse(decodeURIComponent(args[0])), 13 | duration = JSON.parse(decodeURIComponent(args[1])), 14 | position = JSON.parse(decodeURIComponent(args[2])); 15 | 16 | toast.getInstance().show(result.callbackId, {message:message, duration:duration, position:position}); 17 | } 18 | }; 19 | 20 | /////////////////////////////////////////////////////////////////// 21 | // JavaScript wrapper for JNEXT plugin for connection 22 | /////////////////////////////////////////////////////////////////// 23 | 24 | JNEXT.Toast = function () { 25 | var self = this, 26 | hasInstance = false; 27 | 28 | self.getId = function () { 29 | return self.m_id; 30 | }; 31 | 32 | self.init = function () { 33 | if (!JNEXT.require("libToast")) { 34 | return false; 35 | } 36 | 37 | self.m_id = JNEXT.createObject("libToast.Toast_JS"); 38 | 39 | if (self.m_id === "") { 40 | return false; 41 | } 42 | 43 | JNEXT.registerEvents(self); 44 | }; 45 | 46 | // calls into InvokeMethod(string command) in Toast_JS.cpp 47 | self.show = function (callbackId, input) { 48 | return JNEXT.invoke(self.m_id, "show " + callbackId + " " + JSON.stringify(input)); 49 | }; 50 | 51 | // Fired by the Event framework (used by asynchronous callbacks) 52 | self.onEvent = function (strData) { 53 | var arData = strData.split(" "), 54 | callbackId = arData[0], 55 | result = resultObjs[callbackId], 56 | data = arData.slice(1, arData.length).join(" "); 57 | 58 | if (result) { 59 | if (callbackId != threadCallback) { 60 | result.callbackOk(data, false); 61 | delete resultObjs[callbackId]; 62 | } else { 63 | result.callbackOk(data, true); 64 | } 65 | } 66 | }; 67 | 68 | // ************************ 69 | // End of methods to edit 70 | // ************************ 71 | self.m_id = ""; 72 | 73 | self.getInstance = function () { 74 | if (!hasInstance) { 75 | hasInstance = true; 76 | self.init(); 77 | } 78 | return self; 79 | }; 80 | 81 | }; 82 | 83 | toast = new JNEXT.Toast(); 84 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/libToast.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/libToast.so -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/public/json_reader.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/public/json_reader.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/public/json_value.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/public/json_value.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/public/json_writer.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/public/json_writer.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/public/plugin.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/public/plugin.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/public/tokenizer.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/public/tokenizer.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/src/Logger.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/src/Logger.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/src/toast_js.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/src/toast_js.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/src/toast_ndk.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/device/src/toast_ndk.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/public/json/autolink.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_AUTOLINK_H_INCLUDED 2 | # define JSON_AUTOLINK_H_INCLUDED 3 | 4 | # include "config.h" 5 | 6 | # ifdef JSON_IN_CPPTL 7 | # include 8 | # endif 9 | 10 | # if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && !defined(JSON_IN_CPPTL) 11 | # define CPPTL_AUTOLINK_NAME "json" 12 | # undef CPPTL_AUTOLINK_DLL 13 | # ifdef JSON_DLL 14 | # define CPPTL_AUTOLINK_DLL 15 | # endif 16 | # include "autolink.h" 17 | # endif 18 | 19 | #endif // JSON_AUTOLINK_H_INCLUDED 20 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/public/json/config.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_CONFIG_H_INCLUDED 2 | # define JSON_CONFIG_H_INCLUDED 3 | 4 | /// If defined, indicates that json library is embedded in CppTL library. 5 | //# define JSON_IN_CPPTL 1 6 | 7 | /// If defined, indicates that json may leverage CppTL library 8 | //# define JSON_USE_CPPTL 1 9 | /// If defined, indicates that cpptl vector based map should be used instead of std::map 10 | /// as Value container. 11 | //# define JSON_USE_CPPTL_SMALLMAP 1 12 | /// If defined, indicates that Json specific container should be used 13 | /// (hash table & simple deque container with customizable allocator). 14 | /// THIS FEATURE IS STILL EXPERIMENTAL! 15 | //# define JSON_VALUE_USE_INTERNAL_MAP 1 16 | /// Force usage of standard new/malloc based allocator instead of memory pool based allocator. 17 | /// The memory pools allocator used optimization (initializing Value and ValueInternalLink 18 | /// as if it was a POD) that may cause some validation tool to report errors. 19 | /// Only has effects if JSON_VALUE_USE_INTERNAL_MAP is defined. 20 | //# define JSON_USE_SIMPLE_INTERNAL_ALLOCATOR 1 21 | 22 | /// If defined, indicates that Json use exception to report invalid type manipulation 23 | /// instead of C assert macro. 24 | # define JSON_USE_EXCEPTION 1 25 | 26 | # ifdef JSON_IN_CPPTL 27 | # include 28 | # ifndef JSON_USE_CPPTL 29 | # define JSON_USE_CPPTL 1 30 | # endif 31 | # endif 32 | 33 | # ifdef JSON_IN_CPPTL 34 | # define JSON_API CPPTL_API 35 | # elif defined(JSON_DLL_BUILD) 36 | # define JSON_API __declspec(dllexport) 37 | # elif defined(JSON_DLL) 38 | # define JSON_API __declspec(dllimport) 39 | # else 40 | # define JSON_API 41 | # endif 42 | 43 | #endif // JSON_CONFIG_H_INCLUDED 44 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/public/json/features.h: -------------------------------------------------------------------------------- 1 | #ifndef CPPTL_JSON_FEATURES_H_INCLUDED 2 | # define CPPTL_JSON_FEATURES_H_INCLUDED 3 | 4 | # include "forwards.h" 5 | 6 | namespace Json { 7 | 8 | /** \brief Configuration passed to reader and writer. 9 | * This configuration object can be used to force the Reader or Writer 10 | * to behave in a standard conforming way. 11 | */ 12 | class JSON_API Features 13 | { 14 | public: 15 | /** \brief A configuration that allows all features and assumes all strings are UTF-8. 16 | * - C & C++ comments are allowed 17 | * - Root object can be any JSON value 18 | * - Assumes Value strings are encoded in UTF-8 19 | */ 20 | static Features all(); 21 | 22 | /** \brief A configuration that is strictly compatible with the JSON specification. 23 | * - Comments are forbidden. 24 | * - Root object must be either an array or an object value. 25 | * - Assumes Value strings are encoded in UTF-8 26 | */ 27 | static Features strictMode(); 28 | 29 | /** \brief Initialize the configuration like JsonConfig::allFeatures; 30 | */ 31 | Features(); 32 | 33 | /// \c true if comments are allowed. Default: \c true. 34 | bool allowComments_; 35 | 36 | /// \c true if root must be either an array or an object value. Default: \c false. 37 | bool strictRoot_; 38 | }; 39 | 40 | } // namespace Json 41 | 42 | #endif // CPPTL_JSON_FEATURES_H_INCLUDED 43 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/public/json/forwards.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_FORWARDS_H_INCLUDED 2 | # define JSON_FORWARDS_H_INCLUDED 3 | 4 | # include "config.h" 5 | 6 | namespace Json { 7 | 8 | // writer.h 9 | class FastWriter; 10 | class StyledWriter; 11 | 12 | // reader.h 13 | class Reader; 14 | 15 | // features.h 16 | class Features; 17 | 18 | // value.h 19 | typedef int Int; 20 | typedef unsigned int UInt; 21 | class StaticString; 22 | class Path; 23 | class PathArgument; 24 | class Value; 25 | class ValueIteratorBase; 26 | class ValueIterator; 27 | class ValueConstIterator; 28 | #ifdef JSON_VALUE_USE_INTERNAL_MAP 29 | class ValueAllocator; 30 | class ValueMapAllocator; 31 | class ValueInternalLink; 32 | class ValueInternalArray; 33 | class ValueInternalMap; 34 | #endif // #ifdef JSON_VALUE_USE_INTERNAL_MAP 35 | 36 | } // namespace Json 37 | 38 | 39 | #endif // JSON_FORWARDS_H_INCLUDED 40 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/public/json/json.h: -------------------------------------------------------------------------------- 1 | #ifndef JSON_JSON_H_INCLUDED 2 | # define JSON_JSON_H_INCLUDED 3 | 4 | # include "autolink.h" 5 | # include "value.h" 6 | # include "reader.h" 7 | # include "writer.h" 8 | # include "features.h" 9 | 10 | #endif // JSON_JSON_H_INCLUDED 11 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/public/tokenizer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/public/tokenizer.cpp -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/public/tokenizer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/public/tokenizer.h -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/libToast.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/libToast.so -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/public/json_reader.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/public/json_reader.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/public/json_value.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/public/json_value.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/public/json_writer.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/public/json_writer.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/public/plugin.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/public/plugin.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/public/tokenizer.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/public/tokenizer.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/src/Logger.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/src/Logger.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/src/toast_js.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/src/toast_js.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/src/toast_ndk.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/simulator/src/toast_ndk.o -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/src/Logger.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 BlackBerry Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef LOGGER_HPP_ 18 | #define LOGGER_HPP_ 19 | 20 | #include 21 | #include 22 | 23 | class Toast_JS; 24 | 25 | namespace webworks { 26 | 27 | class Logger { 28 | public: 29 | explicit Logger(const char* name, Toast_JS *parent = NULL); 30 | virtual ~Logger(); 31 | int debug(const char* message); 32 | int info(const char* message); 33 | int notice(const char* message); 34 | int warn(const char* message); 35 | int error(const char* message); 36 | int critical(const char* message); 37 | int setVerbosity(_Uint8t verbosity); 38 | _Uint8t getVerbosity(); 39 | slog2_buffer_t hiPriorityBuffer(); 40 | slog2_buffer_t lowPriorityBuffer(); 41 | private: 42 | Toast_JS *m_pParent; 43 | slog2_buffer_set_config_t buffer_config; 44 | slog2_buffer_t buffer_handle[2]; 45 | int log(slog2_buffer_t buffer, _Uint8t severity, const char* message); 46 | }; 47 | 48 | } /* namespace webworks */ 49 | #endif /* LOGGER_HPP_ */ 50 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/src/toast_js.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 BlackBerry Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef toast_JS_HPP_ 18 | #define toast_JS_HPP_ 19 | 20 | #include 21 | #include "../public/plugin.h" 22 | #include "toast_ndk.hpp" 23 | #include "Logger.hpp" 24 | 25 | class Toast_JS: public JSExt { 26 | 27 | public: 28 | explicit Toast_JS(const std::string& id); 29 | virtual ~Toast_JS(); 30 | virtual bool CanDelete(); 31 | virtual std::string InvokeMethod(const std::string& command); 32 | void NotifyEvent(const std::string& event); 33 | webworks::Logger* getLog(); 34 | private: 35 | std::string m_id; 36 | // Definition of a pointer to the actual native extension code 37 | webworks::Toast_NDK *m_pToastController; 38 | webworks::Logger *m_pLogger; 39 | }; 40 | 41 | #endif /* toast_JS_HPP_ */ 42 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/src/toast_ndk.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 BlackBerry Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "toast_ndk.hpp" 19 | #include "toast_js.hpp" 20 | 21 | #include 22 | #include 23 | 24 | using namespace bb::system; 25 | 26 | namespace webworks 27 | { 28 | 29 | Toast_NDK::Toast_NDK(Toast_JS *parent) : 30 | m_pParent(parent) 31 | { 32 | } 33 | 34 | Toast_NDK::~Toast_NDK() 35 | { 36 | } 37 | 38 | void Toast_NDK::toast(const std::string& message, const std::string& duration, 39 | const std::string& position, const std::string callbackId) 40 | { 41 | 42 | SystemToast* m_toast; 43 | m_toast = new SystemToast(); 44 | 45 | m_toast->setBody(message.c_str()); 46 | 47 | if (position == "top") 48 | { 49 | m_toast->setPosition(SystemUiPosition::TopCenter); 50 | } else if (position == "bottom") 51 | { 52 | m_toast->setPosition(SystemUiPosition::BottomCenter); 53 | } else 54 | 55 | { 56 | m_toast->setPosition(SystemUiPosition::MiddleCenter); 57 | } 58 | 59 | m_toast->show(); 60 | 61 | m_pParent->NotifyEvent(callbackId); 62 | } 63 | 64 | } /* namespace webworks */ 65 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/blackberry10/native/src/toast_ndk.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 BlackBerry Limited 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef toast_NDK_HPP_ 18 | #define toast_NDK_HPP_ 19 | 20 | #include 21 | #include 22 | 23 | class Toast_JS; 24 | 25 | namespace webworks { 26 | 27 | class Toast_NDK { 28 | public: 29 | explicit Toast_NDK(Toast_JS *parent = NULL); 30 | virtual ~Toast_NDK(); 31 | 32 | void toast(const std::string& message, const std::string& duration, const std::string& position, const std::string callbackId); 33 | 34 | 35 | private: 36 | Toast_JS *m_pParent; 37 | }; 38 | 39 | } // namespace webworks 40 | 41 | #endif /* toast_NDK_HPP_ */ 42 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/ios/Toast+UIView.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface UIView (Toast) 5 | 6 | // each makeToast method creates a view and displays it as toast 7 | - (void)makeToast:(NSString *)message; 8 | - (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position; 9 | - (void)makeToast:(NSString *)message duration:(NSTimeInterval)duration position:(id)position addPixelsY:(int)addPixelsY data:(NSDictionary*)data styling:(NSDictionary*)styling commandDelegate:(id )commandDelegate callbackId:(NSString *)callbackId; 10 | - (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position image:(UIImage *)image; 11 | - (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position title:(NSString *)title; 12 | - (void)makeToast:(NSString *)message duration:(NSTimeInterval)interval position:(id)position title:(NSString *)title image:(UIImage *)image; 13 | 14 | - (void)hideToast; 15 | 16 | // displays toast with an activity spinner 17 | - (void)makeToastActivity; 18 | - (void)makeToastActivity:(id)position; 19 | - (void)hideToastActivity; 20 | 21 | // the showToast methods display any view as toast 22 | - (void)showToast:(UIView *)toast; 23 | - (void)showToast:(UIView *)toast duration:(NSTimeInterval)interval position:(id)point ; 24 | - (void)showToast:(UIView *)toast duration:(NSTimeInterval)interval position:(id)point addedPixelsY:(int)addPixelsY; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/ios/Toast.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface Toast : CDVPlugin 4 | 5 | - (void)show:(CDVInvokedUrlCommand*)command; 6 | - (void)hide:(CDVInvokedUrlCommand*)command; 7 | 8 | @end -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/ios/Toast.m: -------------------------------------------------------------------------------- 1 | #import "Toast.h" 2 | #import "Toast+UIView.h" 3 | #import 4 | 5 | @implementation Toast 6 | 7 | - (void)show:(CDVInvokedUrlCommand*)command { 8 | NSDictionary* options = [command argumentAtIndex:0]; 9 | NSString *message = options[@"message"]; 10 | NSString *duration = options[@"duration"]; 11 | NSString *position = options[@"position"]; 12 | NSDictionary *data = options[@"data"]; 13 | NSNumber *addPixelsY = options[@"addPixelsY"]; 14 | NSDictionary *styling = options[@"styling"]; 15 | 16 | if (![position isEqual: @"top"] && ![position isEqual: @"center"] && ![position isEqual: @"bottom"]) { 17 | CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"invalid position. valid options are 'top', 'center' and 'bottom'"]; 18 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 19 | return; 20 | } 21 | 22 | NSTimeInterval durationMS; 23 | if ([duration.lowercaseString isEqualToString: @"short"]) { 24 | durationMS = 2000; 25 | } else if ([duration.lowercaseString isEqualToString: @"long"]) { 26 | durationMS = 4000; 27 | } else { 28 | durationMS = [duration intValue]; 29 | } 30 | 31 | [self.webView makeToast:message 32 | duration:durationMS / 1000 33 | position:position 34 | addPixelsY:addPixelsY == nil ? 0 : [addPixelsY intValue] 35 | data:data 36 | styling:styling 37 | commandDelegate:self.commandDelegate 38 | callbackId:command.callbackId]; 39 | 40 | CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; 41 | pluginResult.keepCallback = [NSNumber numberWithBool:YES]; 42 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 43 | } 44 | 45 | - (void)hide:(CDVInvokedUrlCommand*)command { 46 | [self.webView hideToast]; 47 | 48 | CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; 49 | [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; 50 | } 51 | 52 | @end -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/src/windows/toastProxy.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Piotr Smolarski 3 | */ 4 | var toastProxy = { 5 | 6 | lastDisplayedNotification: null, 7 | 8 | show: function(successCallback, errorCallback, options) { 9 | var notifications = Windows.UI.Notifications; 10 | 11 | var template = notifications.ToastTemplateType.ToastText01; 12 | var toastXml = notifications.ToastNotificationManager.getTemplateContent(template); 13 | 14 | var toastTextElements = toastXml.getElementsByTagName("text"); 15 | toastTextElements[0].appendChild(toastXml.createTextNode(options[0].message)); 16 | 17 | var toastNode = toastXml.selectSingleNode("/toast"); 18 | toastNode.setAttribute("duration", options[0].duration); 19 | 20 | var toast = new notifications.ToastNotification(toastXml); 21 | 22 | toast.onactivated = function (event) { 23 | toastProxy.lastDisplayedNotification = null; 24 | successCallback({ 25 | event: "touch", 26 | message: options[0].message, 27 | data: options[0].data 28 | }); 29 | }; 30 | 31 | toast.ondismissed = function (event) { 32 | toastProxy.lastDisplayedNotification = null; 33 | successCallback({ 34 | event: "hide", 35 | message: options[0].message, 36 | data: options[0].data 37 | }); 38 | }; 39 | 40 | toast.onfailed = function(err) { 41 | toastProxy.lastDisplayedNotification = null; 42 | errorCallback(err); 43 | }; 44 | 45 | notifications.ToastNotificationManager.createToastNotifier().show(toast); 46 | }, 47 | 48 | hide: function() { 49 | if (this.lastDisplayedNotification !== null) { 50 | notifications.ToastNotificationManager.createToastNotifier().hide(toast); 51 | this.lastDisplayedNotification = null; 52 | } 53 | } 54 | }; 55 | 56 | cordova.commandProxy.add("Toast", toastProxy); 57 | -------------------------------------------------------------------------------- /app-js/plugins/cordova-plugin-x-toast/test/tests.js: -------------------------------------------------------------------------------- 1 | exports.defineAutoTests = function() { 2 | 3 | var fail = function (done) { 4 | expect(true).toBe(false); 5 | done(); 6 | }, 7 | succeed = function (done) { 8 | expect(true).toBe(true); 9 | done(); 10 | }; 11 | 12 | describe('Plugin availability', function () { 13 | it("window.plugins.toast should exist", function() { 14 | expect(window.plugins.toast).toBeDefined(); 15 | }); 16 | }); 17 | 18 | describe('API functions', function () { 19 | it("should define show", function() { 20 | expect(window.plugins.toast.show).toBeDefined(); 21 | }); 22 | 23 | it("should define showWithOptions", function() { 24 | expect(window.plugins.toast.showWithOptions).toBeDefined(); 25 | }); 26 | 27 | it("should define optionsBuilder", function() { 28 | expect(window.plugins.toast.optionsBuilder).toBeDefined(); 29 | }); 30 | 31 | it("should define showShortTop", function() { 32 | expect(window.plugins.toast.showShortTop).toBeDefined(); 33 | }); 34 | 35 | it("should define showShortCenter", function() { 36 | expect(window.plugins.toast.showShortCenter).toBeDefined(); 37 | }); 38 | 39 | it("should define showShortBottom", function() { 40 | expect(window.plugins.toast.showShortBottom).toBeDefined(); 41 | }); 42 | 43 | it("should define showLongTop", function() { 44 | expect(window.plugins.toast.showLongTop).toBeDefined(); 45 | }); 46 | 47 | it("should define showLongCenter", function() { 48 | expect(window.plugins.toast.showLongCenter).toBeDefined(); 49 | }); 50 | 51 | it("should define showLongBottom", function() { 52 | expect(window.plugins.toast.showLongBottom).toBeDefined(); 53 | }); 54 | }); 55 | 56 | describe('Invalid usage', function () { 57 | it("should fail due to an invalid position", function(done) { 58 | window.plugins.toast.show('hi', 'short', 'nowhere', fail.bind(null, done), succeed.bind(null, done)); 59 | }); 60 | }); 61 | }; 62 | -------------------------------------------------------------------------------- /app-js/plugins/de.appplant.cordova.plugin.local-notification/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "de.appplant.cordova.plugin.local-notification", 3 | "cordova_name": "Cordova LocalNotification Plugin", 4 | "version": "0.8.4", 5 | "description": "Schedules and queries for local notifications", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/katzer/cordova-plugin-local-notifications.git" 12 | }, 13 | "keywords": [ 14 | "appplant", 15 | "notification", 16 | "local notification", 17 | "cordova", 18 | "ecosystem:cordova", 19 | "cordova-android", 20 | "cordova-ios", 21 | "cordova-windows" 22 | ], 23 | "platforms": [ 24 | "ios", 25 | "android", 26 | "windows" 27 | ], 28 | "engines": [ 29 | { 30 | "name": "cordova", 31 | "version": ">=3.6.0" 32 | }, 33 | { 34 | "name": "cordova-plugman", 35 | "version": ">=4.3.0" 36 | }, 37 | { 38 | "name": "cordova-windows", 39 | "version": ">=4.2.0" 40 | } 41 | ], 42 | "dependencies": { 43 | "cordova-plugin-device": "*", 44 | "cordova-plugin-app-event": ">=1.1.0" 45 | }, 46 | "author": "Sebastián Katzer", 47 | "license": "Apache-2.0", 48 | "bugs": { 49 | "url": "https://github.com/katzer/cordova-plugin-local-notifications/issues" 50 | }, 51 | "homepage": "https://github.com/katzer/cordova-plugin-local-notifications#readme" 52 | } 53 | -------------------------------------------------------------------------------- /app-js/plugins/de.appplant.cordova.plugin.local-notification/src/android/ClearReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2015 by appPlant UG. All rights reserved. 3 | * 4 | * @APPPLANT_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apache License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://opensource.org/licenses/Apache-2.0/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPPLANT_LICENSE_HEADER_END@ 22 | */ 23 | 24 | package de.appplant.cordova.plugin.localnotification; 25 | 26 | import de.appplant.cordova.plugin.notification.Notification; 27 | 28 | 29 | /** 30 | * The clear intent receiver is triggered when the user clears a 31 | * notification manually. It un-persists the cleared notification from the 32 | * shared preferences. 33 | */ 34 | public class ClearReceiver extends de.appplant.cordova.plugin.notification.ClearReceiver { 35 | 36 | /** 37 | * Called when a local notification was cleared from outside of the app. 38 | * 39 | * @param notification 40 | * Wrapper around the local notification 41 | */ 42 | @Override 43 | public void onClear (Notification notification) { 44 | super.onClear(notification); 45 | LocalNotification.fireEvent("clear", notification); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app-js/plugins/de.appplant.cordova.plugin.local-notification/src/android/notification/ClearReceiver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2015 by appPlant UG. All rights reserved. 3 | * 4 | * @APPPLANT_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apache License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://opensource.org/licenses/Apache-2.0/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPPLANT_LICENSE_HEADER_END@ 22 | */ 23 | 24 | package de.appplant.cordova.plugin.notification; 25 | 26 | /** 27 | * The clear intent receiver is triggered when the user clears a 28 | * notification manually. It un-persists the cleared notification from the 29 | * shared preferences. 30 | */ 31 | public class ClearReceiver extends AbstractClearReceiver { 32 | 33 | /** 34 | * Called when a local notification was cleared from outside of the app. 35 | * 36 | * @param notification 37 | * Wrapper around the local notification 38 | */ 39 | @Override 40 | public void onClear (Notification notification) { 41 | notification.clear(); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /app-js/plugins/de.appplant.cordova.plugin.local-notification/src/android/notification/ClickActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2015 by appPlant UG. All rights reserved. 3 | * 4 | * @APPPLANT_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apache License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://opensource.org/licenses/Apache-2.0/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPPLANT_LICENSE_HEADER_END@ 22 | */ 23 | 24 | package de.appplant.cordova.plugin.notification; 25 | 26 | /** 27 | * The receiver activity is triggered when a notification is clicked by a user. 28 | * The activity calls the background callback and brings the launch intent 29 | * up to foreground. 30 | */ 31 | public class ClickActivity extends AbstractClickActivity { 32 | 33 | /** 34 | * Called when local notification was clicked by the user. Will 35 | * move the app to foreground. 36 | * 37 | * @param notification 38 | * Wrapper around the local notification 39 | */ 40 | @Override 41 | public void onClick(Notification notification) { 42 | launchApp(); 43 | 44 | if (notification.isRepeating()) { 45 | notification.clear(); 46 | } else { 47 | notification.cancel(); 48 | } 49 | } 50 | 51 | /** 52 | * Build notification specified by options. 53 | * 54 | * @param builder 55 | * Notification builder 56 | */ 57 | public Notification buildNotification (Builder builder) { 58 | return builder.build(); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /app-js/plugins/de.appplant.cordova.plugin.local-notification/src/ios/APPLocalNotificationOptions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2015 by appPlant UG. All rights reserved. 3 | * 4 | * @APPPLANT_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apache License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://opensource.org/licenses/Apache-2.0/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPPLANT_LICENSE_HEADER_END@ 22 | */ 23 | 24 | @interface APPLocalNotificationOptions : NSObject 25 | 26 | - (id) initWithDict:(NSDictionary*)dict; 27 | 28 | @property (readonly, getter=id) NSNumber* id; 29 | @property (readonly, getter=badgeNumber) NSInteger badgeNumber; 30 | @property (readonly, getter=alertBody) NSString* alertBody; 31 | @property (readonly, getter=soundName) NSString* soundName; 32 | @property (readonly, getter=fireDate) NSDate* fireDate; 33 | @property (readonly, getter=repeatInterval) NSCalendarUnit repeatInterval; 34 | @property (readonly, getter=userInfo) NSDictionary* userInfo; 35 | 36 | // If it's a repeating notification 37 | - (BOOL) isRepeating; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /app-js/plugins/de.appplant.cordova.plugin.local-notification/src/ios/UILocalNotification+APPLocalNotification.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2015 by appPlant UG. All rights reserved. 3 | * 4 | * @APPPLANT_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apache License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://opensource.org/licenses/Apache-2.0/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPPLANT_LICENSE_HEADER_END@ 22 | */ 23 | 24 | #import "APPLocalNotificationOptions.h" 25 | 26 | typedef NS_ENUM(NSUInteger, APPLocalNotificationType) { 27 | NotifcationTypeAll = 0, 28 | NotifcationTypeScheduled = 1, 29 | NotifcationTypeTriggered = 2 30 | }; 31 | 32 | @interface UILocalNotification (APPLocalNotification) 33 | 34 | // Initialize a new local notification 35 | - (id) initWithOptions:(NSDictionary*)dict; 36 | // The options provided by the plug-in 37 | - (APPLocalNotificationOptions*) options; 38 | // Timeinterval since last trigger date 39 | - (double) timeIntervalSinceLastTrigger; 40 | // Timeinterval since fire date 41 | - (double) timeIntervalSinceFireDate; 42 | // If the fire date was in the past 43 | - (BOOL) wasInThePast; 44 | // If the notification was already scheduled 45 | - (BOOL) isScheduled; 46 | // If the notification was already triggered 47 | - (BOOL) isTriggered; 48 | // If the notification was updated 49 | - (BOOL) wasUpdated; 50 | // If it's a repeating notification 51 | - (BOOL) isRepeating; 52 | // Notifciation type 53 | - (APPLocalNotificationType) type; 54 | // Encode the user info dict to JSON 55 | - (NSString*) encodeToJSON; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /app-js/plugins/fetch.json: -------------------------------------------------------------------------------- 1 | { 2 | "cordova-plugin-whitelist": { 3 | "source": { 4 | "type": "registry", 5 | "id": "cordova-plugin-whitelist@1" 6 | }, 7 | "is_top_level": true, 8 | "variables": {} 9 | }, 10 | "cordova-plugin-device": { 11 | "source": { 12 | "type": "registry", 13 | "id": "cordova-plugin-device" 14 | }, 15 | "is_top_level": true, 16 | "variables": {} 17 | }, 18 | "cordova-plugin-background-mode": { 19 | "source": { 20 | "type": "registry", 21 | "id": "cordova-plugin-background-mode" 22 | }, 23 | "is_top_level": true, 24 | "variables": {} 25 | }, 26 | "de.appplant.cordova.plugin.local-notification": { 27 | "source": { 28 | "type": "registry", 29 | "id": "de.appplant.cordova.plugin.local-notification" 30 | }, 31 | "is_top_level": true, 32 | "variables": {} 33 | }, 34 | "cordova-plugin-app-event": { 35 | "source": { 36 | "type": "registry", 37 | "id": "cordova-plugin-app-event" 38 | }, 39 | "is_top_level": false, 40 | "variables": {} 41 | }, 42 | "cordova-plugin-x-toast": { 43 | "source": { 44 | "type": "registry", 45 | "id": "cordova-plugin-x-toast" 46 | }, 47 | "is_top_level": true, 48 | "variables": {} 49 | }, 50 | "cordova-plugin-ble-central": { 51 | "source": { 52 | "type": "registry", 53 | "id": "cordova-plugin-ble-central" 54 | }, 55 | "is_top_level": true, 56 | "variables": {} 57 | }, 58 | "cordova-plugin-compat": { 59 | "source": { 60 | "type": "registry", 61 | "id": "cordova-plugin-compat" 62 | }, 63 | "is_top_level": false, 64 | "variables": {} 65 | }, 66 | "net.coconauts.notification-listener": { 67 | "source": { 68 | "type": "local", 69 | "path": "net.coconauts.notification-listener" 70 | }, 71 | "is_top_level": true, 72 | "variables": {} 73 | } 74 | } -------------------------------------------------------------------------------- /app-js/plugins/net.coconauts.notification-listener/CHANGES.txt: -------------------------------------------------------------------------------- 1 | = 0.0.1 = 2 | 3 | In progress 4 | -------------------------------------------------------------------------------- /app-js/plugins/net.coconauts.notification-listener/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2015 Javier Rengel (Coconauts) 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /app-js/plugins/net.coconauts.notification-listener/README.md: -------------------------------------------------------------------------------- 1 | ## In progress 2 | -------------------------------------------------------------------------------- /app-js/plugins/net.coconauts.notification-listener/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.0.1", 3 | "name": "net.coconauts.notification-listener", 4 | "cordova_name": "Notification-listener", 5 | "description": "Notification listener Plugin for Android", 6 | "license": "Apache 2.0", 7 | "repo": "https://github.com/coconauts/watchduino2", 8 | "issue": "https://github.com/coconauts/watchduino2/issues", 9 | "keywords": [ 10 | "notification", 11 | "listener", 12 | "android" 13 | ], 14 | "platforms": [ 15 | "android" 16 | ], 17 | "engines": [ 18 | { 19 | "name": "cordova", 20 | "version": ">=3.1.0" 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /app-js/plugins/net.coconauts.notification-listener/plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | Notification-listener 9 | Notification listener Plugin for Android 10 | Apache 2.0 11 | notification, listener, android 12 | 13 | https://github.com/coconauts/watchduino2 14 | https://github.com/coconauts/watchduino2/issues 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app-js/plugins/net.coconauts.notification-listener/www/notification-listener.js: -------------------------------------------------------------------------------- 1 | // (c) 2015 Javier Rengel (Coconauts) 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | "use strict"; 16 | 17 | module.exports = { 18 | 19 | // value must be an ArrayBuffer 20 | listen: function (success, failure) { 21 | console.log("Calling cordova listen method"); 22 | cordova.exec(success, failure, 'NotificationListener', 'listen', []); 23 | } 24 | }; 25 | -------------------------------------------------------------------------------- /app-js/release-key.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/release-key.keystore -------------------------------------------------------------------------------- /app-js/www/css/MaterialIcons.css: -------------------------------------------------------------------------------- 1 | /* fallback */ 2 | 3 | @font-face { 4 | font-family: 'Material Icons'; 5 | font-style: normal; 6 | font-weight: 400; 7 | src: local('Material Icons'), local('MaterialIcons-Regular'), url(../fonts/material-design-icons/Material-Design-Icons.woff2) format('woff2'); 8 | } 9 | 10 | .material-icons { 11 | font-family: 'Material Icons'; 12 | font-weight: normal; 13 | font-style: normal; 14 | font-size: 24px; 15 | line-height: 1; 16 | letter-spacing: normal; 17 | text-transform: none; 18 | display: inline-block; 19 | white-space: nowrap; 20 | word-wrap: normal; 21 | direction: ltr; 22 | -moz-font-feature-settings: 'liga'; 23 | -moz-osx-font-smoothing: grayscale; 24 | } -------------------------------------------------------------------------------- /app-js/www/css/chat.css: -------------------------------------------------------------------------------- 1 | #chat { 2 | text-align: left; 3 | width: 100%; 4 | overflow: auto; 5 | bottom: 0px; 6 | padding: 10px; 7 | } 8 | 9 | #chat div { 10 | width: 100%; 11 | text-align: center; 12 | position: relative; 13 | } 14 | 15 | #chat .time { 16 | font-size: small; 17 | color: gray; 18 | margin: -30px 10px 0px 10px; 19 | } 20 | 21 | #chat .info .time { 22 | margin: -5px; 23 | } 24 | 25 | #chat .text { 26 | border-radius: 2px; 27 | padding: 5px 10px; 28 | display: inline-block; 29 | margin: 5px; 30 | } 31 | 32 | #chat .send { 33 | text-align: left; 34 | } 35 | 36 | #chat .receive { 37 | text-align: right; 38 | } 39 | 40 | #chat .send .text { 41 | background-color: #e8f5e9; 42 | padding-left: 60px; 43 | } 44 | 45 | #chat .receive .text { 46 | background-color: #fff3e0; 47 | padding-right: 60px; 48 | } 49 | 50 | #chat .error { 51 | color: red; 52 | } 53 | 54 | #chat .info { 55 | color: blue; 56 | } 57 | 58 | #chat .debug { 59 | color: green; 60 | } -------------------------------------------------------------------------------- /app-js/www/css/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | display: flex; 3 | min-height: 100vh; 4 | flex-direction: column; 5 | } 6 | 7 | @media(min-width:993px) { 8 | nav, 9 | main, 10 | footer { 11 | padding-left: 300px; 12 | } 13 | } 14 | 15 | #content { 16 | display: flex; 17 | /*min-height: 100vh;*/ 18 | flex-direction: column; 19 | text-align: center; 20 | } 21 | 22 | .content { 23 | margin-top: 2em; 24 | } 25 | 26 | main { 27 | flex: 1 0 auto; 28 | } 29 | /*Hide Cordova loading tag */ 30 | 31 | .ui-loader { 32 | display: none; 33 | } 34 | 35 | a { 36 | color: #00AEEF; 37 | text-decoration: none; 38 | } 39 | 40 | #log { 41 | text-align: left; 42 | background-color: #ddd; 43 | height: 30%; 44 | bottom: 0px; 45 | position: absolute; 46 | width: 100%; 47 | padding: 10px; 48 | overflow: auto; 49 | } 50 | 51 | #log p { 52 | border-bottom: 1px solid #bbb; 53 | /*line-height: 10px;*/ 54 | } 55 | 56 | #log .error { 57 | color: red; 58 | } 59 | 60 | #log .info { 61 | color: blue; 62 | } 63 | 64 | #log .debug { 65 | color: green; 66 | } 67 | 68 | .btn { 69 | margin: 5px; 70 | } 71 | 72 | .small { 73 | font-size: small; 74 | } 75 | 76 | .logo { 77 | background-image: url("logo-transparent.png"); 78 | width: 32px; 79 | height: 32px; 80 | background-size: 32px 32px; 81 | margin: 5px; 82 | } 83 | 84 | .connected { 85 | background-color: #80cbc4; 86 | } 87 | 88 | .disconnected { 89 | background-color: #ef9a9a; 90 | } 91 | 92 | .connecting { 93 | background-color: #ffcc80; 94 | } 95 | 96 | #chart_div { 97 | width: 100%; 98 | height: 450px; 99 | background-color: gray 100 | } -------------------------------------------------------------------------------- /app-js/www/css/logo-transparent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/css/logo-transparent.png -------------------------------------------------------------------------------- /app-js/www/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /app-js/www/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /app-js/www/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /app-js/www/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /app-js/www/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /app-js/www/fonts/material-design-icons/Material-Design-Icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/material-design-icons/Material-Design-Icons.eot -------------------------------------------------------------------------------- /app-js/www/fonts/material-design-icons/Material-Design-Icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/material-design-icons/Material-Design-Icons.ttf -------------------------------------------------------------------------------- /app-js/www/fonts/material-design-icons/Material-Design-Icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/material-design-icons/Material-Design-Icons.woff -------------------------------------------------------------------------------- /app-js/www/fonts/material-design-icons/Material-Design-Icons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/material-design-icons/Material-Design-Icons.woff2 -------------------------------------------------------------------------------- /app-js/www/fonts/roboto/Roboto-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/roboto/Roboto-Bold.woff -------------------------------------------------------------------------------- /app-js/www/fonts/roboto/Roboto-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/roboto/Roboto-Bold.woff2 -------------------------------------------------------------------------------- /app-js/www/fonts/roboto/Roboto-Light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/roboto/Roboto-Light.woff -------------------------------------------------------------------------------- /app-js/www/fonts/roboto/Roboto-Light.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/roboto/Roboto-Light.woff2 -------------------------------------------------------------------------------- /app-js/www/fonts/roboto/Roboto-Medium.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/roboto/Roboto-Medium.woff -------------------------------------------------------------------------------- /app-js/www/fonts/roboto/Roboto-Medium.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/roboto/Roboto-Medium.woff2 -------------------------------------------------------------------------------- /app-js/www/fonts/roboto/Roboto-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/roboto/Roboto-Regular.woff -------------------------------------------------------------------------------- /app-js/www/fonts/roboto/Roboto-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/roboto/Roboto-Regular.woff2 -------------------------------------------------------------------------------- /app-js/www/fonts/roboto/Roboto-Thin.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/roboto/Roboto-Thin.woff -------------------------------------------------------------------------------- /app-js/www/fonts/roboto/Roboto-Thin.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/fonts/roboto/Roboto-Thin.woff2 -------------------------------------------------------------------------------- /app-js/www/img/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/img/background.jpg -------------------------------------------------------------------------------- /app-js/www/img/ic_keyboard_arrow_left_black_24px.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app-js/www/img/ic_keyboard_arrow_left_black_disabled_24px.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app-js/www/img/ic_keyboard_arrow_left_white_24px.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app-js/www/img/ic_keyboard_arrow_left_white_disabled_24px.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app-js/www/img/ic_keyboard_arrow_right_black_24px.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app-js/www/img/ic_keyboard_arrow_right_black_disabled_24px.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app-js/www/img/ic_keyboard_arrow_right_white_24px.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app-js/www/img/ic_keyboard_arrow_right_white_disabled_24px.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app-js/www/img/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jim-kirisame/LotWatch/c64a5ef91aee679749c411ef279072408558d11e/app-js/www/img/logo.png -------------------------------------------------------------------------------- /app-js/www/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Watchduino 2 8 | 9 | 10 | -------------------------------------------------------------------------------- /app-js/www/js/actions.js: -------------------------------------------------------------------------------- 1 | var sendTime = function() { 2 | var date = new Date(); 3 | var seconds = date.getTime() / 1000; 4 | //bt.send("!tm:" + parseInt(secondsUTC)); 5 | bt.sendRaw("\x55\x02" + intToBytes(seconds) + "\x00"); 6 | drawChat("send", "Time:" + seconds); 7 | }; 8 | 9 | var changeStatus = function(message, status) { 10 | 11 | if (settings.notification) notification.watchduinoStatus(status); 12 | cordova.plugins.backgroundMode.configure({ text: status }); 13 | drawChat("info", status); 14 | log("Chat", message + " " + status) 15 | 16 | $("#status-bar").removeClass().addClass("row " + status); 17 | $("#bt-status").html(message); 18 | }; 19 | 20 | var notificationStatus = function(enabled) { 21 | 22 | $("#send-notif-enable").prop('disabled', enabled); 23 | $("#send-notif-trigger").prop('disabled', !enabled); 24 | $("#send-notif-cancel").prop('disabled', !enabled); 25 | }; -------------------------------------------------------------------------------- /app-js/www/js/battery.js: -------------------------------------------------------------------------------- 1 | var battery = new Battery(); 2 | 3 | //Initialize google charts 4 | //https://developers.google.com/chart/interactive/docs/gallery/annotationchart 5 | 6 | // Load the Visualization API and the piechart package. 7 | //google.load('visualization', '1.0', {'packages':['corechart']}); 8 | //google.load('visualization', '1', {'packages':['annotationchart']}); 9 | 10 | google.load('visualization', '1', {'packages':['annotationchart']}); 11 | //google.setOnLoadCallback(battery.draw); 12 | //google.setOnLoadCallback(drawChart); 13 | 14 | $(document).ready(function() { 15 | $('#battery-button').click(function(){ 16 | setTimeout(battery.draw, 100); 17 | }); 18 | 19 | setInterval(battery.draw, 1000); 20 | }); 21 | 22 | 23 | function Battery(){ 24 | 25 | var records = []; 26 | /* 27 | var batteryValue = 4000; 28 | setInterval(function(){ 29 | battery.add(batteryValue-= 100); 30 | }, 1000); 31 | */ 32 | this.add = function(value){ 33 | var now = new Date(); 34 | records.push({date: now, value: parseInt(value) }); 35 | 36 | //this.draw(); 37 | }; 38 | 39 | this.clear = function(){ 40 | records = []; 41 | }; 42 | 43 | this.draw = function(){ 44 | 45 | if (records.length == 0) return; 46 | //log(TAG, "Drawing battery over "+records.length +" points"); 47 | 48 | var data = new google.visualization.DataTable(); 49 | data.addColumn('date', 'Date'); 50 | data.addColumn('number', 'value'); 51 | 52 | var rows = []; 53 | for(var i=0; i< records.length; i++){ 54 | var r = records[i]; 55 | rows.push([r.date, r.value]); 56 | } 57 | data.addRows(rows); 58 | 59 | var chart = new google.visualization.AnnotationChart(document.getElementById('chart_div')); 60 | chart.draw(data, {displayAnnotations: true, dateFormat: "HH:mm:ss", max: 4000, min:3000}); 61 | }; 62 | } 63 | -------------------------------------------------------------------------------- /app-js/www/js/bluetooth/receive.js: -------------------------------------------------------------------------------- 1 | var TAG = "Receive"; 2 | 3 | var onReceive = function(msg) { 4 | //drawChat("receive", msg); 5 | 6 | if (msg.contains("\x55")) { 7 | var command = msg.substring(1, 2); 8 | var value = msg.substring(2); 9 | processCommand(command, value); 10 | } else { 11 | log(TAG, "Unrecognized message: " + msg, "error"); 12 | } 13 | } 14 | 15 | var processCommand = function(command, value) { 16 | log(TAG, "Command " + command + " value " + value); 17 | switch (command) { 18 | case "\x01": 19 | console.log("Received pong"); 20 | drawChat("receive", "Pong"); 21 | break; 22 | case "\x02": 23 | sendTime(); 24 | drawChat("receive", "Time"); 25 | break; 26 | case "nt": 27 | notification.cancelLast(); 28 | break; 29 | case "\x00": 30 | log(TAG, "Battery notification " + value); 31 | battery.add(value.substring(0, 4)); 32 | drawChat("receive", "Batt:" + value.substring(0, 4)); 33 | break; 34 | case "sl": 35 | log(TAG, "Disconnecting on sleep"); 36 | bt.disconnect(); 37 | default: 38 | drawChat("receive", stringToHexString(command) + ":" + stringToHexString(value)); 39 | log(TAG, "Unrecognized command: " + command, "error"); 40 | } 41 | } -------------------------------------------------------------------------------- /app-js/www/js/controls.js: -------------------------------------------------------------------------------- 1 | var TAG = "controls"; 2 | 3 | $("#custom-message-button").click(function() { 4 | var customMessage = $("#custom-message").val(); 5 | log("Controls", "Sending custom message: " + customMessage); 6 | bt.send(customMessage); 7 | }); 8 | 9 | $("#send-time").click(function() { 10 | sendTime(); 11 | }); 12 | $("#send-ping").click(function() { 13 | drawChat("send", "Ping"); 14 | bt.sendRaw("\x55\x01"); 15 | }); 16 | $("#bt-connect").click(function() { 17 | 18 | bt.connect(); 19 | }); 20 | $("#bt-disconnect").click(function() { 21 | 22 | bt.disconnect(); 23 | }); 24 | $("#bt-scan").click(function() { 25 | 26 | bt.scan(); 27 | }); 28 | 29 | $("#clear-chat").click(function() { 30 | $("#chat").empty(); 31 | }); 32 | 33 | $("#send-notification").click(function() { 34 | var customMessage = $("#custom-message").val(); 35 | log("Controls", "Sending notification: " + customMessage); 36 | bt.send("!nt:" + customMessage); 37 | }); 38 | 39 | $("#send-notif-enable").click(function() { 40 | notification.enable(); 41 | }); 42 | 43 | $("#send-notif-trigger").click(function() { 44 | var customMessage = $("#custom-message").val(); 45 | notification.notificate(customMessage); 46 | }); 47 | 48 | $("#send-notif-cancel").click(function() { 49 | notification.cancelAll(); 50 | }); 51 | 52 | $("#reconnect:checkbox").change(function() { 53 | 54 | var check = $(this).is(':checked'); 55 | //Either "checked" or undefined ? 56 | bt.setAutoreconnect(check); 57 | }); 58 | 59 | $("#clear-battery").change(function() { 60 | battery.clear(); 61 | }); 62 | 63 | $("#ongoing-notification:checkbox").change(function() { 64 | 65 | var check = $(this).is(':checked'); 66 | settings.notification = check; 67 | 68 | if (!check) notification.cancelStatus(); 69 | }); -------------------------------------------------------------------------------- /app-js/www/js/cordova/dialog.js: -------------------------------------------------------------------------------- 1 | var showToast = function (text) { 2 | setTimeout(function () { 3 | if (device.platform != 'windows') { 4 | window.plugins.toast.showShortBottom(text); 5 | } else { 6 | showDialog(text); 7 | } 8 | }, 100); 9 | }; 10 | var showDialog = function (text) { 11 | if (dialog) { 12 | dialog.content = text; 13 | return; 14 | } 15 | dialog = new Windows.UI.Popups.MessageDialog(text); 16 | dialog.showAsync().done(function () { 17 | dialog = null; 18 | }); 19 | }; 20 | -------------------------------------------------------------------------------- /app-js/www/js/cordova/notification.js: -------------------------------------------------------------------------------- 1 | //Plugin: https://github.com/katzer/cordova-plugin-local-notifications 2 | 3 | //Index sample: https://github.com/katzer/cordova-plugin-local-notifications/blob/example/www/index.html 4 | 5 | var notification = new Notification(); 6 | 7 | function Notification(){ 8 | var notificationId = 0; 9 | 10 | var logo = 'res://icon'; 11 | 12 | this.isEnabled = function(callback){ 13 | cordova.plugins.notification.local.hasPermission(callback); 14 | } 15 | this.enable = function(){ 16 | cordova.plugins.notification.local.registerPermission(function (granted) { 17 | showToast(granted ? 'Yes' : 'No'); 18 | notificationStatus(granted); //Update status of notification debug buttons 19 | }); 20 | } 21 | 22 | this.notificate = function(msg) { 23 | notificationId++; 24 | cordova.plugins.notification.local.schedule({ 25 | id: notificationId, 26 | text: msg, 27 | icon: logo, 28 | smallIcon: logo, 29 | sound: null, 30 | data: { test: notificationId } 31 | }); 32 | //TODO add click action (as a new argument) 33 | } 34 | 35 | this.watchduinoStatus = function(msg) { 36 | cordova.plugins.notification.local.schedule({ 37 | id: 0, 38 | text: msg, 39 | icon: logo, 40 | smallIcon: logo, 41 | sound: null, 42 | ongoing: true, 43 | data: { } 44 | }); 45 | } 46 | 47 | this.cancelStatus = function(){ 48 | cordova.plugins.notification.local.cancel(0, function(){}); 49 | }; 50 | this.cancel = function(id) { 51 | cordova.plugins.notification.local.cancel(id, function(){}); 52 | }; 53 | this.cancelLast = function() { 54 | cordova.plugins.notification.local.cancel(notificationId, function(){}); 55 | }; 56 | 57 | this.cancelAll = function(){ 58 | cordova.plugins.notification.local.cancelAll(function(){}); 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /app-js/www/js/cordova/start.js: -------------------------------------------------------------------------------- 1 | //Public avaialable cordova functions (loaded on initialization) 2 | var bt; 3 | var push; 4 | 5 | var app = { 6 | // Application Constructor 7 | initialize: function() { 8 | console.log("Initializing app"); 9 | this.bindEvents(); 10 | }, 11 | bindEvents: function() { 12 | console.log("Binding events"); 13 | 14 | document.addEventListener('deviceready', this.onDeviceReady, false); 15 | }, 16 | onDeviceReady: function() { 17 | log("Cordova start", "Device ready"); 18 | 19 | //Bluetooth 20 | bt = new Bluetooth(ble); 21 | console.log("Bluetooth plugin " + JSON.stringify(bt)); 22 | 23 | //Notification status 24 | notification.isEnabled(function(granted) { 25 | notificationStatus(granted); 26 | }); 27 | 28 | //Start nofication listener 29 | console.log("Notification listener " + notificationListener); 30 | setNotificationListenerCallback(); 31 | 32 | cordova.plugins.backgroundMode.setDefaults({ title: 'LotWatch', text: '已连接' }); 33 | cordova.plugins.backgroundMode.overrideBackButton(); 34 | cordova.plugins.backgroundMode.enable(); 35 | 36 | } 37 | }; 38 | 39 | app.initialize(); 40 | 41 | var setNotificationListenerCallback = function() { 42 | notificationListener.listen(function(n) { 43 | console.log("Received notification " + JSON.stringify(n)); 44 | 45 | var message = n.title + '\n'; 46 | if (n.textLines) message += n.textLines; 47 | else message += n.text; 48 | 49 | bt.send("!nt:" + message); 50 | 51 | }, function(e) { 52 | setTimeout(setNotificationListenerCallback, 1000); 53 | console.log("Notification Error " + e); 54 | }) 55 | } -------------------------------------------------------------------------------- /app-js/www/js/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. 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, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | var app = { 20 | // Application Constructor 21 | initialize: function() { 22 | document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); 23 | }, 24 | 25 | // deviceready Event Handler 26 | // 27 | // Bind any cordova events here. Common events are: 28 | // 'pause', 'resume', etc. 29 | onDeviceReady: function() { 30 | this.receivedEvent('deviceready'); 31 | }, 32 | 33 | // Update DOM on a Received Event 34 | receivedEvent: function(id) { 35 | var parentElement = document.getElementById(id); 36 | var listeningElement = parentElement.querySelector('.listening'); 37 | var receivedElement = parentElement.querySelector('.received'); 38 | 39 | listeningElement.setAttribute('style', 'display:none;'); 40 | receivedElement.setAttribute('style', 'display:block;'); 41 | 42 | console.log('Received Event: ' + id); 43 | } 44 | }; 45 | 46 | app.initialize(); -------------------------------------------------------------------------------- /app-js/www/js/settings.js: -------------------------------------------------------------------------------- 1 | //Requires oauth-phonegap 2 | //https://github.com/oauth-io/oauth-phonegap 3 | 4 | //Twitter API Documentation 5 | //https://dev.twitter.com/rest/reference/get/statuses/home_timeline 6 | 7 | var settings = new Settings(); 8 | 9 | function Settings() { 10 | 11 | var TAG = "settings" 12 | this.notification = true; 13 | 14 | this.save = function(){ 15 | //TODO 16 | }; 17 | this.load = function(){ 18 | //TODO 19 | }; 20 | } 21 | -------------------------------------------------------------------------------- /app-js/www/js/utils.js: -------------------------------------------------------------------------------- 1 | if (!String.prototype.contains) { 2 | String.prototype.contains = function() { 3 | 'use strict'; 4 | return String.prototype.indexOf.apply(this, arguments) !== -1; 5 | }; 6 | } 7 | 8 | var log = function(tag, txt, level) { 9 | if (!level) level = "info"; 10 | 11 | var date = formatDate(new Date()); 12 | var entryText = "[" + date + "] (" + tag + ") " + level.toUpperCase() + ": " + txt; 13 | var entry = "

" + entryText + "

"; 14 | 15 | if (level == "error") console.error(entryText); 16 | else console.info(entryText); 17 | 18 | //$("#log").prepend(entry); 19 | 20 | } 21 | 22 | var isCordova = function() { 23 | console.log("URL ", document.URL); 24 | //var app = document.URL.indexOf( 'http://' ) === -1 && document.URL.indexOf( 'https://' ) === -1 && document.URL.indexOf( 'file://' ) === -1; 25 | return document.URL.indexOf('android_asset') !== -1; 26 | } 27 | 28 | var formatDate = function(d) { 29 | var date = d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate(); // Returns the year 30 | var time = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds(); 31 | return date + " " + time; 32 | } 33 | 34 | // ASCII only 35 | function stringToBytes(string) { 36 | var array = new Uint8Array(string.length); 37 | for (var i = 0, l = string.length; i < l; i++) { 38 | array[i] = string.charCodeAt(i); 39 | } 40 | return array.buffer; 41 | } 42 | 43 | // ASCII only 44 | function bytesToString(buffer) { 45 | return String.fromCharCode.apply(null, new Uint8Array(buffer)); 46 | } 47 | 48 | function intToBytes(num) { 49 | num = parseInt(num); 50 | var result = ""; 51 | while (num != 0) { 52 | result = String.fromCharCode(num % 256) + result; 53 | num = parseInt(num / 256); 54 | } 55 | return result; 56 | } 57 | 58 | function stringToHexString(string) { 59 | var str = ""; 60 | for (var i = 0, l = string.length; i < l; i++) { 61 | var str2 = (string.charCodeAt(i)).toString(16); 62 | if (str2.length == 1) 63 | str += "0" + str2; 64 | else 65 | str += str2; 66 | } 67 | return str; 68 | } -------------------------------------------------------------------------------- /app-js/www/js/ux/chat.js: -------------------------------------------------------------------------------- 1 | var fillWithZero = function(i) { 2 | if (i < 10) return "0" + i; 3 | else return i; 4 | } 5 | var drawChat = function(type, text) { 6 | var MAX_LOG_SIZE = 20; 7 | 8 | var date = new Date(); 9 | var time = date.getHours() + ":" + fillWithZero(date.getMinutes()) + ":" + fillWithZero(date.getSeconds()); 10 | var template = $('#chat-template').html(); 11 | Mustache.parse(template); 12 | var rendered = Mustache.render(template, { time: time, text: text, type: type }); 13 | 14 | var $chat = $("#chat"); 15 | var top = $chat.scrollTop; 16 | var maxHeight = $chat.scrollHeight; 17 | var height = $chat.outerHeight(); 18 | 19 | var isAtBottom = top + height >= maxHeight; 20 | 21 | $chat.append(rendered); 22 | var $chatLog = $chat.find('div'); 23 | 24 | if ($chatLog.length > MAX_LOG_SIZE) { 25 | var $sliceChat = $chatLog.slice($chatLog.length - MAX_LOG_SIZE); 26 | $chat.html($sliceChat); 27 | } 28 | 29 | //Scroll to bottom of chat 30 | if (isAtBottom) $chat.scrollTop(maxHeight); 31 | } 32 | 33 | var isDivAtBottom = function(id) { 34 | 35 | var $div = $(id); 36 | var top = $div[0].scrollTop; 37 | var maxHeight = $div[0].scrollHeight; 38 | var height = $div.outerHeight(); 39 | 40 | return top + height >= maxHeight; 41 | } 42 | var scrollToBottom = function(id) { 43 | var $div = $(id); 44 | var maxHeight = $div[0].scrollHeight; 45 | $div.scrollTop(maxHeight); 46 | } 47 | 48 | var lastMessageType = ""; 49 | if (!isCordova()) { 50 | 51 | setInterval(function() { 52 | if (lastMessageType === "") lastMessageType = "info"; 53 | else if (lastMessageType === "receive") lastMessageType = "send"; 54 | else lastMessageType = "receive"; 55 | 56 | drawChat(lastMessageType, "Sample text"); 57 | }, 2000); 58 | 59 | drawChat("info", "Sample text"); 60 | 61 | } --------------------------------------------------------------------------------