#include <unistd.h>
#include <amulet.h>
#include <am_inc.h>
#include "rwil.h"
#include "X10Device.h"
#include "AmuletRWIL.h"
Go to the source code of this file.
Defines | |
#define | Am_X10_VALUE_SLOT 0x0004 |
Functions | |
void | x10_create (Am_Object device) |
void | x10_destroy (Am_Object device) |
void | x10_send_message (Am_Object device) |
Am_Define_Method (Am_Timer_Method, void, x10_check_slot,(Am_Object device, const Am_Time &tme)) | |
void | x10_value_slot (Am_Slot first_invalidated) |
void | RWIL_Initialize () |
Variables | |
Am_Slot_Key | Am_DIMMABLE = Am_Register_Slot_Name ("Am_DIMMABLE") |
Am_Slot_Key | Am_HOUSE = Am_Register_Slot_Name ("Am_HOUSE") |
Am_Slot_Key | Am_NUMBER = Am_Register_Slot_Name ("Am_NUMBER") |
Am_Slot_Key | Am_CUR_VALUE = Am_Register_Slot_Name ("Am_CUR_VALUE") |
Am_Slot_Key | Am_READY = Am_Register_Slot_Name ("Am_READY") |
Am_Slot_Key | Am_CHECK_IF_READY = Am_Register_Slot_Name ("Am_CHECK_IF_READY") |
Am_Slot_Key | Am_DEV_PTR = Am_Register_Slot_Name("Am_DEV_PTR") |
char | strangebuf [10000] |
Am_Object | Am_X10_Device |
int | grumblebuf [6000] |
RWIL * | g_myRWIL |
int | grumblebuf2 [6000] |
|
Definition at line 20 of file AmuletRWIL.cpp. Referenced by RWIL_Initialize(). |
|
Definition at line 85 of file AmuletRWIL.cpp. References Am_CHECK_IF_READY, Am_CUR_VALUE, Am_READY, g_myRWIL, and x10_send_message().
00086 { 00087 //discover if we got a message of completion of event 00088 //update Am_CUR_VALUE 00089 std::list<Message *> lst; 00090 bool messagereceived = false; 00091 00092 lst = g_myRWIL->output.Query("device", device.Get_Name()); 00093 if(!lst.empty()) 00094 { 00095 device.Set(Am_CUR_VALUE, atoi(lst.front()->GetParam("percent").c_str())); 00096 messagereceived = true; 00097 g_myRWIL->output.Destroy(lst); 00098 } 00099 if(messagereceived) 00100 { 00101 if(device.Get(Am_VALUE) != device.Get(Am_CUR_VALUE)) 00102 { 00103 x10_send_message(device); 00104 } 00105 else 00106 { 00107 device.Set(Am_READY, true); 00108 Am_Stop_Timer(device, Am_CHECK_IF_READY); 00109 } 00110 } 00111 } |
|
Definition at line 136 of file AmuletRWIL.cpp. References Am_CHECK_IF_READY, Am_CUR_VALUE, Am_DIMMABLE, Am_HOUSE, Am_NUMBER, Am_READY, Am_X10_Device, Am_X10_VALUE_SLOT, g_myRWIL, x10_create(), x10_destroy(), and x10_value_slot().
00137 { 00138 Am_Object_Advanced temp; 00139 Am_Demon_Set demons; 00140 unsigned short demon_mask; 00141 00142 Am_X10_Device = Am_Root_Object.Create("Am_X10_Device") 00143 .Add (Am_ACTIVE, false) // consider a formula that checks to see if object is in window and sets active from that. 00144 .Add (Am_VALUE, 0) 00145 .Add (Am_DIMMABLE, true) 00146 .Add (Am_HOUSE, "") 00147 .Add (Am_NUMBER, -1) 00148 .Add (Am_CUR_VALUE, -1) 00149 .Add (Am_READY, true) 00150 .Add (Am_CHECK_IF_READY, x10_check_slot) 00151 ; 00152 00153 00154 temp = (Am_Object_Advanced&)Am_X10_Device; 00155 00156 demons = temp.Get_Demons ().Copy (); 00157 demons.Set_Object_Demon (Am_CREATE_OBJ, x10_create); 00158 // demons.Set_Object_Demon (Am_COPY_OBJ, x10_copy); // Do not really want to allow copying... x10copy should assert 00159 demons.Set_Object_Demon (Am_DESTROY_OBJ, x10_destroy); 00160 00161 temp.Get_Slot (Am_VALUE).Set_Demon_Bits (Am_X10_VALUE_SLOT | 00162 Am_EAGER_DEMON); 00163 00164 demons.Set_Slot_Demon (Am_X10_VALUE_SLOT, x10_value_slot, 00165 Am_DEMON_PER_OBJECT | Am_DEMON_ON_CHANGE); 00166 demon_mask = temp.Get_Demon_Mask (); 00167 demon_mask |= 0x0004; 00168 temp.Set_Demon_Mask (demon_mask); 00169 temp.Set_Demons (demons); 00170 00171 g_myRWIL = new RWIL; 00172 g_myRWIL->Start(); 00173 } |
|
Definition at line 44 of file AmuletRWIL.cpp. References Am_DEV_PTR, and g_myRWIL. Referenced by RWIL_Initialize().
00045 { 00046 Device *devptr = new X10Device(device.Get_Name(), g_myRWIL->output, 'a',1); 00047 device.Add(Am_DEV_PTR, (Am_Ptr)devptr); 00048 g_myRWIL->AddDevice(devptr); 00049 } |
|
Definition at line 52 of file AmuletRWIL.cpp. References g_myRWIL. Referenced by RWIL_Initialize().
|
|
Definition at line 67 of file AmuletRWIL.cpp. References Am_DEV_PTR, Am_HOUSE, Am_NUMBER, g_myRWIL, and rwil::IntToString(). Referenced by Am_Define_Method(), and x10_value_slot().
00068 { 00069 Message msg(device.Get_Name(), "dim"); 00070 Device *devptr = (Device *)(Am_Ptr)device.Get(Am_DEV_PTR); 00071 00072 if((int)device.Get(Am_VALUE) >=0) 00073 { 00074 00075 msg.SetParam("percent", IntToString(device.Get(Am_VALUE))); 00076 00077 ((X10Device*)devptr)->SetHouse((std::string)(const char *)(Am_String)device.Get(Am_HOUSE)); 00078 ((X10Device*)devptr)->SetNumber((int)device.Get(Am_NUMBER)); 00079 00080 g_myRWIL->input.Add(msg); 00081 } 00082 } |
|
Definition at line 115 of file AmuletRWIL.cpp. References Am_CHECK_IF_READY, Am_CUR_VALUE, Am_READY, and x10_send_message(). Referenced by RWIL_Initialize().
00116 { 00117 Am_Object device = first_invalidated.Get_Owner (); 00118 if (device.Get(Am_VALUE) != device.Get(Am_CUR_VALUE)) 00119 { 00120 if (device.Get(Am_READY)) 00121 { 00122 x10_send_message(device); 00123 device.Set(Am_READY, false); 00124 Am_Register_Timer(Am_Time(1000), device, Am_CHECK_IF_READY, false); 00125 } 00126 } 00127 } |
|
Definition at line 33 of file AmuletRWIL.cpp. Referenced by Am_Define_Method(), RWIL_Initialize(), and x10_value_slot(). |
|
Definition at line 31 of file AmuletRWIL.cpp. Referenced by Am_Define_Method(), RWIL_Initialize(), and x10_value_slot(). |
|
Definition at line 34 of file AmuletRWIL.cpp. Referenced by x10_create(), and x10_send_message(). |
|
Definition at line 28 of file AmuletRWIL.cpp. Referenced by RWIL_Initialize(). |
|
Definition at line 29 of file AmuletRWIL.cpp. Referenced by RWIL_Initialize(), and x10_send_message(). |
|
Definition at line 30 of file AmuletRWIL.cpp. Referenced by RWIL_Initialize(), and x10_send_message(). |
|
Definition at line 32 of file AmuletRWIL.cpp. Referenced by Am_Define_Method(), RWIL_Initialize(), and x10_value_slot(). |
|
Definition at line 36 of file AmuletRWIL.cpp. Referenced by RWIL_Initialize(). |
|
Definition at line 42 of file AmuletRWIL.cpp. Referenced by Am_Define_Method(), RWIL_Initialize(), x10_create(), x10_destroy(), and x10_send_message(). |
|
Definition at line 40 of file AmuletRWIL.cpp. |
|
Definition at line 43 of file AmuletRWIL.cpp. |
|
Definition at line 35 of file AmuletRWIL.cpp. |