├── .gitattributes ├── bin └── flash_4M.bin ├── data ├── favicon.png ├── log.html ├── shutter.html ├── index.html ├── system.html ├── scripts.js └── style.css ├── pcb ├── Schematic.pdf ├── Gerber_PCB.zip └── README.md ├── pictures ├── Home.PNG ├── Log.PNG ├── pcb.jpg ├── Shutter.PNG ├── System.PNG └── device.jpg ├── Somfy_MQTT.ino.nodemcu.bin ├── Somfy_Remote.h ├── helpers.h ├── README.md ├── Somfy_Remote.cpp ├── ELECHOUSE_CC1101_RCS_DRV.h ├── html_api.h ├── global.h ├── ELECHOUSE_CC1101_RCS_DRV.cpp ├── Somfy_MQTT.ino └── LICENSE.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /bin/flash_4M.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supermomo31/Somfy_MQTT/HEAD/bin/flash_4M.bin -------------------------------------------------------------------------------- /data/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supermomo31/Somfy_MQTT/HEAD/data/favicon.png -------------------------------------------------------------------------------- /pcb/Schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supermomo31/Somfy_MQTT/HEAD/pcb/Schematic.pdf -------------------------------------------------------------------------------- /pictures/Home.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supermomo31/Somfy_MQTT/HEAD/pictures/Home.PNG -------------------------------------------------------------------------------- /pictures/Log.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supermomo31/Somfy_MQTT/HEAD/pictures/Log.PNG -------------------------------------------------------------------------------- /pictures/pcb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supermomo31/Somfy_MQTT/HEAD/pictures/pcb.jpg -------------------------------------------------------------------------------- /pcb/Gerber_PCB.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supermomo31/Somfy_MQTT/HEAD/pcb/Gerber_PCB.zip -------------------------------------------------------------------------------- /pictures/Shutter.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supermomo31/Somfy_MQTT/HEAD/pictures/Shutter.PNG -------------------------------------------------------------------------------- /pictures/System.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supermomo31/Somfy_MQTT/HEAD/pictures/System.PNG -------------------------------------------------------------------------------- /pictures/device.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supermomo31/Somfy_MQTT/HEAD/pictures/device.jpg -------------------------------------------------------------------------------- /pcb/README.md: -------------------------------------------------------------------------------- 1 | You can also use EasyEda with my project : https://easyeda.com/n.morreale/somfy-esp8266 -------------------------------------------------------------------------------- /Somfy_MQTT.ino.nodemcu.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/supermomo31/Somfy_MQTT/HEAD/Somfy_MQTT.ino.nodemcu.bin -------------------------------------------------------------------------------- /Somfy_Remote.h: -------------------------------------------------------------------------------- 1 | /* 2 | This library is based on the Arduino sketch by Nickduino: https://github.com/Nickduino/Somfy_Remote 3 | */ 4 | 5 | #ifndef SOMFY_REMOTE 6 | #define SOMFY_REMOTE 7 | 8 | #include 9 | #include "ELECHOUSE_CC1101_RCS_DRV.h" 10 | 11 | class SomfyRemote 12 | { 13 | private: 14 | String _name; 15 | uint32_t _remoteCode; 16 | uint32_t _rollingCode; 17 | byte _eepromAddress; 18 | 19 | void buildFrame(uint8_t *frame, uint8_t command); 20 | void sendCommand(uint8_t *frame, uint8_t sync); 21 | void sendBit(bool value); 22 | uint32_t getRollingCode(); 23 | 24 | public: 25 | SomfyRemote(String name, uint32_t remoteCode, byte eepromAddress); // Constructor requires name and remote code 26 | String getName(); // Getter for name 27 | void move(String command); // Method to send a command (Possible inputs: UP, DOWN, MY, PROGRAM) 28 | }; 29 | #endif 30 | -------------------------------------------------------------------------------- /data/log.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Jarolift Wifi Dongle 6 | 7 | 8 | 9 | 10 | 11 | 18 | 19 | 20 | 21 |
22 | 23 |
24 | 25 |
26 | Home 27 | System 28 | Shutter 29 | Log 30 |
31 |
32 | 33 | 34 |
35 |
36 |
Wifi Dongle - Eventlog
37 |
This eventlog contains a log history of the last events coming from serial output. Its refreshing every 3 seconds.
38 |
39 | 40 |
41 | 42 |
43 |
44 | 45 | -------------------------------------------------------------------------------- /data/shutter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Jarolift Wifi Dongle 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 18 | 19 |
20 | 21 |
22 | 23 |
24 | Home 25 | System 26 | Shutter 27 | Log 28 |
29 |
30 | 31 | 32 |
33 |
34 |
Wifi Dongle - SOMFY Control
35 |
36 | Each shutter channel has to be configured before it will be displayed in the list below. 37 | Please click configure shutter in order to name each shutter channel.
38 |
39 |
40 |
41 |
42 | 43 | -------------------------------------------------------------------------------- /helpers.h: -------------------------------------------------------------------------------- 1 | /* Controlling Jarolift TDEF 433MHZ radio shutters via ESP8266 and CC1101 Transceiver Module in asynchronous mode. 2 | Copyright (C) 2017-2018 Steffen Hille et al. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #ifndef HELPERS_H 19 | #define HELPERS_H 20 | 21 | 22 | 23 | 24 | //#################################################################### 25 | // Check if the Value is between 0-255 26 | //#################################################################### 27 | boolean checkRange(String Value) 28 | { 29 | if (Value.toInt() < 0 || Value.toInt() > 255) 30 | { 31 | return false; 32 | } 33 | else 34 | { 35 | return true; 36 | } 37 | } // boolean checkRange 38 | 39 | 40 | //#################################################################### 41 | void WriteStringToEEPROM(int beginaddress, String string) 42 | { 43 | char charBuf[string.length() + 1]; 44 | string.toCharArray(charBuf, string.length() + 1); 45 | for (int t = 0; t < sizeof(charBuf); t++) 46 | { 47 | EEPROM.write(beginaddress + t, charBuf[t]); 48 | } 49 | } // void WriteStringToEEPROM 50 | 51 | //#################################################################### 52 | String ReadStringFromEEPROM(int beginaddress, int MaxLen) 53 | { 54 | byte counter = 0; 55 | char rChar; 56 | String retString = ""; 57 | while (1) 58 | { 59 | rChar = EEPROM.read(beginaddress + counter); 60 | if (rChar == 0) break; 61 | if (counter > MaxLen) break; 62 | counter++; 63 | retString.concat(rChar); 64 | 65 | } 66 | return retString; 67 | } // String ReadStringFromEEPROM 68 | 69 | //#################################################################### 70 | void EEPROMWritelong(int address, long value) 71 | { 72 | byte four = (value & 0xFF); 73 | byte three = ((value >> 8) & 0xFF); 74 | byte two = ((value >> 16) & 0xFF); 75 | byte one = ((value >> 24) & 0xFF); 76 | 77 | // Write the 4 bytes into the eeprom memory. 78 | EEPROM.write(address, four); 79 | EEPROM.write(address + 1, three); 80 | EEPROM.write(address + 2, two); 81 | EEPROM.write(address + 3, one); 82 | } // void EEPROMWritelong 83 | 84 | //#################################################################### 85 | long EEPROMReadlong(long address) 86 | { 87 | // Read the 4 bytes from the eeprom memory. 88 | long four = EEPROM.read(address); 89 | long three = EEPROM.read(address + 1); 90 | long two = EEPROM.read(address + 2); 91 | long one = EEPROM.read(address + 3); 92 | 93 | // Return the recomposed long by using bitshift. 94 | return ((four << 0) & 0xFF) + ((three << 8) & 0xFFFF) + ((two << 16) & 0xFFFFFF) + ((one << 24) & 0xFFFFFFFF); 95 | } // long EEPROMReadlong 96 | 97 | //#################################################################### 98 | // convert a single hex digit character to its integer value (from https://code.google.com/p/avr-netino/) 99 | //#################################################################### 100 | unsigned char h2int(char c) 101 | { 102 | if (c >= '0' && c <= '9') { 103 | return ((unsigned char)c - '0'); 104 | } 105 | if (c >= 'a' && c <= 'f') { 106 | return ((unsigned char)c - 'a' + 10); 107 | } 108 | if (c >= 'A' && c <= 'F') { 109 | return ((unsigned char)c - 'A' + 10); 110 | } 111 | return (0); 112 | } // unsigned char h2int 113 | 114 | //#################################################################### 115 | String urldecode(String input) // (based on https://code.google.com/p/avr-netino/) 116 | { 117 | char c; 118 | String ret = ""; 119 | 120 | for (byte t = 0; t < input.length(); t++) 121 | { 122 | c = input[t]; 123 | if (c == '+') c = ' '; 124 | if (c == '%') { 125 | t++; 126 | c = input[t]; 127 | t++; 128 | c = (h2int(c) << 4) | h2int(input[t]); 129 | } 130 | ret.concat(c); 131 | } 132 | return ret; 133 | } // String urldecode 134 | 135 | #endif 136 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Somfy_MQTT 2 | 3 | Controlling Somfy/Simu RTS 433MHz radio shutters via ESP8266 and CC1101 Transceiver Module. 4 | Experimental version. 5 | Use at your own risk. 6 | 7 | 8 | This version is a fork of Somfy_MQTT in order to make Somfy & Simu RTS protocol work with Message Queuing Telemetry Transport (MQTT) procotol. 9 | MQTT enables communication with several different Smart Home systems like OpenHab, FHEM or Home Assistant. 10 | It is for use with a ECP8266 with a CC1101 module with the library made by LSatan. 11 | All the credits come to madmartin for the excelent User Interface and Nickduino & EinfachArne for Somfy Remote Class. 12 | 13 | ### Cédits 14 | https://github.com/madmartin/Somfy_MQTT 15 | https://github.com/Nickduino/Somfy_Remote 16 | https://github.com/EinfachArne/Somfy_Remote 17 | https://github.com/LSatan/RCSwitch-CC1101-Driver-Lib 18 | 19 | ### Necessary Hardware: 20 | 21 | * a NodeMCU board or similar, based on ESP8266 microcontroller 22 | * a CC1101 Transmitter board 23 | 24 | ### My build 25 | 26 | I desing my own PCB, see /pcb 27 | You can also use EasyEda with my project : https://easyeda.com/n.morreale/somfy-esp8266 28 | 29 | BOM : 30 | - WEMOS D1 Mini Pro : https://www.aliexpress.com/item/32803725174.html?spm=a2g0s.9042311.0.0.53954c4dPuQzfj 31 | - CC1101-433MHz wireless module : https://www.aliexpress.com/item/32260182854.html?spm=a2g0s.9042311.0.0.53954c4dPuQzfj 32 | - RF Coaxial Connectors : https://www.aliexpress.com/item/32836695692.html?spm=a2g0s.9042311.0.0.53954c4dPuQzfj 33 | - 433MHz Antenna : https://www.aliexpress.com/item/32981671438.html?spm=a2g0s.9042311.0.0.53954c4dPuQzfj 34 | - din rial case : https://www.aliexpress.com/item/32917979071.html?spm=a2g0s.9042311.0.0.53954c4dPuQzfj 35 | 36 | ### Compile 37 | 38 | Open the Arduino IDE and open the project .ino file (`Somfy_MQTT.ino`) 39 | Upload to your Hardware 40 | 41 | ### Uploading files to SPIFFS (ESP8266 internal filesystem) 42 | 43 | *ESP8266FS* is a tool which integrates into the Arduino IDE. It adds a 44 | menu item to *Tools* menu for uploading the contents of sketch data 45 | directory into ESP8266 flash file system. 46 | 47 | - Download the [SPIFFS tool](https://github.com/esp8266/arduino-esp8266fs-plugin/releases/download/0.3.0/ESP8266FS-0.3.0.zip) 48 | - In your Arduino sketchbook directory, create `tools` directory if 49 | it doesn't exist yet 50 | - Unpack the tool into `tools` directory (the path will look like 51 | `$HOME/Arduino/tools/ESP8266FS/tool/esp8266fs.jar`) 52 | - Restart Arduino IDE 53 | - Open the Somfy_MQTT sketch 54 | - Make sure you have selected a board, port, and closed Serial Monitor 55 | - Select Tools > ESP8266 Sketch Data Upload. This should start 56 | uploading the files into ESP8266 flash file system. When done, IDE 57 | status bar will display `SPIFFS Image Uploaded` message. 58 | 59 | ### already Compiled firmware 60 | in /bin 61 | to flash it if connected to COM3 : 62 | python esptool.py -b 115200 --port COM3 write_flash --flash_freq 80m 0x000000 flash_4M.bin 63 | 64 | #### Tested on Wemos D1 miniPro 65 | * Board: "NodeMCU 1.0 (ESP-12E Module)" 66 | * Flash Size: "4M (1M SPIFFS)" 67 | * lwIP variant: "v2 Lower Memory" 68 | * CPU Frequency: "80 MHz" 69 | * Upload speed: "115200" 70 | 71 | ### Setup instructions 72 | 73 | The configuration of the Somfy Dongle is stored in the EEPROM memory of the ESP8266. On first initialisation, when no configuration is found, it is initialized with some default values and the Dongle turns on the Admin-Mode. 74 | 75 | In Admin-Mode, the blue LED on the ESP submodule is turned on and the Dongle creates an WLAN-Access-Point with the SSID `Somfy-Dongle`, protectet with the WPA-Passwort `12345678`. Now you have 180 seconds (3 minutes) time to connect to the WLAN Accesspoint and visit the configuration webserver on 76 | 77 | http://192.168.4.1 78 | 79 | Admin-Mode quits after the 180 second timeout or when you restart the Dongle from the configuration webserver. 80 | 81 | If you need the Admin-Mode later, just press the "Reset" button on the NodeMCU module two times within 10 seconds. This double-reset will be detected and the Dongle enters Admin-Mode again, showing this with the blue LED turned on. 82 | 83 | The running Somfy Dongle does some debug output on the serial console. 84 | Console Speed is 115200 Bit/s 85 | 86 | To program a new shutter : 87 | - Long-press the program button of your actual remote until your blind goes up and down slightly 88 | - Send 'PROGRAM' to the simulated remote 89 | The rolling code value is stored in the EEPROM, so that you don't loose count of your rolling code after a reset. 90 | 91 | ### Known issues 92 | 93 | I'm sure many to come... 94 | 95 | ### Contribute 96 | 97 | You can contribute as much as you can. 98 | -------------------------------------------------------------------------------- /data/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | somfy Wifi Dongle 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |
17 | 18 |
19 | Home 20 | System 21 | Shutter 22 | Log 23 |
24 |
25 | 26 | 27 |
28 |
29 |
Somfy Wifi Dongle - Welcome
30 |
31 | 32 |
33 |

General

34 |

35 | This version is a fork of Jarolift_MQTT in order to make Somfy & Simu RTS protocol work with Message Queuing Telemetry Transport (MQTT) procotol. 36 | MQTT enables communication with several different Smart Home systems like OpenHab, FHEM or Home Assistant. 37 | It is for use with a ECP8266 with a CC1101 module with the library made by LSatan. 38 | All the credits come to madmartin for the excelent User Interface and Nickduino & EinfachArne for Somfy Remote Class. 39 |
40 | All the code may not be clean, feel free to make it gretter here. 41 |

42 |

MQTT topic structure

43 |

44 | This version uses MQTT topics with the following parts, combined by "/" characters: 45 |

    46 |
  • command type prefix: one of "cmd", "tele", "stat".
  • 47 |
  • identifying device name - can be configured. default: "somfy".
  • 48 |
  • fix part: "shutter"
  • 49 |
  • the numeric channel number
  • 50 |

51 |

52 | The MQTT payload for the "cmd" commands are: "UP", "DOWN", "STOP", "SHADE", "SETSHADE" and "LEARN". 53 | All MQTT topics and commands are case sensitive, use them exactly as described here.

54 |

55 |

example MQTT topics to send commands to the Wifi Dongle:

56 |

57 |

 58 |   cmd/somfy/shutter/0 UP
 59 |   cmd/somfy/shutter/4 DOWN
 60 |   cmd/somfy/shutter/2 STOP
 61 |   cmd/somfy/shutter/6 SHADE
 62 |   cmd/somfy/shutter/12 SETSHADE
 63 |   cmd/somfy/shutter/12 LEARN
64 |

65 |

66 |

MQTT topics send back with the updated status of a shutter:

67 | The status of a shutter is: 68 |

69 |

    70 |
  • 0 - open
  • 71 |
  • 90 - shade position
  • 72 |
  • 100 - close
  • 73 |
74 |
 75 |   stat/somfy/shutter/0 100
76 |

77 |
78 |

Integration into openHAB

79 |

80 | The integration in Smart Home system openHAB is actually pretty easy. Just install a MQTT broker binding and add the following into the item configuration: 81 |

 82 |   Rollershutter shutter1 "shutter1" {mqtt="<[mosquitto:cmd/somfy/shutter/0:command:*:default], >[mosquitto:stat/somfy/shutter/0:state:default]"}
 83 |   Rollershutter shutter2 "shutter2" {mqtt="<[mosquitto:cmd/somfy/shutter/1:command:*:default], >[mosquitto:stat/somfy/shutter/1:state:default]"}
 84 |   Rollershutter shutter3 "shutter3" {mqtt="<[mosquitto:cmd/somfy/shutter/2:command:*:default], >[mosquitto:stat/somfy/shutter/2:state:default]"}
 85 |         
86 |

87 |

Integration into Home Assistant

88 | 89 |

Here is a configuration example for Home Assistant: 90 |

 91 | cover:
 92 |   - platform: mqtt
 93 |     name: "Wohnzimmer links"
 94 |     command_topic: "cmd/somfy/shutter/1"
 95 |     availability_topic: "tele/somfy/LWT"
 96 |     payload_open: "UP"
 97 |     payload_close: "DOWN"
 98 |     payload_stop: "STOP"
 99 |     payload_available: "Online"
100 |     payload_not_available: "Offline"
101 |         

102 | 103 |

104 |
105 | 106 | -------------------------------------------------------------------------------- /Somfy_Remote.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | This library is based on the Arduino sketch by Nickduino: https://github.com/Nickduino/Somfy_Remote 3 | */ 4 | 5 | #include "Somfy_Remote.h" 6 | 7 | const uint16_t symbol = 604; 8 | 9 | uint8_t currentEppromAddress = 0; 10 | uint8_t gdo0Pin; 11 | uint8_t gdo2Pin; 12 | 13 | // Constructor 14 | SomfyRemote::SomfyRemote(String name, uint32_t remoteCode, byte eepromAddress) 15 | { 16 | _name = name; 17 | _remoteCode = remoteCode; 18 | _eepromAddress = eepromAddress; 19 | _rollingCode = getRollingCode(); 20 | } 21 | 22 | // Getter for name 23 | String SomfyRemote::getName() 24 | { 25 | return _name; 26 | } 27 | 28 | // define RollingCode 29 | uint32_t SomfyRemote::getRollingCode() 30 | { 31 | uint32_t rollingCode; 32 | // Set new rolling code if not already set 33 | if (EEPROM.get(_eepromAddress, rollingCode) < 1) 34 | { 35 | rollingCode = 1; 36 | } 37 | return rollingCode; 38 | } 39 | 40 | // Send a command to the blinds 41 | void SomfyRemote::move(String command) 42 | { 43 | const uint8_t up = 0x2; 44 | const uint8_t down = 0x4; 45 | const uint8_t my = 0x1; 46 | const uint8_t prog = 0x8; 47 | 48 | uint8_t frame[7]; 49 | 50 | // Build frame according to selected command 51 | command.toUpperCase(); 52 | 53 | switch (command[0]) 54 | { 55 | case 'U': 56 | buildFrame(frame, up); 57 | break; 58 | case 'D': 59 | buildFrame(frame, down); 60 | break; 61 | case 'M': 62 | buildFrame(frame, my); 63 | break; 64 | case 'P': 65 | buildFrame(frame, prog); 66 | break; 67 | default: 68 | buildFrame(frame, my); 69 | break; 70 | } 71 | 72 | // Send the frame according to Somfy RTS protocol 73 | sendCommand(frame, 2); 74 | for (int i = 0; i < 2; i = i + 1) 75 | { 76 | sendCommand(frame, 7); 77 | } 78 | } 79 | 80 | // Build frame according to Somfy RTS protocol 81 | void SomfyRemote::buildFrame(uint8_t *frame, uint8_t command) 82 | { 83 | uint8_t checksum = 0; 84 | 85 | frame[0] = 0xA7; // Encryption key. 86 | frame[1] = command << 4; // Selected command. The 4 LSB are the checksum 87 | frame[2] = _rollingCode >> 8; // Rolling code (big endian) 88 | frame[3] = _rollingCode; // Rolling code 89 | frame[4] = _remoteCode >> 16; // Remote address 90 | frame[5] = _remoteCode >> 8; // Remote address 91 | frame[6] = _remoteCode; // Remote address 92 | 93 | // Checksum calculation (XOR of all nibbles) 94 | for (uint8_t i = 0; i < 7; i = i + 1) 95 | { 96 | checksum = checksum ^ frame[i] ^ (frame[i] >> 4); 97 | } 98 | checksum &= 0b1111; // Keep the last 4 bits only 99 | 100 | //Checksum integration 101 | frame[1] |= checksum; // If a XOR of all the nibbles is equal to 0, the blinds will 102 | // consider the checksum ok. 103 | 104 | // Obfuscation (XOR of all bytes) 105 | for (uint8_t i = 1; i < 7; i = i + 1) 106 | { 107 | frame[i] ^= frame[i - 1]; 108 | } 109 | 110 | _rollingCode = _rollingCode + 1; 111 | 112 | EEPROM.put(_eepromAddress, _rollingCode); // Store the new value of the rolling code in the EEPROM. 113 | EEPROM.commit(); 114 | } 115 | 116 | // Send frame according to Somfy RTS protocol 117 | void SomfyRemote::sendCommand(uint8_t *frame, uint8_t sync) 118 | { 119 | if (sync == 2) 120 | { // Only with the first frame. 121 | 122 | // Set pins according to module 123 | #if defined __AVR_ATmega168__ || defined __AVR_ATmega328P__ 124 | gdo0Pin = 2; 125 | gdo2Pin = 3; 126 | #elif ESP32 || ESP8266 127 | gdo0Pin = 4; 128 | gdo2Pin = 5; 129 | #endif 130 | 131 | ELECHOUSE_cc1101.setGDO(gdo0Pin, gdo2Pin); 132 | 133 | // Initialize radio chip 134 | ELECHOUSE_cc1101.Init(PA10); 135 | 136 | // Enable transmission at 433.42 MHz 137 | ELECHOUSE_cc1101.SetTx(433.42); 138 | 139 | // Wake-up pulse & Silence 140 | digitalWrite(gdo2Pin, HIGH); // High 141 | delayMicroseconds(9415); 142 | digitalWrite(gdo2Pin, LOW); // Low 143 | delayMicroseconds(89565); 144 | } 145 | 146 | // Hardware sync: two sync for the first frame, seven for the following ones. 147 | for (int i = 0; i < sync; i = i + 1) 148 | { 149 | digitalWrite(gdo2Pin, HIGH); // PIN 2 HIGH 150 | delayMicroseconds(4 * symbol); 151 | digitalWrite(gdo2Pin, LOW); // PIN 2 LOW 152 | delayMicroseconds(4 * symbol); 153 | } 154 | 155 | // Software sync 156 | digitalWrite(gdo2Pin, HIGH); // PIN 2 HIGH 157 | delayMicroseconds(4550); 158 | digitalWrite(gdo2Pin, LOW); // PIN 2 LOW 159 | delayMicroseconds(symbol); 160 | 161 | //Data: bits are sent one by one, starting with the MSB. 162 | for (uint8_t i = 0; i < 56; i = i + 1) 163 | { 164 | if (((frame[i / 8] >> (7 - (i % 8))) & 1) == 1) 165 | { 166 | sendBit(true); 167 | } 168 | else 169 | { 170 | sendBit(false); 171 | } 172 | } 173 | digitalWrite(gdo2Pin, LOW); // PIN 2 LOW 174 | delayMicroseconds(30415); // Inter-frame silence 175 | } 176 | 177 | // Send one bit 178 | void SomfyRemote::sendBit(bool value) 179 | { 180 | uint8_t firstState; 181 | uint8_t secondState; 182 | 183 | // Decide which bit to send (Somfy RTS bits are manchester encoded: 0 = high->low 1 = low->high) 184 | if (value == true) 185 | { 186 | firstState = LOW; 187 | secondState = HIGH; 188 | } 189 | else if (value == false) 190 | { 191 | firstState = HIGH; 192 | secondState = LOW; 193 | } 194 | 195 | // Send the bit 196 | digitalWrite(gdo2Pin, firstState); 197 | delayMicroseconds(symbol); 198 | digitalWrite(gdo2Pin, secondState); 199 | delayMicroseconds(symbol); 200 | } 201 | -------------------------------------------------------------------------------- /ELECHOUSE_CC1101_RCS_DRV.h: -------------------------------------------------------------------------------- 1 | /* 2 | ELECHOUSE_CC1101.cpp - CC1101 module library 3 | Copyright (c) 2010 Michael. 4 | Author: Michael, 5 | Version: November 12, 2010 6 | 7 | This library is designed to use CC1101/CC1100 module on Arduino platform. 8 | CC1101/CC1100 module is an useful wireless module.Using the functions of the 9 | library, you can easily send and receive data by the CC1101/CC1100 module. 10 | Just have fun! 11 | For the details, please refer to the datasheet of CC1100/CC1101. 12 | ---------------------------------------------------------------------------------------------------------------- 13 | cc1101 Driver for RC Switch. Mod by Little Satan. With permission to modify and publish Wilson Shen (ELECHOUSE). 14 | ---------------------------------------------------------------------------------------------------------------- 15 | */ 16 | #ifndef ELECHOUSE_CC1101_RCS_DRV_h 17 | #define ELECHOUSE_CC1101_RCS_DRV_h 18 | 19 | #include 20 | 21 | // Init constants 22 | #define PA10 0x00 23 | #define PA7 0x01 24 | #define PA5 0x02 25 | #define PA0 0x03 26 | #define PA_10 0x04 27 | #define PA_15 0x05 28 | #define PA_20 0x06 29 | #define PA_30 0x07 30 | 31 | //***************************************CC1101 define**************************************************// 32 | // CC1101 CONFIG REGSITER 33 | #define CC1101_IOCFG2 0x00 // GDO2 output pin configuration 34 | #define CC1101_IOCFG1 0x01 // GDO1 output pin configuration 35 | #define CC1101_IOCFG0 0x02 // GDO0 output pin configuration 36 | #define CC1101_FIFOTHR 0x03 // RX FIFO and TX FIFO thresholds 37 | #define CC1101_SYNC1 0x04 // Sync word, high INT8U 38 | #define CC1101_SYNC0 0x05 // Sync word, low INT8U 39 | #define CC1101_PKTLEN 0x06 // Packet length 40 | #define CC1101_PKTCTRL1 0x07 // Packet automation control 41 | #define CC1101_PKTCTRL0 0x08 // Packet automation control 42 | #define CC1101_ADDR 0x09 // Device address 43 | #define CC1101_CHANNR 0x0A // Channel number 44 | #define CC1101_FSCTRL1 0x0B // Frequency synthesizer control 45 | #define CC1101_FSCTRL0 0x0C // Frequency synthesizer control 46 | #define CC1101_FREQ2 0x0D // Frequency control word, high INT8U 47 | #define CC1101_FREQ1 0x0E // Frequency control word, middle INT8U 48 | #define CC1101_FREQ0 0x0F // Frequency control word, low INT8U 49 | #define CC1101_MDMCFG4 0x10 // Modem configuration 50 | #define CC1101_MDMCFG3 0x11 // Modem configuration 51 | #define CC1101_MDMCFG2 0x12 // Modem configuration 52 | #define CC1101_MDMCFG1 0x13 // Modem configuration 53 | #define CC1101_MDMCFG0 0x14 // Modem configuration 54 | #define CC1101_DEVIATN 0x15 // Modem deviation setting 55 | #define CC1101_MCSM2 0x16 // Main Radio Control State Machine configuration 56 | #define CC1101_MCSM1 0x17 // Main Radio Control State Machine configuration 57 | #define CC1101_MCSM0 0x18 // Main Radio Control State Machine configuration 58 | #define CC1101_FOCCFG 0x19 // Frequency Offset Compensation configuration 59 | #define CC1101_BSCFG 0x1A // Bit Synchronization configuration 60 | #define CC1101_AGCCTRL2 0x1B // AGC control 61 | #define CC1101_AGCCTRL1 0x1C // AGC control 62 | #define CC1101_AGCCTRL0 0x1D // AGC control 63 | #define CC1101_WOREVT1 0x1E // High INT8U Event 0 timeout 64 | #define CC1101_WOREVT0 0x1F // Low INT8U Event 0 timeout 65 | #define CC1101_WORCTRL 0x20 // Wake On Radio control 66 | #define CC1101_FREND1 0x21 // Front end RX configuration 67 | #define CC1101_FREND0 0x22 // Front end TX configuration 68 | #define CC1101_FSCAL3 0x23 // Frequency synthesizer calibration 69 | #define CC1101_FSCAL2 0x24 // Frequency synthesizer calibration 70 | #define CC1101_FSCAL1 0x25 // Frequency synthesizer calibration 71 | #define CC1101_FSCAL0 0x26 // Frequency synthesizer calibration 72 | #define CC1101_RCCTRL1 0x27 // RC oscillator configuration 73 | #define CC1101_RCCTRL0 0x28 // RC oscillator configuration 74 | #define CC1101_FSTEST 0x29 // Frequency synthesizer calibration control 75 | #define CC1101_PTEST 0x2A // Production test 76 | #define CC1101_AGCTEST 0x2B // AGC test 77 | #define CC1101_TEST2 0x2C // Various test settings 78 | #define CC1101_TEST1 0x2D // Various test settings 79 | #define CC1101_TEST0 0x2E // Various test settings 80 | 81 | //CC1101 Strobe commands 82 | #define CC1101_SRES 0x30 // Reset chip. 83 | #define CC1101_SFSTXON 0x31 // Enable and calibrate frequency synthesizer (if MCSM0.FS_AUTOCAL=1). 84 | // If in RX/TX: Go to a wait state where only the synthesizer is 85 | // running (for quick RX / TX turnaround). 86 | #define CC1101_SXOFF 0x32 // Turn off crystal oscillator. 87 | #define CC1101_SCAL 0x33 // Calibrate frequency synthesizer and turn it off 88 | // (enables quick start). 89 | #define CC1101_SRX 0x34 // Enable RX. Perform calibration first if coming from IDLE and 90 | // MCSM0.FS_AUTOCAL=1. 91 | #define CC1101_STX 0x35 // In IDLE state: Enable TX. Perform calibration first if 92 | // MCSM0.FS_AUTOCAL=1. If in RX state and CCA is enabled: 93 | // Only go to TX if channel is clear. 94 | #define CC1101_SIDLE 0x36 // Exit RX / TX, turn off frequency synthesizer and exit 95 | // Wake-On-Radio mode if applicable. 96 | #define CC1101_SAFC 0x37 // Perform AFC adjustment of the frequency synthesizer 97 | #define CC1101_SWOR 0x38 // Start automatic RX polling sequence (Wake-on-Radio) 98 | #define CC1101_SPWD 0x39 // Enter power down mode when CSn goes high. 99 | #define CC1101_SFRX 0x3A // Flush the RX FIFO buffer. 100 | #define CC1101_SFTX 0x3B // Flush the TX FIFO buffer. 101 | #define CC1101_SWORRST 0x3C // Reset real time clock. 102 | #define CC1101_SNOP 0x3D // No operation. May be used to pad strobe commands to two 103 | // INT8Us for simpler software. 104 | //CC1101 STATUS REGSITER 105 | #define CC1101_PARTNUM 0x30 106 | #define CC1101_VERSION 0x31 107 | #define CC1101_FREQEST 0x32 108 | #define CC1101_LQI 0x33 109 | #define CC1101_RSSI 0x34 110 | #define CC1101_MARCSTATE 0x35 111 | #define CC1101_WORTIME1 0x36 112 | #define CC1101_WORTIME0 0x37 113 | #define CC1101_PKTSTATUS 0x38 114 | #define CC1101_VCO_VC_DAC 0x39 115 | #define CC1101_TXBYTES 0x3A 116 | #define CC1101_RXBYTES 0x3B 117 | 118 | //CC1101 PATABLE,TXFIFO,RXFIFO 119 | #define CC1101_PATABLE 0x3E 120 | #define CC1101_TXFIFO 0x3F 121 | #define CC1101_RXFIFO 0x3F 122 | 123 | //************************************* class **************************************************// 124 | class ELECHOUSE_CC1101 125 | { 126 | private: 127 | void SpiStart(void); 128 | void SpiEnd(void); 129 | void GDO_Set (void); 130 | void Reset (void); 131 | void SpiWriteReg(byte addr, byte value); 132 | void SpiWriteBurstReg(byte addr, byte *buffer, byte num); 133 | void SpiStrobe(byte strobe); 134 | void SpiReadBurstReg(byte addr, byte *buffer, byte num); 135 | byte SpiReadReg(byte addr); 136 | void RegConfigSettings(byte f); 137 | void setSpi(void); 138 | public: 139 | void Init(void); 140 | void Init(byte f); 141 | void SetRx(void); 142 | void SetTx(void); 143 | void SetRx(float mhz); 144 | void SetTx(float mhz); 145 | void setMHZ(float mhz); 146 | void SendData(byte *txBuffer, byte size); 147 | void setSpiPin(byte sck, byte miso, byte mosi, byte ss); 148 | void setSres(void); 149 | void setGDO(byte gdo0, byte gdo2); 150 | void setChsp(byte Chsp); 151 | void setRxBW(byte RxBW); 152 | void setChannel(byte chnl); 153 | byte CheckReceiveFlag(void); 154 | byte ReceiveData(byte *rxBuffer); 155 | byte SpiReadStatus(byte addr); 156 | 157 | }; 158 | 159 | extern ELECHOUSE_CC1101 ELECHOUSE_cc1101; 160 | 161 | #endif 162 | -------------------------------------------------------------------------------- /html_api.h: -------------------------------------------------------------------------------- 1 | /* Controlling Jarolift TDEF 433MHZ radio shutters via ESP8266 and CC1101 Transceiver Module in asynchronous mode. 2 | Copyright (C) 2017-2018 Steffen Hille et al. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | //#################################################################### 19 | // API call to get data or execute commands via WebIf 20 | //#################################################################### 21 | void html_api() { 22 | if (debug_webui) Serial.printf("html_api server.args()=%d \n", server.args()); 23 | if (server.args() > 0 ) { 24 | // get server args from HTML POST 25 | String cmd = ""; 26 | int channel; 27 | String channel_name = ""; 28 | if (debug_webui) { 29 | for ( uint8_t i = 0; i < server.args(); i++ ) { 30 | Serial.printf("server.argName(%d) == %s\n", i, server.argName(i).c_str()); 31 | Serial.printf(" urldecode: %s\n", urldecode(server.arg(i)).c_str()); 32 | } 33 | } 34 | for ( uint8_t i = 0; i < server.args(); i++ ) { 35 | if (server.argName(i) == "cmd") cmd = urldecode(server.arg(i)); 36 | if (server.argName(i) == "channel") channel = server.arg(i).toInt(); 37 | if (server.argName(i) == "channel_name") channel_name = urldecode(server.arg(i)); 38 | 39 | if (server.argName(i) == "ssid") config.ssid = urldecode(server.arg(i)); 40 | if (server.argName(i) == "password") config.password = urldecode(server.arg(i)); 41 | 42 | if (server.argName(i) == "mqtt_broker_port") config.mqtt_broker_port = urldecode(server.arg(i)); 43 | if (server.argName(i) == "mqtt_broker_client_id") config.mqtt_broker_client_id = urldecode(server.arg(i)); 44 | if (server.argName(i) == "mqtt_broker_username") config.mqtt_broker_username = urldecode(server.arg(i)); 45 | if (server.argName(i) == "mqtt_broker_password") config.mqtt_broker_password = urldecode(server.arg(i)); 46 | if (server.argName(i) == "mqtt_devicetopic") config.mqtt_devicetopic_new = urldecode(server.arg(i)); 47 | 48 | if (server.argName(i) == "ip_0") if (checkRange(server.arg(i))) config.ip[0] = server.arg(i).toInt(); 49 | if (server.argName(i) == "ip_1") if (checkRange(server.arg(i))) config.ip[1] = server.arg(i).toInt(); 50 | if (server.argName(i) == "ip_2") if (checkRange(server.arg(i))) config.ip[2] = server.arg(i).toInt(); 51 | if (server.argName(i) == "ip_3") if (checkRange(server.arg(i))) config.ip[3] = server.arg(i).toInt(); 52 | if (server.argName(i) == "nm_0") if (checkRange(server.arg(i))) config.netmask[0] = server.arg(i).toInt(); 53 | if (server.argName(i) == "nm_1") if (checkRange(server.arg(i))) config.netmask[1] = server.arg(i).toInt(); 54 | if (server.argName(i) == "nm_2") if (checkRange(server.arg(i))) config.netmask[2] = server.arg(i).toInt(); 55 | if (server.argName(i) == "nm_3") if (checkRange(server.arg(i))) config.netmask[3] = server.arg(i).toInt(); 56 | if (server.argName(i) == "gw_0") if (checkRange(server.arg(i))) config.gateway[0] = server.arg(i).toInt(); 57 | if (server.argName(i) == "gw_1") if (checkRange(server.arg(i))) config.gateway[1] = server.arg(i).toInt(); 58 | if (server.argName(i) == "gw_2") if (checkRange(server.arg(i))) config.gateway[2] = server.arg(i).toInt(); 59 | if (server.argName(i) == "gw_3") if (checkRange(server.arg(i))) config.gateway[3] = server.arg(i).toInt(); 60 | 61 | if (server.argName(i) == "mqtt_broker_addr_0") if (checkRange(server.arg(i))) config.mqtt_broker_addr[0] = server.arg(i).toInt(); 62 | if (server.argName(i) == "mqtt_broker_addr_1") if (checkRange(server.arg(i))) config.mqtt_broker_addr[1] = server.arg(i).toInt(); 63 | if (server.argName(i) == "mqtt_broker_addr_2") if (checkRange(server.arg(i))) config.mqtt_broker_addr[2] = server.arg(i).toInt(); 64 | if (server.argName(i) == "mqtt_broker_addr_3") if (checkRange(server.arg(i))) config.mqtt_broker_addr[3] = server.arg(i).toInt(); 65 | 66 | if (server.argName(i) == "dhcp") 67 | config.dhcp = (urldecode(server.arg(i)) == "true"); 68 | } // for 69 | if (cmd != "") { 70 | if (cmd == "eventlog") { 71 | String values = ""; 72 | // web_log_message[] is an array of strings, used as a circular buffer 73 | // web_log_message_nextfree points to the next free-to-use buffer line 74 | // first message in log depends of web_log_message_rotated 75 | // false: first message is entry 0, last is (web_log_message_nextfree-1) 76 | // true: first/oldest message is (web_log_message_nextfree), last is (web_log_message_nextfree-1) 77 | if (web_log_message_rotated) { 78 | int msg_end = web_log_message_nextfree + NUM_WEB_LOG_MESSAGES; 79 | for (int msg_ptr = web_log_message_nextfree; msg_ptr < msg_end; msg_ptr++) { 80 | values += web_log_message[(msg_ptr % NUM_WEB_LOG_MESSAGES)] + "\n"; 81 | } 82 | } else { 83 | for (int msg_ptr = 0; msg_ptr < web_log_message_nextfree; msg_ptr++) { 84 | values += web_log_message[msg_ptr] + "\n"; 85 | } 86 | } 87 | server.send ( 200, "text/plain", values ); 88 | } else if (cmd == "save") { 89 | // handled in main loop 90 | web_cmd = cmd; 91 | } else if (cmd == "restart") { 92 | // handled in main loop 93 | web_cmd = cmd; 94 | } else if (cmd == "get channel name") { 95 | String values = ""; 96 | values += "channel_0=" + config.channel_name[0] + "\n"; 97 | values += "channel_1=" + config.channel_name[1] + "\n"; 98 | values += "channel_2=" + config.channel_name[2] + "\n"; 99 | values += "channel_3=" + config.channel_name[3] + "\n"; 100 | values += "channel_4=" + config.channel_name[4] + "\n"; 101 | values += "channel_5=" + config.channel_name[5] + "\n"; 102 | values += "channel_6=" + config.channel_name[6] + "\n"; 103 | values += "channel_7=" + config.channel_name[7] + "\n"; 104 | values += "channel_8=" + config.channel_name[8] + "\n"; 105 | values += "channel_9=" + config.channel_name[9] + "\n"; 106 | values += "channel_10=" + config.channel_name[10] + "\n"; 107 | values += "channel_11=" + config.channel_name[11] + "\n"; 108 | values += "channel_12=" + config.channel_name[12] + "\n"; 109 | values += "channel_13=" + config.channel_name[13] + "\n"; 110 | values += "channel_14=" + config.channel_name[14] + "\n"; 111 | values += "channel_15=" + config.channel_name[15] + "\n"; 112 | server.send ( 200, "text/plain", values ); 113 | 114 | } else if (cmd == "get config") { 115 | String values = ""; 116 | values += "ssid=" + config.ssid + "\n"; 117 | values += "password=" + config.password + "\n"; 118 | if (config.dhcp) { 119 | values += "checkbox=dhcp=1\n"; 120 | } else { 121 | values += "checkbox=dhcp=0\n"; 122 | } 123 | values += "ip_0=" + (String) config.ip[0] + "\n"; 124 | values += "ip_1=" + (String) config.ip[1] + "\n"; 125 | values += "ip_2=" + (String) config.ip[2] + "\n"; 126 | values += "ip_3=" + (String) config.ip[3] + "\n"; 127 | values += "nm_0=" + (String) config.netmask[0] + "\n"; 128 | values += "nm_1=" + (String) config.netmask[1] + "\n"; 129 | values += "nm_2=" + (String) config.netmask[2] + "\n"; 130 | values += "nm_3=" + (String) config.netmask[3] + "\n"; 131 | values += "gw_0=" + (String) config.gateway[0] + "\n"; 132 | values += "gw_1=" + (String) config.gateway[1] + "\n"; 133 | values += "gw_2=" + (String) config.gateway[2] + "\n"; 134 | values += "gw_3=" + (String) config.gateway[3] + "\n"; 135 | values += "mqtt_broker_addr_0=" + (String) config.mqtt_broker_addr[0] + "\n"; 136 | values += "mqtt_broker_addr_1=" + (String) config.mqtt_broker_addr[1] + "\n"; 137 | values += "mqtt_broker_addr_2=" + (String) config.mqtt_broker_addr[2] + "\n"; 138 | values += "mqtt_broker_addr_3=" + (String) config.mqtt_broker_addr[3] + "\n"; 139 | values += "mqtt_broker_port=" + config.mqtt_broker_port + "\n"; 140 | values += "mqtt_broker_username=" + config.mqtt_broker_username + "\n"; 141 | values += "mqtt_broker_password=" + config.mqtt_broker_password + "\n"; 142 | values += "mqtt_broker_client_id=" + config.mqtt_broker_client_id + "\n"; 143 | values += "mqtt_devicetopic=" + config.mqtt_devicetopic + "\n"; 144 | values += "text=versionstr=Firmware " + String(PROGRAM_VERSION) + "\n"; 145 | server.send ( 200, "text/plain", values ); 146 | 147 | } else if ( cmd == "set channel name") { 148 | if ((channel >= 0) && (channel <= 15)) { 149 | config.channel_name[channel] = channel_name; 150 | WriteConfig(); 151 | String status_text = "Updating channel description to '" + channel_name + "'."; 152 | server.send ( 200, "text/plain", status_text ); 153 | } 154 | } else { 155 | 156 | web_cmd_channel = channel; 157 | web_cmd = cmd; 158 | String status_text = "Running command '" + cmd + "' for channel " + channel + "."; 159 | server.send ( 200, "text/plain", status_text ); 160 | } 161 | 162 | } else { 163 | String status_text = "No command to execute!"; 164 | server.send ( 200, "text/plain", status_text ); 165 | } 166 | delay(100); 167 | } 168 | } // void html_api 169 | -------------------------------------------------------------------------------- /data/system.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Somfy Wifi Dongle 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 | 20 |
21 | 22 |
23 | 24 |
25 | Home 26 | System 27 | Shutter 28 | Log 29 |
30 |
31 | 32 | 33 |
34 | 35 |
36 |
Wifi Dongle - Configuration
37 |
Firmware
38 |
39 |
40 | 41 | 159 |
160 |
161 | 162 | -------------------------------------------------------------------------------- /global.h: -------------------------------------------------------------------------------- 1 | /* Controlling Jarolift TDEF 433MHZ radio shutters via ESP8266 and CC1101 Transceiver Module in asynchronous mode. 2 | Copyright (C) 2017-2018 Steffen Hille et al. 3 | 4 | This program is free software: you can redistribute it and/or modify 5 | it under the terms of the GNU General Public License as published by 6 | the Free Software Foundation, either version 3 of the License, or 7 | (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program. If not, see . 16 | */ 17 | 18 | #ifndef GLOBAL_H 19 | #define GLOBAL_H 20 | 21 | #define PROGRAM_VERSION "v0.1" 22 | 23 | #define ACCESS_POINT_NAME "Somfy-Dongle" // default SSID for Admin-Mode 24 | #define ACCESS_POINT_PASSWORD "12345678" // default WLAN password for Admin-Mode 25 | #define AdminTimeOut 180 // Defines the time in seconds, when the Admin-Mode will be disabled 26 | #define MQTT_Reconnect_Interval 30000 // try connect to MQTT server very X milliseconds 27 | #define NTP_SERVERS "0.pool.ntp.org", "1.pool.ntp.org", "2.pool.ntp.org" // List of up to 3 NTP servers 28 | #define TIMEZONE +1 // difference localtime to UTC/GMT in hours 29 | 30 | struct dstRule StartRule = {"CEST", Last, Sun, Mar, 2, 3600}; // Daylight time 31 | struct dstRule EndRule = {"CET", Last, Sun, Oct, 2, 0}; // Standard time 32 | simpleDSTadjust dstAdjusted(StartRule, EndRule); // Setup simpleDSTadjust Library rules 33 | 34 | ESP8266WebServer server(80); // The Webserver 35 | WiFiClient espClient; 36 | PubSubClient mqtt_client(espClient); // mqtt client instance 37 | long mqttLastConnectAttempt = 0; // timepoint of last connect attempt in milliseconds 38 | WiFiEventHandler gotIpEventHandler, disconnectedEventHandler; 39 | 40 | boolean AdminEnabled = false; // Admin-Mode opens AccessPoint for configuration 41 | int AdminTimeOutCounter = 0; // Counter for Disabling the Admin-Mode 42 | boolean wifi_disconnect_log = true; // Flag to avoid repeated logging of disconnect events 43 | int led_pin = LED_BUILTIN; // GPIO Pin number for LED 44 | Ticker tkHeartBeat; // Timer for HeartBeat 45 | unsigned short devcnt = 0x0; // Initial 16Bit countervalue, stored in EEPROM and incremented once every time a command is send 46 | 47 | String web_cmd = ""; // trigger to run a command whenever a action button has been pressed on the web interface 48 | int web_cmd_channel; // keeps the respective channel ID for the web_cmd 49 | 50 | #define NUM_WEB_LOG_MESSAGES 42 // number of messages in the web-UI log page 51 | String web_log_message[NUM_WEB_LOG_MESSAGES]; 52 | uint16_t web_log_message_nextfree = 0; 53 | boolean web_log_message_rotated = false; 54 | boolean web_log_message_newline = true; 55 | 56 | // boolean settings which will later be configurable through WebUI 57 | boolean debug_mqtt = true; 58 | boolean debug_webui = true; 59 | boolean debug_log_radio_receive_all = false; 60 | boolean mqtt_send_radio_receive_all = true; 61 | 62 | struct strConfig { 63 | uint16_t cfgVersion; 64 | String ssid; 65 | String password; 66 | byte ip[4]; 67 | byte netmask[4]; 68 | byte gateway[4]; 69 | boolean dhcp; 70 | byte mqtt_broker_addr[4]; 71 | String mqtt_broker_port; 72 | String mqtt_broker_client_id; 73 | String mqtt_broker_username; 74 | String mqtt_broker_password; 75 | String mqtt_devicetopic; 76 | String channel_name[16]; 77 | // temporary values, for web ui, not to store in EEPROM 78 | String mqtt_devicetopic_new = ""; // needed to figure out if the devicetopic has been changed 79 | } config; 80 | 81 | 82 | //#################################################################### 83 | // Initalize log message array with empty strings 84 | //#################################################################### 85 | void InitLog() 86 | { 87 | for ( int i = 0; i < NUM_WEB_LOG_MESSAGES; i++ ) { 88 | web_log_message[i] = ""; 89 | } 90 | } // void InitLog 91 | 92 | //#################################################################### 93 | // Function to write Log to both, serial and Weblog 94 | //#################################################################### 95 | void WriteLog(String msg, boolean new_line = false) 96 | { 97 | // web_log_message[] is an array of strings, used as a circular buffer 98 | // web_log_message_nextfree points to the next free-to-use buffer line 99 | // when web_log_message_nextfree becomes larger than NUM_WEB_LOG_MESSAGES, 100 | // it is reset to 0 and web_log_message_rotated=true 101 | // web_log_message_newline indicates whether we are at the beginning of a line or not 102 | 103 | if (web_log_message_newline) { 104 | char *dstAbbrev; 105 | time_t now = dstAdjusted.time(&dstAbbrev); 106 | struct tm * timeinfo = localtime(&now); 107 | char buffer[30]; 108 | strftime (buffer, 30, "%Y-%m-%d %T", timeinfo); 109 | web_log_message[web_log_message_nextfree] = (String)buffer + " " + dstAbbrev + " " + msg; 110 | Serial.print((String)buffer + " " + dstAbbrev + " " + msg); 111 | web_log_message_newline = false; 112 | } else { 113 | web_log_message[web_log_message_nextfree] += " " + msg; 114 | Serial.print(" " + msg); 115 | } 116 | if (new_line == true) { 117 | web_log_message_nextfree++; 118 | if (web_log_message_nextfree >= NUM_WEB_LOG_MESSAGES) { 119 | web_log_message_nextfree = 0; 120 | web_log_message_rotated = true; 121 | } 122 | Serial.println(); 123 | web_log_message_newline = true; 124 | } 125 | } // void WriteLog 126 | 127 | //#################################################################### 128 | // Function to connect to Wifi 129 | //#################################################################### 130 | void ConfigureWifi() 131 | { 132 | WriteLog("[INFO] - WiFi connecting to", false); 133 | WriteLog(config.ssid, true); 134 | WiFi.mode(WIFI_STA); 135 | WiFi.begin (config.ssid.c_str(), config.password.c_str()); 136 | if (!config.dhcp) 137 | { 138 | WiFi.config(IPAddress(config.ip[0], config.ip[1], config.ip[2], config.ip[3] ), IPAddress(config.gateway[0], config.gateway[1], config.gateway[2], config.gateway[3] ) , IPAddress(config.netmask[0], config.netmask[1], config.netmask[2], config.netmask[3] )); 139 | } 140 | wifi_disconnect_log = true; 141 | } // void ConfigureWifi 142 | 143 | //################################################################ 144 | // Function to write newest version of configuration into EEPROM 145 | //################################################################ 146 | void WriteConfig() 147 | { 148 | WriteLog("[INFO] - write config to EEPROM", true); 149 | EEPROM.write(120, 'C'); 150 | EEPROM.write(121, 'f'); 151 | EEPROM.write(122, 'g'); 152 | EEPROM.put(123, config.cfgVersion); 153 | 154 | EEPROM.write(128, config.dhcp); 155 | 156 | EEPROM.write(144, config.ip[0]); 157 | EEPROM.write(145, config.ip[1]); 158 | EEPROM.write(146, config.ip[2]); 159 | EEPROM.write(147, config.ip[3]); 160 | 161 | EEPROM.write(148, config.netmask[0]); 162 | EEPROM.write(149, config.netmask[1]); 163 | EEPROM.write(150, config.netmask[2]); 164 | EEPROM.write(151, config.netmask[3]); 165 | 166 | EEPROM.write(152, config.gateway[0]); 167 | EEPROM.write(153, config.gateway[1]); 168 | EEPROM.write(154, config.gateway[2]); 169 | EEPROM.write(155, config.gateway[3]); 170 | 171 | EEPROM.write(156, config.mqtt_broker_addr[0]); 172 | EEPROM.write(157, config.mqtt_broker_addr[1]); 173 | EEPROM.write(158, config.mqtt_broker_addr[2]); 174 | EEPROM.write(159, config.mqtt_broker_addr[3]); 175 | 176 | WriteStringToEEPROM(164, config.ssid); 177 | WriteStringToEEPROM(196, config.password); 178 | 179 | WriteStringToEEPROM(262, config.mqtt_broker_port); 180 | 181 | WriteStringToEEPROM(375, config.mqtt_broker_client_id); 182 | WriteStringToEEPROM(400, config.mqtt_broker_username); 183 | WriteStringToEEPROM(450, config.mqtt_broker_password); 184 | 185 | WriteStringToEEPROM(500, config.channel_name[0]); 186 | WriteStringToEEPROM(550, config.channel_name[1]); 187 | WriteStringToEEPROM(600, config.channel_name[2]); 188 | WriteStringToEEPROM(650, config.channel_name[3]); 189 | WriteStringToEEPROM(700, config.channel_name[4]); 190 | WriteStringToEEPROM(750, config.channel_name[5]); 191 | WriteStringToEEPROM(800, config.channel_name[6]); 192 | WriteStringToEEPROM(850, config.channel_name[7]); 193 | WriteStringToEEPROM(900, config.channel_name[8]); 194 | WriteStringToEEPROM(950, config.channel_name[9]); 195 | WriteStringToEEPROM(1000, config.channel_name[10]); 196 | WriteStringToEEPROM(1050, config.channel_name[11]); 197 | WriteStringToEEPROM(1100, config.channel_name[12]); 198 | WriteStringToEEPROM(1150, config.channel_name[13]); 199 | WriteStringToEEPROM(1200, config.channel_name[14]); 200 | WriteStringToEEPROM(1250, config.channel_name[15]); 201 | 202 | WriteStringToEEPROM(1300, config.mqtt_devicetopic); 203 | EEPROM.commit(); 204 | delay(1000); 205 | } // void WriteConfig 206 | 207 | //#################################################################### 208 | // Function to read configuration from EEPROM 209 | //#################################################################### 210 | boolean ReadConfig() 211 | { 212 | WriteLog("[INFO] - read config from EEPROM . . .", false); 213 | config.cfgVersion = 0; 214 | 215 | if (EEPROM.read(120) == 'C' && EEPROM.read(121) == 'F' && EEPROM.read(122) == 'G' ) 216 | { 217 | WriteLog("config version 1 found", true); 218 | config.cfgVersion = 1; 219 | } else 220 | { 221 | if (EEPROM.read(120) == 'C' && EEPROM.read(121) == 'f' && EEPROM.read(122) == 'g' ) 222 | { 223 | EEPROM.get(123, config.cfgVersion); 224 | WriteLog("config version " + (String) config.cfgVersion + " found", true); 225 | } 226 | } 227 | if (config.cfgVersion == 0) 228 | { 229 | WriteLog(" no configuration found in EEPROM!!!!", true); 230 | return false; 231 | } 232 | if (config.cfgVersion <= 2) // read config parts up to version 2 233 | { 234 | config.dhcp = EEPROM.read(128); 235 | config.ip[0] = EEPROM.read(144); 236 | config.ip[1] = EEPROM.read(145); 237 | config.ip[2] = EEPROM.read(146); 238 | config.ip[3] = EEPROM.read(147); 239 | config.netmask[0] = EEPROM.read(148); 240 | config.netmask[1] = EEPROM.read(149); 241 | config.netmask[2] = EEPROM.read(150); 242 | config.netmask[3] = EEPROM.read(151); 243 | config.gateway[0] = EEPROM.read(152); 244 | config.gateway[1] = EEPROM.read(153); 245 | config.gateway[2] = EEPROM.read(154); 246 | config.gateway[3] = EEPROM.read(155); 247 | config.mqtt_broker_addr[0] = EEPROM.read(156); 248 | config.mqtt_broker_addr[1] = EEPROM.read(157); 249 | config.mqtt_broker_addr[2] = EEPROM.read(158); 250 | config.mqtt_broker_addr[3] = EEPROM.read(159); 251 | 252 | config.ssid = ReadStringFromEEPROM(164, 32); 253 | config.password = ReadStringFromEEPROM(196, 64); 254 | config.mqtt_broker_port = ReadStringFromEEPROM(262, 6); 255 | 256 | config.mqtt_broker_client_id = ReadStringFromEEPROM(375, 25); 257 | config.mqtt_broker_username = ReadStringFromEEPROM(400, 25); 258 | config.mqtt_broker_password = ReadStringFromEEPROM(450, 25); 259 | 260 | config.channel_name[0] = ReadStringFromEEPROM(500, 25); 261 | config.channel_name[1] = ReadStringFromEEPROM(550, 25); 262 | config.channel_name[2] = ReadStringFromEEPROM(600, 25); 263 | config.channel_name[3] = ReadStringFromEEPROM(650, 25); 264 | config.channel_name[4] = ReadStringFromEEPROM(700, 25); 265 | config.channel_name[5] = ReadStringFromEEPROM(750, 25); 266 | config.channel_name[6] = ReadStringFromEEPROM(800, 25); 267 | config.channel_name[7] = ReadStringFromEEPROM(850, 25); 268 | config.channel_name[8] = ReadStringFromEEPROM(900, 25); 269 | config.channel_name[9] = ReadStringFromEEPROM(950, 25); 270 | config.channel_name[10] = ReadStringFromEEPROM(1000, 25); 271 | config.channel_name[11] = ReadStringFromEEPROM(1050, 25); 272 | config.channel_name[12] = ReadStringFromEEPROM(1100, 25); 273 | config.channel_name[13] = ReadStringFromEEPROM(1150, 25); 274 | config.channel_name[14] = ReadStringFromEEPROM(1200, 25); 275 | config.channel_name[15] = ReadStringFromEEPROM(1250, 25); 276 | } 277 | if (config.cfgVersion == 2) 278 | { // read config parts of version 2 279 | config.mqtt_devicetopic = ReadStringFromEEPROM(1300, 20); 280 | } else 281 | { // upgrade config to version 2 282 | config.mqtt_devicetopic = "somfy"; // default devicetopic 283 | config.cfgVersion = 2; 284 | // clear EEPROM space 285 | for (int index = 120 ; index < 4096 ; index++) { 286 | EEPROM.write(index, 0); 287 | } 288 | WriteLog("[INFO] - config update to version 2 - mqtt_devicetopic set to default", true); 289 | WriteConfig(); 290 | } 291 | return true; 292 | } // boolean ReadConfig 293 | 294 | //############################################################################ 295 | // Function to initialize configuration, either defaults or read from EEPROM 296 | //############################################################################ 297 | void InitializeConfigData() 298 | { 299 | char chipIdString[10]; 300 | sprintf(chipIdString, "-%08x", ESP.getChipId()); 301 | 302 | // apply default config if saved configuration not yet exist 303 | if (!ReadConfig()) 304 | { 305 | // DEFAULT CONFIG 306 | config.cfgVersion = 2; 307 | config.ssid = "MYSSID"; 308 | config.password = "MYPASSWORD"; 309 | config.dhcp = true; 310 | config.ip[0] = 192; config.ip[1] = 168; config.ip[2] = 1; config.ip[3] = 100; 311 | config.netmask[0] = 255; config.netmask[1] = 255; config.netmask[2] = 255; config.netmask[3] = 0; 312 | config.gateway[0] = 192; config.gateway[1] = 168; config.gateway[2] = 1; config.gateway[3] = 1; 313 | config.mqtt_broker_addr[0] = 0; config.mqtt_broker_addr[1] = 0; config.mqtt_broker_addr[2] = 0; config.mqtt_broker_addr[3] = 0; 314 | config.mqtt_broker_port = "1883"; 315 | config.mqtt_broker_client_id = "SomfyDongle"; 316 | config.mqtt_broker_client_id += chipIdString; 317 | config.mqtt_devicetopic = "somfy"; 318 | 319 | for ( int i = 0; i <= 15; i++ ) { 320 | config.channel_name[i] = ""; 321 | } 322 | WriteConfig(); 323 | WriteLog("[INFO] - default config applied", true); 324 | } 325 | 326 | // check if mqtt client-ID needs migration to new unique ID 327 | if (config.mqtt_broker_client_id == "SomfyDongle") { 328 | config.mqtt_broker_client_id += chipIdString; 329 | WriteLog("[INFO] - mqtt_broker_client_id changed to " + config.mqtt_broker_client_id, true); 330 | WriteConfig(); 331 | } 332 | } // void InitializeConfigData 333 | 334 | //#################################################################### 335 | // Callback function for Ticker 336 | //#################################################################### 337 | void Admin_Mode_Timeout() 338 | { 339 | AdminTimeOutCounter++; 340 | } // void Admin_Mode_Timeout 341 | 342 | //#################################################################### 343 | // Callback function for LED HeartBeat 344 | //#################################################################### 345 | boolean highPulse = true; 346 | #define HEART_BEAT_CYCLE 4 // HeartBeat cycle in seconds 347 | void HeartBeat() 348 | { 349 | float pulse_on = 0.05; // LED on for 50 milliseconds in normal mode 350 | float pulse_off = HEART_BEAT_CYCLE - pulse_on; 351 | 352 | if (WiFi.status() != WL_CONNECTED) 353 | { 354 | pulse_on = HEART_BEAT_CYCLE / 2; // LED on for 2 seconds, 2 seconds off while waiting for WiFi connect 355 | pulse_off = pulse_on; 356 | } 357 | 358 | if (AdminEnabled) 359 | { 360 | AdminTimeOutCounter++; 361 | pulse_off = 0.05; 362 | pulse_on = HEART_BEAT_CYCLE - pulse_off; // LED off for 50 milliseconds in admin mode 363 | } 364 | 365 | if (highPulse) 366 | tkHeartBeat.attach(pulse_on, HeartBeat); 367 | else 368 | tkHeartBeat.attach(pulse_off, HeartBeat); 369 | 370 | highPulse = !highPulse; 371 | digitalWrite(led_pin, highPulse); // toogle LED 372 | } // void HeartBeat 373 | 374 | #endif 375 | -------------------------------------------------------------------------------- /data/scripts.js: -------------------------------------------------------------------------------- 1 | "use strict";var iqwerty=iqwerty||{};iqwerty.toast=function(){function t(o,r,i){if(null!==e())t.prototype.toastQueue.push({text:o,options:r,transitions:i});else{t.prototype.Transitions=i||n;var a=r||{};a=t.prototype.mergeOptions(t.prototype.DEFAULT_SETTINGS,a),t.prototype.show(o,a),a=null}}function e(){return i}function o(t){i=t}var r=400,n={SHOW:{"-webkit-transition":"opacity "+r+"ms, -webkit-transform "+r+"ms",transition:"opacity "+r+"ms, transform "+r+"ms",opacity:"1","-webkit-transform":"translateY(-100%) translateZ(0)",transform:"translateY(-100%) translateZ(0)"},HIDE:{opacity:"0","-webkit-transform":"translateY(150%) translateZ(0)",transform:"translateY(150%) translateZ(0)"}},i=null;return t.prototype.DEFAULT_SETTINGS={style:{main:{background:"rgba(0, 0, 0, .85)","box-shadow":"0 0 10px rgba(0, 0, 0, .8)","border-radius":"3px","z-index":"99999",color:"rgba(255, 255, 255, .9)",padding:"10px 15px","max-width":"60%",width:"100%","word-break":"keep-all",margin:"0 auto","text-align":"center",position:"fixed",left:"0",right:"0",bottom:"0","-webkit-transform":"translateY(150%) translateZ(0)",transform:"translateY(150%) translateZ(0)","-webkit-filter":"blur(0)",opacity:"0"}},settings:{duration:4e3}},t.prototype.Transitions={},t.prototype.toastQueue=[],t.prototype.timeout=null,t.prototype.mergeOptions=function(e,o){var r=o;for(var n in e)r.hasOwnProperty(n)?null!==e[n]&&e[n].constructor===Object&&(r[n]=t.prototype.mergeOptions(e[n],r[n])):r[n]=e[n];return r},t.prototype.generate=function(r,n){var i=document.createElement("div");"string"==typeof r&&(r=document.createTextNode(r)),i.appendChild(r),o(i),i=null,t.prototype.stylize(e(),n)},t.prototype.stylize=function(t,e){Object.keys(e).forEach(function(o){t.style[o]=e[o]})},t.prototype.show=function(o,r){this.generate(o,r.style.main);var n=e();document.body.insertBefore(n,document.body.firstChild),n.offsetHeight,t.prototype.stylize(n,t.prototype.Transitions.SHOW),n=null,clearTimeout(t.prototype.timeout),t.prototype.timeout=setTimeout(t.prototype.hide,r.settings.duration)},t.prototype.hide=function(){var o=e();t.prototype.stylize(o,t.prototype.Transitions.HIDE),clearTimeout(t.prototype.timeout),o.addEventListener("transitionend",t.prototype.animationListener),o=null},t.prototype.animationListener=function(){e().removeEventListener("transitionend",t.prototype.animationListener),t.prototype.destroy.call(this)},t.prototype.destroy=function(){var r=e();if(document.body.removeChild(r),r=null,o(null),t.prototype.toastQueue.length>0){var n=t.prototype.toastQueue.shift();t(n.text,n.options,n.transitions),n=null}},{Toast:t}}(),"undefined"!=typeof module&&(module.exports=iqwerty.toast); 2 | 3 | function showAllShutterChannel(){ 4 | var els = document.getElementsByName('shuttercontrol'); 5 | for (var i=0; i < els.length; i++) { 6 | els[i].style.display = "block"; 7 | } 8 | } 9 | 10 | function getEventLog() { 11 | var http = new XMLHttpRequest(); 12 | http.onreadystatechange = function() { 13 | if (this.readyState == 4 && this.status == 200) { 14 | var log = this.responseText; 15 | log = log.replace(/(?:\r\n|\r|\n)/g, '
'); 16 | 17 | document.getElementById("log").innerHTML = log; 18 | document.getElementById('spinner').style.display = "none"; 19 | document.getElementById('log').style.display = "block"; 20 | } 21 | }; 22 | http.open("POST", "api", true); 23 | http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 24 | http.send("cmd=eventlog"); 25 | } 26 | 27 | 28 | function runShutterCmd(cmd, channel, channel_name) { 29 | var http = new XMLHttpRequest(); 30 | http.onreadystatechange = function() { 31 | if (this.readyState == 4 && this.status == 200) { 32 | iqwerty.toast.Toast(this.responseText); 33 | } 34 | }; 35 | http.open("POST", "api", true); 36 | http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 37 | http.send("cmd=" + cmd + "&channel=" + channel + "&channel_name=" + channel_name); 38 | } 39 | 40 | function setChannelNameCallback(rowData, rowName) { 41 | runShutterCmd('set channel name', rowName, rowData['channel_name']) 42 | } 43 | 44 | var setChannelName = {"finishCallback": setChannelNameCallback}; 45 | 46 | 47 | function getChannelName(){ 48 | var http = new XMLHttpRequest(); 49 | http.onreadystatechange = function() { 50 | if (this.readyState == 4 && this.status == 200) { 51 | 52 | var lines = this.responseText.split('\n'); 53 | var counter = 0; 54 | for (var j = 0; j < lines.length; j++) { 55 | var result = lines[j].split('='); 56 | 57 | if (result[0] != ""){ 58 | 59 | //get channel Id and get configured status 60 | var channel_id = (result[0].split('_'))[1]; 61 | var configured = true; 62 | 63 | // set alternative display name if channel name is empty 64 | if (result[1] == ""){ 65 | configured = false; 66 | result[1] = "Channel " + channel_id; 67 | }else{ 68 | counter++; 69 | } 70 | 71 | // create new element 72 | var element = document.createElement("div"); 73 | element.setAttribute("name", "shuttercontrol"); 74 | // add HTML stuff to the element 75 | element.innerHTML = ` 76 |
Ch-` + channel_id + ` ` + result[1] + `  edit
77 |
78 |
UP
79 |
STOP
80 |
DOWN
81 |
PROG
82 |
83 |

