1 /*----------------------------------------------------------------------------+ 2 | | 3 | State and Script functions for HEYU | 4 | Copyright 2004-2010 Charles W. Sullivan | 5 | | 6 | | 7 | As used herein, HEYU is a trademark of Daniel B. Suthers. | 8 | X10, CM11A, and ActiveHome are trademarks of X-10 (USA) Inc. | 9 | The author is not affiliated with either entity. | 10 | | 11 | Charles W. Sullivan | 12 | Co-author and Maintainer | 13 | Greensboro, North Carolina | 14 | Email ID: cwsulliv01 | 15 | Email domain: -at- heyu -dot- org | 16 | | 17 +----------------------------------------------------------------------------*/ 18 19 /* 20 * This program is free software: you can redistribute it and/or modify 21 * it under the terms of the GNU General Public License as published by 22 * the Free Software Foundation, either version 3 of the License, or 23 * (at your option) any later version. 24 * 25 * This program is distributed in the hope that it will be useful, 26 * but WITHOUT ANY WARRANTY; without even the implied warranty of 27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 * GNU General Public License for more details. 29 * 30 * You should have received a copy of the GNU General Public License 31 * along with this program. If not, see <http://www.gnu.org/licenses/>. 32 * 33 */ 34 35 36 37 #include <time.h> 38 39 /* Structure of Heyu State Table */ 40 41 typedef struct { 42 unsigned char reset; 43 unsigned char lastunit; 44 unsigned char lastcmd; 45 unsigned int addressed; /* X10 bitmap */ 46 unsigned int exclusive; /* Exclusive bitmap */ 47 unsigned int sticky; /* Stickey address bitmap */ 48 unsigned int vaddress; /* Virtual address bitmap */ 49 unsigned int squelch; /* Squelch address bitmap */ 50 unsigned int lastactive; /* Active mask for last command */ 51 unsigned char xconfigmode; /* Mode for xconfig */ 52 unsigned int state[NumStates]; /* 0 = OnState 1 = DimState 2 = ChgState 3 = LightsOnState 4 = AlertState 5 = AuxAlertState */ 53 unsigned int launched; /* Launched script bitmap */ 54 // unsigned int statusflags; /* Status pending flags */ 55 unsigned int rfxlobat; /* RFXSensor low battery flags */ 56 unsigned long vflags[16]; /* Virtual data flags */ 57 unsigned char dimlevel[16]; /* Current dim level (or security data) */ 58 unsigned char memlevel[16]; /* "memory" level - preset modules (or Aux security data) */ 59 unsigned long vident[16]; /* ident - virtual modules */ 60 time_t timestamp[16]; /* time of last update */ 61 long longdata; /* Data storage for Unit 0 */ 62 int rcstemp; /* RCS Temperature */ 63 unsigned long rfxmeter[16]; /* RFXMeter data */ 64 unsigned char grpmember[16]; /* bits 0-3 are bitmapped ext3 group memberships */ 65 unsigned char grpaddr[16]; /* abs or relative group address */ 66 unsigned char grplevel[16][4]; /* ext3 levels for groups 0-3 */ 67 } x10hcode_t; 68 69 struct x10global_st { 70 time_t filestamp; /* Time of last file write */ 71 unsigned long longvdata; 72 unsigned long longvdata2; 73 unsigned long longvdata3; 74 unsigned char sigcount; /* Electrisave/Owl signal counter */ 75 long interval; 76 unsigned char lastvtype; 77 unsigned char lasthc; 78 unsigned int lastaddr; 79 // unsigned long timer_count[NUM_USER_TIMERS + 1]; 80 long timer_count[NUM_USER_TIMERS + 1]; 81 unsigned long flags[NUM_FLAG_BANKS]; /* Common flags */ 82 unsigned long sflags; /* State and Security flags */ 83 unsigned long vflags; /* Global vflags */ 84 unsigned long longdata_flags; /* Unit 0 has valid data */ 85 unsigned long rcstemp_flags; /* RCS Temperature has valid data */ 86 unsigned char dawndusk_enable; /* Set when config has Lat and Long.*/ 87 int isdark_offset; 88 time_t utc0_macrostamp; /* Most recent timer macro exec. */ 89 time_t utc0_dawn; 90 time_t utc0_dusk; 91 time_t utc0_tomorrow; 92 x10hcode_t x10hcode[16]; 93 unsigned long data_storage[MAXDATASTORAGE]; 94 unsigned short rfxdata[8][32]; 95 unsigned long rfxflags[8]; 96 unsigned short counter[32 * NUM_COUNTER_BANKS]; 97 unsigned long czflags[NUM_COUNTER_BANKS]; 98 unsigned long tzflags[NUM_TIMER_BANKS]; 99 unsigned int hailstate; 100 }; 101 102 103