├── .gitignore ├── LICENSE ├── README.md ├── cubeMX └── windowSensor.ioc ├── images ├── pcb │ ├── pcb_buttom.jpg │ └── pcb_top.jpg ├── screenschots │ ├── floor_1_alarm.png │ ├── floor_1_ok.png │ ├── floor_2_alarm.png │ ├── floor_2_ok.png │ └── server.png ├── sensors │ ├── sensor01.jpg │ ├── sensor02.jpg │ ├── sensor03.jpg │ ├── sensor04.jpg │ ├── sensor05.jpg │ ├── sensor06.jpg │ ├── sensor07.jpg │ └── sensor08.jpg └── server │ ├── server01.jpg │ ├── server02.jpg │ ├── server03.jpg │ └── server04.jpg ├── libs ├── rxtx-2.2pre2-source.zip └── rxtx-2.2pre2 │ ├── README │ ├── RXTXcomm.jar │ ├── i686-pc-linux-gnu │ ├── librxtxParallel.so │ └── librxtxSerial.so │ ├── win32 │ └── rxtxSerial.dll │ ├── win64 │ └── rxtxSerial.dll │ └── x86_64-unknown-linux-gnu │ └── librxtxSerial.so ├── pcb ├── DESCRIPTION ├── DRILEGEND.CFG ├── MyComponents.lbr ├── eagle.dru ├── eagle.epf ├── ftdichip.lbr ├── sensorGateway.brd ├── sensorGateway.sch ├── stm32.lbr ├── windowSensor.brd └── windowSensor.sch ├── src ├── CMSIS │ ├── core │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm0plus.h │ │ ├── core_cm3.h │ │ ├── core_cm4.h │ │ ├── core_cm7.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── core_sc000.h │ │ └── core_sc300.h │ └── device │ │ ├── stm32l011xx.h │ │ ├── stm32l021xx.h │ │ ├── stm32l031xx.h │ │ ├── stm32l041xx.h │ │ ├── stm32l051xx.h │ │ ├── stm32l052xx.h │ │ ├── stm32l053xx.h │ │ ├── stm32l061xx.h │ │ ├── stm32l062xx.h │ │ ├── stm32l063xx.h │ │ ├── stm32l071xx.h │ │ ├── stm32l072xx.h │ │ ├── stm32l073xx.h │ │ ├── stm32l081xx.h │ │ ├── stm32l082xx.h │ │ ├── stm32l083xx.h │ │ ├── stm32l0xx.h │ │ └── system_stm32l0xx.h ├── HAL_Driver │ ├── Inc │ │ ├── Legacy │ │ │ └── stm32_hal_legacy.h │ │ ├── stm32_assert_template.h │ │ ├── stm32l0xx_hal.h │ │ ├── stm32l0xx_hal_adc.h │ │ ├── stm32l0xx_hal_adc_ex.h │ │ ├── stm32l0xx_hal_comp.h │ │ ├── stm32l0xx_hal_comp_ex.h │ │ ├── stm32l0xx_hal_cortex.h │ │ ├── stm32l0xx_hal_crc.h │ │ ├── stm32l0xx_hal_crc_ex.h │ │ ├── stm32l0xx_hal_cryp.h │ │ ├── stm32l0xx_hal_cryp_ex.h │ │ ├── stm32l0xx_hal_dac.h │ │ ├── stm32l0xx_hal_dac_ex.h │ │ ├── stm32l0xx_hal_def.h │ │ ├── stm32l0xx_hal_dma.h │ │ ├── stm32l0xx_hal_firewall.h │ │ ├── stm32l0xx_hal_flash.h │ │ ├── stm32l0xx_hal_flash_ex.h │ │ ├── stm32l0xx_hal_flash_ramfunc.h │ │ ├── stm32l0xx_hal_gpio.h │ │ ├── stm32l0xx_hal_gpio_ex.h │ │ ├── stm32l0xx_hal_i2c.h │ │ ├── stm32l0xx_hal_i2c_ex.h │ │ ├── stm32l0xx_hal_i2s.h │ │ ├── stm32l0xx_hal_irda.h │ │ ├── stm32l0xx_hal_irda_ex.h │ │ ├── stm32l0xx_hal_iwdg.h │ │ ├── stm32l0xx_hal_lcd.h │ │ ├── stm32l0xx_hal_lptim.h │ │ ├── stm32l0xx_hal_lptim_ex.h │ │ ├── stm32l0xx_hal_pcd.h │ │ ├── stm32l0xx_hal_pcd_ex.h │ │ ├── stm32l0xx_hal_pwr.h │ │ ├── stm32l0xx_hal_pwr_ex.h │ │ ├── stm32l0xx_hal_rcc.h │ │ ├── stm32l0xx_hal_rcc_ex.h │ │ ├── stm32l0xx_hal_rng.h │ │ ├── stm32l0xx_hal_rtc.h │ │ ├── stm32l0xx_hal_rtc_ex.h │ │ ├── stm32l0xx_hal_smartcard.h │ │ ├── stm32l0xx_hal_smartcard_ex.h │ │ ├── stm32l0xx_hal_smbus.h │ │ ├── stm32l0xx_hal_spi.h │ │ ├── stm32l0xx_hal_tim.h │ │ ├── stm32l0xx_hal_tim_ex.h │ │ ├── stm32l0xx_hal_tsc.h │ │ ├── stm32l0xx_hal_uart.h │ │ ├── stm32l0xx_hal_uart_ex.h │ │ ├── stm32l0xx_hal_usart.h │ │ ├── stm32l0xx_hal_usart_ex.h │ │ └── stm32l0xx_hal_wwdg.h │ ├── Release_Notes.html │ └── Src │ │ ├── stm32l0xx_hal.c │ │ ├── stm32l0xx_hal_adc.c │ │ ├── stm32l0xx_hal_adc_ex.c │ │ ├── stm32l0xx_hal_comp.c │ │ ├── stm32l0xx_hal_comp_ex.c │ │ ├── stm32l0xx_hal_cortex.c │ │ ├── stm32l0xx_hal_crc.c │ │ ├── stm32l0xx_hal_crc_ex.c │ │ ├── stm32l0xx_hal_cryp.c │ │ ├── stm32l0xx_hal_cryp_ex.c │ │ ├── stm32l0xx_hal_dac.c │ │ ├── stm32l0xx_hal_dac_ex.c │ │ ├── stm32l0xx_hal_dma.c │ │ ├── stm32l0xx_hal_firewall.c │ │ ├── stm32l0xx_hal_flash.c │ │ ├── stm32l0xx_hal_flash_ex.c │ │ ├── stm32l0xx_hal_flash_ramfunc.c │ │ ├── stm32l0xx_hal_gpio.c │ │ ├── stm32l0xx_hal_i2c.c │ │ ├── stm32l0xx_hal_i2c_ex.c │ │ ├── stm32l0xx_hal_i2s.c │ │ ├── stm32l0xx_hal_irda.c │ │ ├── stm32l0xx_hal_iwdg.c │ │ ├── stm32l0xx_hal_lcd.c │ │ ├── stm32l0xx_hal_lptim.c │ │ ├── stm32l0xx_hal_msp_template.c │ │ ├── stm32l0xx_hal_pcd.c │ │ ├── stm32l0xx_hal_pcd_ex.c │ │ ├── stm32l0xx_hal_pwr.c │ │ ├── stm32l0xx_hal_pwr_ex.c │ │ ├── stm32l0xx_hal_rcc.c │ │ ├── stm32l0xx_hal_rcc_ex.c │ │ ├── stm32l0xx_hal_rng.c │ │ ├── stm32l0xx_hal_rtc.c │ │ ├── stm32l0xx_hal_rtc_ex.c │ │ ├── stm32l0xx_hal_smartcard.c │ │ ├── stm32l0xx_hal_smartcard_ex.c │ │ ├── stm32l0xx_hal_smbus.c │ │ ├── stm32l0xx_hal_spi.c │ │ ├── stm32l0xx_hal_tim.c │ │ ├── stm32l0xx_hal_tim_ex.c │ │ ├── stm32l0xx_hal_tsc.c │ │ ├── stm32l0xx_hal_uart.c │ │ ├── stm32l0xx_hal_uart_ex.c │ │ ├── stm32l0xx_hal_usart.c │ │ └── stm32l0xx_hal_wwdg.c ├── LinkerScript.ld ├── MyL051K6.cfg ├── MyL051K6.xml ├── MyL051K8.cfg ├── MyL051K8.xml ├── src │ ├── BasicIO.cpp │ ├── BasicIO.h │ ├── EepRomInteger.cpp │ ├── EepRomInteger.h │ ├── RFM69.cpp │ ├── RFM69.h │ ├── RFM69registers.h │ ├── SensorBase.h │ ├── SensorGateway.h │ ├── WindowSensor.h │ ├── main.cpp │ ├── stm32l0xx_hal_conf.h │ ├── stm32l0xx_it.c │ ├── stm32l0xx_it.h │ ├── syscalls.c │ └── system_stm32l0xx.c └── startup │ └── startup_stm32l051xx.s └── zNetMonitor ├── README.md ├── app ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ ├── convert.sh │ ├── convert_file.sh │ ├── floor_1_background.svg │ ├── floor_1_bathroom_1_alarm.svg │ ├── floor_1_bathroom_1_warning.svg │ ├── floor_1_hall_1_alarm.svg │ ├── floor_1_hall_1_warning.svg │ ├── floor_1_launge_1_alarm.svg │ ├── floor_1_launge_1_warning.svg │ ├── floor_1_launge_2_alarm.svg │ ├── floor_1_launge_2_warning.svg │ ├── floor_1_launge_3_alarm.svg │ ├── floor_1_launge_3_warning.svg │ ├── floor_1_launge_4_alarm.svg │ ├── floor_1_launge_4_warning.svg │ ├── floor_1_launge_5_alarm.svg │ ├── floor_1_launge_5_warning.svg │ ├── floor_1_storeroom_1_alarm.svg │ ├── floor_1_storeroom_1_warning.svg │ ├── floor_1_study_1_alarm.svg │ ├── floor_1_study_1_warning.svg │ ├── floor_1_study_2_alarm.svg │ ├── floor_1_study_2_warning.svg │ ├── floor_2_background.svg │ ├── floor_2_bathroom_1_alarm.svg │ ├── floor_2_bathroom_1_warning.svg │ ├── floor_2_bedroom_1_alarm.svg │ ├── floor_2_bedroom_1_warning.svg │ ├── floor_2_bedroom_2_alarm.svg │ ├── floor_2_bedroom_2_warning.svg │ ├── floor_2_child1_1_alarm.svg │ ├── floor_2_child1_1_warning.svg │ ├── floor_2_child1_2_alarm.svg │ ├── floor_2_child1_2_warning.svg │ ├── floor_2_child2_1_alarm.svg │ ├── floor_2_child2_1_warning.svg │ ├── floor_2_child2_2_alarm.svg │ └── floor_2_child2_2_warning.svg │ ├── java │ └── com │ │ ├── caverock │ │ └── androidsvg │ │ │ ├── CSSParseException.java │ │ │ ├── CSSParser.java │ │ │ ├── CanvasLegacy.java │ │ │ ├── IntegerParser.java │ │ │ ├── LibConfig.java │ │ │ ├── NumberParser.java │ │ │ ├── PreserveAspectRatio.java │ │ │ ├── RenderOptions.java │ │ │ ├── SVG.java │ │ │ ├── SVGAndroidRenderer.java │ │ │ ├── SVGExternalFileResolver.java │ │ │ ├── SVGImageView.java │ │ │ ├── SVGParseException.java │ │ │ ├── SVGParser.java │ │ │ └── SimpleAssetResolver.java │ │ └── mkulesh │ │ └── znet │ │ ├── BaseFragment.java │ │ ├── CommunicationTask.java │ │ ├── CustomImageView.java │ │ ├── FloorFragment.java │ │ ├── Logging.java │ │ ├── MainActivity.java │ │ ├── MainPagerAdapter.java │ │ ├── ServerFragment.java │ │ └── StateManager.java │ └── res │ ├── drawable-hdpi │ ├── ball_green.png │ ├── ball_red.png │ ├── ball_yellow.png │ ├── divider_horizontal_light.png │ ├── fan.png │ ├── harddisk.png │ ├── ic_launcher.png │ └── temperature.png │ ├── drawable-ldpi │ └── divider_horizontal_light.png │ ├── drawable-mdpi │ ├── ball_green.png │ ├── ball_red.png │ ├── ball_yellow.png │ ├── divider_horizontal_light.png │ ├── fan.png │ ├── harddisk.png │ ├── ic_launcher.png │ └── temperature.png │ ├── drawable-xhdpi │ ├── ball_green.png │ ├── ball_red.png │ ├── ball_yellow.png │ ├── divider_horizontal_light.png │ ├── fan.png │ ├── harddisk.png │ ├── ic_launcher.png │ └── temperature.png │ ├── drawable-xxhdpi │ ├── ball_green.png │ ├── ball_red.png │ ├── ball_yellow.png │ ├── fan.png │ ├── harddisk.png │ ├── ic_launcher.png │ └── temperature.png │ ├── drawable-xxxhdpi │ ├── ball_green.png │ ├── ball_red.png │ ├── ball_yellow.png │ ├── fan.png │ ├── harddisk.png │ └── temperature.png │ ├── layout │ ├── activity_main.xml │ ├── floor_fragment.xml │ ├── info_bar.xml │ └── server_fragment.xml │ ├── menu │ └── main.xml │ ├── raw │ ├── ball_green.svg │ ├── ball_red.svg │ ├── ball_yellow.svg │ ├── convert.sh │ ├── convert_file.sh │ ├── convert_single.sh │ ├── fan.svg │ ├── harddisk.svg │ └── temperature.svg │ ├── values-v14 │ └── styles.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── attrs.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── common ├── build.gradle ├── common.iml └── src │ └── main │ └── java │ └── com │ └── mkulesh │ └── znet │ └── common │ ├── AdvancedEncryptionStandard.java │ ├── CustomLogger.java │ ├── DeviceConfig.java │ ├── DeviceState.java │ ├── Message.java │ └── Utils.java ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── release ├── librxtxSerial.so ├── startup.sh └── znet.cfg ├── server ├── build.gradle ├── libs │ └── RXTXcomm.jar ├── server.iml └── src │ └── main │ └── java │ └── com │ └── mkulesh │ └── znet │ ├── Application.java │ ├── Config.java │ ├── StateManager.java │ ├── network │ ├── ClientAppCommThread.java │ ├── ClientAppManager.java │ ├── ConnectionManager.java │ ├── IdGenerator.java │ └── ServerState.java │ └── serial │ ├── MessageHandler.java │ ├── MessageHandlerIf.java │ └── SerialCommunication.java ├── settings.gradle └── zNetMonitor.iml /.gitignore: -------------------------------------------------------------------------------- 1 | doc/ 2 | images/prototypes/ 3 | keystore/ 4 | src/.cproject 5 | src/.project 6 | src/.settings/ 7 | src/Release/ 8 | zNetMonitor/.gradle/ 9 | zNetMonitor/.idea/ 10 | zNetMonitor/server/build/ 11 | zNetMonitor/app/build/ 12 | zNetMonitor/build/ 13 | zNetMonitor/common/build/ 14 | zNetMonitor/local.properties 15 | zNetMonitor/release 16 | 17 | 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![License](https://img.shields.io/badge/license-GNU_GPLv3-orange.svg)](https://github.com/mkulesh/stm32WindowSensor/blob/master/LICENSE) 2 | 3 | # stm32WindowSensor 4 | 5 | *RF window sensors: STM32L + RFM69 + Android* 6 | 7 | This is a DIY windows monitorig system that consist of: 8 | - A window sensor based on STM32L051 MCU and RFM69 RF module. The PCB is developed in EagleCad, firmware written in C++ using System Workbench for STM32 9 | - A server unit also based on STM32L051 MCU and RFM69 RF module 10 | - A server software module (Java) that reads data from server unit and forwards it to the mobile app 11 | - A mobile app for Android written in Java 12 | 13 | ## Window Sensor 14 | 15 | 16 | ## Server Unit 17 | 18 | 19 | ## Android App 20 | 21 | 22 | ## License 23 | 24 | This software is published under the *GNU General Public License, Version 3* 25 | 26 | Copyright © 2018-2019 by Mikhail Kulesh 27 | 28 | This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as 29 | published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 30 | 31 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty 32 | of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have 33 | received a copy of the GNU General Public License along with this program. 34 | 35 | If not, see [www.gnu.org/licenses](https://www.gnu.org/licenses). 36 | -------------------------------------------------------------------------------- /cubeMX/windowSensor.ioc: -------------------------------------------------------------------------------- 1 | #MicroXplorer Configuration settings - do not modify 2 | File.Version=6 3 | KeepUserPlacement=false 4 | Mcu.Family=STM32L0 5 | Mcu.IP0=NVIC 6 | Mcu.IP1=RCC 7 | Mcu.IP2=SPI1 8 | Mcu.IP3=SYS 9 | Mcu.IP4=TIM2 10 | Mcu.IP5=USART1 11 | Mcu.IPNb=6 12 | Mcu.Name=STM32L051K(6-8)Tx 13 | Mcu.Package=LQFP32 14 | Mcu.Pin0=PA0 15 | Mcu.Pin1=PA1 16 | Mcu.Pin10=PA11 17 | Mcu.Pin11=PA13 18 | Mcu.Pin12=PA14 19 | Mcu.Pin13=VP_SYS_VS_Systick 20 | Mcu.Pin2=PA2 21 | Mcu.Pin3=PA3 22 | Mcu.Pin4=PA4 23 | Mcu.Pin5=PA5 24 | Mcu.Pin6=PA6 25 | Mcu.Pin7=PA7 26 | Mcu.Pin8=PA9 27 | Mcu.Pin9=PA10 28 | Mcu.PinsNb=14 29 | Mcu.UserConstants= 30 | Mcu.UserName=STM32L051K8Tx 31 | MxCube.Version=4.14.0 32 | MxDb.Version=DB.4.0.140 33 | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true 34 | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true 35 | NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true 36 | PA0.Locked=true 37 | PA0.Mode=Wake_Up_1 38 | PA0.Signal=SYS_WKUP1 39 | PA1.GPIOParameters=GPIO_Label 40 | PA1.GPIO_Label=pinSwithValue 41 | PA1.Locked=true 42 | PA1.Signal=GPIO_Input 43 | PA10.Locked=true 44 | PA10.Mode=Asynchronous 45 | PA10.Signal=USART1_RX 46 | PA11.GPIOParameters=GPIO_Label 47 | PA11.GPIO_Label=pinDio0 48 | PA11.Locked=true 49 | PA11.Signal=GPIO_Input 50 | PA13.Locked=true 51 | PA13.Mode=Serial_Wire 52 | PA13.Signal=SYS_SWDIO 53 | PA14.Mode=Serial_Wire 54 | PA14.Signal=SYS_SWCLK 55 | PA2.GPIOParameters=GPIO_Label 56 | PA2.GPIO_Label=pinLed 57 | PA2.Locked=true 58 | PA2.Signal=S_TIM2_CH3 59 | PA3.GPIOParameters=GPIO_Label 60 | PA3.GPIO_Label=pinRfmPower 61 | PA3.Locked=true 62 | PA3.Signal=GPIO_Output 63 | PA4.Mode=NSS_Signal_Hard_Output 64 | PA4.Signal=SPI1_NSS 65 | PA5.Locked=true 66 | PA5.Mode=Full_Duplex_Master 67 | PA5.Signal=SPI1_SCK 68 | PA6.Locked=true 69 | PA6.Mode=Full_Duplex_Master 70 | PA6.Signal=SPI1_MISO 71 | PA7.Locked=true 72 | PA7.Mode=Full_Duplex_Master 73 | PA7.Signal=SPI1_MOSI 74 | PA9.Locked=true 75 | PA9.Mode=Asynchronous 76 | PA9.Signal=USART1_TX 77 | PCC.Checker=true 78 | PCC.Line=STM32L0x1 79 | PCC.MCU=STM32L051K(6-8)Tx 80 | PCC.MXVersion=4.14.0 81 | PCC.PartNumber=STM32L051K8Tx 82 | PCC.Seq0=0 83 | PCC.Series=STM32L0 84 | PCC.Temperature=25 85 | PCC.Vdd=null 86 | RCC.ADCFreq_Value=4000000 87 | RCC.AHBFreq_Value=2097000 88 | RCC.APB1Freq_Value=2097000 89 | RCC.APB1TimFreq_Value=2097000 90 | RCC.APB2Freq_Value=2097000 91 | RCC.APB2TimFreq_Value=2097000 92 | RCC.FCLKCortexFreq_Value=2097000 93 | RCC.FamilyName=M 94 | RCC.HCLKFreq_Value=2097000 95 | RCC.HSI16_VALUE=16000000 96 | RCC.HSIRCDiv=4 97 | RCC.HSI_VALUE=4000000 98 | RCC.I2C1Freq_Value=2097000 99 | RCC.IPParameters=FamilyName,MSI_VALUE,SYSCLKFreq_VALUE,AHBFreq_Value,TIMFreq_Value,APB1Freq_Value,APB1TimFreq_Value,LPTIMFreq_Value,APB2Freq_Value,APB2TimFreq_Value,PWRFreq_Value,LSI_VALUE,WatchDogFreq_Value,RTCFreq_Value,USART1Freq_Value,I2C1Freq_Value,HSI16_VALUE,HSI_VALUE,VCOOutputFreq_Value,PLLCLKFreq_Value,LSE_VALUE,USART2Freq_Value,HCLKFreq_Value,TimerFreq_Value,FCLKCortexFreq_Value,MCOPinFreq_Value,ADCFreq_Value,VCOInputFreq_Value,HSIRCDiv,PLLDIV,PLLMUL 100 | RCC.LPTIMFreq_Value=2097000 101 | RCC.LSE_VALUE=32768 102 | RCC.LSI_VALUE=37000 103 | RCC.MCOPinFreq_Value=2097000 104 | RCC.MSI_VALUE=2097000 105 | RCC.PLLCLKFreq_Value=4000000 106 | RCC.PLLDIV=RCC_PLLDIV_4 107 | RCC.PLLMUL=RCC_PLLMUL_4 108 | RCC.PWRFreq_Value=2097000 109 | RCC.RTCFreq_Value=37000 110 | RCC.SYSCLKFreq_VALUE=2097000 111 | RCC.TIMFreq_Value=2097000 112 | RCC.TimerFreq_Value=2097000 113 | RCC.USART1Freq_Value=2097000 114 | RCC.USART2Freq_Value=2097000 115 | RCC.VCOInputFreq_Value=4000000 116 | RCC.VCOOutputFreq_Value=16000000 117 | RCC.WatchDogFreq_Value=37000 118 | SH.S_TIM2_CH3.0=TIM2_CH3,PWM Generation3 CH3 119 | SH.S_TIM2_CH3.ConfNb=1 120 | SPI1.CalculateBaudRate=1.0485 MBits/s 121 | SPI1.IPParameters=Mode,CalculateBaudRate,VirtualNSS 122 | SPI1.Mode=SPI_MODE_MASTER 123 | SPI1.VirtualNSS=VM_NSSHARD 124 | TIM2.Channel-PWM\ Generation3\ CH3=TIM_CHANNEL_3 125 | TIM2.IPParameters=Channel-PWM Generation3 CH3 126 | VP_SYS_VS_Systick.Mode=SysTick 127 | VP_SYS_VS_Systick.Signal=SYS_VS_Systick 128 | -------------------------------------------------------------------------------- /images/pcb/pcb_buttom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/pcb/pcb_buttom.jpg -------------------------------------------------------------------------------- /images/pcb/pcb_top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/pcb/pcb_top.jpg -------------------------------------------------------------------------------- /images/screenschots/floor_1_alarm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/screenschots/floor_1_alarm.png -------------------------------------------------------------------------------- /images/screenschots/floor_1_ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/screenschots/floor_1_ok.png -------------------------------------------------------------------------------- /images/screenschots/floor_2_alarm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/screenschots/floor_2_alarm.png -------------------------------------------------------------------------------- /images/screenschots/floor_2_ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/screenschots/floor_2_ok.png -------------------------------------------------------------------------------- /images/screenschots/server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/screenschots/server.png -------------------------------------------------------------------------------- /images/sensors/sensor01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/sensors/sensor01.jpg -------------------------------------------------------------------------------- /images/sensors/sensor02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/sensors/sensor02.jpg -------------------------------------------------------------------------------- /images/sensors/sensor03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/sensors/sensor03.jpg -------------------------------------------------------------------------------- /images/sensors/sensor04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/sensors/sensor04.jpg -------------------------------------------------------------------------------- /images/sensors/sensor05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/sensors/sensor05.jpg -------------------------------------------------------------------------------- /images/sensors/sensor06.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/sensors/sensor06.jpg -------------------------------------------------------------------------------- /images/sensors/sensor07.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/sensors/sensor07.jpg -------------------------------------------------------------------------------- /images/sensors/sensor08.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/sensors/sensor08.jpg -------------------------------------------------------------------------------- /images/server/server01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/server/server01.jpg -------------------------------------------------------------------------------- /images/server/server02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/server/server02.jpg -------------------------------------------------------------------------------- /images/server/server03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/server/server03.jpg -------------------------------------------------------------------------------- /images/server/server04.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/images/server/server04.jpg -------------------------------------------------------------------------------- /libs/rxtx-2.2pre2-source.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/libs/rxtx-2.2pre2-source.zip -------------------------------------------------------------------------------- /libs/rxtx-2.2pre2/README: -------------------------------------------------------------------------------- 1 | Wed Feb 4 20:13:07 EST 2009 Rxtx-2.2pre2 2 | 3 | Build Solaris with ../configure cc='gcc -static-libgcc' 4 | 5 | More 64 bit fixes. 6 | 7 | Maintain DTR=false during setSerialPortParams 8 | 9 | Tried adjusting the header files for win32/64. The pin events are getting lost. Still need to check if 10 | this fixed it. Cross compiling works but I'm fixing the native w32 MSVC builds. 11 | 12 | Tue Dec 30 22:02:44 EST 2008 Rxtx-2.2pre1 13 | 14 | For information on how to use these files, please see the installation page on 15 | http://rxtx.qbang.org 16 | 17 | This is the rxtx-2.2pre1. The purpose is to expose any problems with the 18 | builds on as many platforms as we can. 19 | 20 | To reproduce these files, download the source. For all platforms except 21 | windows, the following was used to build: 22 | 23 | cd rxtx-2.2pre1 24 | mkdir build 25 | cd build 26 | ../configure && build 27 | 28 | For Windows, the following was done in a Visual Studio command prompt: 29 | 30 | cd rxtx-2.2pre1 31 | mdkir build 32 | copy Makefile.msvc build\Makefile 33 | nmake 34 | 35 | 36 | Feel free to add additional information if you run into or solve a problem. 37 | 38 | 39 | The files: 40 | 41 | mac-10.4/librxtxSerial.jnilib: Mach-O universal binary with 2 architectures 42 | mac-10.4/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 43 | mac-10.4/librxtxSerial.jnilib (for architecture ppc): Mach-O bundle ppc 44 | 45 | mac-10.5/librxtxSerial.jnilib: Mach-O universal binary with 3 architectures 46 | mac-10.5/librxtxSerial.jnilib (for architecture i386): Mach-O bundle i386 47 | mac-10.5/librxtxSerial.jnilib (for architecture x86_64): Mach-O 64-bit bundle x86_64 48 | mac-10.5/librxtxSerial.jnilib (for architecture ppc7400): Mach-O bundle ppc 49 | 50 | win32/rxtxParallel.dll: MS-DOS executable PE for MS Windows (DLL) (GUI) Intel 80386 32-bit 51 | win32/rxtxSerial.dll: MS-DOS executable PE for MS Windows (DLL) (GUI) Intel 80386 32-bit 52 | 53 | win64/rxtxParallel.dll: MS-DOS executable PE for MS Windows (DLL) (GUI) 54 | win64/rxtxSerial.dll: MS-DOS executable PE for MS Windows (DLL) (GUI) 55 | 56 | i686-pc-linux-gnu/librxtxParallel.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped 57 | i686-pc-linux-gnu/librxtxSerial.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), not stripped 58 | 59 | x86_64-unknown-linux-gnu/librxtxParallel.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped 60 | x86_64-unknown-linux-gnu/librxtxSerial.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped 61 | 62 | sparc-sun-solaris2.10/librxtxSerial.so: ELF 64-bit MSB dynamic lib SPARCV9 Version 1, dynamically linked, not stripped 63 | 64 | sparc-sun-solaris2.6/librxtxSerial.so: ELF 32-bit MSB shared object, SPARC, version 1 (SYSV), not stripped 65 | 66 | -------------------------------------------------------------------------------- /libs/rxtx-2.2pre2/RXTXcomm.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/libs/rxtx-2.2pre2/RXTXcomm.jar -------------------------------------------------------------------------------- /libs/rxtx-2.2pre2/i686-pc-linux-gnu/librxtxParallel.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/libs/rxtx-2.2pre2/i686-pc-linux-gnu/librxtxParallel.so -------------------------------------------------------------------------------- /libs/rxtx-2.2pre2/i686-pc-linux-gnu/librxtxSerial.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/libs/rxtx-2.2pre2/i686-pc-linux-gnu/librxtxSerial.so -------------------------------------------------------------------------------- /libs/rxtx-2.2pre2/win32/rxtxSerial.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/libs/rxtx-2.2pre2/win32/rxtxSerial.dll -------------------------------------------------------------------------------- /libs/rxtx-2.2pre2/win64/rxtxSerial.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/libs/rxtx-2.2pre2/win64/rxtxSerial.dll -------------------------------------------------------------------------------- /libs/rxtx-2.2pre2/x86_64-unknown-linux-gnu/librxtxSerial.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/libs/rxtx-2.2pre2/x86_64-unknown-linux-gnu/librxtxSerial.so -------------------------------------------------------------------------------- /pcb/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Window sensor project. 2 | Version 3: 3 | 1. Used 433MHz radio module 4 | 2. Sensor gateway for Pi case 5 | -------------------------------------------------------------------------------- /pcb/DRILEGEND.CFG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/pcb/DRILEGEND.CFG -------------------------------------------------------------------------------- /pcb/eagle.dru: -------------------------------------------------------------------------------- 1 | description[de] = EAGLE Design Rules\n

\nDie Standard-Design-Rules sind so gewählt, dass sie für \ndie meisten Anwendungen passen. Sollte ihre Platine \nbesondere Anforderungen haben, treffen Sie die erforderlichen\nEinstellungen hier und speichern die Design Rules unter \neinem neuen Namen ab. 2 | description[en] = EAGLE Design Rules\n

\nThe default Design Rules have been set to cover\na wide range of applications. Your particular design\nmay have different requirements, so please make the\nnecessary adjustments and save your customized\ndesign rules under a new name. 3 | layerSetup = (1*16) 4 | mtCopper = 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 0.035mm 5 | mtIsolate = 1.5mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 0.15mm 0.2mm 6 | mdWireWire = 8mil 7 | mdWirePad = 8mil 8 | mdWireVia = 8mil 9 | mdPadPad = 7mil 10 | mdPadVia = 12mil 11 | mdViaVia = 12mil 12 | mdSmdPad = 7mil 13 | mdSmdVia = 7mil 14 | mdSmdSmd = 7mil 15 | mdViaViaSameLayer = 8mil 16 | mnLayersViaInSmd = 2 17 | mdCopperDimension = 3mil 18 | mdDrill = 30mil 19 | mdSmdStop = 0mil 20 | msWidth = 10mil 21 | msDrill = 19mil 22 | msMicroVia = 9.99mm 23 | msBlindViaRatio = 0.500000 24 | rvPadTop = 0.150000 25 | rvPadInner = 0.150000 26 | rvPadBottom = 0.150000 27 | rvViaOuter = 0.150000 28 | rvViaInner = 0.150000 29 | rvMicroViaOuter = 0.250000 30 | rvMicroViaInner = 0.250000 31 | rlMinPadTop = 15mil 32 | rlMaxPadTop = 30mil 33 | rlMinPadInner = 10mil 34 | rlMaxPadInner = 20mil 35 | rlMinPadBottom = 15mil 36 | rlMaxPadBottom = 30mil 37 | rlMinViaOuter = 8mil 38 | rlMaxViaOuter = 20mil 39 | rlMinViaInner = 8mil 40 | rlMaxViaInner = 20mil 41 | rlMinMicroViaOuter = 4mil 42 | rlMaxMicroViaOuter = 20mil 43 | rlMinMicroViaInner = 4mil 44 | rlMaxMicroViaInner = 20mil 45 | psTop = -1 46 | psBottom = -1 47 | psFirst = 2 48 | psElongationLong = 100 49 | psElongationOffset = 100 50 | mvStopFrame = 1.000000 51 | mvCreamFrame = 0.000000 52 | mlMinStopFrame = 4mil 53 | mlMaxStopFrame = 4mil 54 | mlMinCreamFrame = 0mil 55 | mlMaxCreamFrame = 0mil 56 | mlViaStopLimit = 0mil 57 | srRoundness = 0.000000 58 | srMinRoundness = 0mil 59 | srMaxRoundness = 0mil 60 | slThermalIsolate = 10mil 61 | slThermalsForVias = 0 62 | dpMaxLengthDifference = 10mm 63 | dpGapFactor = 2.500000 64 | checkGrid = 0 65 | checkAngle = 1 66 | checkFont = 1 67 | checkRestrict = 1 68 | useDiameter = 13 69 | maxErrors = 50 70 | -------------------------------------------------------------------------------- /src/CMSIS/core/arm_const_structs.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_const_structs.h 9 | * 10 | * Description: This file has constant structs that are initialized for 11 | * user convenience. For example, some can be given as 12 | * arguments to the arm_cfft_f32() function. 13 | * 14 | * Target Processor: Cortex-M4/Cortex-M3 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions 18 | * are met: 19 | * - Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * - Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in 23 | * the documentation and/or other materials provided with the 24 | * distribution. 25 | * - Neither the name of ARM LIMITED nor the names of its contributors 26 | * may be used to endorse or promote products derived from this 27 | * software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 32 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 33 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 35 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 39 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 40 | * POSSIBILITY OF SUCH DAMAGE. 41 | * -------------------------------------------------------------------- */ 42 | 43 | #ifndef _ARM_CONST_STRUCTS_H 44 | #define _ARM_CONST_STRUCTS_H 45 | 46 | #include "arm_math.h" 47 | #include "arm_common_tables.h" 48 | 49 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16; 50 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32; 51 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64; 52 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128; 53 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256; 54 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512; 55 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024; 56 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048; 57 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096; 58 | 59 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16; 60 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32; 61 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64; 62 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128; 63 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256; 64 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512; 65 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024; 66 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048; 67 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096; 68 | 69 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16; 70 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32; 71 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64; 72 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128; 73 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256; 74 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512; 75 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024; 76 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048; 77 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /src/CMSIS/core/core_cmFunc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmFunc.h 3 | * @brief CMSIS Cortex-M Core Function Access Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMFUNC_H 42 | #define __CORE_CMFUNC_H 43 | 44 | 45 | /* ########################### Core Function Access ########################### */ 46 | /** \ingroup CMSIS_Core_FunctionInterface 47 | \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions 48 | @{ 49 | */ 50 | 51 | /*------------------ RealView Compiler -----------------*/ 52 | #if defined ( __CC_ARM ) 53 | #include "cmsis_armcc.h" 54 | 55 | /*------------------ ARM Compiler V6 -------------------*/ 56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 57 | #include "cmsis_armcc_V6.h" 58 | 59 | /*------------------ GNU Compiler ----------------------*/ 60 | #elif defined ( __GNUC__ ) 61 | #include "cmsis_gcc.h" 62 | 63 | /*------------------ ICC Compiler ----------------------*/ 64 | #elif defined ( __ICCARM__ ) 65 | #include 66 | 67 | /*------------------ TI CCS Compiler -------------------*/ 68 | #elif defined ( __TMS470__ ) 69 | #include 70 | 71 | /*------------------ TASKING Compiler ------------------*/ 72 | #elif defined ( __TASKING__ ) 73 | /* 74 | * The CMSIS functions have been implemented as intrinsics in the compiler. 75 | * Please use "carm -?i" to get an up to date list of all intrinsics, 76 | * Including the CMSIS ones. 77 | */ 78 | 79 | /*------------------ COSMIC Compiler -------------------*/ 80 | #elif defined ( __CSMC__ ) 81 | #include 82 | 83 | #endif 84 | 85 | /*@} end of CMSIS_Core_RegAccFunctions */ 86 | 87 | #endif /* __CORE_CMFUNC_H */ 88 | -------------------------------------------------------------------------------- /src/CMSIS/core/core_cmInstr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmInstr.h 3 | * @brief CMSIS Cortex-M Core Instruction Access Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMINSTR_H 42 | #define __CORE_CMINSTR_H 43 | 44 | 45 | /* ########################## Core Instruction Access ######################### */ 46 | /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface 47 | Access to dedicated instructions 48 | @{ 49 | */ 50 | 51 | /*------------------ RealView Compiler -----------------*/ 52 | #if defined ( __CC_ARM ) 53 | #include "cmsis_armcc.h" 54 | 55 | /*------------------ ARM Compiler V6 -------------------*/ 56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 57 | #include "cmsis_armcc_V6.h" 58 | 59 | /*------------------ GNU Compiler ----------------------*/ 60 | #elif defined ( __GNUC__ ) 61 | #include "cmsis_gcc.h" 62 | 63 | /*------------------ ICC Compiler ----------------------*/ 64 | #elif defined ( __ICCARM__ ) 65 | #include 66 | 67 | /*------------------ TI CCS Compiler -------------------*/ 68 | #elif defined ( __TMS470__ ) 69 | #include 70 | 71 | /*------------------ TASKING Compiler ------------------*/ 72 | #elif defined ( __TASKING__ ) 73 | /* 74 | * The CMSIS functions have been implemented as intrinsics in the compiler. 75 | * Please use "carm -?i" to get an up to date list of all intrinsics, 76 | * Including the CMSIS ones. 77 | */ 78 | 79 | /*------------------ COSMIC Compiler -------------------*/ 80 | #elif defined ( __CSMC__ ) 81 | #include 82 | 83 | #endif 84 | 85 | /*@}*/ /* end of group CMSIS_Core_InstructionInterface */ 86 | 87 | #endif /* __CORE_CMINSTR_H */ 88 | -------------------------------------------------------------------------------- /src/CMSIS/core/core_cmSimd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmSimd.h 3 | * @brief CMSIS Cortex-M SIMD Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMSIMD_H 42 | #define __CORE_CMSIMD_H 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | 49 | /* ################### Compiler specific Intrinsics ########################### */ 50 | /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics 51 | Access to dedicated SIMD instructions 52 | @{ 53 | */ 54 | 55 | /*------------------ RealView Compiler -----------------*/ 56 | #if defined ( __CC_ARM ) 57 | #include "cmsis_armcc.h" 58 | 59 | /*------------------ ARM Compiler V6 -------------------*/ 60 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 61 | #include "cmsis_armcc_V6.h" 62 | 63 | /*------------------ GNU Compiler ----------------------*/ 64 | #elif defined ( __GNUC__ ) 65 | #include "cmsis_gcc.h" 66 | 67 | /*------------------ ICC Compiler ----------------------*/ 68 | #elif defined ( __ICCARM__ ) 69 | #include 70 | 71 | /*------------------ TI CCS Compiler -------------------*/ 72 | #elif defined ( __TMS470__ ) 73 | #include 74 | 75 | /*------------------ TASKING Compiler ------------------*/ 76 | #elif defined ( __TASKING__ ) 77 | /* 78 | * The CMSIS functions have been implemented as intrinsics in the compiler. 79 | * Please use "carm -?i" to get an up to date list of all intrinsics, 80 | * Including the CMSIS ones. 81 | */ 82 | 83 | /*------------------ COSMIC Compiler -------------------*/ 84 | #elif defined ( __CSMC__ ) 85 | #include 86 | 87 | #endif 88 | 89 | /*@} end of group CMSIS_SIMD_intrinsics */ 90 | 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* __CORE_CMSIMD_H */ 97 | -------------------------------------------------------------------------------- /src/HAL_Driver/Inc/stm32_assert_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32_assert.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 8-January-2016 7 | * @brief STM32 assert template file. 8 | * This file should be copied to the application folder and renamed 9 | * to stm32_assert.h. 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | *

© COPYRIGHT(c) 2016 STMicroelectronics

14 | * 15 | * Redistribution and use in source and binary forms, with or without modification, 16 | * are permitted provided that the following conditions are met: 17 | * 1. Redistributions of source code must retain the above copyright notice, 18 | * this list of conditions and the following disclaimer. 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 23 | * may be used to endorse or promote products derived from this software 24 | * without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 33 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 34 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************** 38 | */ 39 | 40 | /* Define to prevent recursive inclusion -------------------------------------*/ 41 | #ifndef __STM32_ASSERT_H 42 | #define __STM32_ASSERT_H 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Exported constants --------------------------------------------------------*/ 50 | /* Includes ------------------------------------------------------------------*/ 51 | /* Exported macro ------------------------------------------------------------*/ 52 | #ifdef USE_FULL_ASSERT 53 | /** 54 | * @brief The assert_param macro is used for function's parameters check. 55 | * @param expr: If expr is false, it calls assert_failed function 56 | * which reports the name of the source file and the source 57 | * line number of the call that failed. 58 | * If expr is true, it returns no value. 59 | * @retval None 60 | */ 61 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 62 | /* Exported functions ------------------------------------------------------- */ 63 | void assert_failed(uint8_t* file, uint32_t line); 64 | #else 65 | #define assert_param(expr) ((void)0) 66 | #endif /* USE_FULL_ASSERT */ 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* __STM32_ASSERT_H */ 73 | 74 | 75 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 76 | -------------------------------------------------------------------------------- /src/HAL_Driver/Inc/stm32l0xx_hal_comp_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_comp_ex.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 8-January-2016 7 | * @brief Header file of COMP HAL Extended module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2016 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32L0xx_HAL_COMP_EX_H 40 | #define __STM32L0xx_HAL_COMP_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32l0xx_hal_def.h" 48 | 49 | /** @addtogroup STM32L0xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @defgroup COMPEx COMPEx 54 | * @{ 55 | */ 56 | 57 | /* Exported functions --------------------------------------------------------*/ 58 | /** @defgroup COMPEx_Exported_Functions COMPEx Exported Functions 59 | * @{ 60 | */ 61 | 62 | /** @defgroup COMPEx_Exported_Functions_Group1 Extended COMP VREFINT setup functions 63 | * @{ 64 | */ 65 | /* COMP specific functions to manage VREFINT *************************************/ 66 | void HAL_COMPEx_EnableVREFINT(void); 67 | void HAL_COMPEx_DisableVREFINT(void); 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** 82 | * @} 83 | */ 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif /* __STM32L0xx_HAL_COMP_EX_H */ 89 | 90 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 91 | 92 | -------------------------------------------------------------------------------- /src/HAL_Driver/Inc/stm32l0xx_hal_cryp_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_cryp_ex.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 8-January-2016 7 | * @brief Header file of CRYPEx HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2016 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32L0xx_HAL_CRYP_EX_H 40 | #define __STM32L0xx_HAL_CRYP_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined (STM32L021xx) || defined (STM32L041xx) || defined (STM32L061xx) || defined (STM32L062xx) || defined (STM32L063xx) || (STM32L081xx) || defined (STM32L082xx) || defined (STM32L083xx) 47 | 48 | /* Includes ------------------------------------------------------------------*/ 49 | #include "stm32l0xx_hal_def.h" 50 | 51 | /** @addtogroup STM32L0xx_HAL_Driver 52 | * @{ 53 | */ 54 | 55 | /** @defgroup CRYPEx CRYPEx 56 | * @{ 57 | */ 58 | 59 | /* Exported types ------------------------------------------------------------*/ 60 | /* Exported constants --------------------------------------------------------*/ 61 | /* Exported functions --------------------------------------------------------*/ 62 | 63 | /** @defgroup CRYPEx_Exported_Functions CRYPEx Exported Functions 64 | * @{ 65 | */ 66 | 67 | /** @defgroup CRYPEx_Exported_Functions_Group1 Extended features functions 68 | * @{ 69 | */ 70 | 71 | /* CallBack functions ********************************************************/ 72 | void HAL_CRYPEx_ComputationCpltCallback(CRYP_HandleTypeDef *hcryp); 73 | 74 | /** 75 | * @} 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | #endif /* STM32L021xx || STM32L041xx || STM32L061xx || STM32L062xx || STM32L063xx || STM32L081xx || STM32L082xx || STM32L083xx */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* __STM32L0xx_HAL_CRYP_EX_H */ 97 | 98 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 99 | 100 | -------------------------------------------------------------------------------- /src/HAL_Driver/Inc/stm32l0xx_hal_pcd_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_hal_pcd.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 8-January-2016 7 | * @brief Header file of PCD HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2016 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32L0xx_HAL_PCD_EX_H 40 | #define __STM32L0xx_HAL_PCD_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32l0xx_hal_def.h" 48 | 49 | /** @addtogroup STM32L0xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @defgroup PCDEx PCDEx 54 | * @{ 55 | */ 56 | 57 | /* Exported functions --------------------------------------------------------*/ 58 | 59 | /** @defgroup PCDEx_Exported_Functions PCDEx Exported Functions 60 | * @{ 61 | */ 62 | 63 | /** @defgroup PCDEx__Exported_Functions_Group1 Initialization and de-initialization functions 64 | * @brief Initialization and Configuration functions 65 | */ 66 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, 67 | uint16_t ep_addr, 68 | uint16_t ep_kind, 69 | uint32_t pmaadress); 70 | /** 71 | * @} 72 | */ 73 | 74 | /** 75 | * @} 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | #ifdef __cplusplus 83 | } 84 | #endif 85 | 86 | 87 | #endif /* __STM32L0xx_HAL_PCD_EX_H */ 88 | 89 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 90 | 91 | -------------------------------------------------------------------------------- /src/HAL_Driver/Release_Notes.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/src/HAL_Driver/Release_Notes.html -------------------------------------------------------------------------------- /src/HAL_Driver/Src/stm32l0xx_hal_adc_ex.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/src/HAL_Driver/Src/stm32l0xx_hal_adc_ex.c -------------------------------------------------------------------------------- /src/MyL051K6.cfg: -------------------------------------------------------------------------------- 1 | # This is an MyL051K6 board with a single STM32L051K6Tx chip. 2 | # Generated by System Workbench for STM32 3 | 4 | source [find interface/stlink-v2.cfg] 5 | 6 | set WORKAREASIZE 0x2000 7 | transport select "hla_swd" 8 | set CPUTAPID 0x0bc11477 9 | set CHIPNAME STM32L051K6Tx 10 | 11 | source [find target/stm32l0.cfg] 12 | 13 | # use hardware reset, connect under reset 14 | reset_config srst_only srst_nogate 15 | -------------------------------------------------------------------------------- /src/MyL051K6.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ]> 11 | 12 | 13 | 14 | MyL051K6 15 | SWD 16 | ST-Link 17 | stm32l051k6tx 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/MyL051K8.cfg: -------------------------------------------------------------------------------- 1 | # This is an MyL051K8 board with a single STM32L051K8Tx chip. 2 | # Generated by System Workbench for STM32 3 | 4 | source [find interface/stlink-v2.cfg] 5 | 6 | set WORKAREASIZE 0x2000 7 | transport select "hla_swd" 8 | set CPUTAPID 0x0bc11477 9 | 10 | source [find target/stm32lx_stlink.cfg] 11 | 12 | # use hardware reset, connect under reset 13 | reset_config srst_only srst_nogate 14 | -------------------------------------------------------------------------------- /src/MyL051K8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MyL051K8 5 | stm32l051k8tx 6 | SWD 7 | ST-LinkV2 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/src/EepRomInteger.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | #include 17 | #include "stm32l0xx_hal_flash.h" 18 | 19 | using namespace StmPlusPlus; 20 | 21 | 22 | EepRomInteger::EepRomInteger(uint32_t _startAddr): 23 | startAddr(_startAddr) 24 | { 25 | // empty 26 | } 27 | 28 | 29 | uint32_t EepRomInteger::readEEPROM (uint32_t address) 30 | { 31 | address = DATA_EEPROM_BASE + address; 32 | return (*(__IO uint32_t*) address); 33 | } 34 | 35 | 36 | HAL_StatusTypeDef EepRomInteger::writeEEPROM (uint32_t address, uint8_t data) 37 | { 38 | HAL_StatusTypeDef status = HAL_ERROR; 39 | address = DATA_EEPROM_BASE + address; 40 | if (IS_FLASH_DATA_ADDRESS(address) && HAL_FLASHEx_DATAEEPROM_Unlock() == HAL_OK) 41 | { 42 | status = HAL_FLASHEx_DATAEEPROM_Program(FLASH_TYPEPROGRAMDATA_BYTE, address, data); 43 | HAL_FLASHEx_DATAEEPROM_Lock(); 44 | } 45 | return status; 46 | } 47 | 48 | 49 | HAL_StatusTypeDef EepRomInteger::writeValue (uint32_t val) 50 | { 51 | HAL_StatusTypeDef status = HAL_OK; 52 | LongToBytes longValue; 53 | longValue.value = val; 54 | if (writeEEPROM(startAddr + 0, longValue.bytes.b0) != HAL_OK) 55 | { 56 | status = HAL_ERROR; 57 | } 58 | if (writeEEPROM(startAddr + 1, longValue.bytes.b1)) 59 | { 60 | status = HAL_ERROR; 61 | } 62 | if (writeEEPROM(startAddr + 2, longValue.bytes.b2)) 63 | { 64 | status = HAL_ERROR; 65 | } 66 | if (writeEEPROM(startAddr + 3, longValue.bytes.b3)) 67 | { 68 | status = HAL_ERROR; 69 | } 70 | return status; 71 | } 72 | -------------------------------------------------------------------------------- /src/src/EepRomInteger.h: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | #ifndef REQUEST_ID_H_ 17 | #define REQUEST_ID_H_ 18 | 19 | #include "stm32l0xx_hal.h" 20 | 21 | namespace StmPlusPlus { 22 | 23 | typedef union 24 | { 25 | uint32_t value; 26 | struct 27 | { 28 | uint8_t b0; 29 | uint8_t b1; 30 | uint8_t b2; 31 | uint8_t b3; 32 | } bytes; 33 | } LongToBytes; 34 | 35 | 36 | /** 37 | * @brief Class implementing persistent request ID stored in EEPROM. 38 | */ 39 | class EepRomInteger 40 | { 41 | public: 42 | 43 | /** 44 | * @brief Default constructor. 45 | */ 46 | EepRomInteger (uint32_t _startAddr); 47 | 48 | inline uint32_t readValue () 49 | { 50 | return readEEPROM(startAddr); 51 | }; 52 | 53 | HAL_StatusTypeDef writeValue (uint32_t val); 54 | 55 | private: 56 | 57 | const uint32_t startAddr; 58 | uint32_t readEEPROM (uint32_t address); 59 | HAL_StatusTypeDef writeEEPROM (uint32_t address, uint8_t data); 60 | 61 | }; 62 | 63 | } // end of namespace StmPlusPlus 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /src/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | #define SENSOR_LOGIC true 17 | 18 | #include "WindowSensor.h" 19 | #include "SensorGateway.h" 20 | 21 | __IO uint32_t sysTick; 22 | 23 | SensorBase * appPtr = NULL; 24 | 25 | int main (void) 26 | { 27 | HAL_Init(); 28 | 29 | IOPort defaultPortA(IOPort::PortName::A, GPIO_MODE_ANALOG, GPIO_NOPULL, GPIO_SPEED_LOW); __GPIOA_CLK_DISABLE(); 30 | IOPort defaultPortB(IOPort::PortName::B, GPIO_MODE_ANALOG, GPIO_NOPULL, GPIO_SPEED_LOW); __GPIOB_CLK_DISABLE(); 31 | IOPort defaultPortC(IOPort::PortName::C, GPIO_MODE_ANALOG, GPIO_NOPULL, GPIO_SPEED_LOW); __GPIOC_CLK_DISABLE(); 32 | 33 | #ifdef SENSOR_LOGIC 34 | WindowSensor::initSystemClock(); 35 | WindowSensor::initWakeUp(); 36 | WindowSensor sensor(/*sensorId=*/ 19); 37 | appPtr = &sensor; 38 | sensor.run(); 39 | #else 40 | SensorGateway::initSystemClock(); 41 | SensorGateway::initWakeUp(); 42 | SensorGateway gateway; 43 | appPtr = &gateway; 44 | gateway.run(); 45 | #endif 46 | 47 | while (true) 48 | { 49 | // empty 50 | } 51 | } 52 | 53 | extern "C" void EXTI0_1_IRQHandler (void) 54 | { 55 | appPtr->processEXTI0_1_IRQn(); 56 | } 57 | 58 | extern "C" void HAL_SYSTICK_Callback (void) 59 | { 60 | ++sysTick; 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/src/stm32l0xx_it.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l0xx_it.c 4 | * @author Ac6 5 | * @version V1.0 6 | * @date 02-Feb-2015 7 | * @brief Default Interrupt Service Routines. 8 | ****************************************************************************** 9 | */ 10 | 11 | /* Includes ------------------------------------------------------------------*/ 12 | #include "stm32l0xx_hal.h" 13 | #include "stm32l0xx.h" 14 | #ifdef USE_RTOS_SYSTICK 15 | #include 16 | #endif 17 | #include "stm32l0xx_it.h" 18 | 19 | /* Private typedef -----------------------------------------------------------*/ 20 | /* Private define ------------------------------------------------------------*/ 21 | /* Private macro -------------------------------------------------------------*/ 22 | /* Private variables ---------------------------------------------------------*/ 23 | /* Private function prototypes -----------------------------------------------*/ 24 | /* Private functions ---------------------------------------------------------*/ 25 | 26 | /******************************************************************************/ 27 | /* Processor Exceptions Handlers */ 28 | /******************************************************************************/ 29 | 30 | /** 31 | * @brief This function handles SysTick Handler, but only if no RTOS defines it. 32 | * @param None 33 | * @retval None 34 | */ 35 | void SysTick_Handler(void) 36 | { 37 | HAL_IncTick(); 38 | HAL_SYSTICK_IRQHandler(); 39 | #ifdef USE_RTOS_SYSTICK 40 | osSystickHandler(); 41 | #endif 42 | } 43 | -------------------------------------------------------------------------------- /src/src/stm32l0xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file Templates/Inc/stm32l0xx_it.h 4 | * @author MCD Application Team 5 | * @version V1.5.0 6 | * @date 8-January-2016 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2016 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32L0xx_IT_H 40 | #define __STM32L0xx_IT_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | /* Exported types ------------------------------------------------------------*/ 48 | /* Exported constants --------------------------------------------------------*/ 49 | /* Exported macro ------------------------------------------------------------*/ 50 | /* Exported functions ------------------------------------------------------- */ 51 | 52 | void NMI_Handler(void); 53 | void HardFault_Handler(void); 54 | void SVC_Handler(void); 55 | void DebugMon_Handler(void); 56 | void PendSV_Handler(void); 57 | void SysTick_Handler(void); 58 | 59 | #ifdef __cplusplus 60 | } 61 | #endif 62 | 63 | #endif /* __STM32L0xx_IT_H */ 64 | 65 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 66 | -------------------------------------------------------------------------------- /zNetMonitor/README.md: -------------------------------------------------------------------------------- 1 | How to build and install server module and Android app: 2 | 3 | 1. On the build host: 4 | - Install and setup AndroidStudio, import zNetMonitor project 5 | - In the terminal, go to zNetMonitor directory and enter 6 | 7 | > ./gradlew buildServer 8 | 9 | - File znet-server-X.X.jar appears in the _release_ directory. 10 | - Build the app from AndroidStudio 11 | - File znet-monitor-1.1-release.apk appears in the _release_ directory 12 | - Attach Android device via USB and install the app 13 | 14 | > adb install release/znet-monitor-1.1-release.apk 15 | 16 | 17 | 2. On the CentOS 7 server: 18 | - Ensure that the "FT232 Serial" exists and loaded: 19 | 20 | > lsusb 21 | 22 | 23 | > Bus 001 Device 091: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC 24 | 25 | - Add port 5017 fo the firewall: 26 | 27 | > firewall-cmd --zone=internal --add-port=5017/tcp --permanent 28 | 29 | > firewall-cmd --reload 30 | 31 | > firewall-cmd --list-all-zones 32 | 33 | - Copy znet ADE (release directory) that includes: znet-server-X.X.jar, znet.cfg, librxtxSerial.so library, startup.sh file 34 | - As root, run startup.sh 35 | -------------------------------------------------------------------------------- /zNetMonitor/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | buildToolsVersion "29.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.mkulesh.znet" 9 | minSdkVersion 14 10 | targetSdkVersion 29 11 | versionCode 3 12 | versionName "1.2" 13 | setProperty("archivesBaseName", "znet-monitor-" + versionName) 14 | } 15 | 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 20 | } 21 | } 22 | } 23 | 24 | dependencies { 25 | implementation project(':common') 26 | implementation 'androidx.appcompat:appcompat:1.1.0' 27 | } 28 | -------------------------------------------------------------------------------- /zNetMonitor/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/andrey/Android/Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 22 | 23 | 24 | 25 | 33 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/convert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | find . -name "*.svg" -exec ./convert_file.sh {} \; 4 | 5 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/convert_file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo Converting to ${1} to plains SVG 4 | inkscape --vacuum-defs --export-plain-svg=${1} ${1} 5 | 6 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_1_bathroom_1_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_1_hall_1_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_1_launge_1_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_1_launge_2_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_1_launge_3_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_1_launge_4_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_1_launge_5_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_1_storeroom_1_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_1_study_1_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_1_study_2_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_2_bathroom_1_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_2_bedroom_1_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_2_bedroom_2_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 36 | 41 | 46 | 50 | 54 | 58 | 62 | 63 | 64 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_2_child1_1_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_2_child1_2_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 36 | 41 | 46 | 50 | 54 | 58 | 62 | 63 | 64 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_2_child2_1_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 36 | 41 | 46 | 50 | 54 | 58 | 62 | 63 | 64 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/assets/floor_2_child2_2_alarm.svg: -------------------------------------------------------------------------------- 1 | 2 | 12 | 14 | 15 | 17 | image/svg+xml 18 | 20 | 21 | 22 | 23 | 25 | 28 | 31 | 32 | 33 | 37 | 40 | 45 | 50 | 54 | 58 | 62 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/java/com/caverock/androidsvg/CSSParseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013 Paul LeBeau, Cave Rock Software Ltd. 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 | package com.caverock.androidsvg; 18 | 19 | /* 20 | * Thrown by the CSS parser if a problem is found while parsing a CSS file. 21 | */ 22 | 23 | class CSSParseException extends Exception 24 | { 25 | CSSParseException(String msg) 26 | { 27 | super(msg); 28 | } 29 | 30 | CSSParseException(String msg, Exception cause) 31 | { 32 | super(msg, cause); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/java/com/caverock/androidsvg/CanvasLegacy.java: -------------------------------------------------------------------------------- 1 | package com.caverock.androidsvg; 2 | 3 | import android.graphics.Canvas; 4 | 5 | import java.lang.reflect.Method; 6 | 7 | /** 8 | * "Aaand it's gone": Canvas#save(int) has been removed from sdk-28, 9 | * so this helper classes uses reflection to access the API on older devices. 10 | */ 11 | @SuppressWarnings("JavaReflectionMemberAccess") 12 | class CanvasLegacy { 13 | static final int MATRIX_SAVE_FLAG; 14 | 15 | private static final Method SAVE; 16 | 17 | static { 18 | try { 19 | MATRIX_SAVE_FLAG = (int) Canvas.class.getField("MATRIX_SAVE_FLAG").get(null); 20 | SAVE = Canvas.class.getMethod("save", int.class); 21 | } catch (Throwable e) { 22 | throw sneakyThrow(e); 23 | } 24 | } 25 | 26 | static void save(Canvas canvas, int saveFlags) { 27 | try { 28 | SAVE.invoke(canvas, saveFlags); 29 | } catch (Throwable e) { 30 | throw sneakyThrow(e); 31 | } 32 | } 33 | 34 | private static RuntimeException sneakyThrow(Throwable t) { 35 | if (t == null) throw new NullPointerException("t"); 36 | return CanvasLegacy.sneakyThrow0(t); 37 | } 38 | 39 | @SuppressWarnings("unchecked") 40 | private static T sneakyThrow0(Throwable t) throws T { 41 | throw (T) t; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/java/com/caverock/androidsvg/LibConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013 Paul LeBeau, Cave Rock Software Ltd. 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 | package com.caverock.androidsvg; 18 | 19 | /** 20 | * Configure debugging on or off. 21 | */ 22 | class LibConfig 23 | { 24 | static final boolean DEBUG = false; 25 | } 26 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/java/com/caverock/androidsvg/SVGParseException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2013 Paul LeBeau, Cave Rock Software Ltd. 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 | package com.caverock.androidsvg; 18 | 19 | import org.xml.sax.SAXException; 20 | 21 | /** 22 | * Thrown by the parser if a problem is found in the SVG file. 23 | */ 24 | 25 | public class SVGParseException extends SAXException 26 | { 27 | SVGParseException(String msg) 28 | { 29 | super(msg); 30 | } 31 | 32 | SVGParseException(String msg, Exception cause) 33 | { 34 | super(msg, cause); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/java/com/mkulesh/znet/Logging.java: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | package com.mkulesh.znet; 17 | 18 | 19 | final class Logging 20 | { 21 | public static void info(Object o, String text) 22 | { 23 | //Log.d("znet", o.getClass().getSimpleName() + ": " + text); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/java/com/mkulesh/znet/MainPagerAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | package com.mkulesh.znet; 17 | 18 | import android.content.Context; 19 | import android.os.Bundle; 20 | import android.util.SparseArray; 21 | import android.view.ViewGroup; 22 | 23 | import java.util.Locale; 24 | 25 | import androidx.annotation.NonNull; 26 | import androidx.fragment.app.Fragment; 27 | import androidx.fragment.app.FragmentManager; 28 | import androidx.fragment.app.FragmentStatePagerAdapter; 29 | 30 | class MainPagerAdapter extends FragmentStatePagerAdapter 31 | { 32 | private final Context context; 33 | private final SparseArray registeredFragments = new SparseArray<>(); 34 | private final int items; 35 | 36 | MainPagerAdapter(final Context context, final FragmentManager fm) 37 | { 38 | super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT); 39 | this.context = context; 40 | this.items = 3; 41 | } 42 | 43 | @Override 44 | @NonNull 45 | public Fragment getItem(int position) 46 | { 47 | switch (position) 48 | { 49 | case 0: case 1: 50 | return prepareFragment(new FloorFragment(), position); 51 | case 2: 52 | return prepareFragment(new ServerFragment(), position); 53 | } 54 | return prepareFragment(new FloorFragment(), position); 55 | } 56 | 57 | private Fragment prepareFragment(Fragment fragment, int position) 58 | { 59 | Bundle args = new Bundle(); 60 | args.putInt(BaseFragment.FRAGMENT_NUMBER, position); 61 | fragment.setArguments(args); 62 | return fragment; 63 | } 64 | 65 | @Override 66 | public int getCount() 67 | { 68 | return items; 69 | } 70 | 71 | @Override 72 | public CharSequence getPageTitle(int position) 73 | { 74 | Locale l = Locale.getDefault(); 75 | switch (position) 76 | { 77 | case 0: 78 | return context.getString(R.string.title_section1).toUpperCase(l); 79 | case 1: 80 | return context.getString(R.string.title_section2).toUpperCase(l); 81 | case 2: 82 | return context.getString(R.string.title_section3).toUpperCase(l); 83 | } 84 | return null; 85 | } 86 | 87 | // Register the fragment when the item is instantiated 88 | @NonNull 89 | @Override 90 | public Object instantiateItem(@NonNull ViewGroup container, int position) 91 | { 92 | Fragment fragment = (Fragment) super.instantiateItem(container, position); 93 | registeredFragments.put(position, fragment); 94 | return fragment; 95 | } 96 | 97 | // Unregister when the item is inactive 98 | @Override 99 | public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) 100 | { 101 | registeredFragments.remove(position); 102 | super.destroyItem(container, position, object); 103 | } 104 | 105 | // Returns the fragment for the position (if instantiated) 106 | Fragment getRegisteredFragment(int position) 107 | { 108 | return registeredFragments.get(position); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/java/com/mkulesh/znet/ServerFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | package com.mkulesh.znet; 17 | 18 | import android.annotation.SuppressLint; 19 | import android.content.SharedPreferences; 20 | import android.os.Bundle; 21 | import android.util.Pair; 22 | import android.view.LayoutInflater; 23 | import android.view.View; 24 | import android.view.ViewGroup; 25 | import android.widget.Button; 26 | import android.widget.EditText; 27 | import android.widget.TextView; 28 | 29 | import androidx.annotation.NonNull; 30 | 31 | public class ServerFragment extends BaseFragment implements View.OnClickListener 32 | { 33 | public ServerFragment() 34 | { 35 | // Empty constructor required for fragment subclasses 36 | } 37 | 38 | @SuppressLint("SetTextI18n") 39 | @Override 40 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) 41 | { 42 | initializeFragment(inflater, container, R.layout.server_fragment); 43 | 44 | final Button buttonServerConnect = rootView.findViewById(R.id.button_server_connect); 45 | buttonServerConnect.setOnClickListener(this); 46 | 47 | ((EditText) rootView.findViewById(R.id.field_server_name)).setText(preferences.getString( 48 | ServerFragment.SERVER_NAME, "supermicro")); 49 | ((EditText) rootView.findViewById(R.id.field_server_port)).setText(Integer.toString(preferences.getInt( 50 | ServerFragment.SERVER_PORT, 5017))); 51 | ((EditText) rootView.findViewById(R.id.field_server_password)).setText(preferences.getString( 52 | ServerFragment.SERVER_PASSWORD, "")); 53 | 54 | update(); 55 | return rootView; 56 | } 57 | 58 | @Override 59 | public void onClick(View v) 60 | { 61 | if (v.getId() == R.id.button_server_connect) 62 | { 63 | final String serverName = ((EditText) rootView.findViewById(R.id.field_server_name)).getText().toString(); 64 | final String serverPortStr = ((EditText) rootView.findViewById(R.id.field_server_port)).getText().toString(); 65 | final int serverPort = Integer.parseInt(serverPortStr); 66 | final String serverPassword = ((EditText) rootView.findViewById(R.id.field_server_password)).getText().toString(); 67 | if (activity.connectToServer(serverName, serverPort, serverPassword)) 68 | { 69 | SharedPreferences.Editor prefEditor = preferences.edit(); 70 | prefEditor.putString(SERVER_NAME, serverName); 71 | prefEditor.putInt(SERVER_PORT, serverPort); 72 | prefEditor.putString(SERVER_PASSWORD, serverPassword); 73 | prefEditor.apply(); 74 | } 75 | } 76 | } 77 | 78 | @Override 79 | public void update() 80 | { 81 | super.update(); 82 | int line = 1; 83 | for (Pair e : activity.getStateManager().getServerState()) 84 | { 85 | ((TextView) rootView.findViewWithTag("SERVER_STATE_KEY_" + line)).setText(e.first); 86 | ((TextView) rootView.findViewWithTag("SERVER_STATE_VALUE_" + line)).setText(e.second); 87 | line++; 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-hdpi/ball_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-hdpi/ball_green.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-hdpi/ball_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-hdpi/ball_red.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-hdpi/ball_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-hdpi/ball_yellow.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-hdpi/divider_horizontal_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-hdpi/divider_horizontal_light.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-hdpi/fan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-hdpi/fan.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-hdpi/harddisk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-hdpi/harddisk.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-hdpi/temperature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-hdpi/temperature.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-ldpi/divider_horizontal_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-ldpi/divider_horizontal_light.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-mdpi/ball_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-mdpi/ball_green.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-mdpi/ball_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-mdpi/ball_red.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-mdpi/ball_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-mdpi/ball_yellow.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-mdpi/divider_horizontal_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-mdpi/divider_horizontal_light.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-mdpi/fan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-mdpi/fan.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-mdpi/harddisk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-mdpi/harddisk.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-mdpi/temperature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-mdpi/temperature.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xhdpi/ball_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xhdpi/ball_green.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xhdpi/ball_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xhdpi/ball_red.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xhdpi/ball_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xhdpi/ball_yellow.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xhdpi/divider_horizontal_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xhdpi/divider_horizontal_light.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xhdpi/fan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xhdpi/fan.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xhdpi/harddisk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xhdpi/harddisk.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xhdpi/temperature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xhdpi/temperature.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxhdpi/ball_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxhdpi/ball_green.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxhdpi/ball_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxhdpi/ball_red.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxhdpi/ball_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxhdpi/ball_yellow.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxhdpi/fan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxhdpi/fan.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxhdpi/harddisk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxhdpi/harddisk.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxhdpi/temperature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxhdpi/temperature.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxxhdpi/ball_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxxhdpi/ball_green.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxxhdpi/ball_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxxhdpi/ball_red.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxxhdpi/ball_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxxhdpi/ball_yellow.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxxhdpi/fan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxxhdpi/fan.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxxhdpi/harddisk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxxhdpi/harddisk.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/drawable-xxxhdpi/temperature.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/app/src/main/res/drawable-xxxhdpi/temperature.png -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 22 | 23 | 33 | 34 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/layout/floor_fragment.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 21 | 22 | 31 | 32 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/layout/info_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 29 | 30 | 39 | 40 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 19 | 20 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/raw/ball_red.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 16 | 18 | image/svg+xml 19 | 21 | 22 | 23 | 24 | 26 | 28 | 32 | 36 | 37 | 39 | 43 | 47 | 48 | 50 | 54 | 58 | 62 | 66 | 70 | 71 | 80 | 90 | 100 | 101 | 104 | 109 | 114 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/raw/convert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | find . -name "*.svg" -exec ./convert_single.sh {} \; 4 | 5 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/raw/convert_file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NAME1=${1%.svg} 4 | TARGET="../drawable-"${2}"/"${NAME1:2}".png" 5 | echo Converting to ${1} to png and plains SVG 6 | inkscape --vacuum-defs --export-plain-svg=${1} ${1} 7 | inkscape --export-png ${TARGET} -w ${3} -h ${3} ${1} 8 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/raw/convert_single.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo Converting ${1} 4 | if [[ ${1} == *"flb_"* ]] 5 | then 6 | echo "Using floating button size"; 7 | ./convert_file.sh ./${1} mdpi 56 8 | ./convert_file.sh ./${1} hdpi 84 9 | ./convert_file.sh ./${1} xhdpi 112 10 | ./convert_file.sh ./${1} xxhdpi 168 11 | else 12 | echo "Using normal button size"; 13 | ./convert_file.sh ./${1} mdpi 24 14 | ./convert_file.sh ./${1} hdpi 36 15 | ./convert_file.sh ./${1} xhdpi 48 16 | ./convert_file.sh ./${1} xxhdpi 72 17 | ./convert_file.sh ./${1} xxxhdpi 96 18 | fi 19 | 20 | 21 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/raw/fan.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 16 | 18 | image/svg+xml 19 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/raw/harddisk.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 16 | 18 | image/svg+xml 19 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/raw/temperature.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 16 | 18 | image/svg+xml 19 | 21 | 22 | 23 | 24 | 26 | 29 | 30 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 23 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 23 | 64dp 24 | 25 | 26 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | #33b5e5 20 | #fff 21 | 22 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 19 | 32dp 20 | 16dp 21 | 16dp 22 | 23 | 16dp 24 | 42dp 25 | 18dp 26 | 18dp 27 | 28 | 29 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | 18 | 19 | Znet Monitor 20 | Floor 1 21 | Floor 2 22 | Server 23 | Settings 24 | Connect 25 | 26 | Can not connect to %s 27 | server not found 28 | Can not open file %s 29 | Not enough memory for plot visualization 30 | 31 | Alarm 32 | Warning 33 | OK 34 | 35 | No signal 36 | Not ready 37 | Low battery 38 | Unknown message 39 | 40 | -------------------------------------------------------------------------------- /zNetMonitor/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 22 | 29 | 30 | 31 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /zNetMonitor/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | jcenter() 5 | maven { 6 | url "https://maven.google.com" 7 | } 8 | google() 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.3.2' 12 | } 13 | } 14 | allprojects { 15 | repositories { 16 | jcenter() 17 | maven { 18 | url "https://maven.google.com" 19 | } 20 | google() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /zNetMonitor/common/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | 3 | version = '1.0' 4 | 5 | sourceCompatibility = "1.7" 6 | targetCompatibility = "1.7" 7 | 8 | dependencies { 9 | } -------------------------------------------------------------------------------- /zNetMonitor/common/common.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /zNetMonitor/common/src/main/java/com/mkulesh/znet/common/AdvancedEncryptionStandard.java: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | package com.mkulesh.znet.common; 17 | 18 | import javax.crypto.Cipher; 19 | import javax.crypto.spec.SecretKeySpec; 20 | 21 | public class AdvancedEncryptionStandard 22 | { 23 | private String encryptionKey; 24 | 25 | public AdvancedEncryptionStandard(String encryptionKey) 26 | { 27 | this.encryptionKey = encryptionKey; 28 | } 29 | 30 | public byte[] encrypt(String plainText) throws Exception 31 | { 32 | Cipher cipher = getCipher(Cipher.ENCRYPT_MODE); 33 | return cipher.doFinal(plainText.getBytes()); 34 | } 35 | 36 | public String decrypt(byte[] encrypted) throws Exception 37 | { 38 | Cipher cipher = getCipher(Cipher.DECRYPT_MODE); 39 | byte[] plainBytes = cipher.doFinal(encrypted); 40 | return new String(plainBytes); 41 | } 42 | 43 | private Cipher getCipher(int cipherMode) throws Exception 44 | { 45 | String encryptionAlgorithm = "AES"; 46 | SecretKeySpec keySpecification = new SecretKeySpec(encryptionKey.getBytes("UTF-8"), encryptionAlgorithm); 47 | Cipher cipher = Cipher.getInstance(encryptionAlgorithm); 48 | cipher.init(cipherMode, keySpecification); 49 | return cipher; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /zNetMonitor/common/src/main/java/com/mkulesh/znet/common/DeviceConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | package com.mkulesh.znet.common; 17 | 18 | import java.util.Locale; 19 | 20 | public class DeviceConfig 21 | { 22 | private final static String SEPARATOR = "\\|"; 23 | 24 | private final int id; 25 | private final String type, model, floor, room, position; 26 | 27 | public DeviceConfig(String cfg) throws Exception 28 | { 29 | String[] tokens = cfg.split(SEPARATOR); 30 | if (tokens.length != Message.Type.DEVICE_CONFIG.getParNumber()) 31 | { 32 | throw new Exception("invalid number of tokens: " + tokens.length); 33 | } 34 | id = Integer.parseInt(tokens[0].trim()); 35 | type = tokens[1].trim(); 36 | model = tokens[2].trim(); 37 | floor = tokens[3].trim(); 38 | room = tokens[4].trim(); 39 | position = tokens[5].trim(); 40 | } 41 | 42 | public DeviceConfig(Message m) throws Exception 43 | { 44 | if (m.getType() != Message.Type.DEVICE_CONFIG) 45 | { 46 | throw new Exception("invalid message type"); 47 | } 48 | id = Integer.parseInt(m.getParameter(0)); 49 | type = m.getParameter(1); 50 | model = m.getParameter(2); 51 | floor = m.getParameter(3); 52 | room = m.getParameter(4); 53 | position = m.getParameter(5); 54 | } 55 | 56 | public Message getDeviceConfigMsg() 57 | { 58 | Message m = new Message(Message.Type.DEVICE_CONFIG); 59 | m.addParameter(Integer.toString(id)); 60 | m.addParameter(type); 61 | m.addParameter(model); 62 | m.addParameter(floor); 63 | m.addParameter(room); 64 | m.addParameter(position); 65 | return m; 66 | } 67 | 68 | public String toString() 69 | { 70 | return "#" + Integer.toString(getId()) + ": " + getType() + "(" + getModel() + "); floor " + getFloor() 71 | + "; room " + getRoom() + "; position " + getPosition(); 72 | } 73 | 74 | public int getId() 75 | { 76 | return id; 77 | } 78 | 79 | public String getType() 80 | { 81 | return type; 82 | } 83 | 84 | private String getModel() 85 | { 86 | return model; 87 | } 88 | 89 | public String getFloor() 90 | { 91 | return floor; 92 | } 93 | 94 | private String getRoom() 95 | { 96 | return room; 97 | } 98 | 99 | private String getPosition() 100 | { 101 | return position; 102 | } 103 | 104 | public String getImageName() 105 | { 106 | final Locale locale = Locale.getDefault(); 107 | return "floor_" + floor.toLowerCase(locale) + "_" + room.toLowerCase(locale) + "_" 108 | + position.toLowerCase(locale); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /zNetMonitor/common/src/main/java/com/mkulesh/znet/common/Utils.java: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | package com.mkulesh.znet.common; 17 | 18 | import java.text.DecimalFormat; 19 | import java.text.DecimalFormatSymbols; 20 | 21 | public class Utils 22 | { 23 | 24 | /** 25 | * Converts a byte array to a hexadecimal string representation 26 | */ 27 | static public String bb2hex(byte[] buffer) 28 | { 29 | String result = ""; 30 | for (byte b : buffer) 31 | { 32 | result = result + String.format("%02X ", b); 33 | } 34 | return result; 35 | } 36 | 37 | public static DecimalFormat getDecimalFormat(String format) 38 | { 39 | DecimalFormat df = new DecimalFormat(format); 40 | DecimalFormatSymbols dfs = new DecimalFormatSymbols(); 41 | dfs.setDecimalSeparator('.'); 42 | dfs.setExponentSeparator("e"); 43 | df.setDecimalFormatSymbols(dfs); 44 | return df; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /zNetMonitor/gradle.properties: -------------------------------------------------------------------------------- 1 | android.enableJetifier=true 2 | android.useAndroidX=true 3 | org.gradle.jvmargs=-Xmx1536M 4 | -------------------------------------------------------------------------------- /zNetMonitor/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /zNetMonitor/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Dec 18 13:00:12 CET 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /zNetMonitor/release/librxtxSerial.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/release/librxtxSerial.so -------------------------------------------------------------------------------- /zNetMonitor/release/startup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | 3 | setenv LD_LIBRARY_PATH . 4 | rm -f /var/lock/LCK..ttyS4 5 | java -jar znet-server-1.2.jar 6 | 7 | -------------------------------------------------------------------------------- /zNetMonitor/release/znet.cfg: -------------------------------------------------------------------------------- 1 | # general configuration 2 | serialPort = /dev/ttyUSB0 3 | serialPortSpeed = 2000000 4 | networkInterface = enp5s0f0 5 | clientAppPort = 5017 6 | heartbitInterval = 1000 7 | loginWaitingTime = 5 8 | password = 9 | 10 | # sensor on the first floor 11 | # Id | Type | Model | Floor | Room | Position 12 | sensor1 = 11 | Window sensor | KMA-WS-1.1 | 1 | room1 | 1 13 | sensor2 = 10 | Window sensor | KMA-WS-1.1 | 1 | room1 | 2 14 | sensor3 = 12 | Window sensor | KMA-WS-1.1 | 1 | room1 | 3 15 | sensor4 = 13 | Window sensor | KMA-WS-1.1 | 1 | room1 | 4 16 | sensor5 = 15 | Window sensor | KMA-WS-1.1 | 1 | room1 | 5 17 | sensor6 = 14 | Window sensor | KMA-WS-1.1 | 1 | room2 | 1 18 | sensor7 = 16 | Window sensor | KMA-WS-1.1 | 1 | room3 | 1 19 | sensor8 = 17 | Window sensor | KMA-WS-1.1 | 1 | room4 | 1 20 | sensor9 = 18 | Window sensor | KMA-WS-1.1 | 1 | room4 | 2 21 | sensor10 = 19 | Window sensor | KMA-WS-1.1 | 1 | room4 | 3 22 | 23 | # sensors on the second floor 24 | # Id | Type | Model | Floor | Room | Position 25 | sensor11 = 5 | Window sensor | KMA-WS-1.1 | 2 | room1 | 1 26 | sensor12 = 8 | Window sensor | KMA-WS-1.1 | 2 | room1 | 2 27 | sensor13 = 6 | Window sensor | KMA-WS-1.1 | 2 | room1 | 3 28 | sensor14 = 7 | Window sensor | KMA-WS-1.1 | 2 | room2 | 1 29 | sensor15 = 9 | Window sensor | KMA-WS-1.1 | 2 | room2 | 2 30 | sensor16 = 3 | Window sensor | KMA-WS-1.1 | 2 | room3 | 1 31 | sensor17 = 4 | Window sensor | KMA-WS-1.1 | 2 | room3 | 2 32 | 33 | # server sensors 34 | serverSensorID = CPU SoC Temp | FAN 2 | FAN 3 35 | 36 | # disk space configuration 37 | diskSpacePath = / | /work | /Multimedia 38 | diskSpaceLabel = root | work | multimedia 39 | 40 | -------------------------------------------------------------------------------- /zNetMonitor/server/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | 3 | version = '1.2' 4 | 5 | sourceCompatibility = 1.8 6 | targetCompatibility = 1.8 7 | 8 | task createJar(type: Jar) { 9 | manifest { 10 | attributes 'Implementation-Title': 'zNetServer', 11 | 'Implementation-Version': version, 12 | 'Main-Class': 'com.mkulesh.znet.Application' 13 | } 14 | baseName = 'znet-server' 15 | from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } 16 | with jar 17 | } 18 | 19 | task copyJar(type: Copy) { 20 | from createJar // shortcut for createJar.outputs.files 21 | into "${buildDir}/../../release" 22 | } 23 | 24 | task buildServer(dependsOn: [clean, copyJar]) 25 | 26 | dependencies { 27 | compile project(':common') 28 | compile fileTree(dir: 'libs', include: ['*.jar']) 29 | } 30 | -------------------------------------------------------------------------------- /zNetMonitor/server/libs/RXTXcomm.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mkulesh/stm32WindowSensor/c20716d8380f1971b13351cdb8e1448e23647136/zNetMonitor/server/libs/RXTXcomm.jar -------------------------------------------------------------------------------- /zNetMonitor/server/server.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /zNetMonitor/server/src/main/java/com/mkulesh/znet/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | package com.mkulesh.znet; 17 | 18 | import com.mkulesh.znet.common.CustomLogger; 19 | import com.mkulesh.znet.common.DeviceState; 20 | import com.mkulesh.znet.network.ClientAppManager; 21 | import com.mkulesh.znet.network.IdGenerator; 22 | import com.mkulesh.znet.serial.MessageHandler; 23 | import com.mkulesh.znet.serial.SerialCommunication; 24 | 25 | import java.util.logging.Level; 26 | import java.util.logging.Logger; 27 | 28 | public class Application 29 | { 30 | public static void main(String[] args) 31 | { 32 | final CustomLogger cLogger = new CustomLogger(Config.LOGFILE_NAME, Config.LOGFILE_SIZE); 33 | final Logger logger = cLogger.getLogger(); 34 | 35 | logger.log(Level.INFO, "znet server started", CustomLogger.ADD_TO_CONSOLE); 36 | Config.loadConfiguration(logger); 37 | 38 | final StateManager stateManager = new StateManager(logger); 39 | 40 | MessageHandler messageHandler = new MessageHandler(logger, stateManager); 41 | 42 | SerialCommunication serialCommunication; 43 | try 44 | { 45 | serialCommunication = new SerialCommunication(logger, messageHandler); 46 | serialCommunication.printAvailablePorts(); 47 | } 48 | catch (Exception | UnsatisfiedLinkError e) 49 | { 50 | serialCommunication = null; 51 | logger.log(Level.SEVERE, "can not initialize znet port", e); 52 | } 53 | 54 | try 55 | { 56 | stateManager.readConfigurationFile(Config.getSensors()); 57 | for (DeviceState d : stateManager.getDevices().values()) 58 | { 59 | logger.info(d.getConfig().toString()); 60 | } 61 | } 62 | catch (Exception e) 63 | { 64 | logger.log(Level.SEVERE, "can not read configuration", e); 65 | } 66 | 67 | IdGenerator.reset(); 68 | 69 | final ClientAppManager clientAppManager = new ClientAppManager(logger, stateManager, Config.getNetworkInterface(), 70 | Config.getClientAppPort()); 71 | stateManager.setClientAppManager(clientAppManager); 72 | clientAppManager.start(); 73 | stateManager.start(); 74 | if (serialCommunication != null) 75 | { 76 | serialCommunication.start(); 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /zNetMonitor/server/src/main/java/com/mkulesh/znet/network/ClientAppManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | package com.mkulesh.znet.network; 17 | 18 | import com.mkulesh.znet.StateManager; 19 | import com.mkulesh.znet.common.CustomLogger; 20 | 21 | import java.io.IOException; 22 | import java.net.InetSocketAddress; 23 | import java.nio.channels.ServerSocketChannel; 24 | import java.util.HashMap; 25 | import java.util.logging.Level; 26 | import java.util.logging.Logger; 27 | 28 | public class ClientAppManager extends ConnectionManager 29 | { 30 | private final HashMap clients = new HashMap<>(); 31 | 32 | public ClientAppManager(Logger logger, StateManager stateManager, String networkInterface, int port) 33 | { 34 | super(logger, stateManager, networkInterface, port); 35 | } 36 | 37 | public HashMap getClients() 38 | { 39 | return clients; 40 | } 41 | 42 | @Override 43 | public void run() 44 | { 45 | ServerSocketChannel listener = null; 46 | try 47 | { 48 | listener = ServerSocketChannel.open(); 49 | listener.bind(new InetSocketAddress(port)); 50 | logger.log(Level.INFO, "client network service " + getIPAddress() + ":" + Integer.toString(port) + " is ready", 51 | CustomLogger.ADD_TO_CONSOLE); 52 | while (true) 53 | { 54 | ClientAppCommThread client = new ClientAppCommThread(logger, this, listener.accept(), 55 | IdGenerator.generateId()); 56 | logger.info(client.toString() + ": connection established"); 57 | onClientConnected(client); 58 | client.start(); 59 | } 60 | } 61 | catch (IOException e) 62 | { 63 | logger.log(Level.SEVERE, "can not open TCP/IP port " + port, e); 64 | } 65 | if (listener != null) 66 | { 67 | try 68 | { 69 | listener.close(); 70 | } 71 | catch (IOException e) 72 | { 73 | // nothing to do 74 | } 75 | } 76 | } 77 | 78 | private void onClientConnected(ClientAppCommThread client) 79 | { 80 | synchronized (clients) 81 | { 82 | clients.put(client.getClientId(), client); 83 | logger.info("there are " + clients.size() + " active connection(s)"); 84 | } 85 | if (stateManager != null) 86 | { 87 | stateManager.sendConfiguration(client); 88 | stateManager.sendDeviceState(client); 89 | } 90 | } 91 | 92 | void onClientDisconnected(ClientAppCommThread client) 93 | { 94 | synchronized (clients) 95 | { 96 | clients.remove(client.getClientId()); 97 | logger.info("there are " + clients.size() + " active connection(s)"); 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /zNetMonitor/server/src/main/java/com/mkulesh/znet/network/ConnectionManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | package com.mkulesh.znet.network; 17 | 18 | import com.mkulesh.znet.StateManager; 19 | 20 | import java.net.Inet4Address; 21 | import java.net.InetAddress; 22 | import java.net.NetworkInterface; 23 | import java.net.SocketException; 24 | import java.util.Enumeration; 25 | import java.util.logging.Level; 26 | import java.util.logging.Logger; 27 | 28 | class ConnectionManager implements Runnable 29 | { 30 | final Logger logger; 31 | final StateManager stateManager; 32 | private final String networkInterface; 33 | final int port; 34 | private Thread thread = null; 35 | 36 | ConnectionManager(Logger logger, StateManager stateManager, String networkInterface, int port) 37 | { 38 | this.logger = logger; 39 | this.stateManager = stateManager; 40 | this.networkInterface = networkInterface; 41 | this.port = port; 42 | thread = new Thread(this, this.getClass().getSimpleName()); 43 | } 44 | 45 | public void start() 46 | { 47 | thread.start(); 48 | } 49 | 50 | @Override 51 | public void run() 52 | { 53 | 54 | } 55 | 56 | InetAddress getIPAddress() 57 | { 58 | try 59 | { 60 | Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); 61 | while (interfaces.hasMoreElements()) 62 | { 63 | NetworkInterface in = interfaces.nextElement(); 64 | if (networkInterface.equals(in.getName())) 65 | { 66 | Enumeration addresses = in.getInetAddresses(); 67 | while (addresses.hasMoreElements()) 68 | { 69 | InetAddress add = addresses.nextElement(); 70 | if (add instanceof Inet4Address && !add.isLoopbackAddress()) 71 | { 72 | return add; 73 | } 74 | } 75 | } 76 | } 77 | } 78 | catch (SocketException e) 79 | { 80 | logger.log(Level.SEVERE, "can not access network interfaces", e); 81 | } 82 | 83 | return null; 84 | } 85 | 86 | StateManager getStateManager() 87 | { 88 | return stateManager; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /zNetMonitor/server/src/main/java/com/mkulesh/znet/network/IdGenerator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | package com.mkulesh.znet.network; 17 | 18 | import java.util.concurrent.atomic.AtomicInteger; 19 | 20 | /** 21 | * Generate a value suitable for use in setId(int). This value will not collide with ID values generated at 22 | * build time by aapt for R.id. 23 | */ 24 | public class IdGenerator 25 | { 26 | private static final int INITIAL_VALUE = 1; 27 | private static final AtomicInteger sNextGeneratedId = new AtomicInteger(INITIAL_VALUE); 28 | public static void reset() 29 | { 30 | set(INITIAL_VALUE); 31 | } 32 | 33 | private static void set(int i) 34 | { 35 | sNextGeneratedId.set(i + 1); 36 | } 37 | 38 | static int generateId() 39 | { 40 | for (; ; ) 41 | { 42 | final int result = sNextGeneratedId.get(); 43 | // aapt-generated IDs have the high byte nonzero; clamp to the range under that. 44 | int newValue = result + 1; 45 | if (newValue > 0x00FFFFFF) 46 | newValue = INITIAL_VALUE; // Roll over to 1, not 0. 47 | if (sNextGeneratedId.compareAndSet(result, newValue)) 48 | { 49 | return result; 50 | } 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /zNetMonitor/server/src/main/java/com/mkulesh/znet/serial/MessageHandlerIf.java: -------------------------------------------------------------------------------- 1 | /* 2 | * stm32WindowSensor: RF window sensors: STM32L + RFM69 + Android 3 | * 4 | * Copyright (C) 2019. Mikhail Kulesh 5 | * 6 | * This program is free software: you can redistribute it and/or modify it under the terms of the GNU 7 | * General Public License as published by the Free Software Foundation, either version 3 of the License, 8 | * or (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 11 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. You should have received a copy of the GNU General 13 | * Public License along with this program. 14 | */ 15 | 16 | package com.mkulesh.znet.serial; 17 | 18 | public interface MessageHandlerIf 19 | { 20 | void connected(); 21 | 22 | void handle(final String data); 23 | 24 | void disconnected(); 25 | } 26 | -------------------------------------------------------------------------------- /zNetMonitor/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':common', ':server', ':app' -------------------------------------------------------------------------------- /zNetMonitor/zNetMonitor.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | --------------------------------------------------------------------------------