84 | `; 85 | // hide element if it is not yet configured 86 | if (configured == false){ 87 | element.style.display = "none"; 88 | } 89 | document.getElementById('container').appendChild(element); 90 | } 91 | } 92 | // disable spinner and show all shutter if there is no shutter configured yet. 93 | document.getElementById('spinner').style.display = "none"; 94 | if (counter == 0){ 95 | showAllShutterChannel(); 96 | } 97 | } 98 | }; 99 | http.open("POST", "api", true); 100 | http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 101 | http.send("cmd=get channel name"); 102 | } 103 | 104 | function getConfig(){ 105 | var http = new XMLHttpRequest(); 106 | http.onreadystatechange = function() { 107 | if (this.readyState == 4 && this.status == 200) { 108 | var lines = this.responseText.split('\n'); 109 | for (var j = 0; j < lines.length; j++) { 110 | var result = lines[j].split('='); 111 | if (result[1] != "" && result[0] != "") { 112 | if (result[0] == "checkbox") { 113 | if (result[2] == 1) { 114 | document.getElementById(result[1]).checked = true; 115 | } else { 116 | document.getElementById(result[1]).checked = false; 117 | } 118 | } else if (result[0] == "text") { 119 | document.getElementById(result[1]).textContent = result[2]; 120 | } else { 121 | document.getElementById(result[0]).value = result[1]; 122 | } 123 | } 124 | } 125 | document.getElementById('spinner').style.display = "none"; 126 | document.getElementById('config').style.display = "block"; 127 | } 128 | }; 129 | http.open("POST", "api", true); 130 | http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 131 | http.send("cmd=get config"); 132 | } 133 | 134 | function writeConfig(cmd){ 135 | var elements = document.getElementById("configForm").elements; 136 | var params = ""; 137 | for (var i = 0, element; element = elements[i++];) { 138 | if (element.type == "checkbox"){ 139 | if (element.checked == true){ 140 | params += element.name + "=true&" 141 | }else{ 142 | params += element.name + "=false&" 143 | } 144 | }else{ 145 | params += element.name + "=" + element.value + "&" 146 | } 147 | } 148 | var http = new XMLHttpRequest(); 149 | http.onreadystatechange = function() { 150 | if (this.readyState == 4 && this.status == 200) { 151 | iqwerty.toast.Toast(this.responseText); 152 | } 153 | }; 154 | http.open("POST", "api", true); 155 | http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 156 | http.send("cmd=" + cmd + "&" + params); 157 | 158 | } 159 | 160 | 161 | 162 | 163 | var inlineEditRowContents = {}; 164 | 165 | function inlineEdit(rowName, options) { 166 | var tableRow = document.getElementById(rowName); 167 | inlineEditRowContents[rowName] = {}; 168 | for (var i=0; i`; 184 | } 185 | switch (cell.dataset.inlinetype) { 186 | case "plain": 187 | cellContent += inlineEditRowContents[rowName][i]; 188 | break; 189 | case "doneButton": 190 | cellContent += ``; 191 | break; 192 | case "button": 193 | cellContent += inlineEditRowContents[rowName][i]; 194 | break; 195 | case "link": 196 | cellContent += `"+cell.children[getFromChildren].value+""; 288 | break; 289 | case "text": 290 | case "date": 291 | rowData[cell.dataset.inlinename] = cell.children[getFromChildren].value; 292 | inlineEditRowContents[rowName][i] = cell.children[getFromChildren].value; 293 | break; 294 | case "select": 295 | rowData[cell.dataset.inlinename] = cell.children[getFromChildren].selectedIndex; 296 | rowData["_"+cell.dataset.inlinename+"Title"] = JSON.parse(cell.dataset.inlineoptionstitle)[cell.children[getFromChildren].selectedIndex]; 297 | rowData["_"+cell.dataset.inlinename+"Value"] = JSON.parse(cell.dataset.inlineoptionsvalue)[cell.children[getFromChildren].selectedIndex]; 298 | inlineEditRowContents[rowName][i] = JSON.parse(cell.dataset.inlineoptionstitle)[cell.children[getFromChildren].selectedIndex]; 299 | break; 300 | case "textarea": 301 | // TODO textarea value is \n not
302 | rowData[cell.dataset.inlinename] = cell.children[getFromChildren].value; 303 | inlineEditRowContents[rowName][i] = cell.children[getFromChildren].value; 304 | break; 305 | default: 306 | break; 307 | } 308 | } 309 | 310 | // do whatever ajax magic 311 | if (options.hasOwnProperty("finishCallback")) 312 | options.finishCallback(rowData, rowName); 313 | 314 | for (i=0; i 5 | Version: November 12, 2010 6 | 7 | This library is designed to use CC1101/CC1100 module on Arduino platform. 8 | CC1101/CC1100 module is an useful wireless module.Using the functions of the 9 | library, you can easily send and receive data by the CC1101/CC1100 module. 10 | Just have fun! 11 | For the details, please refer to the datasheet of CC1100/CC1101. 12 | ---------------------------------------------------------------------------------------------------------------- 13 | cc1101 Driver for RC Switch. Mod by Little Satan. With permission to modify and publish Wilson Shen (ELECHOUSE). 14 | ---------------------------------------------------------------------------------------------------------------- 15 | */ 16 | #include 17 | #include "ELECHOUSE_CC1101_RCS_DRV.h" 18 | #include 19 | 20 | /****************************************************************/ 21 | #define WRITE_BURST 0x40 //write burst 22 | #define READ_SINGLE 0x80 //read single 23 | #define READ_BURST 0xC0 //read burst 24 | #define BYTES_IN_RXFIFO 0x47 //byte number in RXfifo 25 | 26 | int mdcf1 = 0x00; 27 | int mdcf0 = 0xF8; 28 | int chan = 1; 29 | int rbw = 0x07; 30 | int F2 = 16; 31 | int F1 = 176; 32 | int F0 = 113; 33 | 34 | int conf = PA10; 35 | 36 | int SCK_PIN = 13; 37 | int MISO_PIN = 12; 38 | int MOSI_PIN = 11; 39 | int SS_PIN = 10; 40 | int GDO0; 41 | int GDO2; 42 | int spi; 43 | 44 | /****************************************************************/ 45 | uint8_t PA_TABLE10[8] {0x00,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,}; 46 | uint8_t PA_TABLE7[8] {0x00,0xC8,0x00,0x00,0x00,0x00,0x00,0x00,}; 47 | uint8_t PA_TABLE5[8] {0x00,0x84,0x00,0x00,0x00,0x00,0x00,0x00,}; 48 | uint8_t PA_TABLE0[8] {0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,}; 49 | uint8_t PA_TABLE_10[8] {0x00,0x34,0x00,0x00,0x00,0x00,0x00,0x00,}; 50 | uint8_t PA_TABLE_15[8] {0x00,0x1D,0x00,0x00,0x00,0x00,0x00,0x00,}; 51 | uint8_t PA_TABLE_20[8] {0x00,0x0E,0x00,0x00,0x00,0x00,0x00,0x00,}; 52 | uint8_t PA_TABLE_30[8] {0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,}; 53 | /**************************************************************** 54 | *FUNCTION NAME:SpiStart 55 | *FUNCTION :spi communication start 56 | *INPUT :none 57 | *OUTPUT :none 58 | ****************************************************************/ 59 | void ELECHOUSE_CC1101::SpiStart(void) 60 | { 61 | // initialize the SPI pins 62 | pinMode(SCK_PIN, OUTPUT); 63 | pinMode(MOSI_PIN, OUTPUT); 64 | pinMode(MISO_PIN, INPUT); 65 | pinMode(SS_PIN, OUTPUT); 66 | 67 | // enable SPI 68 | #ifdef ESP32 69 | SPI.begin(SCK_PIN, MISO_PIN, MOSI_PIN, SS_PIN); 70 | #else 71 | SPI.begin(); 72 | #endif 73 | } 74 | /**************************************************************** 75 | *FUNCTION NAME:SpiEnd 76 | *FUNCTION :spi communication disable 77 | *INPUT :none 78 | *OUTPUT :none 79 | ****************************************************************/ 80 | void ELECHOUSE_CC1101::SpiEnd(void) 81 | { 82 | // disable SPI 83 | SPI.endTransaction(); 84 | SPI.end(); 85 | } 86 | /**************************************************************** 87 | *FUNCTION NAME: GDO_Set() 88 | *FUNCTION : set GDO0,GDO2 pin 89 | *INPUT : none 90 | *OUTPUT : none 91 | ****************************************************************/ 92 | void ELECHOUSE_CC1101::GDO_Set (void) 93 | { 94 | pinMode(GDO0, INPUT); 95 | pinMode(GDO2, OUTPUT); 96 | } 97 | /**************************************************************** 98 | *FUNCTION NAME:Reset 99 | *FUNCTION :CC1101 reset //details refer datasheet of CC1101/CC1100// 100 | *INPUT :none 101 | *OUTPUT :none 102 | ****************************************************************/ 103 | void ELECHOUSE_CC1101::Reset (void) 104 | { 105 | digitalWrite(SS_PIN, LOW); 106 | delay(1); 107 | digitalWrite(SS_PIN, HIGH); 108 | delay(1); 109 | digitalWrite(SS_PIN, LOW); 110 | while(digitalRead(MISO_PIN)); 111 | SPI.transfer(CC1101_SRES); 112 | while(digitalRead(MISO_PIN)); 113 | digitalWrite(SS_PIN, HIGH); 114 | } 115 | /**************************************************************** 116 | *FUNCTION NAME:Init 117 | *FUNCTION :CC1101 initialization 118 | *INPUT :none 119 | *OUTPUT :none 120 | ****************************************************************/ 121 | void ELECHOUSE_CC1101::Init(void) 122 | { 123 | setSpi(); 124 | SpiStart(); //spi initialization 125 | GDO_Set(); //GDO set 126 | digitalWrite(SS_PIN, HIGH); 127 | digitalWrite(SCK_PIN, HIGH); 128 | digitalWrite(MOSI_PIN, LOW); 129 | Reset(); //CC1101 reset 130 | RegConfigSettings(conf); //CC1101 register config 131 | SpiEnd(); 132 | } 133 | /**************************************************************** 134 | *FUNCTION NAME:Init 135 | *FUNCTION :CC1101 initialization 136 | *INPUT :none 137 | *OUTPUT :none 138 | ****************************************************************/ 139 | void ELECHOUSE_CC1101::Init(byte f) 140 | { 141 | setSpi(); 142 | conf = (f); 143 | SpiStart(); //spi initialization 144 | GDO_Set(); //GDO set 145 | digitalWrite(SS_PIN, HIGH); 146 | digitalWrite(SCK_PIN, HIGH); 147 | digitalWrite(MOSI_PIN, LOW); 148 | Reset(); //CC1101 reset 149 | RegConfigSettings(conf); //CC1101 register config 150 | SpiEnd(); 151 | } 152 | /**************************************************************** 153 | *FUNCTION NAME:SpiWriteReg 154 | *FUNCTION :CC1101 write data to register 155 | *INPUT :addr: register address; value: register value 156 | *OUTPUT :none 157 | ****************************************************************/ 158 | void ELECHOUSE_CC1101::SpiWriteReg(byte addr, byte value) 159 | { 160 | SpiStart(); 161 | digitalWrite(SS_PIN, LOW); 162 | while(digitalRead(MISO_PIN)); 163 | SPI.transfer(addr); 164 | SPI.transfer(value); 165 | digitalWrite(SS_PIN, HIGH); 166 | SpiEnd(); 167 | } 168 | /**************************************************************** 169 | *FUNCTION NAME:SpiWriteBurstReg 170 | *FUNCTION :CC1101 write burst data to register 171 | *INPUT :addr: register address; buffer:register value array; num:number to write 172 | *OUTPUT :none 173 | ****************************************************************/ 174 | void ELECHOUSE_CC1101::SpiWriteBurstReg(byte addr, byte *buffer, byte num) 175 | { 176 | byte i, temp; 177 | SpiStart(); 178 | temp = addr | WRITE_BURST; 179 | digitalWrite(SS_PIN, LOW); 180 | while(digitalRead(MISO_PIN)); 181 | SPI.transfer(temp); 182 | for (i = 0; i < num; i++) 183 | { 184 | SPI.transfer(buffer[i]); 185 | } 186 | digitalWrite(SS_PIN, HIGH); 187 | SpiEnd(); 188 | } 189 | /**************************************************************** 190 | *FUNCTION NAME:SpiStrobe 191 | *FUNCTION :CC1101 Strobe 192 | *INPUT :strobe: command; //refer define in CC1101.h// 193 | *OUTPUT :none 194 | ****************************************************************/ 195 | void ELECHOUSE_CC1101::SpiStrobe(byte strobe) 196 | { 197 | SpiStart(); 198 | digitalWrite(SS_PIN, LOW); 199 | while(digitalRead(MISO_PIN)); 200 | SPI.transfer(strobe); 201 | digitalWrite(SS_PIN, HIGH); 202 | SpiEnd(); 203 | } 204 | /**************************************************************** 205 | *FUNCTION NAME:SpiReadReg 206 | *FUNCTION :CC1101 read data from register 207 | *INPUT :addr: register address 208 | *OUTPUT :register value 209 | ****************************************************************/ 210 | byte ELECHOUSE_CC1101::SpiReadReg(byte addr) 211 | { 212 | byte temp, value; 213 | SpiStart(); 214 | temp = addr| READ_SINGLE; 215 | digitalWrite(SS_PIN, LOW); 216 | while(digitalRead(MISO_PIN)); 217 | SPI.transfer(temp); 218 | value=SPI.transfer(0); 219 | digitalWrite(SS_PIN, HIGH); 220 | SpiEnd(); 221 | return value; 222 | } 223 | 224 | /**************************************************************** 225 | *FUNCTION NAME:SpiReadBurstReg 226 | *FUNCTION :CC1101 read burst data from register 227 | *INPUT :addr: register address; buffer:array to store register value; num: number to read 228 | *OUTPUT :none 229 | ****************************************************************/ 230 | void ELECHOUSE_CC1101::SpiReadBurstReg(byte addr, byte *buffer, byte num) 231 | { 232 | byte i,temp; 233 | SpiStart(); 234 | temp = addr | READ_BURST; 235 | digitalWrite(SS_PIN, LOW); 236 | while(digitalRead(MISO_PIN)); 237 | SPI.transfer(temp); 238 | for(i=0;i=5){s9=s6+1;} 313 | if (s8<5){s9=s6;} 314 | float s10 = MHZ-(freq2*s2+freq1*s9); 315 | float s11 = s10/freq0; 316 | int s12 = s11; 317 | float s13 = (s11-s12)*(10); 318 | int s14; //freq0 319 | if (s13>=5){s14=s12+1;} 320 | if (s13<5){s14=s12;} 321 | 322 | F2 = s2; 323 | F1 = s9; 324 | F0 = s14; 325 | } 326 | /**************************************************************** 327 | *FUNCTION NAME:GDO Pin settings 328 | *FUNCTION :set GDO Pins 329 | *INPUT :none 330 | *OUTPUT :none 331 | ****************************************************************/ 332 | void ELECHOUSE_CC1101::setGDO(byte gdo0, byte gdo2){ 333 | GDO0 = gdo0; 334 | GDO2 = gdo2; 335 | } 336 | /**************************************************************** 337 | *FUNCTION NAME:Channel spacing 338 | *FUNCTION :Channel spacing 339 | *INPUT :none 340 | *OUTPUT :none 341 | ****************************************************************/ 342 | void ELECHOUSE_CC1101::setChsp(byte Chsp){ 343 | 344 | switch (Chsp) 345 | { 346 | case 1: mdcf1=0x00; mdcf0=0x00; break; case 2: mdcf1=0x00; mdcf0=0xF8; break; case 3: mdcf1=0x01; mdcf0=0x93; break; case 4: mdcf1=0x01; mdcf0=0xF8; break; case 5: mdcf1=0x02; mdcf0=0x7A; break; 347 | case 6: mdcf1=0x02; mdcf0=0xF8; break; case 7: mdcf1=0x03; mdcf0=0x3B; break; case 8: mdcf1=0x03; mdcf0=0x7A; break; case 9: mdcf1=0x03; mdcf0=0xB9; break; case 10: mdcf1=0x03; mdcf0=0xFF; break; 348 | } 349 | } 350 | /**************************************************************** 351 | *FUNCTION NAME:Set RX bandwidth 352 | *FUNCTION :Recive bandwidth 353 | *INPUT :none 354 | *OUTPUT :none 355 | ****************************************************************/ 356 | void ELECHOUSE_CC1101::setRxBW(byte RxBW){ 357 | 358 | switch (RxBW) 359 | { 360 | case 1: rbw=0xF7; break; case 2: rbw=0xE7; break; case 3: rbw=0xD7; break; case 4: rbw=0xC7; break; case 5: rbw=0xB7; break; case 6: rbw=0xA7; break; case 7: rbw=0x97; break; case 8: rbw=0x87; break; 361 | case 9: rbw=0x77; break; case 10: rbw=0x67; break; case 11: rbw=0x57; break; case 12: rbw=0x47; break; case 13: rbw=0x37; break; case 14: rbw=0x27; break; case 15: rbw=0x17; break; case 16: rbw=0x07; break; 362 | } 363 | } 364 | /**************************************************************** 365 | *FUNCTION NAME:Set Channel 366 | *FUNCTION :Recive channel from sketch 367 | *INPUT :none 368 | *OUTPUT :none 369 | ****************************************************************/ 370 | void ELECHOUSE_CC1101::setChannel(byte chnl){ 371 | chan = chnl; 372 | } 373 | /**************************************************************** 374 | *FUNCTION NAME:RegConfigSettings 375 | *FUNCTION :CC1101 register config //details refer datasheet of CC1101/CC1100// 376 | *INPUT :none 377 | *OUTPUT :none 378 | ****************************************************************/ 379 | void ELECHOUSE_CC1101::RegConfigSettings(byte f) 380 | { 381 | 382 | SpiWriteReg(CC1101_FSCTRL1, 0x06); 383 | SpiWriteReg(CC1101_FSCTRL0, 0x00); 384 | SpiWriteReg(CC1101_FREQ2, F2); 385 | SpiWriteReg(CC1101_FREQ1, F1); 386 | SpiWriteReg(CC1101_FREQ0, F0); 387 | 388 | switch(f) 389 | { 390 | case PA10: 391 | SpiWriteBurstReg(CC1101_PATABLE,PA_TABLE10,8); 392 | break; 393 | case PA7: 394 | SpiWriteBurstReg(CC1101_PATABLE,PA_TABLE7,8); 395 | break; 396 | case PA5: 397 | SpiWriteBurstReg(CC1101_PATABLE,PA_TABLE5,8); 398 | break; 399 | case PA0: 400 | SpiWriteBurstReg(CC1101_PATABLE,PA_TABLE0,8); 401 | break; 402 | case PA_10: 403 | SpiWriteBurstReg(CC1101_PATABLE,PA_TABLE_10,8); 404 | break; 405 | case PA_15: 406 | SpiWriteBurstReg(CC1101_PATABLE,PA_TABLE_15,8); 407 | break; 408 | case PA_20: 409 | SpiWriteBurstReg(CC1101_PATABLE,PA_TABLE_20,8); 410 | break; 411 | case PA_30: 412 | SpiWriteBurstReg(CC1101_PATABLE,PA_TABLE_30,8); 413 | break; 414 | 415 | } 416 | 417 | 418 | SpiWriteReg(CC1101_MDMCFG4, rbw); 419 | SpiWriteReg(CC1101_MDMCFG3, 0x93); 420 | SpiWriteReg(CC1101_MDMCFG2, 0x30); 421 | SpiWriteReg(CC1101_MDMCFG1, mdcf1); 422 | SpiWriteReg(CC1101_MDMCFG0, mdcf0); 423 | SpiWriteReg(CC1101_CHANNR, chan); 424 | SpiWriteReg(CC1101_DEVIATN, 0x15); 425 | SpiWriteReg(CC1101_FREND1, 0x56); 426 | SpiWriteReg(CC1101_FREND0, 0x11); 427 | SpiWriteReg(CC1101_MCSM0 , 0x18); 428 | SpiWriteReg(CC1101_FOCCFG, 0x16); 429 | SpiWriteReg(CC1101_BSCFG, 0x1C); 430 | SpiWriteReg(CC1101_AGCCTRL2, 0xC7); 431 | SpiWriteReg(CC1101_AGCCTRL1, 0x00); 432 | SpiWriteReg(CC1101_AGCCTRL0, 0xB2); 433 | SpiWriteReg(CC1101_FSCAL3, 0xE9); 434 | SpiWriteReg(CC1101_FSCAL2, 0x2A); 435 | SpiWriteReg(CC1101_FSCAL1, 0x00); 436 | SpiWriteReg(CC1101_FSCAL0, 0x1F); 437 | SpiWriteReg(CC1101_FSTEST, 0x59); 438 | SpiWriteReg(CC1101_TEST2, 0x81); 439 | SpiWriteReg(CC1101_TEST1, 0x35); 440 | SpiWriteReg(CC1101_TEST0, 0x09); 441 | SpiWriteReg(CC1101_IOCFG2, 0x0D); //serial clock.synchronous to the data in synchronous serial mode 442 | SpiWriteReg(CC1101_IOCFG0, 0x0D); //asserts when sync word has been sent/received, and de-asserts at the end of the packet 443 | SpiWriteReg(CC1101_PKTCTRL1, 0x04); //two status bytes will be appended to the payload of the packet,including RSSI LQI and CRC OK 444 | //No address check 445 | SpiWriteReg(CC1101_PKTCTRL0, 0x32); //whitening off;CRC Enable��variable length packets, packet length configured by the first byte after sync word 446 | SpiWriteReg(CC1101_ADDR, 0x00); //address used for packet filtration. 447 | SpiWriteReg(CC1101_PKTLEN, 0x3D); //61 bytes max length 448 | } 449 | 450 | /**************************************************************** 451 | *FUNCTION NAME:SetTx 452 | *FUNCTION :set CC1101 send data 453 | *INPUT :none 454 | *OUTPUT :none 455 | ****************************************************************/ 456 | void ELECHOUSE_CC1101::SetTx(void) 457 | { 458 | SpiStrobe(CC1101_SRES); 459 | SpiStart(); //spi initialization 460 | GDO_Set(); //GDO set 461 | digitalWrite(SS_PIN, HIGH); 462 | digitalWrite(SCK_PIN, HIGH); 463 | digitalWrite(MOSI_PIN, LOW); 464 | Reset(); //CC1101 reset 465 | RegConfigSettings(conf); //CC1101 register config 466 | SpiStrobe(CC1101_STX); //start send 467 | } 468 | /**************************************************************** 469 | *FUNCTION NAME:SetRx 470 | *FUNCTION :set CC1101 to receive state 471 | *INPUT :none 472 | *OUTPUT :none 473 | ****************************************************************/ 474 | void ELECHOUSE_CC1101::SetRx(void) 475 | { 476 | SpiStrobe(CC1101_SRES); 477 | SpiStart(); //spi initialization 478 | GDO_Set(); //GDO set 479 | digitalWrite(SS_PIN, HIGH); 480 | digitalWrite(SCK_PIN, HIGH); 481 | digitalWrite(MOSI_PIN, LOW); 482 | Reset(); //CC1101 reset 483 | RegConfigSettings(conf); //CC1101 register config 484 | SpiStrobe(CC1101_SRX); //start receive 485 | } 486 | /**************************************************************** 487 | *FUNCTION NAME:SetTx 488 | *FUNCTION :set CC1101 send data 489 | *INPUT :none 490 | *OUTPUT :none 491 | ****************************************************************/ 492 | void ELECHOUSE_CC1101::SetTx(float mhz) 493 | { 494 | SpiStrobe(CC1101_SRES); 495 | setMHZ(mhz); 496 | SpiStart(); //spi initialization 497 | GDO_Set(); //GDO set 498 | digitalWrite(SS_PIN, HIGH); 499 | digitalWrite(SCK_PIN, HIGH); 500 | digitalWrite(MOSI_PIN, LOW); 501 | Reset(); //CC1101 reset 502 | RegConfigSettings(conf); //CC1101 register config 503 | SpiStrobe(CC1101_STX); //start send 504 | } 505 | /**************************************************************** 506 | *FUNCTION NAME:SetRx 507 | *FUNCTION :set CC1101 to receive state 508 | *INPUT :none 509 | *OUTPUT :none 510 | ****************************************************************/ 511 | void ELECHOUSE_CC1101::SetRx(float mhz) 512 | { 513 | SpiStrobe(CC1101_SRES); 514 | setMHZ(mhz); 515 | SpiStart(); //spi initialization 516 | GDO_Set(); //GDO set 517 | digitalWrite(SS_PIN, HIGH); 518 | digitalWrite(SCK_PIN, HIGH); 519 | digitalWrite(MOSI_PIN, LOW); 520 | Reset(); //CC1101 reset 521 | RegConfigSettings(conf); //CC1101 register config 522 | SpiStrobe(CC1101_SRX); //start receive 523 | } 524 | /**************************************************************** 525 | *FUNCTION NAME:SetSres 526 | *FUNCTION :Reset CC1101 527 | *INPUT :none 528 | *OUTPUT :none 529 | ****************************************************************/ 530 | void ELECHOUSE_CC1101::setSres(void) 531 | { 532 | SpiStrobe(CC1101_SRES); //reset cc1101 533 | } 534 | 535 | /**************************************************************** 536 | *FUNCTION NAME:CheckReceiveFlag 537 | *FUNCTION :check receive data or not 538 | *INPUT :none 539 | *OUTPUT :flag: 0 no data; 1 receive data 540 | ****************************************************************/ 541 | byte ELECHOUSE_CC1101::CheckReceiveFlag(void) 542 | { 543 | if(digitalRead(GDO0)) //receive data 544 | { 545 | while (digitalRead(GDO0)); 546 | return 1; 547 | } 548 | else // no data 549 | { 550 | return 0; 551 | } 552 | } 553 | 554 | 555 | /**************************************************************** 556 | *FUNCTION NAME:ReceiveData 557 | *FUNCTION :read data received from RXfifo 558 | *INPUT :rxBuffer: buffer to store data 559 | *OUTPUT :size of data received 560 | ****************************************************************/ 561 | byte ELECHOUSE_CC1101::ReceiveData(byte *rxBuffer) 562 | { 563 | byte size; 564 | byte status[2]; 565 | 566 | if(SpiReadStatus(CC1101_RXBYTES) & BYTES_IN_RXFIFO) 567 | { 568 | size=SpiReadReg(CC1101_RXFIFO); 569 | SpiReadBurstReg(CC1101_RXFIFO,rxBuffer,size); 570 | SpiReadBurstReg(CC1101_RXFIFO,status,2); 571 | SpiStrobe(CC1101_SFRX); 572 | return size; 573 | } 574 | else 575 | { 576 | SpiStrobe(CC1101_SFRX); 577 | return 0; 578 | } 579 | 580 | } 581 | 582 | ELECHOUSE_CC1101 ELECHOUSE_cc1101; 583 | -------------------------------------------------------------------------------- /Somfy_MQTT.ino: -------------------------------------------------------------------------------- 1 | /* Controlling Somfy RTS Stores via ESP8266 and CC1101. 2 | All the code is from Jarolift_MQTT 3 | And 4 | Somfy_Remote 5 | */ 6 | /* Controlling Jarolift TDEF 433MHZ radio shutters via ESP8266 and CC1101 Transceiver Module in asynchronous mode. 7 | Copyright (C) 2017-2018 Steffen Hille et al. 8 | 9 | This program is free software: you can redistribute it and/or modify 10 | it under the terms of the GNU General Public License as published by 11 | the Free Software Foundation, either version 3 of the License, or 12 | (at your option) any later version. 13 | 14 | This program is distributed in the hope that it will be useful, 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | GNU General Public License for more details. 18 | 19 | You should have received a copy of the GNU General Public License 20 | along with this program. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include // settimeofday_cb() 34 | 35 | #include "helpers.h" 36 | #include "global.h" 37 | #include "html_api.h" 38 | 39 | extern "C" { 40 | #include "user_interface.h" 41 | #include "Arduino.h" 42 | #include "Somfy_Remote.h" 43 | } 44 | 45 | // Number of seconds after reset during which a 46 | // subseqent reset will be considered a double reset. 47 | #define DRD_TIMEOUT 10 48 | 49 | // RTC Memory Address for the DoubleResetDetector to use 50 | #define DRD_ADDRESS 0 51 | 52 | // User configuration 53 | uint32_t remoteCode[] = {0x131100, 0x131110, 0x131120, 0x131130, 0x131140, 0x131150, 0x131160, 0x131170, 0x131180, 0x131190, 0x131200, 0x131210, 0x131220, 0x131230, 0x131240, 0x131250}; // Defineremote code to use for each remote 54 | byte adresses[] = {5, 11, 17, 23, 29, 35, 41, 47, 53, 59, 65, 71, 77, 85, 91, 97 }; // Defines start addresses of channel rollingcode stored in EEPROM 4bytes. 55 | SomfyRemote *remote[16]; 56 | 57 | boolean time_is_set_first = true; 58 | DoubleResetDetector drd(DRD_TIMEOUT, DRD_ADDRESS); 59 | 60 | //#################################################################### 61 | // sketch initialization routine 62 | //#################################################################### 63 | void setup() 64 | { 65 | InitLog(); 66 | EEPROM.begin(4096); 67 | Serial.begin(115200); 68 | settimeofday_cb(time_is_set); 69 | updateNTP(); // Init the NTP time 70 | WriteLog("[INFO] - starting Somfy Dongle " + (String)PROGRAM_VERSION, true); 71 | WriteLog("[INFO] - ESP-ID " + (String)ESP.getChipId() + " // ESP-Core " + ESP.getCoreVersion() + " // SDK Version " + ESP.getSdkVersion(), true); 72 | 73 | // callback functions for WiFi connect and disconnect 74 | // placed as early as possible in the setup() function to get the connect 75 | // message catched when the WiFi connect is really fast 76 | gotIpEventHandler = WiFi.onStationModeGotIP([](const WiFiEventStationModeGotIP & event) 77 | { 78 | WriteLog("[INFO] - WiFi station connected - IP: " + WiFi.localIP().toString(), true); 79 | wifi_disconnect_log = true; 80 | }); 81 | 82 | disconnectedEventHandler = WiFi.onStationModeDisconnected([](const WiFiEventStationModeDisconnected & event) 83 | { 84 | if (wifi_disconnect_log) { 85 | WriteLog("[INFO] - WiFi station disconnected", true); 86 | // turn off logging disconnect events after first occurrence, otherwise the log is filled up 87 | wifi_disconnect_log = false; 88 | } 89 | }); 90 | 91 | InitializeConfigData(); 92 | 93 | // init SomefyRemotes 94 | for (int channelNum = 0; channelNum <= 15; channelNum++) { 95 | WriteLog((String)"[INFO] - Init SomfyRemote 1 : 0x" + String(remoteCode[channelNum],HEX) + " / " + config.channel_name[channelNum], true); 96 | remote[channelNum] = new SomfyRemote(config.channel_name[channelNum], remoteCode[channelNum], adresses[channelNum]); 97 | } 98 | 99 | pinMode(led_pin, OUTPUT); // prepare LED on ESP-Chip 100 | 101 | // test if the WLAN SSID is on default 102 | // or DoubleReset detected 103 | if ((drd.detectDoubleReset()) || (config.ssid == "MYSSID")) { 104 | digitalWrite(led_pin, LOW); // turn LED on // if yes then turn on LED 105 | AdminEnabled = true; // and go to Admin-Mode 106 | } else { 107 | digitalWrite(led_pin, HIGH); // turn LED off // turn LED off 108 | } 109 | 110 | // enable access point mode if Admin-Mode is enabled 111 | if (AdminEnabled) 112 | { 113 | WriteLog("[WARN] - Admin-Mode enabled!", true); 114 | WriteLog("[WARN] - starting soft-AP ... ", false); 115 | wifi_disconnect_log = false; 116 | WiFi.mode(WIFI_AP); 117 | WriteLog(WiFi.softAP(ACCESS_POINT_NAME, ACCESS_POINT_PASSWORD) ? "Ready" : "Failed!", true); 118 | WriteLog("[WARN] - Access Point <" + (String)ACCESS_POINT_NAME + "> activated. WPA password is " + ACCESS_POINT_PASSWORD, true); 119 | WriteLog("[WARN] - you have " + (String)AdminTimeOut + " seconds time to connect and configure!", true); 120 | WriteLog("[WARN] - configuration webserver is http://" + WiFi.softAPIP().toString(), true); 121 | } 122 | else 123 | { 124 | // establish Wifi connection in station mode 125 | ConfigureWifi(); 126 | } 127 | 128 | // configure webserver and start it 129 | server.on ( "/api", html_api ); // command api 130 | SPIFFS.begin(); // Start the SPI flash filesystem 131 | server.onNotFound([]() { // If the client requests any URI 132 | if (!handleFileRead(server.uri())) { // send it if it exists 133 | server.send(404, "text/plain", "404: Not Found"); // otherwise, respond with a 404 (Not Found) error 134 | Serial.println(" File not found: did you upload the data directory?"); 135 | } 136 | }); 137 | 138 | server.begin(); 139 | WriteLog("[INFO] - HTTP server started", true); 140 | tkHeartBeat.attach(1, HeartBeat); 141 | 142 | // configure MQTT client 143 | mqtt_client.setServer(IPAddress(config.mqtt_broker_addr[0], config.mqtt_broker_addr[1], 144 | config.mqtt_broker_addr[2], config.mqtt_broker_addr[3]), 145 | config.mqtt_broker_port.toInt()); 146 | mqtt_client.setCallback(mqtt_callback); // define Handler for incoming messages 147 | mqttLastConnectAttempt = 0; 148 | 149 | } // void setup 150 | 151 | //#################################################################### 152 | // main loop 153 | //#################################################################### 154 | void loop() 155 | { 156 | 157 | // Call the double reset detector loop method every so often, 158 | // so that it can recognise when the timeout expires. 159 | // You can also call drd.stop() when you wish to no longer 160 | // consider the next reset as a double reset. 161 | drd.loop(); 162 | 163 | // disable Admin-Mode after AdminTimeOut 164 | if (AdminEnabled) 165 | { 166 | if (AdminTimeOutCounter > AdminTimeOut / HEART_BEAT_CYCLE) 167 | { 168 | AdminEnabled = false; 169 | digitalWrite(led_pin, HIGH); // turn LED off 170 | WriteLog("[WARN] - Admin-Mode disabled, soft-AP terminate ...", false); 171 | WriteLog(WiFi.softAPdisconnect(true) ? "success" : "fail!", true); 172 | ConfigureWifi(); 173 | } 174 | } 175 | server.handleClient(); 176 | 177 | // If you do not use a MQTT broker so configure the address 0.0.0.0 178 | if (config.mqtt_broker_addr[0] + config.mqtt_broker_addr[1] + config.mqtt_broker_addr[2] + config.mqtt_broker_addr[3]) { 179 | // establish connection to MQTT broker 180 | if (WiFi.status() == WL_CONNECTED) { 181 | if (!mqtt_client.connected()) { 182 | // calculate time since last connection attempt 183 | long now = millis(); 184 | // possible values of mqttLastReconnectAttempt: 185 | // 0 => never attempted to connect 186 | // >0 => at least one connect attempt was made 187 | if ((mqttLastConnectAttempt == 0) || (now - mqttLastConnectAttempt > MQTT_Reconnect_Interval)) { 188 | mqttLastConnectAttempt = now; 189 | // attempt to connect 190 | mqtt_connect(); 191 | } 192 | } else { 193 | // client is connected, call the mqtt loop 194 | mqtt_client.loop(); 195 | } 196 | } 197 | } 198 | 199 | // run a CMD whenever a web_cmd event has been triggered 200 | if (web_cmd != "") { 201 | if (web_cmd == "up") { 202 | cmd_up(web_cmd_channel); 203 | } else if (web_cmd == "down") { 204 | cmd_down(web_cmd_channel); 205 | } else if (web_cmd == "prog") { 206 | cmd_prog(web_cmd_channel); 207 | } else if (web_cmd == "stop") { 208 | cmd_stop(web_cmd_channel); 209 | } else if (web_cmd == "save") { 210 | Serial.println("main loop: in web_cmd save"); 211 | cmd_save_config(); 212 | } else if (web_cmd == "restart") { 213 | Serial.println("main loop: in web_cmd restart"); 214 | cmd_restart(); 215 | } else { 216 | WriteLog("[ERR ] - received unknown command from web_cmd.", true); 217 | } 218 | web_cmd = ""; 219 | } 220 | } // void loop 221 | 222 | 223 | 224 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 225 | // Webserver functions group 226 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 227 | 228 | // void html_api() -> see html_api.h 229 | 230 | //#################################################################### 231 | // convert the file extension to the MIME type 232 | //#################################################################### 233 | String getContentType(String filename) { 234 | if (filename.endsWith(".html")) return "text/html"; 235 | else if (filename.endsWith(".css")) return "text/css"; 236 | else if (filename.endsWith(".js")) return "application/javascript"; 237 | else if (filename.endsWith(".ico")) return "image/x-icon"; 238 | return "text/plain"; 239 | } // String getContentType 240 | 241 | //#################################################################### 242 | // send the right file to the client (if it exists) 243 | //#################################################################### 244 | bool handleFileRead(String path) { 245 | if (debug_webui) Serial.println("handleFileRead: " + path); 246 | if (path.endsWith("/")) path += "index.html"; // If a folder is requested, send the index file 247 | String contentType = getContentType(path); // Get the MIME type 248 | if (SPIFFS.exists(path)) { // If the file exists 249 | File file = SPIFFS.open(path, "r"); // Open it 250 | size_t sent = server.streamFile(file, contentType); // And send it to the client 251 | file.close(); // Then close the file again 252 | return true; 253 | } 254 | if (debug_webui) Serial.println("\tFile Not Found"); 255 | return false; // If the file doesn't exist, return false 256 | } // bool handleFileRead 257 | 258 | 259 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 260 | // MQTT functions group 261 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 262 | 263 | //#################################################################### 264 | // Callback for incoming MQTT messages 265 | //#################################################################### 266 | void mqtt_callback(char* topic, byte* payload, unsigned int length) { 267 | 268 | if (debug_mqtt) { 269 | Serial.printf("mqtt in: %s - ", topic); 270 | for (int i = 0; i < length; i++) { 271 | Serial.print((char)payload[i]); 272 | } 273 | Serial.println(); 274 | } 275 | 276 | // extract channel id from topic name 277 | int channel = 999; 278 | char * token = strtok(topic, "/"); // initialize token 279 | token = strtok(NULL, "/"); // now token = 2nd token 280 | token = strtok(NULL, "/"); // now token = 3rd token, "shutter" or so 281 | if (debug_mqtt) Serial.printf("command token: %s\n", token); 282 | if (strncmp(token, "shutter", 7) == 0) { 283 | token = strtok(NULL, "/"); 284 | if (token != NULL) { 285 | channel = atoi(token); 286 | } 287 | } else if (strncmp(token, "sendconfig", 10) == 0) { 288 | WriteLog("[INFO] - incoming MQTT command: sendconfig", true); 289 | mqtt_send_config(); 290 | return; 291 | } else { 292 | WriteLog("[ERR ] - incoming MQTT command unknown: " + (String)token, true); 293 | return; 294 | } 295 | 296 | // convert payload in string 297 | payload[length] = '\0'; 298 | String cmd = String((char*)payload); 299 | 300 | // print serial message 301 | WriteLog("[INFO] - incoming MQTT command: channel " + (String) channel + ":", false); 302 | WriteLog(cmd, true); 303 | 304 | if (channel <= 15) { 305 | if (cmd == "UP" || cmd == "0") { 306 | cmd_up(channel); 307 | } else if (cmd == "DOWN" || cmd == "100") { 308 | cmd_down(channel); 309 | } else if (cmd == "PROG") { 310 | cmd_prog(channel); 311 | } else if (cmd == "STOP") { 312 | cmd_stop(channel); 313 | } else { 314 | WriteLog("[ERR ] - incoming MQTT payload unknown.", true); 315 | } 316 | } else { 317 | WriteLog("[ERR ] - invalid channel, choose one of 0-15", true); 318 | } 319 | } // void mqtt_callback 320 | 321 | //#################################################################### 322 | // send status via mqtt 323 | //#################################################################### 324 | void mqtt_send_percent_closed_state(int channelNum, int percent, String command) { 325 | if (percent > 100) percent = 100; 326 | if (percent < 0) percent = 0; 327 | if (mqtt_client.connected()) { 328 | char percentstr[4]; 329 | itoa(percent, percentstr, 10); 330 | String Topic = "stat/" + config.mqtt_devicetopic + "/shutter/" + (String)channelNum; 331 | const char * msg = Topic.c_str(); 332 | mqtt_client.publish(msg, percentstr); 333 | } 334 | WriteLog("[INFO] - command " + command + " for channel " + (String)channelNum + " (" + config.channel_name[channelNum] + ") sent.", true); 335 | } // void mqtt_send_percent_closed_state 336 | 337 | //#################################################################### 338 | // send config via mqtt 339 | //#################################################################### 340 | void mqtt_send_config() { 341 | String Payload; 342 | int configCnt = 0, lineCnt = 0; 343 | char numBuffer[25]; 344 | 345 | if (mqtt_client.connected()) { 346 | 347 | // send config of the shutter channels 348 | for (int channelNum = 0; channelNum <= 15; channelNum++) { 349 | if (config.channel_name[channelNum] != "") { 350 | if (lineCnt == 0) { 351 | Payload = "{\"channel\":["; 352 | } else { 353 | Payload += ", "; 354 | } 355 | 356 | Payload += "{\"id\":" + String(channelNum) + ", \"name\":\"" + config.channel_name[channelNum] + "\", " 357 | + "\"serial\":\"" + numBuffer + "\"}"; 358 | lineCnt++; 359 | 360 | if (lineCnt >= 4) { 361 | Payload += "]}"; 362 | mqtt_send_config_line(configCnt, Payload); 363 | lineCnt = 0; 364 | } 365 | } // if (config.channel_name[channelNum] != "") 366 | } // for 367 | 368 | // handle last item 369 | if (lineCnt > 0) { 370 | Payload += "]}"; 371 | mqtt_send_config_line(configCnt, Payload); 372 | } 373 | 374 | // send most important other config info 375 | snprintf(numBuffer, 15, "%d", devcnt); 376 | Payload = "{\"mqtt-clientid\":\"" + config.mqtt_broker_client_id + "\", " 377 | + "\"mqtt-devicetopic\":\"" + config.mqtt_devicetopic + "\", " 378 | + "\"devicecounter\":" + (String)numBuffer + "}"; 379 | mqtt_send_config_line(configCnt, Payload); 380 | } // if (mqtt_client.connected()) 381 | } // void mqtt_send_config 382 | 383 | //#################################################################### 384 | // send one config telegram via mqtt 385 | //#################################################################### 386 | void mqtt_send_config_line(int & counter, String Payload) { 387 | String Topic = "stat/" + config.mqtt_devicetopic + "/config/" + (String)counter; 388 | if (debug_mqtt) Serial.println("mqtt send: " + Topic + " - " + Payload); 389 | mqtt_client.publish(Topic.c_str(), Payload.c_str()); 390 | counter++; 391 | yield(); 392 | } // void mqtt_send_config_line 393 | 394 | 395 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 396 | // execute cmd_ functions group 397 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 398 | 399 | //#################################################################### 400 | // function to move the shutter up 401 | //#################################################################### 402 | void cmd_up(int channel) { 403 | remote[channel]->move("UP"); 404 | mqtt_send_percent_closed_state(channel, 0, "UP"); 405 | } // void cmd_up 406 | 407 | //#################################################################### 408 | // function to move the shutter down 409 | //#################################################################### 410 | void cmd_down(int channel) { 411 | remote[channel]->move("DOWN"); 412 | mqtt_send_percent_closed_state(channel, 100, "DOWN"); 413 | } // void cmd_down 414 | 415 | //#################################################################### 416 | // function to program the shutter 417 | //#################################################################### 418 | void cmd_prog(int channel) { 419 | remote[channel]->move("PROGRAM"); 420 | WriteLog("[INFO] - command PROG for channel " + (String)channel + " (" + config.channel_name[channel] + ") sent.", true); 421 | } // void cmd_prog 422 | 423 | //#################################################################### 424 | // function to stop the shutter 425 | //#################################################################### 426 | void cmd_stop(int channel) { 427 | remote[channel]->move("MY"); 428 | WriteLog("[INFO] - command STOP for channel " + (String)channel + " (" + config.channel_name[channel] + ") sent.", true); 429 | } // void cmd_stop 430 | 431 | //#################################################################### 432 | // webUI save config function 433 | //#################################################################### 434 | void cmd_save_config() { 435 | WriteLog("[CFG ] - save config initiated from WebUI", true); 436 | // check if mqtt_devicetopic was changed 437 | if (config.mqtt_devicetopic_new != config.mqtt_devicetopic) { 438 | // in case the devicetopic has changed, the LWT state with the old devicetopic should go away 439 | WriteLog("[CFG ] - devicetopic changed, gracefully disconnect from mqtt server", true); 440 | // first we send an empty message that overwrites the retained "Online" message 441 | String topicOld = "tele/" + config.mqtt_devicetopic + "/LWT"; 442 | mqtt_client.publish(topicOld.c_str(), "", true); 443 | // next: remove retained "devicecounter" message 444 | topicOld = "stat/" + config.mqtt_devicetopic + "/devicecounter"; 445 | mqtt_client.publish(topicOld.c_str(), "", true); 446 | delay(200); 447 | // finally we disconnect gracefully from the mqtt broker so the stored LWT "Offline" message is discarded 448 | mqtt_client.disconnect(); 449 | config.mqtt_devicetopic = config.mqtt_devicetopic_new; 450 | delay(200); 451 | } 452 | WriteConfig(); 453 | server.send ( 200, "text/plain", "Configuration has been saved, system is restarting. Please refresh manually in about 30 seconds.." ); 454 | cmd_restart(); 455 | } // void cmd_save_config 456 | 457 | //#################################################################### 458 | // webUI restart function 459 | //#################################################################### 460 | void cmd_restart() { 461 | server.send ( 200, "text/plain", "System is restarting. Please refresh manually in about 30 seconds." ); 462 | delay(500); 463 | wifi_disconnect_log = false; 464 | ESP.restart(); 465 | } // void cmd_restart 466 | 467 | //#################################################################### 468 | // connect function for MQTT broker 469 | // called from the main loop 470 | //#################################################################### 471 | boolean mqtt_connect() { 472 | const char* client_id = config.mqtt_broker_client_id.c_str(); 473 | const char* username = config.mqtt_broker_username.c_str(); 474 | const char* password = config.mqtt_broker_password.c_str(); 475 | String willTopic = "tele/" + config.mqtt_devicetopic + "/LWT"; // connect with included "Last-Will-and-Testament" message 476 | uint8_t willQos = 0; 477 | boolean willRetain = true; 478 | const char* willMessage = "Offline"; // LWT message says "Offline" 479 | String subscribeString = "cmd/" + config.mqtt_devicetopic + "/#"; 480 | 481 | WriteLog("[INFO] - trying to connect to MQTT broker", true); 482 | // try to connect to MQTT 483 | if (mqtt_client.connect(client_id, username, password, willTopic.c_str(), willQos, willRetain, willMessage )) { 484 | WriteLog("[INFO] - MQTT connect success", true); 485 | // subscribe the needed topics 486 | mqtt_client.subscribe(subscribeString.c_str()); 487 | // publish telemetry message "we are online now" 488 | mqtt_client.publish(willTopic.c_str(), "Online", true); 489 | } else { 490 | WriteLog("[ERR ] - MQTT connect failed, rc =" + (String)mqtt_client.state(), true); 491 | } 492 | return mqtt_client.connected(); 493 | } // boolean mqtt_connect 494 | 495 | //#################################################################### 496 | // NTP update 497 | //#################################################################### 498 | void updateNTP() { 499 | configTime(TIMEZONE * 3600, 0, NTP_SERVERS); 500 | } // void updateNTP 501 | 502 | //#################################################################### 503 | // callback function when time is set via SNTP 504 | //#################################################################### 505 | void time_is_set(void) { 506 | if (time_is_set_first) { // call WriteLog only once for the initial time set 507 | time_is_set_first = false; 508 | WriteLog("[INFO] - time set from NTP server", true); 509 | } 510 | } // void time_is_set 511 | -------------------------------------------------------------------------------- /data/style.css: -------------------------------------------------------------------------------- 1 | /** 2 | * @name siimple v3.0.0 3 | * @description Minimal CSS framework for flat and clean designs. 4 | * @docs https://www.siimple.xyz/ 5 | * @license MIT 6 | **/ 7 | 8 | @import url(https://fonts.googleapis.com/css?family=Montserrat:400,700);html{font-family:Montserrat,sans-serif;font-weight:400;font-size:14px;color:#ffc107}body{margin:0}.siimple-alert{display:block;width:calc(100% - 10px - 30px);color:#ffc107;line-height:22px;font-size:14px;position:relative;border-radius:5px;background-color:#F8FAEB;padding-top:10px;padding-bottom:10px;padding-left:10px;padding-right:30px;margin-top:0;margin-bottom:16px}.siimple-alert.siimple-alert--navy{background-color:#ffc107;color:#fff}.siimple-alert.siimple-alert--green{background-color:#1add9f;color:#fff}.siimple-alert.siimple-alert--teal{background-color:#18d2ba;color:#fff}.siimple-alert.siimple-alert--blue{background-color:#4894f0;color:#fff}.siimple-alert.siimple-alert--purple{background-color:#b490f5;color:#fff}.siimple-alert.siimple-alert--pink{background-color:#f45b93;color:#fff}.siimple-alert.siimple-alert--red{background-color:#ff1a4f;color:#fff}.siimple-alert.siimple-alert--orange{background-color:#ff8463;color:#fff}.siimple-alert.siimple-alert--yellow{background-color:#ffbf00;color:#fff}.siimple-alert.siimple-alert--grey{background-color:#F8FAEB;color:#ffc107}.siimple-alert.siimple-alert--white{background-color:#fff;color:#ffc107}.siimple-btn{display:inline-block;height:30px;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s;cursor:pointer;line-height:30px;text-align:center;text-decoration:none;font-size:14px;font-weight:700;padding-left:10px;padding-right:10px;border:none;border-radius:5px;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none}.siimple-btn:hover{opacity:.8;text-decoration:none}.siimple-btn.siimple-btn--navy{background-color:#ffc107;color:#fff}.siimple-btn.siimple-btn--green{background-color:#1add9f;color:#fff}.siimple-btn.siimple-btn--teal{background-color:#18d2ba;color:#fff}.siimple-btn.siimple-btn--blue{background-color:#4894f0;color:#fff}.siimple-btn.siimple-btn--purple{background-color:#b490f5;color:#fff}.siimple-btn.siimple-btn--pink{background-color:#f45b93;color:#fff}.siimple-btn.siimple-btn--red{background-color:#ff1a4f;color:#fff}.siimple-btn.siimple-btn--orange{background-color:#ff8463;color:#fff}.siimple-btn.siimple-btn--yellow{background-color:#ffbf00;color:#fff}.siimple-btn.siimple-btn--grey{background-color:#F8FAEB;color:#ffc107}.siimple-btn.siimple-btn--white{background-color:#fff;color:#ffc107}.siimple-btn--disabled{background-color:#c3d7ef!important;color:rgba(87,96,124,.2)!important;cursor:not-allowed!important}.siimple-close{display:inline-block;width:20px;height:20px;cursor:pointer;-webkit-transition:background-color .3s;-o-transition:background-color .3s;transition:background-color .3s;position:relative;border-radius:100px;background-color:rgba(135,144,171,.3)}.siimple-close:after,.siimple-close:before{content:"";display:block;width:12px;height:2px;position:absolute;top:9px;left:4px;background-color:#fff}.siimple-close:after{-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);transform:rotate(45deg)}.siimple-close:before{-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg)}.siimple-close:hover{background-color:rgba(135,144,171,.6)}.siimple-alert .siimple-close{position:absolute!important;right:5px!important;top:5px!important}.siimple-spinner{width:10px;height:10px;content:"";-webkit-animation:siimple_spinner_animation 1s infinite ease-in-out;animation:siimple_spinner_animation 1s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both;border-radius:100px;display:block;text-indent:-9999em;font-size:10px;position:relative;-webkit-transform:translateZ(0);transform:translateZ(0);-webkit-animation-delay:.33s;animation-delay:.33s;margin-left:auto;margin-right:auto;margin-top:0}@-webkit-keyframes siimple_spinner_animation{50%{background-color:transparent}}@keyframes siimple_spinner_animation{50%{background-color:transparent}}.siimple-spinner:before{width:10px;height:10px;content:"";-webkit-animation:siimple_spinner_animation 1s infinite ease-in-out;animation:siimple_spinner_animation 1s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both;border-radius:100px;position:absolute;left:calc(15px * -1);top:0}.siimple-spinner:after{width:10px;height:10px;content:"";-webkit-animation:siimple_spinner_animation 1s infinite ease-in-out;animation:siimple_spinner_animation 1s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both;border-radius:100px;-webkit-animation-delay:.66s;animation-delay:.66s;position:absolute;left:15px;top:0}.siimple-spinner.siimple-spinner--navy,.siimple-spinner.siimple-spinner--navy:after,.siimple-spinner.siimple-spinner--navy:before{background-color:#ffc107}.siimple-spinner.siimple-spinner--green,.siimple-spinner.siimple-spinner--green:after,.siimple-spinner.siimple-spinner--green:before{background-color:#1add9f}.siimple-spinner.siimple-spinner--teal,.siimple-spinner.siimple-spinner--teal:after,.siimple-spinner.siimple-spinner--teal:before{background-color:#18d2ba}.siimple-spinner.siimple-spinner--blue,.siimple-spinner.siimple-spinner--blue:after,.siimple-spinner.siimple-spinner--blue:before{background-color:#4894f0}.siimple-spinner.siimple-spinner--purple,.siimple-spinner.siimple-spinner--purple:after,.siimple-spinner.siimple-spinner--purple:before{background-color:#b490f5}.siimple-spinner.siimple-spinner--pink,.siimple-spinner.siimple-spinner--pink:after,.siimple-spinner.siimple-spinner--pink:before{background-color:#f45b93}.siimple-spinner.siimple-spinner--red,.siimple-spinner.siimple-spinner--red:after,.siimple-spinner.siimple-spinner--red:before{background-color:#ff1a4f}.siimple-spinner.siimple-spinner--orange,.siimple-spinner.siimple-spinner--orange:after,.siimple-spinner.siimple-spinner--orange:before{background-color:#ff8463}.siimple-spinner.siimple-spinner--yellow,.siimple-spinner.siimple-spinner--yellow:after,.siimple-spinner.siimple-spinner--yellow:before{background-color:#ffbf00}.siimple-spinner.siimple-spinner--grey,.siimple-spinner.siimple-spinner--grey:after,.siimple-spinner.siimple-spinner--grey:before{background-color:#F8FAEB}.siimple-spinner.siimple-spinner--white,.siimple-spinner.siimple-spinner--white:after,.siimple-spinner.siimple-spinner--white:before{background-color:#fff}.siimple-spinner--small,.siimple-spinner--small:after,.siimple-spinner--small:before{width:8px!important;height:8px!important}.siimple-spinner--small:before{left:calc(13px * -1)!important}.siimple-spinner--small:after{left:13px!important}.siimple-spinner--large,.siimple-spinner--large:after,.siimple-spinner--large:before{width:15px!important;height:15px!important}.siimple-spinner--large:before{left:calc(20px * -1)!important}.siimple-spinner--large:after{left:20px!important}.siimple-table{display:table;width:100%;font-size:14px;color:#ffc107;border-collapse:collapse;border-width:0;margin-top:0;margin-bottom:16px}.siimple-table-row{display:table-row;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s;border-bottom:2px solid #fff}.siimple-table-row:hover{background-color:#F8FAEB}.siimple-table-row:last-child{border-bottom:0}.siimple-table-cell{display:table-cell;line-height:24px;padding:10px;white-space:nowrap;overflow:hidden;-webkit-transition:background-color .3s;-o-transition:background-color .3s;transition:background-color .3s}.siimple-table--border .siimple-table-cell:not(:last-child){border-right:2px solid #fff}.siimple-table-header{display:table-header-group;border-bottom:3px solid #fff!important;font-weight:700}.siimple-table-header .siimple-table-row:first-child .siimple-table-cell:first-child{border-top-left-radius:5px}.siimple-table-header .siimple-table-row:first-child .siimple-table-cell:last-child{border-top-right-radius:5px}.siimple-table-header .siimple-table-cell{background-color:#c3d7ef!important;border-bottom-right-radius:0!important;border-bottom-left-radius:0!important}.siimple-table-body{display:table-row-group}.siimple-table-body .siimple-table-cell{background-color:#F8FAEB}.siimple-table-body .siimple-table-row:last-child .siimple-table-cell:first-child{border-bottom-left-radius:5px}.siimple-table-body .siimple-table-row:last-child .siimple-table-cell:last-child{border-bottom-right-radius:5px}.siimple-table--striped .siimple-table-body .siimple-table-row:nth-child(odd) .siimple-table-cell{background-color:#f1f4f9}.siimple-table--hover .siimple-table-body .siimple-table-row:hover .siimple-table-cell{background-color:#d7e4f4!important}.siimple-tip{display:block;position:relative;width:calc(100% - 25px - 20px - 5px);border-left-style:solid;border-left-width:5px;border-radius:5px;padding-left:25px!important;padding-right:20px!important;padding-top:10px;padding-bottom:10px;margin-bottom:16px;background-color:#F8FAEB;font-size:14px;color:#ffc107}.siimple-tip::before{position:absolute;top:10px;left:-12px;width:20px;height:20px;border-radius:100px;color:#fff;text-align:center;line-height:20px}.siimple-tip.siimple-tip--navy{border-left-color:#ffc107}.siimple-tip.siimple-tip--navy::before{background-color:#ffc107}.siimple-tip.siimple-tip--green{border-left-color:#1add9f}.siimple-tip.siimple-tip--green::before{background-color:#1add9f}.siimple-tip.siimple-tip--teal{border-left-color:#18d2ba}.siimple-tip.siimple-tip--teal::before{background-color:#18d2ba}.siimple-tip.siimple-tip--blue{border-left-color:#4894f0}.siimple-tip.siimple-tip--blue::before{background-color:#4894f0}.siimple-tip.siimple-tip--purple{border-left-color:#b490f5}.siimple-tip.siimple-tip--purple::before{background-color:#b490f5}.siimple-tip.siimple-tip--pink{border-left-color:#f45b93}.siimple-tip.siimple-tip--pink::before{background-color:#f45b93}.siimple-tip.siimple-tip--red{border-left-color:#ff1a4f}.siimple-tip.siimple-tip--red::before{background-color:#ff1a4f}.siimple-tip.siimple-tip--orange{border-left-color:#ff8463}.siimple-tip.siimple-tip--orange::before{background-color:#ff8463}.siimple-tip.siimple-tip--yellow{border-left-color:#ffbf00}.siimple-tip.siimple-tip--yellow::before{background-color:#ffbf00}.siimple-tip.siimple-tip--grey{border-left-color:#F8FAEB}.siimple-tip.siimple-tip--grey::before{background-color:#F8FAEB}.siimple-tip.siimple-tip--white{border-left-color:#fff}.siimple-tip.siimple-tip--white::before{background-color:#fff}.siimple-tip--heart::before{content:"\2764"}.siimple-tip--exclamation::before{content:"!"}.siimple-tip--question::before{content:"?"}.siimple-form{display:block;width:100%;margin-top:0;margin-bottom:16px;font-size:14px}.siimple-form-rule{display:block;width:100%;height:0;border-bottom:1px solid #d7e4f4;margin-top:5px;margin-bottom:16px}.siimple-form-title{display:block;width:100%;vertical-align:top;font-weight:700;font-size:25px;color:#ffc107;margin-top:0;margin-bottom:5px}.siimple-form-detail{display:block;width:100%;vertical-align:top;font-size:14px;color:#404040;margin-top:0;margin-bottom:10px}.siimple-form-field{display:block;vertical-align:top;margin-bottom:16px;margin-top:0}.siimple-form-field-label{display:block;width:100%;vertical-align:top;font-weight:700;font-size:13px;color:#404040;margin-top:0;margin-bottom:5px}.siimple-form-field-helper{font-weight:400;font-size:12px;color:#8790ab;margin-top:5px;margin-bottom:15px}.siimple-checkbox{display:inline-block;position:relative;width:16px;height:16px;margin-left:10px;margin-right:10px;margin-top:7px;margin-bottom:7px}.siimple-checkbox label{width:16px;height:16px;cursor:pointer;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s;position:absolute;top:0;left:0;border-radius:2px;background:#F8FAEB}.siimple-checkbox label:after{opacity:.2;content:'';width:8px;height:4px;-webkit-transform:rotate(-45deg);-ms-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s;position:absolute;top:3px;left:3px;background:0 0;border:2px solid #ffc107;border-top:none;border-right:none}.siimple-checkbox label:hover::after{opacity:.5}.siimple-checkbox input[type=checkbox]{visibility:hidden}.siimple-checkbox input[type=checkbox]:checked+label:after{opacity:1;border-color:#fff}.siimple-checkbox input[type=checkbox]:checked+label{background-color:#1add9f}.siimple-input,.siimple-select{display:inline-block;height:30px;line-height:30px;font-size:14px;color:#ffc107;padding-left:10px;padding-right:10px;padding-top:0;padding-bottom:0;border:0;border-radius:5px;outline:0;background-color:#F8FAEB}.siimple-input--fluid,.siimple-select--fluid{width:100%}.siimple-switch{display:inline-block;width:30px;height:16px;position:relative;border-radius:50px;margin-left:10px;margin-right:10px;margin-top:7px;margin-bottom:7px}.siimple-switch label{display:block;width:12px;height:12px;border-radius:50px;-webkit-transition:all .3s ease;-o-transition:all .3s ease;transition:all .3s ease;cursor:hand;background:#fff;position:absolute;top:2px;left:2px;z-index:2}.siimple-switch div{width:100%;height:100%;background:#8790ab;border-radius:50px;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s;position:relative;top:-18px;z-index:1}.siimple-switch input[type=checkbox]{visibility:hidden}.siimple-switch input[type=checkbox]:checked~div{background:#1add9f}.siimple-switch input[type=checkbox]:checked~label{left:16px}.siimple-textarea{display:inline-block;line-height:22px;font-size:14px;color:#ffc107;padding:10px;border:0;outline:0;border-radius:5px;background-color:#F8FAEB}.siimple-textarea--fluid{width:100%}.siimple-label{display:inline-block;height:30px;line-height:30px;font-size:13px;color:#ffc107;font-weight:700;padding-right:10px;padding-left:0}.siimple-grid{display:block;width:100%;margin-left:auto;margin-right:auto}.siimple-grid-row{display:inline-block;width:100%;margin-left:0;margin-right:0}.siimple-grid-row:after{content:" ";clear:both;display:table;line-height:0}.siimple-grid-col{display:inline-block;vertical-align:top;float:left;margin-left:10px;margin-right:10px}.siimple-grid-col--1{width:calc(8.33% - 10px - 10px)}.siimple-grid-col--2{width:calc(16.66% - 10px - 10px)}.siimple-grid-col--3{width:calc(24.99% - 10px - 10px)}.siimple-grid-col--4{width:calc(33.33% - 10px - 10px)}.siimple-grid-col--5{width:calc(41.66% - 10px - 10px)}.siimple-grid-col--6{width:calc(49.99% - 10px - 10px)}.siimple-grid-col--7{width:calc(58.33% - 10px - 10px)}.siimple-grid-col--8{width:calc(66.66% - 10px - 10px)}.siimple-grid-col--9{width:calc(74.99% - 10px - 10px)}.siimple-grid-col--10{width:calc(83.33% - 10px - 10px)}.siimple-grid-col--11{width:calc(91.66% - 10px - 10px)}.siimple-grid-col--12{width:calc(99.99% - 10px - 10px)}@media (max-width:1280px){.siimple-grid-col-xl--1{width:calc(8.33% - 10px - 10px)}.siimple-grid-col-xl--2{width:calc(16.66% - 10px - 10px)}.siimple-grid-col-xl--3{width:calc(24.99% - 10px - 10px)}.siimple-grid-col-xl--4{width:calc(33.33% - 10px - 10px)}.siimple-grid-col-xl--5{width:calc(41.66% - 10px - 10px)}.siimple-grid-col-xl--6{width:calc(49.99% - 10px - 10px)}.siimple-grid-col-xl--7{width:calc(58.33% - 10px - 10px)}.siimple-grid-col-xl--8{width:calc(66.66% - 10px - 10px)}.siimple-grid-col-xl--9{width:calc(74.99% - 10px - 10px)}.siimple-grid-col-xl--10{width:calc(83.33% - 10px - 10px)}.siimple-grid-col-xl--11{width:calc(91.66% - 10px - 10px)}.siimple-grid-col-xl--12{width:calc(99.99% - 10px - 10px)}}@media (max-width:960px){.siimple-grid-col-lg--1{width:calc(8.33% - 10px - 10px)}.siimple-grid-col-lg--2{width:calc(16.66% - 10px - 10px)}.siimple-grid-col-lg--3{width:calc(24.99% - 10px - 10px)}.siimple-grid-col-lg--4{width:calc(33.33% - 10px - 10px)}.siimple-grid-col-lg--5{width:calc(41.66% - 10px - 10px)}.siimple-grid-col-lg--6{width:calc(49.99% - 10px - 10px)}.siimple-grid-col-lg--7{width:calc(58.33% - 10px - 10px)}.siimple-grid-col-lg--8{width:calc(66.66% - 10px - 10px)}.siimple-grid-col-lg--9{width:calc(74.99% - 10px - 10px)}.siimple-grid-col-lg--10{width:calc(83.33% - 10px - 10px)}.siimple-grid-col-lg--11{width:calc(91.66% - 10px - 10px)}.siimple-grid-col-lg--12{width:calc(99.99% - 10px - 10px)}}@media (max-width:768px){.siimple-grid-col-md--1{width:calc(8.33% - 10px - 10px)}.siimple-grid-col-md--2{width:calc(16.66% - 10px - 10px)}.siimple-grid-col-md--3{width:calc(24.99% - 10px - 10px)}.siimple-grid-col-md--4{width:calc(33.33% - 10px - 10px)}.siimple-grid-col-md--5{width:calc(41.66% - 10px - 10px)}.siimple-grid-col-md--6{width:calc(49.99% - 10px - 10px)}.siimple-grid-col-md--7{width:calc(58.33% - 10px - 10px)}.siimple-grid-col-md--8{width:calc(66.66% - 10px - 10px)}.siimple-grid-col-md--9{width:calc(74.99% - 10px - 10px)}.siimple-grid-col-md--10{width:calc(83.33% - 10px - 10px)}.siimple-grid-col-md--11{width:calc(91.66% - 10px - 10px)}.siimple-grid-col-md--12{width:calc(99.99% - 10px - 10px)}}@media (max-width:480px){.siimple-grid-col-sm--1{width:calc(8.33% - 10px - 10px)}.siimple-grid-col-sm--2{width:calc(16.66% - 10px - 10px)}.siimple-grid-col-sm--3{width:calc(24.99% - 10px - 10px)}.siimple-grid-col-sm--4{width:calc(33.33% - 10px - 10px)}.siimple-grid-col-sm--5{width:calc(41.66% - 10px - 10px)}.siimple-grid-col-sm--6{width:calc(49.99% - 10px - 10px)}.siimple-grid-col-sm--7{width:calc(58.33% - 10px - 10px)}.siimple-grid-col-sm--8{width:calc(66.66% - 10px - 10px)}.siimple-grid-col-sm--9{width:calc(74.99% - 10px - 10px)}.siimple-grid-col-sm--10{width:calc(83.33% - 10px - 10px)}.siimple-grid-col-sm--11{width:calc(91.66% - 10px - 10px)}.siimple-grid-col-sm--12{width:calc(99.99% - 10px - 10px)}}.siimple-layout{display:block;overflow-x:hidden;width:100%;height:100%;font-family:Montserrat,sans-serif;font-size:14px;color:#ffc107;font-weight:400}.siimple-layout--left{float:left}.siimple-layout--right{float:right}.siimple-box{display:block;vertical-align:top;width:calc(100% - 20px);background-color:#F8FAEB;font-size:14px;color:#ffc107;border-radius:5px;padding:10px;margin-bottom:10px}.siimple-box-title{display:block;font-weight:700;font-size:40px;text-decoration:none;margin-top:20px;margin-bottom:10px}.siimple-box-title:last-child{margin-bottom:20px}.siimple-box-subtitle{display:block;font-weight:700;font-size:30px;text-decoration:none;margin-top:10px;margin-bottom:10px;}.siimple-box-subtitle:first-child{margin-top:20px}.siimple-box-subtitle:last-child{margin-bottom:20px}.siimple-box-title+.siimple-box-subtitle{margin-top:-12px}.siimple-box-detail{display:block;margin-bottom:10px}.siimple-box-detail:first-child{margin-top:20px}.siimple-box-detail:last-child{margin-bottom:20px}.siimple-box.siimple-box--navy{background-color:#ffc107;color:#fff}.siimple-box.siimple-box--green{background-color:#1add9f;color:#fff}.siimple-box.siimple-box--teal{background-color:#18d2ba;color:#fff}.siimple-box.siimple-box--blue{background-color:#4894f0;color:#fff}.siimple-box.siimple-box--purple{background-color:#b490f5;color:#fff}.siimple-box.siimple-box--pink{background-color:#f45b93;color:#fff}.siimple-box.siimple-box--red{background-color:#ff1a4f;color:#fff}.siimple-box.siimple-box--orange{background-color:#ff8463;color:#fff}.siimple-box.siimple-box--yellow{background-color:#ffbf00;color:#fff}.siimple-box.siimple-box--grey{background-color:#F8FAEB;color:#ffc107}.siimple-box.siimple-box--white{background-color:#fff;color:#ffc107}.siimple-breadcrumb{display:block;width:100%;height:34px;margin-bottom:10px;margin-top:0}.siimple-breadcrumb-crumb{display:inline-block;float:left;position:relative;height:34px;line-height:34px;background-color:#F8FAEB;text-align:center;font-size:14px;font-weight:700;text-decoration:none;color:#8790ab;margin-right:5px;padding-left:25px;padding-right:10px;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s}.siimple-breadcrumb-crumb:hover{color:#ffc107;cursor:pointer}.siimple-breadcrumb-crumb:after{content:"";z-index:1;position:absolute;right:-17px;top:0;border-top:17px solid transparent;border-bottom:17px solid transparent;border-left:17px solid #F8FAEB}.siimple-breadcrumb-crumb:before{content:"";z-index:0;position:absolute;left:0;top:0;border-top:17px solid transparent;border-bottom:17px solid transparent;border-left:17px solid #fff}.siimple-breadcrumb-crumb:first-of-type{border-top-left-radius:5px;border-bottom-left-radius:5px;padding-left:10px}.siimple-breadcrumb-crumb:first-of-type:before{display:none}.siimple-breadcrumb-crumb:last-of-type{border-top-right-radius:5px;border-bottom-right-radius:5px;padding-right:10px}.siimple-breadcrumb-crumb:last-of-type:after{display:none}.siimple-content{display:block;padding-top:30px;padding-bottom:30px}.siimple-content--small{width:768px;padding-left:calc(50% - 384px);padding-right:calc(50% - 384px)}@media screen and (max-width:768px){.siimple-content--small{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-content--medium{width:960px;padding-left:calc(50% - 480px);padding-right:calc(50% - 480px)}@media screen and (max-width:960px){.siimple-content--medium{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-content--large{width:1180px;padding-left:calc(50% - 590px);padding-right:calc(50% - 590px)}@media screen and (max-width:1180px){.siimple-content--large{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-content--fluid{width:calc(100% - 40px);padding-left:20px;padding-right:20px}.siimple-footer{display:block;padding-top:50px;padding-bottom:80px}.siimple-footer--small{width:768px;padding-left:calc(50% - 384px);padding-right:calc(50% - 384px)}@media screen and (max-width:768px){.siimple-footer--small{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-footer--medium{width:960px;padding-left:calc(50% - 480px);padding-right:calc(50% - 480px)}@media screen and (max-width:960px){.siimple-footer--medium{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-footer--large{width:1180px;padding-left:calc(50% - 590px);padding-right:calc(50% - 590px)}@media screen and (max-width:1180px){.siimple-footer--large{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-footer--fluid{width:calc(100% - 40px);padding-left:20px;padding-right:20px}.siimple-footer.siimple-footer--navy{background-color:#ffc107;color:#fff}.siimple-footer.siimple-footer--green{background-color:#1add9f;color:#fff}.siimple-footer.siimple-footer--teal{background-color:#18d2ba;color:#fff}.siimple-footer.siimple-footer--blue{background-color:#4894f0;color:#fff}.siimple-footer.siimple-footer--purple{background-color:#b490f5;color:#fff}.siimple-footer.siimple-footer--pink{background-color:#f45b93;color:#fff}.siimple-footer.siimple-footer--red{background-color:#ff1a4f;color:#fff}.siimple-footer.siimple-footer--orange{background-color:#ff8463;color:#fff}.siimple-footer.siimple-footer--yellow{background-color:#ffbf00;color:#fff}.siimple-footer.siimple-footer--grey{background-color:#F8FAEB;color:#ffc107}.siimple-footer.siimple-footer--white{background-color:#fff;color:#ffc107}.siimple-jumbotron{display:block;padding-top:120px;padding-bottom:120px}.siimple-jumbotron--small{width:768px;padding-left:calc(50% - 384px);padding-right:calc(50% - 384px)}@media screen and (max-width:768px){.siimple-jumbotron--small{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-jumbotron--medium{width:960px;padding-left:calc(50% - 480px);padding-right:calc(50% - 480px)}@media screen and (max-width:960px){.siimple-jumbotron--medium{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-jumbotron--large{width:1180px;padding-left:calc(50% - 590px);padding-right:calc(50% - 590px)}@media screen and (max-width:1180px){.siimple-jumbotron--large{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-jumbotron--fluid{width:calc(100% - 40px);padding-left:20px;padding-right:20px}.siimple-jumbotron-title{display:block;text-decoration:none;line-height:60px;font-weight:700;font-size:50px;margin-top:0;margin-bottom:0}.siimple-jumbotron-subtitle{display:block;text-decoration:none;line-height:40px;font-size:30px;margin-top:10px;margin-bottom:10px}.siimple-jumbotron-detail{display:block;text-decoration:none;line-height:30px;font-size:20px;margin-top:10px;margin-bottom:10px}.siimple-jumbotron.siimple-jumbotron--navy{background-color:#ffa500;color:#fff}.siimple-jumbotron.siimple-jumbotron--green{background-color:#18cd94;color:#fff}.siimple-jumbotron.siimple-jumbotron--teal{background-color:#15b7a1;color:#fff}.siimple-jumbotron.siimple-jumbotron--blue{background-color:#2a82ef;color:#fff}.siimple-jumbotron.siimple-jumbotron--purple{background-color:#9f73f2;color:#fff}.siimple-jumbotron.siimple-jumbotron--pink{background-color:#f24081;color:#fff}.siimple-jumbotron.siimple-jumbotron--red{background-color:#ff003c;color:#fff}.siimple-jumbotron.siimple-jumbotron--orange{background-color:#ff734d;color:#fff}.siimple-jumbotron.siimple-jumbotron--yellow{background-color:#e6ac00;color:#fff}.siimple-jumbotron.siimple-jumbotron--grey{background-color:#d7e4f4;color:#ffc107}.siimple-jumbotron.siimple-jumbotron--white{background-color:#fff;color:#ffc107}.siimple-menu{display:block;width:100%;font-size:14px;margin-top:0;margin-bottom:10px;padding:0}.siimple-menu-group{display:block;width:100%;height:25px;line-height:25px;-webkit-transition:color .3s;-o-transition:color .3s;transition:color .3s;font-weight:700;text-decoration:none;color:#697496}.siimple-menu-group:not(:first-child){margin-top:10px}.siimple-menu-group:hover{text-decoration:none!important;color:#697496}.siimple-menu-item{display:block;height:34px;line-height:34px;border:0;border-radius:5px;font-size:14px;color:#ffc107;font-weight:400;text-decoration:none;padding-left:10px;padding-right:10px;opacity:1;-webkit-transition:background-color .3s;-o-transition:background-color .3s;transition:background-color .3s;cursor:pointer}.siimple-menu-item:hover{background-color:#F8FAEB;text-decoration:none!important;color:#ffc107}.siimple-menu-sub{display:block;padding-left:10px;margin-left:10px;margin-top:5px;margin-bottom:5px;border-left:1px solid #d7e4f4}.siimple-navbar{display:block;z-index:3;height:60px}.siimple-navbar--small{width:768px;padding-left:calc(50% - 384px);padding-right:calc(50% - 384px)}@media screen and (max-width:768px){.siimple-navbar--small{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-navbar--medium{width:960px;padding-left:calc(50% - 480px);padding-right:calc(50% - 480px)}@media screen and (max-width:960px){.siimple-navbar--medium{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-navbar--large{width:1180px;padding-left:calc(50% - 590px);padding-right:calc(50% - 590px)}@media screen and (max-width:1180px){.siimple-navbar--large{width:calc(100% - 40px);padding-left:20px;padding-right:20px}}.siimple-navbar--fluid{width:calc(100% - 40px);padding-left:20px;padding-right:20px}.siimple-navbar-item{display:inline-block;height:60px;line-height:60px;margin-left:0;margin-right:0;padding-left:15px;padding-right:15px;text-decoration:none;text-align:center;font-weight:700;font-size:normal}.siimple-navbar-title{display:inline-block;height:60px;line-height:60px;text-decoration:none;font-weight:700;font-size:22px;padding-left:15px;padding-right:15px;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s;cursor:pointer}.siimple-navbar-link{display:inline-block;height:60px;line-height:60px;margin-left:0;margin-right:0;padding-left:15px;padding-right:15px;text-decoration:none;text-align:center;font-weight:700;font-size:normal;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s;cursor:pointer}.siimple-navbar.siimple-navbar--navy{background-color:#ffc107;color:#fff}.siimple-navbar.siimple-navbar--navy .siimple-navbar-title{color:#fff}.siimple-navbar.siimple-navbar--navy .siimple-navbar-title:hover{background-color:#ffa500;color:#fff}.siimple-navbar.siimple-navbar--navy .siimple-navbar-link{color:#fff}.siimple-navbar.siimple-navbar--navy .siimple-navbar-link:hover{background-color:#ffa500;color:#fff}.siimple-navbar.siimple-navbar--green{background-color:#1add9f;color:#fff}.siimple-navbar.siimple-navbar--green .siimple-navbar-title{color:#fff}.siimple-navbar.siimple-navbar--green .siimple-navbar-title:hover{background-color:#18cd94;color:#fff}.siimple-navbar.siimple-navbar--green .siimple-navbar-link{color:#fff}.siimple-navbar.siimple-navbar--green .siimple-navbar-link:hover{background-color:#18cd94;color:#fff}.siimple-navbar.siimple-navbar--teal{background-color:#18d2ba;color:#fff}.siimple-navbar.siimple-navbar--teal .siimple-navbar-title{color:#fff}.siimple-navbar.siimple-navbar--teal .siimple-navbar-title:hover{background-color:#15b7a1;color:#fff}.siimple-navbar.siimple-navbar--teal .siimple-navbar-link{color:#fff}.siimple-navbar.siimple-navbar--teal .siimple-navbar-link:hover{background-color:#15b7a1;color:#fff}.siimple-navbar.siimple-navbar--blue{background-color:#4894f0;color:#fff}.siimple-navbar.siimple-navbar--blue .siimple-navbar-title{color:#fff}.siimple-navbar.siimple-navbar--blue .siimple-navbar-title:hover{background-color:#2a82ef;color:#fff}.siimple-navbar.siimple-navbar--blue .siimple-navbar-link{color:#fff}.siimple-navbar.siimple-navbar--blue .siimple-navbar-link:hover{background-color:#2a82ef;color:#fff}.siimple-navbar.siimple-navbar--purple{background-color:#b490f5;color:#fff}.siimple-navbar.siimple-navbar--purple .siimple-navbar-title{color:#fff}.siimple-navbar.siimple-navbar--purple .siimple-navbar-title:hover{background-color:#9f73f2;color:#fff}.siimple-navbar.siimple-navbar--purple .siimple-navbar-link{color:#fff}.siimple-navbar.siimple-navbar--purple .siimple-navbar-link:hover{background-color:#9f73f2;color:#fff}.siimple-navbar.siimple-navbar--pink{background-color:#f45b93;color:#fff}.siimple-navbar.siimple-navbar--pink .siimple-navbar-title{color:#fff}.siimple-navbar.siimple-navbar--pink .siimple-navbar-title:hover{background-color:#f24081;color:#fff}.siimple-navbar.siimple-navbar--pink .siimple-navbar-link{color:#fff}.siimple-navbar.siimple-navbar--pink .siimple-navbar-link:hover{background-color:#f24081;color:#fff}.siimple-navbar.siimple-navbar--red{background-color:#ff1a4f;color:#fff}.siimple-navbar.siimple-navbar--red .siimple-navbar-title{color:#fff}.siimple-navbar.siimple-navbar--red .siimple-navbar-title:hover{background-color:#ff003c;color:#fff}.siimple-navbar.siimple-navbar--red .siimple-navbar-link{color:#fff}.siimple-navbar.siimple-navbar--red .siimple-navbar-link:hover{background-color:#ff003c;color:#fff}.siimple-navbar.siimple-navbar--orange{background-color:#ff8463;color:#fff}.siimple-navbar.siimple-navbar--orange .siimple-navbar-title{color:#fff}.siimple-navbar.siimple-navbar--orange .siimple-navbar-title:hover{background-color:#ff734d;color:#fff}.siimple-navbar.siimple-navbar--orange .siimple-navbar-link{color:#fff}.siimple-navbar.siimple-navbar--orange .siimple-navbar-link:hover{background-color:#ff734d;color:#fff}.siimple-navbar.siimple-navbar--yellow{background-color:#ffbf00;color:#fff}.siimple-navbar.siimple-navbar--yellow .siimple-navbar-title{color:#fff}.siimple-navbar.siimple-navbar--yellow .siimple-navbar-title:hover{background-color:#e6ac00;color:#fff}.siimple-navbar.siimple-navbar--yellow .siimple-navbar-link{color:#fff}.siimple-navbar.siimple-navbar--yellow .siimple-navbar-link:hover{background-color:#e6ac00;color:#fff}.siimple-navbar.siimple-navbar--grey{background-color:#F8FAEB;color:#ffc107}.siimple-navbar.siimple-navbar--grey .siimple-navbar-title{color:#ffc107}.siimple-navbar.siimple-navbar--grey .siimple-navbar-title:hover{background-color:#d7e4f4;color:#ffc107}.siimple-navbar.siimple-navbar--grey .siimple-navbar-link{color:#ffc107}.siimple-navbar.siimple-navbar--grey .siimple-navbar-link:hover{background-color:#d7e4f4;color:#ffc107}.siimple-navbar.siimple-navbar--white{background-color:#fff;color:#ffc107}.siimple-navbar.siimple-navbar--white .siimple-navbar-title{color:#ffc107}.siimple-navbar.siimple-navbar--white .siimple-navbar-title:hover{background-color:#fff;color:#ffc107}.siimple-navbar.siimple-navbar--white .siimple-navbar-link{color:#ffc107}.siimple-navbar.siimple-navbar--white .siimple-navbar-link:hover{background-color:#fff;color:#ffc107}.siimple-tabs{display:block;position:relative;z-index:8;width:100%;height:40px;line-height:40px;font-size:14px;border-bottom:2px solid #F8FAEB;margin-bottom:10px;margin-top:0;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none}.siimple-tabs-tab{display:inline-block;float:left;z-index:10;height:39px;line-height:40px;font-weight:700;color:#697496;padding-left:15px;padding-right:15px;margin-bottom:-2px;border-bottom:2px solid transparent;border-top-left-radius:5px;border-top-right-radius:5px;cursor:pointer;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s}.siimple-tabs-tab:hover{border-bottom:2px solid #8790ab}.siimple-tabs-tab--selected{color:#ffc107;border-bottom:2px solid #ffc107}.siimple-tabs--boxed .siimple-tabs-tab:hover{background-color:#F8FAEB}.siimple-tabs.siimple-tabs--navy .siimple-tabs-tab:hover{border-bottom-color:#8790ab}.siimple-tabs.siimple-tabs--navy .siimple-tabs-tab--selected{color:#ffc107!important;border-bottom-color:#ffc107!important}.siimple-tabs.siimple-tabs--green .siimple-tabs-tab:hover{border-bottom-color:#48eab7}.siimple-tabs.siimple-tabs--green .siimple-tabs-tab--selected{color:#1add9f!important;border-bottom-color:#1add9f!important}.siimple-tabs.siimple-tabs--teal .siimple-tabs-tab:hover{border-bottom-color:#32e7cf}.siimple-tabs.siimple-tabs--teal .siimple-tabs-tab--selected{color:#18d2ba!important;border-bottom-color:#18d2ba!important}.siimple-tabs.siimple-tabs--blue .siimple-tabs-tab:hover{border-bottom-color:#71acf4}.siimple-tabs.siimple-tabs--blue .siimple-tabs-tab--selected{color:#4894f0!important;border-bottom-color:#4894f0!important}.siimple-tabs.siimple-tabs--purple .siimple-tabs-tab:hover{border-bottom-color:#cfb9f8}.siimple-tabs.siimple-tabs--purple .siimple-tabs-tab--selected{color:#b490f5!important;border-bottom-color:#b490f5!important}.siimple-tabs.siimple-tabs--pink .siimple-tabs-tab:hover{border-bottom-color:#f788b0}.siimple-tabs.siimple-tabs--pink .siimple-tabs-tab--selected{color:#f45b93!important;border-bottom-color:#f45b93!important}.siimple-tabs.siimple-tabs--red .siimple-tabs-tab:hover{border-bottom-color:#ff4d76}.siimple-tabs.siimple-tabs--red .siimple-tabs-tab--selected{color:#ff1a4f!important;border-bottom-color:#ff1a4f!important}.siimple-tabs.siimple-tabs--orange .siimple-tabs-tab:hover{border-bottom-color:#ffaf99}.siimple-tabs.siimple-tabs--orange .siimple-tabs-tab--selected{color:#ff8463!important;border-bottom-color:#ff8463!important}.siimple-tabs.siimple-tabs--yellow .siimple-tabs-tab:hover{border-bottom-color:#fc3}.siimple-tabs.siimple-tabs--yellow .siimple-tabs-tab--selected{color:#ffbf00!important;border-bottom-color:#ffbf00!important}.siimple-tabs.siimple-tabs--grey .siimple-tabs-tab:hover{border-bottom-color:#f1f4f9}.siimple-tabs.siimple-tabs--grey .siimple-tabs-tab--selected{color:#F8FAEB!important;border-bottom-color:#F8FAEB!important}.siimple-tabs.siimple-tabs--white .siimple-tabs-tab:hover{border-bottom-color:#fff}.siimple-tabs.siimple-tabs--white .siimple-tabs-tab--selected{color:#fff!important;border-bottom-color:#fff!important}.siimple-blockquote{display:block;color:#8790ab;font-size:14px;border-left:4px solid #8790ab;padding-top:10px;padding-bottom:10px;padding-left:20px;padding-right:10px;margin-top:10px;margin-bottom:16px}.siimple-code{color:#ffc107;text-decoration:none;font-size:14px;background-color:#F8FAEB;border-radius:5px;padding-top:2px;padding-bottom:2px;padding-left:5px;padding-right:5px}.siimple-code--dark{background-color:#ffc107!important;color:#fff}.siimple-pre{display:block;overflow-x:auto;width:calc(100% - 10px - 10px);color:#404040;line-height:20px;font-weight:400;font-size:14px;background-color:#F8FAEB;border-radius:5px;padding:10px;margin-top:0;margin-bottom:16px}.siimple-pre--dark{background-color:#ffc107!important;color:#fff}.siimple-h1{display:block;font-size:45px;font-weight:700;line-height:51px;color:#ffa500;padding:0;margin-bottom:20px}.siimple-h1:not(:first-child){margin-top:28px}.siimple-h2{display:block;font-size:35px;font-weight:700;color:#ffc107;padding:0;margin-bottom:20px}.siimple-h2:not(:first-child){margin-top:28px}.siimple-h3{display:block;font-size:25px;font-weight:700;color:#ffc107;padding:0;margin-bottom:18px}.siimple-h3:not(:first-child){margin-top:28px}.siimple-h4{display:block;font-size:22px;font-weight:700;color:#ffc107;padding:0;margin-bottom:16px}.siimple-h4:not(:first-child){margin-top:28px}.siimple-h5{display:block;font-size:20px;font-weight:700;color:#ffc107;padding:0;margin-bottom:14px}.siimple-h5:not(:first-child){margin-top:28px}.siimple-h6{display:block;font-size:16px;font-weight:700;color:#ffc107;padding:0;margin-bottom:12px}.siimple-h6:not(:first-child){margin-top:28px}.siimple-tag{display:inline-block;font-size:12px;text-decoration:none;line-height:22px;border-radius:5px;padding-left:6px;padding-right:6px;margin-right:1px}.siimple-tag.siimple-tag--navy{background-color:#ffc107;color:#fff}.siimple-tag.siimple-tag--green{background-color:#1add9f;color:#fff}.siimple-tag.siimple-tag--teal{background-color:#18d2ba;color:#fff}.siimple-tag.siimple-tag--blue{background-color:#4894f0;color:#fff}.siimple-tag.siimple-tag--purple{background-color:#b490f5;color:#fff}.siimple-tag.siimple-tag--pink{background-color:#f45b93;color:#fff}.siimple-tag.siimple-tag--red{background-color:#ff1a4f;color:#fff}.siimple-tag.siimple-tag--orange{background-color:#ff8463;color:#fff}.siimple-tag.siimple-tag--yellow{background-color:#ffbf00;color:#fff}.siimple-tag.siimple-tag--grey{background-color:#F8FAEB;color:#ffc107}.siimple-tag.siimple-tag--white{background-color:#fff;color:#ffc107}.siimple-small{font-size:12px;color:#8790ab}.siimple-p,.siimple-paragraph{display:block;line-height:22px;font-size:14px;margin-top:0;margin-bottom:16px}.siimple-a,.siimple-link{color:#ffc107;font-weight:700;text-decoration:underline;-webkit-transition:all .3s;-o-transition:all .3s;transition:all .3s}.siimple-a:hover,.siimple-link:hover{text-decoration:underline;cursor:pointer}.siimple-color--navy{color:#ffc107}.siimple-color--green{color:#1add9f}.siimple-color--teal{color:#18d2ba}.siimple-color--blue{color:#4894f0}.siimple-color--purple{color:#b490f5}.siimple-color--pink{color:#f45b93}.siimple-color--red{color:#ff1a4f}.siimple-color--orange{color:#ff8463}.siimple-color--yellow{color:#ffbf00}.siimple-color--grey{color:#F8FAEB}.siimple-color--white{color:#fff}.siimple-bg--navy{background-color:#ffc107}.siimple-bg--green{background-color:#1add9f}.siimple-bg--teal{background-color:#18d2ba}.siimple-bg--blue{background-color:#4894f0}.siimple-bg--purple{background-color:#b490f5}.siimple-bg--pink{background-color:#f45b93}.siimple-bg--red{background-color:#ff1a4f}.siimple-bg--orange{background-color:#ff8463}.siimple-bg--yellow{background-color:#ffbf00}.siimple-bg--grey{background-color:#F8FAEB}.siimple-bg--white{background-color:#fff} -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . --------------------------------------------------------------------------------