|
From: <Ba...@us...> - 2012-01-05 12:53:31
|
Revision: 4375
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4375&view=rev
Author: BartEv
Date: 2012-01-05 12:53:23 +0000 (Thu, 05 Jan 2012)
Log Message:
-----------
Added Paths:
-----------
trunk/plugins/VeraControl/releases/
trunk/plugins/VeraControl/releases/VeraControl.xmp2
trunk/plugins/VeraControl/releases/VeraControl_v0.5.0.0.mpe1
trunk/plugins/VeraControl/releases/update.xml
Added: trunk/plugins/VeraControl/releases/VeraControl.xmp2
===================================================================
--- trunk/plugins/VeraControl/releases/VeraControl.xmp2 (rev 0)
+++ trunk/plugins/VeraControl/releases/VeraControl.xmp2 2012-01-05 12:53:23 UTC (rev 4375)
@@ -0,0 +1,917 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PackageClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <Version>2.0</Version>
+ <Groups>
+ <Items>
+ <GroupItem Name="Default">
+ <ParentGroup />
+ <DisplayName>Default</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>Default</Description>
+ <Files>
+ <Items>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="true">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\bin\Debug\VeraControl.dll</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{7313a25a-e5a1-46e7-af14-613b3d1294df}-VeraControl.dll</ZipFileName>
+ <DestinationFilename>%Plugins%\Windows\VeraControl.dll</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="true">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Default\VeraControl.xml</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{028d1570-2f3e-4ddb-9721-36f94cca1de5}-VeraControl.xml</ZipFileName>
+ <DestinationFilename>%Skin%\Default\VeraControl.xml</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="true">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Default\VeraDialogActionTrigger.xml</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{09937fdb-eda7-4fb5-a0c6-b94788cacdb6}-VeraDialogActionTrigger.xml</ZipFileName>
+ <DestinationFilename>%Skin%\Default\VeraDialogActionTrigger.xml</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="true">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Default\VeraDialogDeviceControl.xml</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{507aff1a-15af-493d-b9b4-40ef11cfc4cd}-VeraDialogDeviceControl.xml</ZipFileName>
+ <DestinationFilename>%Skin%\Default\VeraDialogDeviceControl.xml</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="true">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\DefaultWide\VeraControl.xml</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{85789702-644a-4d04-b55c-8d1b76947ba4}-VeraControl.xml</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\VeraControl.xml</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="true">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\DefaultWide\VeraDialogActionTrigger.xml</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{34942e3c-61c3-4475-809b-89fb17f84fbb}-VeraDialogActionTrigger.xml</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\VeraDialogActionTrigger.xml</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="true">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\DefaultWide\VeraDialogDeviceControl.xml</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{81cf93f1-6f6f-46de-9370-e4c75596ca9d}-VeraDialogDeviceControl.xml</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\VeraDialogDeviceControl.xml</DestinationFilename>
+ </FileItem>
+ </Items>
+ </Files>
+ </GroupItem>
+ <GroupItem Name="IconsDefault">
+ <DisplayName>Icons-default</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>IconsDefault</Description>
+ <Files>
+ <Items>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Binary_Light_0.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{89116eb0-9f8f-4115-8585-47c31626e2f2}-Binary_Light_0.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Binary_Light_0.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Binary_Light_100.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{6bb2f991-9a12-485d-b619-127cf337a8e6}-Binary_Light_100.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Binary_Light_100.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\default_panel.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{e50d693c-667a-4bca-9b98-94a88d9a26f3}-default_panel.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\default_panel.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Dimmable_Light_0.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{c4930324-5849-4cfb-b4cb-366999094a0d}-Dimmable_Light_0.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Dimmable_Light_0.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Dimmable_Light_100.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{fb44ba6e-e418-469b-8ba4-3fe1a064bb6e}-Dimmable_Light_100.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Dimmable_Light_100.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Dimmable_Light_25.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{7b289b0b-bae4-4636-a12e-ba59429f0cf3}-Dimmable_Light_25.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Dimmable_Light_25.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Dimmable_Light_50.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{f75631ed-96fe-4349-9be5-d278daff8cba}-Dimmable_Light_50.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Dimmable_Light_50.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Dimmable_Light_75.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{efb6ef6a-7cdf-48bf-b675-d45378f156e4}-Dimmable_Light_75.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Dimmable_Light_75.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Door_Lock.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{df1a20d3-936c-4b7b-89c5-fb509a998cf2}-Door_Lock.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Door_Lock.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Door_Lock_0.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{b1eaf501-4274-4a7f-9e7a-fbcf5cccf440}-Door_Lock_0.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Door_Lock_0.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Door_Lock_100.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{f9f6e928-f0fb-4212-8994-c88ae2981829}-Door_Lock_100.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Door_Lock_100.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\energy.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{53f9d0bd-c18e-40ee-8c54-d319744bc032}-energy.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\energy.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\findvera.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{d66f0720-f31a-494f-8f48-d573342f04bb}-findvera.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\findvera.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Generic_IO.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{5c67f3ea-9e86-4b21-adcf-5a8cb00e94c0}-Generic_IO.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Generic_IO.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\generic_sensor.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{48c7aff1-ff51-4c34-873a-9bb717a11eb1}-generic_sensor.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\generic_sensor.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Humidity_Sensor.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{eee55fd4-330f-40a8-b3e1-c728e9ae40cc}-Humidity_Sensor.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Humidity_Sensor.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Insteon.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{7316caa2-a4c9-43e9-9a11-4491aa20e358}-Insteon.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Insteon.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Light_Sensor.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{cfb228c8-c039-41b3-8388-e1292b40d568}-Light_Sensor.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Light_Sensor.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Motion_Sensor_0.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{4c0ff3e4-6770-4f74-9baf-92e3fefc783b}-Motion_Sensor_0.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Motion_Sensor_0.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Motion_Sensor_100.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{f84bc452-70f3-4bbf-ae56-00fc3182a8f3}-Motion_Sensor_100.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Motion_Sensor_100.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Power_Meter.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{968b6884-21e9-4357-99d5-b4368901d7b4}-Power_Meter.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Power_Meter.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Scenes.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{d4724f5a-6a6e-4702-b122-58d48b4d6822}-Scenes.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Scenes.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Temperature_Sensor.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{cd6d14cf-c7d2-4258-a8b4-4ac0c02ac1da}-Temperature_Sensor.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Temperature_Sensor.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Thermostat.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{6e4a50f0-98dd-4752-af25-7d260e6c4387}-Thermostat.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Thermostat.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Window_Covering.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{81d4d577-b083-4b25-ad60-86ae9f624f8b}-Window_Covering.png</ZipFileName>
+ <DestinationFilename>%Skin%\Default\media\Vera\Window_Covering.png</DestinationFilename>
+ </FileItem>
+ </Items>
+ </Files>
+ </GroupItem>
+ <GroupItem Name="IconsDefaultWide">
+ <DisplayName>IconsDefaultWide</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>IconsDefaultWide</Description>
+ <Files>
+ <Items>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Binary_Light_0.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{6b52dea7-10b3-47f0-b501-fb4066d4401f}-Binary_Light_0.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Binary_Light_0.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Binary_Light_100.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{038b63d1-5117-45d2-aabd-e71be925cd82}-Binary_Light_100.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Binary_Light_100.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\default_panel.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{b73ea654-f982-4b56-9545-6b37eedbe50d}-default_panel.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\default_panel.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Dimmable_Light_0.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{f7b771b8-1e81-4b03-aa0e-e543828ebae6}-Dimmable_Light_0.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Dimmable_Light_0.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Dimmable_Light_100.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{94401be2-c4ff-4ffb-b5cc-467a2a56ce09}-Dimmable_Light_100.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Dimmable_Light_100.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Dimmable_Light_25.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{573a2fa0-792d-4f96-8b6f-77c132b401d9}-Dimmable_Light_25.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Dimmable_Light_25.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Dimmable_Light_50.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{a22acfc5-030e-46b9-b3f2-a3d7715c686e}-Dimmable_Light_50.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Dimmable_Light_50.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Dimmable_Light_75.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{00f2700c-279b-4f65-80a4-c6bf492bfedc}-Dimmable_Light_75.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Dimmable_Light_75.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Door_Lock.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{8c082e30-634c-4522-b8c6-21ed2f1da157}-Door_Lock.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Door_Lock.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Door_Lock_0.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{f4995882-0621-4a4b-b872-5dc4dd375874}-Door_Lock_0.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Door_Lock_0.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Door_Lock_100.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{056c0d53-e453-4c10-aa53-7cc9e2feeeec}-Door_Lock_100.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Door_Lock_100.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\energy.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{1b31597a-7ee0-431f-ac40-2c6f4ef900a1}-energy.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\energy.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\findvera.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{cca1d9fa-0a0c-4e82-8640-335e965f0944}-findvera.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\findvera.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Generic_IO.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{b5124f9f-e8bb-4c30-813c-ff06b9064f2b}-Generic_IO.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Generic_IO.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\generic_sensor.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{9dac2abb-b92b-4f34-987b-89befad576e4}-generic_sensor.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\generic_sensor.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Humidity_Sensor.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{a4e8847b-7b39-4a7b-b2d3-4f3be63991f6}-Humidity_Sensor.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Humidity_Sensor.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Insteon.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{d3df16fc-e295-4af2-8757-37b245cc6522}-Insteon.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Insteon.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Light_Sensor.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{7f28ddf2-f66b-4726-bd27-53062fa65451}-Light_Sensor.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Light_Sensor.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Motion_Sensor_0.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{11842716-9e2a-4226-8af5-57240474673c}-Motion_Sensor_0.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Motion_Sensor_0.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Motion_Sensor_100.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{490ebe21-fa83-4cab-bd25-62d09902bc52}-Motion_Sensor_100.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Motion_Sensor_100.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Power_Meter.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{c7e21c80-2566-4ae8-a656-24f36c0dee24}-Power_Meter.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Power_Meter.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Scenes.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{6a32f914-e28c-4bb5-b6bd-633c527f26fe}-Scenes.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Scenes.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Temperature_Sensor.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{40cc3e24-e58d-49d5-8747-0e7c8421e57d}-Temperature_Sensor.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Temperature_Sensor.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Thermostat.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{26667211-641d-4524-88ac-8d8a07998da6}-Thermostat.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Thermostat.png</DestinationFilename>
+ </FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Media\Vera\Window_Covering.png</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{10317a0b-8169-4b3c-acff-db60a3118d2e}-Window_Covering.png</ZipFileName>
+ <DestinationFilename>%Skin%\DefaultWide\media\Vera\Window_Covering.png</DestinationFilename>
+ </FileItem>
+ </Items>
+ </Files>
+ ...
[truncated message content] |
|
From: <Ba...@us...> - 2012-01-05 14:48:53
|
Revision: 4381
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4381&view=rev
Author: BartEv
Date: 2012-01-05 14:48:47 +0000 (Thu, 05 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/VeraControl/Properties/AssemblyInfo.cs
trunk/plugins/VeraControl/releases/VeraControl.xmp2
trunk/plugins/VeraControl/releases/update.xml
Added Paths:
-----------
trunk/plugins/VeraControl/releases/VeraControl_v0.5.0.1.mpe1
Modified: trunk/plugins/VeraControl/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/VeraControl/Properties/AssemblyInfo.cs 2012-01-05 14:37:36 UTC (rev 4380)
+++ trunk/plugins/VeraControl/Properties/AssemblyInfo.cs 2012-01-05 14:48:47 UTC (rev 4381)
@@ -28,4 +28,4 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("0.5.*")]
+[assembly: AssemblyVersion("0.5.0.1")]
Modified: trunk/plugins/VeraControl/releases/VeraControl.xmp2
===================================================================
--- trunk/plugins/VeraControl/releases/VeraControl.xmp2 2012-01-05 14:37:36 UTC (rev 4380)
+++ trunk/plugins/VeraControl/releases/VeraControl.xmp2 2012-01-05 14:48:47 UTC (rev 4381)
@@ -599,23 +599,29 @@
<Major>0</Major>
<Minor>5</Minor>
<Build>0</Build>
- <Revision>0</Revision>
+ <Revision>1</Revision>
</Version>
- <ExtensionDescription>Control your Vera controller from MediaPortal.
-Supports Scene triggers for starting, hibernating and exiting MediaPortal; Also starting, pausing and stopping media streams. So dim your lights and close the curtain autmatically when MediaPortal starts a movie...
+ <ExtensionDescription>Control your Vera controller from MediaPortal.
-Vera is a Z-wave home automation controller from MicasaVerde. This version is tested with Vera 2 UI4 v.1.1.1267
+Supports Scene triggers for starting, hibernating and exiting MediaPortal; Also starting, pausing and stopping media streams. So dim your lights and close the curtain autmatically when MediaPortal starts a movie...
+
+
+Vera is a Z-wave home automation controller from MicasaVerde. This version is tested with Vera 2 UI4 v.1.1.1267
+
+
+
</ExtensionDescription>
- <VersionDescription>First version - for beta testing only</VersionDescription>
+ <VersionDescription>First version - for beta testing only
+Minor updates</VersionDescription>
<DevelopmentStatus>Beta</DevelopmentStatus>
<OnlineLocation>https://mp-plugins.svn.sourceforge.net/svnroot/mp-plugins/trunk/plugins/VeraControl/releases/</OnlineLocation>
- <ReleaseDate>2012-01-04T22:51:05.585629+01:00</ReleaseDate>
+ <ReleaseDate>2012-01-05T22:51:05</ReleaseDate>
<Tags>home automation,
z-wave,
micasaverde,
vera</Tags>
- <Location>C:\Users\Bart\Documents\SharpDevelop Projects\VeraControl\releases\VeraControl_v0.5.0.0.mpe1</Location>
+ <Location>C:\Users\Bart\Documents\SharpDevelop Projects\VeraControl\releases\VeraControl_v[Version].mpe1</Location>
<Params>
<Items>
<SectionParam Name="Icon">
Added: trunk/plugins/VeraControl/releases/VeraControl_v0.5.0.1.mpe1
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/VeraControl/releases/VeraControl_v0.5.0.1.mpe1
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/plugins/VeraControl/releases/update.xml
===================================================================
--- trunk/plugins/VeraControl/releases/update.xml 2012-01-05 14:37:36 UTC (rev 4380)
+++ trunk/plugins/VeraControl/releases/update.xml 2012-01-05 14:48:47 UTC (rev 4381)
@@ -139,5 +139,150 @@
</ProjectSettings>
<IsSkin>false</IsSkin>
</PackageClass>
+ <PackageClass>
+ <Version>2.0</Version>
+ <Groups>
+ <Items>
+ <GroupItem Name="Default">
+ <DisplayName>Default</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>Default</Description>
+ <Files>
+ <Items />
+ </Files>
+ </GroupItem>
+ <GroupItem Name="IconsDefault">
+ <DisplayName>IconsDefault</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>IconsDefault</Description>
+ <Files>
+ <Items />
+ </Files>
+ </GroupItem>
+ <GroupItem Name="IconsDefaultWide">
+ <DisplayName>IconsDefaultWide</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>IconsDefaultWide</Description>
+ <Files>
+ <Items />
+ </Files>
+ </GroupItem>
+ </Items>
+ </Groups>
+ <Sections>
+ <Items />
+ </Sections>
+ <Dependencies>
+ <Items>
+ <DependencyItem>
+ <Type>MediaPortal</Type>
+ <Id />
+ <MinVersion>
+ <Major>1</Major>
+ <Minor>1</Minor>
+ <Build>6</Build>
+ <Revision>27644</Revision>
+ </MinVersion>
+ <MaxVersion>
+ <Major>1</Major>
+ <Minor>1</Minor>
+ <Build>6</Build>
+ <Revision>27644</Revision>
+ </MaxVersion>
+ <WarnOnly>false</WarnOnly>
+ <Message>requires MediaPortal version 1.1.6.27644 to 1.1.6.27644.</Message>
+ <Name>MediaPortal</Name>
+ </DependencyItem>
+ </Items>
+ </Dependencies>
+ <PluginDependencies>
+ <Items>
+ <PluginDependencyItem AssemblyName="VeraControl.dll">
+ <CompatibleVersion>
+ <Items>
+ <CompatibleVersionItem>
+ <MinRequiredVersion>1.1.6.27644</MinRequiredVersion>
+ <DesignedForVersion>1.1.6.27644</DesignedForVersion>
+ </CompatibleVersionItem>
+ </Items>
+ </CompatibleVersion>
+ <SubSystemsUsed>
+ <Items>
+ <SubSystemItem Name="MP.SkinEngine" />
+ <SubSystemItem Name="MP.Config" />
+ </Items>
+ </SubSystemsUsed>
+ </PluginDependencyItem>
+ </Items>
+ </PluginDependencies>
+ <GeneralInfo>
+ <Name>Vera Controller</Name>
+ <Id>ebb6b1af-6fb9-44e5-a859-9d32ffe20a9e</Id>
+ <Author>Bart Eversdijk</Author>
+ <HomePage>http://www.team-mediaportal.com/extensions/micasaverde-vera-controller</HomePage>
+ <ForumPage>http://forum.team-mediaportal.com/mediaportal-plugins-47/plugin-micasaverde-vera-controller-104337/</ForumPage>
+ <UpdateUrl>https://mp-plugins.svn.sourceforge.net/svnroot/mp-plugins/trunk/plugins/VeraControl/releases/update.xml</UpdateUrl>
+ <Version>
+ <Major>0</Major>
+ <Minor>5</Minor>
+ <Build>0</Build>
+ <Revision>1</Revision>
+ </Version>
+ <ExtensionDescription>Control your Vera controller from MediaPortal.
+
+Supports Scene triggers for starting, hibernating and exiting MediaPortal; Also starting, pausing and stopping media streams. So dim your lights and close the curtain autmatically when MediaPortal starts a movie...
+
+
+
+Vera is a Z-wave home automation controller from MicasaVerde. This version is tested with Vera 2 UI4 v.1.1.1267
+
+
+
+</ExtensionDescription>
+ <VersionDescription>First version - for beta testing only
+Minor updates</VersionDescription>
+ <DevelopmentStatus>Beta</DevelopmentStatus>
+ <OnlineLocation>https://mp-plugins.svn.sourceforge.net/svnroot/mp-plugins/trunk/plugins/VeraControl/releases/</OnlineLocation>
+ <ReleaseDate>2012-01-05T22:51:05</ReleaseDate>
+ <Tags>home automation,
+z-wave,
+micasaverde,
+vera</Tags>
+ <Location>C:\Users\Bart\Documents\SharpDevelop Projects\VeraControl\releases\VeraControl_v[Version].mpe1</Location>
+ <Params>
+ <Items>
+ <SectionParam Name="Online Icon">
+ <Value />
+ <ValueType>String</ValueType>
+ <Description>The icon file of the package stored online (jpg,png,bmp)</Description>
+ </SectionParam>
+ <SectionParam Name="Configuration file">
+ <Value />
+ <ValueType>Template</ValueType>
+ <Description>The file used to configure the extension.
+ If have .exe extension the will be executed
+ If have .dll extension used like MP plugin configuration</Description>
+ </SectionParam>
+ <SectionParam Name="Online Screenshots">
+ <Value />
+ <ValueType>String</ValueType>
+ <Description>Online stored screenshot urls separated by ; </Description>
+ </SectionParam>
+ <SectionParam Name="Force to uninstall on update">
+ <Value>yes</Value>
+ <ValueType>Bool</ValueType>
+ <Description>Show dialog and force to uninstall previous version when updating an extension. Should only be disabled if you are using an NSIS/MSI installer.</Description>
+ </SectionParam>
+ </Items>
+ </Params>
+ </GeneralInfo>
+ <UniqueFileList>
+ <Items />
+ </UniqueFileList>
+ <ProjectSettings>
+ <FolderGroups />
+ </ProjectSettings>
+ <IsSkin>false</IsSkin>
+ </PackageClass>
</Items>
-</ExtensionCollection>
+</ExtensionCollection>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Ba...@us...> - 2012-01-08 19:33:42
|
Revision: 4394
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4394&view=rev
Author: BartEv
Date: 2012-01-08 19:33:34 +0000 (Sun, 08 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/VeraControl/DevCategories.cs
trunk/plugins/VeraControl/DeviceDimmer.cs
trunk/plugins/VeraControl/DeviceDoorlock.cs
trunk/plugins/VeraControl/DeviceGWeather.cs
trunk/plugins/VeraControl/DeviceGeneric.cs
trunk/plugins/VeraControl/DeviceHumidity.cs
trunk/plugins/VeraControl/DeviceLightSensor.cs
trunk/plugins/VeraControl/DevicePowerMeter.cs
trunk/plugins/VeraControl/DeviceSecurity.cs
trunk/plugins/VeraControl/DeviceSprinkler.cs
trunk/plugins/VeraControl/DeviceSwitch.cs
trunk/plugins/VeraControl/DeviceTemperature.cs
trunk/plugins/VeraControl/DeviceThermostat.cs
trunk/plugins/VeraControl/DialogActionTrigger.cs
trunk/plugins/VeraControl/DialogDeviceControl.cs
trunk/plugins/VeraControl/Properties/AssemblyInfo.cs
trunk/plugins/VeraControl/Room.cs
trunk/plugins/VeraControl/Scene.cs
trunk/plugins/VeraControl/Section.cs
trunk/plugins/VeraControl/VeraCommunication.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraControl.csproj
trunk/plugins/VeraControl/skin/Default/VeraControl.xml
trunk/plugins/VeraControl/skin/Default/VeraDialogDeviceControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraDialogDeviceControl.xml
Added Paths:
-----------
trunk/plugins/VeraControl/VeraHelper.cs
trunk/plugins/VeraControl/skin/Media/Vera/Ip_Camera.png
trunk/plugins/VeraControl/skin/Media/Vera/location.png
Modified: trunk/plugins/VeraControl/DevCategories.cs
===================================================================
--- trunk/plugins/VeraControl/DevCategories.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DevCategories.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -20,21 +20,20 @@
{
public DevCategories(XmlNode xn)
{
- if (xn == null) {
- m_sName = "";
- m_iId = 0;
- } else {
+ if (xn != null)
+ {
update(xn);
}
}
- private string m_sName;
- private int m_iId;
+ private string m_sName = "unknown category";
+ private int m_iId = 0;
+ public VeraHelper helper = VeraHelper.Instance;
public bool update(XmlNode xn)
{
- m_sName = xn.Attributes["name"].Value;
- m_iId = int.Parse(xn.Attributes["id"].Value);
+ m_sName = helper.getAttrAsString(xn, "name", m_sName);
+ m_iId = helper.getAttrAsInt (xn, "id", m_iId);
return true;
}
Modified: trunk/plugins/VeraControl/DeviceDimmer.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDimmer.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DeviceDimmer.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -18,8 +18,9 @@
/// </summary>
public class DeviceDimmer : DeviceGeneric
{
- private int m_iLevel;
- private string m_sWatt;
+ private int m_iLevel = 0;
+ private string m_sWatt = "-";
+ private string m_sKwh = "-";
public DeviceDimmer( XmlNode xn ): base (xn)
{
@@ -31,8 +32,9 @@
public override bool update(XmlNode xn)
{
- m_iLevel = (xn.Attributes["level"] != null ? int.Parse(xn.Attributes["level"].Value) : 0);
- m_sWatt = (xn.Attributes["watts"] != null ? xn.Attributes["watts"].Value : "0");
+ m_iLevel = helper.getAttrAsInt (xn, "level", m_iLevel);
+ m_sWatt = helper.getAttrAsString(xn, "watts", m_sWatt);
+ m_sKwh = helper.getAttrAsString(xn, "kwh", m_sKwh);
return base.update(xn);
}
@@ -43,7 +45,7 @@
set { }
}
- public override bool state
+ public override bool status
{
get { return (m_iLevel > 0); }
set {
@@ -62,12 +64,14 @@
} else {
if (newValue < 0) { newValue = 0; }
}
- VeraCommunication vera = VeraCommunication.Instance;
- // Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
- "&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget" +
- "&newLoadlevelTarget="+value;
- string sResult = vera.doVeraRequest(cmd);
+ if (id > 0) // Only send when a valid ID is found
+ {
+ // Do something with vera
+ string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ "&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget" +
+ "&newLoadlevelTarget="+value;
+ vera.doVeraRequest(cmd);
+ }
m_iLevel = newValue;
}
}
@@ -100,9 +104,15 @@
return "Dimmable_Light_"+leveltxt;
}
+
+ public override string getExtraText()
+ {
+ return (m_sKwh != "" ? m_sKwh + "kWh" : "");
+ }
+
public override string getStatusText()
{
- return ( state ? level.ToString() + "%" : "Off");
+ return ( status ? level.ToString() + "%" : "Off");
}
}
}
Modified: trunk/plugins/VeraControl/DeviceDoorlock.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDoorlock.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DeviceDoorlock.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -18,7 +18,7 @@
/// </summary>
public class DeviceDoorlock : DeviceGeneric
{
- private bool m_bStatus;
+ private bool m_bStatus = false;
public DeviceDoorlock( XmlNode xn ): base (xn)
{
@@ -30,21 +30,23 @@
public override bool update(XmlNode xn)
{
- m_bStatus = (xn.Attributes["status"].Value == "1");
+ m_bStatus = helper.getAttrAsBool(xn, "status", m_bStatus);
return base.update(xn);
}
- public override bool state
+ public override bool status
{
get { return m_bStatus; }
set {
- VeraCommunication vera = VeraCommunication.Instance;
- // Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
- "&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget" +
- "&newTargetValue="+(value ? "1" : "0");
- string sResult = vera.doVeraRequest(cmd);
+ if (id > 0) // Only send when a valid ID is found
+ {
+ // Do something with vera
+ string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ "&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget" +
+ "&newTargetValue="+(value ? "1" : "0");
+ vera.doVeraRequest(cmd);
+ }
m_bStatus = value;
}
}
@@ -54,7 +56,7 @@
get { return (m_bStatus ? 1 : 0); }
set
{
- state = (value > 0);
+ status = (value > 0);
}
}
@@ -82,7 +84,7 @@
public override string getStatusText()
{
- return (state ? "Locked" : "Unlocked");
+ return (status ? "Locked" : "Unlocked");
}
}
Modified: trunk/plugins/VeraControl/DeviceGWeather.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGWeather.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DeviceGWeather.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -18,8 +18,8 @@
/// </summary>
public class DeviceGWeather : DeviceGeneric
{
- private string m_sCondition;
- private string m_sWindCondition;
+ private string m_sCondition = "-";
+ private string m_sWindCondition = "-";
public DeviceGWeather( XmlNode xn ): base (xn)
{
@@ -31,8 +31,10 @@
public override bool update(XmlNode xn)
{
- m_sCondition = (xn.Attributes["Condition"] != null ? xn.Attributes["Condition"].Value : "-");
- m_sWindCondition = (xn.Attributes["WindCondition"] != null ? xn.Attributes["WindCondition"].Value : "-");
+ m_sCondition = helper.getAttrAsString(xn, "Condition", m_sCondition); // Google Weather Plugin
+ m_sCondition = helper.getAttrAsString(xn, "condition", m_sCondition); // World Weather plugin
+ m_sWindCondition = helper.getAttrAsString(xn, "WindCondition", m_sWindCondition);
+ m_sWindCondition = helper.getAttrAsString(xn, "windcondition", m_sWindCondition);
return base.update(xn);
}
@@ -50,5 +52,10 @@
{
return m_sWindCondition;
}
+
+ public override string getIconName()
+ {
+ return "location";
+ }
}
}
Modified: trunk/plugins/VeraControl/DeviceGeneric.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -4,8 +4,8 @@
* Date: 22-12-2011
* Time: 13:07
*
- * Copyright: 2012 GPL - Bart Eversdijk
- * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
* E-mail: ba...@ev...
*/
using System;
@@ -14,17 +14,26 @@
namespace VeraControl.Properties
{
+
+
/// <summary>
/// Description of DeviceGeneric.
/// </summary>
public class DeviceGeneric
{
- private string m_sName = "";
+ private string m_sName = "unknown device";
private int m_iId = 0;
private string m_sAltId = "";
private int m_iCategory = 0;
private int m_iRoom = 0;
+ // not connected (-2), none (-1), pending (0,1,5,6), success(4), error (2,3)
+ private DevState m_dsState = DevState.NONE;
+ private string m_sComment = ""; // red(error), green(success) or blue(pending) - icon/text
+
+ public VeraHelper helper = VeraHelper.Instance;
+ public VeraCommunication vera = VeraCommunication.Instance;
+
public DeviceGeneric(XmlNode xn)
{
if (xn != null)
@@ -35,11 +44,29 @@
public virtual bool update(XmlNode xn)
{
- m_sName = xn.Attributes["name"].Value;
- m_iId = int.Parse(xn.Attributes["id"].Value);
- m_sAltId = xn.Attributes["altid"].Value;
- m_iCategory = int.Parse(xn.Attributes["category"].Value);
- m_iRoom = int.Parse(xn.Attributes["room"].Value);
+ m_sName = helper.getAttrAsString(xn, "name", m_sName);
+ m_iId = helper.getAttrAsInt (xn, "id", m_iId);
+ m_sAltId = helper.getAttrAsString(xn, "altid", m_sAltId);
+ m_iCategory = helper.getAttrAsInt (xn, "category", m_iCategory);
+ m_iRoom = helper.getAttrAsInt (xn, "room", m_iRoom);
+
+ m_sComment = helper.getAttrAsString(xn, "comment", m_sComment );
+ m_dsState = helper.toDevState(helper.getAttrAsInt(xn, "state", -1));
+
+ if (m_iId == 0)
+ {
+ // void device no further processing needed
+ return true;
+ }
+ // Make sure room exists
+ if (m_iRoom == 0 || !vera.status.isRoomFound(m_iRoom))
+ {
+ if (!vera.status.isRoomFound(0))
+ { // create dummy room to attach to
+ vera.rooms.Add(new Room(null));
+ }
+ m_iRoom = 0;
+ }
return true;
}
@@ -88,9 +115,21 @@
get { return false; }
set { }
}
-
- public virtual bool state
+
+ public virtual DevState commstate
{
+ get { return m_dsState; }
+ set { }
+ }
+
+ public virtual string comment
+ {
+ get { return (commstate != DevState.NONE ? m_sComment : ""); }
+ set { }
+ }
+
+ public virtual bool status
+ {
get { return false; }
set { }
}
Modified: trunk/plugins/VeraControl/DeviceHumidity.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceHumidity.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DeviceHumidity.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -18,7 +18,7 @@
/// </summary>
public class DeviceHumidity : DeviceGeneric
{
- private int m_iLevel;
+ private int m_iLevel = 0;
public DeviceHumidity( XmlNode xn ): base (xn)
{
@@ -30,7 +30,7 @@
public override bool update(XmlNode xn)
{
- m_iLevel = int.Parse(xn.Attributes["humidity"].Value);
+ m_iLevel = helper.getAttrAsInt(xn, "humidity", m_iLevel);
return base.update(xn);
}
Modified: trunk/plugins/VeraControl/DeviceLightSensor.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceLightSensor.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DeviceLightSensor.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -18,7 +18,7 @@
/// </summary>
public class DeviceLightSensor : DeviceGeneric
{
- private int m_iLevel;
+ private int m_iLevel = 0;
public DeviceLightSensor( XmlNode xn ): base (xn)
{
@@ -30,11 +30,12 @@
public override bool update(XmlNode xn)
{
- m_iLevel = (xn.Attributes["level"] != null ? int.Parse(xn.Attributes["level"].Value) : 0);
+ m_iLevel = helper.getAttrAsInt(xn, "level", m_iLevel);
+ m_iLevel = helper.getAttrAsInt(xn, "light", m_iLevel);
return base.update(xn);
}
- public override bool state
+ public override bool status
{
get { return (m_iLevel > 0); }
set { }
Modified: trunk/plugins/VeraControl/DevicePowerMeter.cs
===================================================================
--- trunk/plugins/VeraControl/DevicePowerMeter.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DevicePowerMeter.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -18,7 +18,8 @@
/// </summary>
public class DevicePowerMeter : DeviceGeneric
{
- private int m_iLevel;
+ private int m_iLevel = 0;
+ private string m_sKwh = "";
public DevicePowerMeter( XmlNode xn ): base (xn)
{
@@ -30,7 +31,8 @@
public override bool update(XmlNode xn)
{
- m_iLevel = (xn.Attributes["level"] != null ? int.Parse(xn.Attributes["watts"].Value) : 0);
+ m_iLevel = helper.getAttrAsInt (xn, "watts", m_iLevel);
+ m_sKwh = helper.getAttrAsString(xn, "kwh", m_sKwh);
return base.update(xn);
}
@@ -40,7 +42,7 @@
set { }
}
- public override bool state
+ public override bool status
{
get { return (m_iLevel > 0); }
set { }
@@ -68,6 +70,11 @@
return "Power_Meter";
}
+ public override string getExtraText()
+ {
+ return (m_sKwh != "" ? m_sKwh + "kWh" : "");
+ }
+
public override string getStatusText()
{
return level.ToString() + "W";
Modified: trunk/plugins/VeraControl/DeviceSecurity.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSecurity.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DeviceSecurity.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -19,8 +19,8 @@
/// </summary>
public class DeviceSecurity: DeviceGeneric
{
- private bool m_bTripped;
- private bool m_bArmed;
+ private bool m_bTripped = false;
+ private bool m_bArmed = true;
public DeviceSecurity( XmlNode xn ): base (xn)
{
@@ -32,20 +32,23 @@
public override bool update(XmlNode xn)
{
- m_bTripped = (xn.Attributes["tripped"].Value == "1");
- m_bArmed = (xn.Attributes["armed"].Value == "1");
+ m_bTripped = helper.getAttrAsBool(xn, "tripped", m_bTripped);
+ m_bArmed = helper.getAttrAsBool(xn, "armed", m_bArmed);
return base.update(xn);
}
- public override bool state
+ public override bool status
{
get { return m_bArmed; }
- set { VeraCommunication vera = VeraCommunication.Instance;
- // Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
- "&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&action=SetArmed" +
- "&newArmedValue=" + (value ? "1" : "0");
- string sResult = vera.doVeraRequest(cmd);
+ set {
+ if (id > 0) // Only send when a valid ID is found
+ {
+ // Do something with vera
+ string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ "&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&action=SetArmed" +
+ "&newArmedValue=" + (value ? "1" : "0");
+ vera.doVeraRequest(cmd);
+ }
m_bArmed = value;
}
}
@@ -59,7 +62,7 @@
public override int level
{
get { return (m_bArmed ? 1 : 0); }
- set { state = (value > 0); }
+ set { status = (value > 0); }
}
public override int maxLevel
@@ -84,7 +87,7 @@
public override string getStatusText()
{
- return (state ? ( tripped ? "TRIPPED" : "standby") : "bypass");
+ return (status ? ( tripped ? "TRIPPED" : "standby") : "bypass");
}
public override string[] getCommands()
Modified: trunk/plugins/VeraControl/DeviceSprinkler.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -19,11 +19,11 @@
/// </summary>
public class DeviceSprinkler : DeviceGeneric
{
- private bool m_bStatus;
- private string m_sMode;
- private string m_sShortMode;
- private string m_sOperationMode;
- private string m_sCondition;
+ private bool m_bStatus = false;
+ private string m_sMode = "-";
+ private string m_sShortMode = "-";
+ private string m_sOperationMode = "-";
+ private string m_sCondition = "-";
public DeviceSprinkler( XmlNode xn ): base (xn)
{
@@ -35,24 +35,26 @@
public override bool update(XmlNode xn)
{
- m_bStatus = (xn.Attributes["status"].Value == "1");
- m_sMode = (xn.Attributes["Mode"] != null ? xn.Attributes["Mode"].Value : "-");
- m_sShortMode = (xn.Attributes["ShortMode"] != null ? xn.Attributes["ShortMode"].Value : "-");
- m_sOperationMode = (xn.Attributes["OperationMode"] != null ? xn.Attributes["OperationMode"].Value : "-");
- m_sCondition = (xn.Attributes["Condition"] != null ? xn.Attributes["Condition"].Value : "-");
+ m_bStatus = helper.getAttrAsBool (xn, "status", m_bStatus);
+ m_sMode = helper.getAttrAsString(xn, "Mode", m_sMode);
+ m_sShortMode = helper.getAttrAsString(xn, "ShortMode", m_sShortMode);
+ m_sOperationMode = helper.getAttrAsString(xn, "OperationMode", m_sOperationMode);
+ m_sCondition = helper.getAttrAsString(xn, "Condition", m_sCondition);
return base.update(xn);
}
- public override bool state
+ public override bool status
{
get { return m_bStatus; }
set {
- VeraCommunication vera = VeraCommunication.Instance;
- // Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
- "&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget" +
- "&newTargetValue="+(value ? "1" : "0");
- string sResult = vera.doVeraRequest(cmd);
+ if (id > 0) // Only send when a valid ID is found
+ {
+ // Do something with vera
+ string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ "&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget" +
+ "&newTargetValue="+(value ? "1" : "0");
+ vera.doVeraRequest(cmd);
+ }
m_bStatus = value;
}
}
@@ -60,19 +62,21 @@
public override int level
{
get { return (m_bStatus ? 1 : 0); }
- set { state = (value > 0); }
+ set { status = (value > 0); }
}
public override string mode
{
get { return m_sMode; }
set {
- VeraCommunication vera = VeraCommunication.Instance;
- // Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
- "&serviceId=urn:upnp-micasaverde-com:serviceId:Sprinkler1&action=" +
- (value == "Auto" ? "SetModeAuto" : (value == "Block" ? "SetModeBlock" : "SetModeManual"));
- string sResult = vera.doVeraRequest(cmd);
+ if (id > 0) // Only send when a valid ID is found
+ {
+ // Do something with vera
+ string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ "&serviceId=urn:upnp-micasaverde-com:serviceId:Sprinkler1&action=" +
+ (value == "Auto" ? "SetModeAuto" : (value == "Block" ? "SetModeBlock" : "SetModeManual"));
+ vera.doVeraRequest(cmd);
+ }
m_sMode = value;
}
}
@@ -108,8 +112,6 @@
{
return m_sCondition;
}
-
-
public override string [] getCommands()
{
Modified: trunk/plugins/VeraControl/DeviceSwitch.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSwitch.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DeviceSwitch.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -18,8 +18,9 @@
/// </summary>
public class DeviceSwitch : DeviceGeneric
{
- private bool m_bStatus;
- private string m_sWatt;
+ private bool m_bStatus = false;
+ private string m_sWatt = "-";
+ private string m_sKwh = "-";
public DeviceSwitch( XmlNode xn ): base (xn)
{
@@ -31,8 +32,10 @@
public override bool update(XmlNode xn)
{
- m_bStatus = (xn.Attributes["status"].Value == "1");
- m_sWatt = (xn.Attributes["watts"] != null ? xn.Attributes["watts"].Value : "0");
+ m_bStatus = helper.getAttrAsBool (xn, "status", m_bStatus);
+ m_sWatt = helper.getAttrAsString(xn, "watts", m_sWatt);
+ m_sKwh = helper.getAttrAsString(xn, "kwh", m_sKwh);
+
return base.update(xn);
}
@@ -42,16 +45,18 @@
set { }
}
- public override bool state
+ public override bool status
{
get { return m_bStatus; }
set {
- VeraCommunication vera = VeraCommunication.Instance;
- // Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
- "&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget" +
- "&newTargetValue="+(value ? "1" : "0");
- string sResult = vera.doVeraRequest(cmd);
+ if (id > 0) // Only send when a valid ID is found
+ {
+ // Do something with vera
+ string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ "&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget" +
+ "&newTargetValue="+(value ? "1" : "0");
+ vera.doVeraRequest(cmd);
+ }
m_bStatus = value;
}
}
@@ -59,7 +64,7 @@
public override int level
{
get { return (m_bStatus ? 1 : 0); }
- set { state = (value > 0); }
+ set { status = (value > 0); }
}
public override int maxLevel
@@ -84,9 +89,14 @@
return "Binary_Light_" + (m_bStatus ? "100" : "0");
}
+ public override string getExtraText()
+ {
+ return (m_sKwh != "" ? m_sKwh + "kWh" : "");
+ }
+
public override string getStatusText()
{
- return (state ? "On" : "Off");
+ return (status ? "On" : "Off");
}
}
}
Modified: trunk/plugins/VeraControl/DeviceTemperature.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceTemperature.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DeviceTemperature.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -18,8 +18,8 @@
/// </summary>
public class DeviceTemperature : DeviceGeneric
{
- public int m_iLevel;
- private bool m_bMetric = true;
+ public string m_sTemp = "0"; // public thermostat class
+ private bool m_bMetric = true;
public DeviceTemperature( XmlNode xn, bool bMetric ): base (xn)
{
@@ -32,13 +32,13 @@
public override bool update(XmlNode xn)
{
- m_iLevel = (xn.Attributes["temperature"] != null ? int.Parse(xn.Attributes["temperature"].Value) : 0);
+ m_sTemp = helper.getAttrAsString(xn, "temperature", m_sTemp);
return base.update(xn);
}
public override int level
{
- get { return m_iLevel; }
+ get { return int.Parse(m_sTemp); }
set { }
}
@@ -66,7 +66,7 @@
public override string getStatusText()
{
- return level + (m_bMetric ? "°C" : "F");
+ return m_sTemp + (m_bMetric ? "°C" : "°F");
}
}
Modified: trunk/plugins/VeraControl/DeviceThermostat.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceThermostat.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DeviceThermostat.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -18,10 +18,10 @@
/// </summary>
public class DeviceThermostat : DeviceTemperature
{
- private bool m_bMetric = true;
- private string m_sFan = "";
- private string m_sState = "Off"; // "Off', "Idle", "Heating", "Cooling", "FanOnly", "PendingHeat", "PendingCool", "Vent"
- private string m_sMode = "Off"; // "Off', "InDeadBand", "HeatOn", "CoolOn", "AutoChangeOver", "AuxHeatOn", "EconomyHeatOn", "EmergencyHeatOn",
+ private bool m_bMetric = true;
+ private string m_sFanMode = "";
+ private string m_sHvacState = "Off"; // "Off', "Idle", "Heating", "Cooling", "FanOnly", "PendingHeat", "PendingCool", "Vent"
+ private string m_sMode = "Off"; // "Off', "InDeadBand", "HeatOn", "CoolOn", "AutoChangeOver", "AuxHeatOn", "EconomyHeatOn", "EmergencyHeatOn",
// "AuxCoolOn", "EconomyCoolOn", "BuildingProtection", "EnergySavingsHeating", "EnergySavingsCooling"
public DeviceThermostat( XmlNode xn, bool bMetric ): base (xn, bMetric)
@@ -35,14 +35,14 @@
public override bool update(XmlNode xn)
{
- m_iLevel = (xn.Attributes["temperature"] != null ? int.Parse(xn.Attributes["temperature"].Value) : 0);
- m_sFan = (xn.Attributes["fan"] != null ? xn.Attributes["fn"].Value : "Off");
- m_sState = (xn.Attributes["hvacstate"] != null ? xn.Attributes["hvacstate"].Value : "Off");
- m_sMode = (xn.Attributes["mode"] != null ? xn.Attributes["mode"].Value : "Off");
+ m_sTemp = helper.getAttrAsString(xn, "temperature", m_sTemp);
+ m_sFanMode = helper.getAttrAsString(xn, "fanmode", m_sFanMode);
+ m_sHvacState = helper.getAttrAsString(xn, "hvacstate", m_sHvacState);
+ m_sMode = helper.getAttrAsString(xn, "mode", m_sMode);
return base.update(xn);
}
- public override bool state
+ public override bool status
{
get { return (mode != "Off"); }
set { mode = (value ? "Auto" : "Off"); }
@@ -58,13 +58,15 @@
{
get { return m_sMode; }
set {
- VeraCommunication vera = VeraCommunication.Instance;
- // Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
- "&serviceId=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget" +
- "&NewModeTarget="+(value == "Off" ? "Off" : (value == "Cool" ? "CoolOn" : (value == "Heat" ? "HeatOn" : "AutoChangeOver"))
- );
- string sResult = vera.doVeraRequest(cmd);
+ if (id > 0) // Only send when a valid ID is found
+ {
+ // Do something with vera
+ string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ "&serviceId=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget" +
+ "&NewModeTarget="+(value == "Off" ? "Off" : (value == "Cool" ? "CoolOn" : (value == "Heat" ? "HeatOn" : "AutoChangeOver"))
+ );
+ vera.doVeraRequest(cmd);
+ }
m_sMode = value;
}
}
@@ -93,7 +95,7 @@
public override string getExtraText()
{
- return m_sState + " - Fan : " + m_sFan + " - " + m_iLevel + (m_bMetric ? "°C" : "F") ;
+ return m_sHvacState + " - Fan : " + m_sFanMode + " - " + m_sTemp + (m_bMetric ? "°C" : "°F") ;
}
public override string getIconName()
Modified: trunk/plugins/VeraControl/DialogActionTrigger.cs
===================================================================
--- trunk/plugins/VeraControl/DialogActionTrigger.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DialogActionTrigger.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -65,6 +65,8 @@
[SkinControlAttribute(52)] protected GUISpinButton spMPExit = null;
+ private VeraCommunication vera = VeraCommunication.Instance;
+
public DialogActionTrigger()
{
GetID = (int)1974;
@@ -89,7 +91,7 @@
// (P)re load spin contor
for (int i = 0; i < spinList.Length; i++)
{
- initSpinButtons(spinList[i], VeraCommunication.Instance.actionTriggerTable[i]);
+ initSpinButtons(spinList[i], vera.actionTriggerTable[i]);
}
lblHeading.Label = strLine;
@@ -97,13 +99,6 @@
public override bool Init()
{
- using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
- {
- for (Actiontrigger i = 0; i < Actiontrigger.LAST_ACTIONTRIGGER; i++)
- {
- VeraCommunication.Instance.actionTriggerTable[(int)i] = xmlreader.GetValueAsInt("veracontroller", i.ToString(), 0);
- }
- }
return Load(GUIGraphicsContext.Skin + @"\VeraDialogActionTrigger.xml");
}
@@ -128,10 +123,10 @@
int iSceneIndex = 0;
spin.AddSpinLabel("- none -", 0);
- for (int i = 0; i < VeraCommunication.Instance.scenes.Count; i++)
+ for (int i = 0; i < vera.scenes.Count; i++)
{
- spin.AddSpinLabel(shortString(VeraCommunication.Instance.scenes[i].name), VeraCommunication.Instance.scenes[i].id);
- if (VeraCommunication.Instance.scenes[i].id == iSelectedScene)
+ spin.AddSpinLabel(shortString(vera.scenes[i].name), vera.scenes[i].id);
+ if (vera.scenes[i].id == iSelectedScene)
{
iSceneIndex = i + 1; // 0 is - none -
}
@@ -164,11 +159,11 @@
for (int i = 0; i < spinList.Length; i++)
{
if (spinList[i].SpinValue == 0) {
- VeraCommunication.Instance.actionTriggerTable[i] = 0;
+ vera.actionTriggerTable[i] = 0;
} else {
- VeraCommunication.Instance.actionTriggerTable[i] = VeraCommunication.Instance.scenes[spinList[i].SpinValue - 1].id;
+ vera.actionTriggerTable[i] = vera.scenes[spinList[i].SpinValue - 1].id;
}
- xmlwritter.SetValue("veracontroller", ((Actiontrigger) i).ToString(), VeraCommunication.Instance.actionTriggerTable[i].ToString());
+ xmlwritter.SetValue("veracontroller", ((Actiontrigger) i).ToString(), vera.actionTriggerTable[i].ToString());
}
}
}
Modified: trunk/plugins/VeraControl/DialogDeviceControl.cs
===================================================================
--- trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-01-08 19:32:04 UTC (rev 4393)
+++ trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-01-08 19:33:34 UTC (rev 4394)
@@ -41,7 +41,9 @@
[SkinControl(13)] protected GUIButtonControl btnMode2 = null;
[SkinControl(14)] protected GUIButtonControl btnMode3 = null;
[SkinControl(15)] protected GUISliderC...
[truncated message content] |
|
From: <Ba...@us...> - 2012-01-08 22:16:54
|
Revision: 4398
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4398&view=rev
Author: BartEv
Date: 2012-01-08 22:16:47 +0000 (Sun, 08 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/VeraControl/VeraCommunication.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraSetupForm.Designer.cs
trunk/plugins/VeraControl/VeraSetupForm.cs
Modified: trunk/plugins/VeraControl/VeraCommunication.cs
===================================================================
--- trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-08 21:54:57 UTC (rev 4397)
+++ trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-08 22:16:47 UTC (rev 4398)
@@ -204,10 +204,10 @@
using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
{
m_sVeraIPAddress = xmlreader.GetValueAsString("veracontroller", "ipaddress", "127.0.0.1");
- m_sVeraTCPIPPort = xmlreader.GetValueAsString("veracontroller", "portnumber", "49451");
- m_sVeraIPAddress = "192.10.1.240";
+ m_sVeraTCPIPPort = xmlreader.GetValueAsString("veracontroller", "portnumber", "3480");
+ //m_sVeraIPAddress = "192.10.1.240";
// m_sVeraIPAddress = "demo.mios.com";
- m_sVeraTCPIPPort = "3480";
+ // m_sVeraTCPIPPort = "3480";
// Fill action table (config settings)
for (Actiontrigger i = 0; i < Actiontrigger.LAST_ACTIONTRIGGER; i++)
@@ -397,9 +397,15 @@
return response;
}
+ public bool isVeraAlive(string ip, string port)
+ {
+ string response = retrieveURL("http://" + ip + ":" + port + "/data_request?id=lu_alive&time="+DateTime.Now.Ticks);
+
+ return (response == "OK");
+ }
+
public string doVeraRequest( string param )
{
-
return retrieveURL("http://" + vera_Address + "/data_request" + param + "&time="+DateTime.Now.Ticks);
}
@@ -425,7 +431,7 @@
return response;
}
- private long getSecondsSince1970()
+ public long getSecondsSince1970()
{
return (DateTime.Now.Ticks / 10000000);
}
@@ -480,7 +486,7 @@
public string vera_Address
{
- get { return m_sVeraIPAddress + " : " +m_sVeraTCPIPPort; }
+ get { return m_sVeraIPAddress + ":" +m_sVeraTCPIPPort; }
set { }
}
}
Modified: trunk/plugins/VeraControl/VeraControl.cs
===================================================================
--- trunk/plugins/VeraControl/VeraControl.cs 2012-01-08 21:54:57 UTC (rev 4397)
+++ trunk/plugins/VeraControl/VeraControl.cs 2012-01-08 22:16:47 UTC (rev 4398)
@@ -31,6 +31,10 @@
[assembly: UsesSubsystem("MP.SkinEngine")]
[assembly: UsesSubsystem("MP.Config")]
+// TODO: support multiple Vera Box
+// TODO: get all boxes for a specific user (http://sta1.mios.com/locator_json.php?username=<user>)
+// TODO: support remote vera Boxes (http://fwd1.mios.com/<name>/<pass>/<serial>/data_request?...)
+
namespace VeraControl
{
public enum Actiontrigger
Modified: trunk/plugins/VeraControl/VeraSetupForm.Designer.cs
===================================================================
--- trunk/plugins/VeraControl/VeraSetupForm.Designer.cs 2012-01-08 21:54:57 UTC (rev 4397)
+++ trunk/plugins/VeraControl/VeraSetupForm.Designer.cs 2012-01-08 22:16:47 UTC (rev 4398)
@@ -33,6 +33,8 @@
this.labelIPaddress = new System.Windows.Forms.Label();
this.IPaddress = new System.Windows.Forms.TextBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
+ this.ConnectionResponse = new System.Windows.Forms.Label();
+ this.CheckConnection = new System.Windows.Forms.Button();
this.labelPortNumber = new System.Windows.Forms.Label();
this.portnumber = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
@@ -46,7 +48,7 @@
// btnOK
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.btnOK.Location = new System.Drawing.Point(31, 194);
+ this.btnOK.Location = new System.Drawing.Point(31, 236);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 3;
@@ -58,7 +60,7 @@
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Location = new System.Drawing.Point(231, 194);
+ this.btnCancel.Location = new System.Drawing.Point(231, 236);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 4;
@@ -88,17 +90,36 @@
//
// groupBox1
//
+ this.groupBox1.Controls.Add(this.ConnectionResponse);
+ this.groupBox1.Controls.Add(this.CheckConnection);
this.groupBox1.Controls.Add(this.labelPortNumber);
this.groupBox1.Controls.Add(this.portnumber);
this.groupBox1.Controls.Add(this.labelIPaddress);
this.groupBox1.Controls.Add(this.IPaddress);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(311, 78);
+ this.groupBox1.Size = new System.Drawing.Size(311, 121);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Vera Box -setting";
//
+ // ConnectionResponse
+ //
+ this.ConnectionResponse.Location = new System.Drawing.Point(168, 88);
+ this.ConnectionResponse.Name = "ConnectionResponse";
+ this.ConnectionResponse.Size = new System.Drawing.Size(123, 19);
+ this.ConnectionResponse.TabIndex = 7;
+ //
+ // CheckConnection
+ //
+ this.CheckConnection.Location = new System.Drawing.Point(19, 84);
+ this.CheckConnection.Name = "CheckConnection";
+ this.CheckConnection.Size = new System.Drawing.Size(136, 23);
+ this.CheckConnection.TabIndex = 6;
+ this.CheckConnection.Text = "Check Connection";
+ this.CheckConnection.UseVisualStyleBackColor = true;
+ this.CheckConnection.Click += new System.EventHandler(this.CheckConnection_Click);
+ //
// labelPortNumber
//
this.labelPortNumber.AutoSize = true;
@@ -118,7 +139,7 @@
this.portnumber.Name = "portnumber";
this.portnumber.Size = new System.Drawing.Size(205, 20);
this.portnumber.TabIndex = 2;
- this.portnumber.Text = "49451";
+ this.portnumber.Text = "3480";
//
// label1
//
@@ -146,7 +167,7 @@
this.groupBox2.Controls.Add(this.enableSceneTrigger);
this.groupBox2.Controls.Add(this.refreshdelay);
this.groupBox2.Controls.Add(this.label1);
- this.groupBox2.Location = new System.Drawing.Point(14, 96);
+ this.groupBox2.Location = new System.Drawing.Point(11, 139);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(309, 82);
this.groupBox2.TabIndex = 8;
@@ -168,7 +189,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
- this.ClientSize = new System.Drawing.Size(332, 229);
+ this.ClientSize = new System.Drawing.Size(332, 271);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnCancel);
@@ -183,6 +204,8 @@
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
+ private System.Windows.Forms.Label ConnectionResponse;
+ private System.Windows.Forms.Button CheckConnection;
private System.Windows.Forms.CheckBox enableSceneTrigger;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox refreshdelay;
Modified: trunk/plugins/VeraControl/VeraSetupForm.cs
===================================================================
--- trunk/plugins/VeraControl/VeraSetupForm.cs 2012-01-08 21:54:57 UTC (rev 4397)
+++ trunk/plugins/VeraControl/VeraSetupForm.cs 2012-01-08 22:16:47 UTC (rev 4398)
@@ -25,6 +25,8 @@
using MediaPortal.Configuration;
using MediaPortal.UserInterface.Controls;
using MediaPortal.Profile;
+using VeraControl.Properties;
+using System.Net;
namespace MediaPortal.GUI.VeraSetupForm
{
@@ -70,5 +72,49 @@
Close();
}
+
+ void CheckConnection_Click(object sender, EventArgs e)
+ {
+ ConnectionResponse.Text = "testing";
+ ConnectionResponse.Update();
+
+ try {
+ WebClient webClient = new WebClient();
+
+ Uri url = new Uri("http://" + IPaddress.Text + ":" + portnumber.Text + "/data_request?id=lu_alive&time="+DateTime.Now.Ticks);
+ webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(OnAsyncCompletedEventArgs);
+ webClient.DownloadStringAsync(url);
+
+ int cnt = 0;
+ long time = VeraCommunication.Instance.getSecondsSince1970();
+ while (webClient.IsBusy)
+ {
+ if (time != VeraCommunication.Instance.getSecondsSince1970())
+ {
+ cnt++;
+ time = VeraCommunication.Instance.getSecondsSince1970();
+ ConnectionResponse.Text = "testing" + new string('.', cnt % 10);
+ ConnectionResponse.Update();
+ }
+ }
+ }
+ catch
+ {
+ ConnectionResponse.Text = "Bad response";
+ }
+ }
+
+ void OnAsyncCompletedEventArgs(Object sender, DownloadStringCompletedEventArgs e)
+ {
+ //if (VeraCommunication.Instance.isVeraAlive(IPaddress.Text, portnumber.Text))
+ if (!e.Cancelled && e.Error == null && (string)e.Result == "OK")
+ {
+ ConnectionResponse.Text = "- Ok -";
+ }
+ else
+ {
+ ConnectionResponse.Text = "ERR: Time out";
+ }
+ }
}
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Ba...@us...> - 2012-01-15 23:50:27
|
Revision: 4405
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4405&view=rev
Author: BartEv
Date: 2012-01-15 23:50:18 +0000 (Sun, 15 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/VeraControl/DeviceDimmer.cs
trunk/plugins/VeraControl/DeviceGeneric.cs
trunk/plugins/VeraControl/DialogDeviceControl.cs
trunk/plugins/VeraControl/Properties/AssemblyInfo.cs
trunk/plugins/VeraControl/Scene.cs
trunk/plugins/VeraControl/VeraCommunication.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraControl.csproj
trunk/plugins/VeraControl/VeraHelper.cs
trunk/plugins/VeraControl/VeraSetupForm.Designer.cs
trunk/plugins/VeraControl/VeraSetupForm.cs
trunk/plugins/VeraControl/releases/VeraControl.xmp2
trunk/plugins/VeraControl/releases/update.xml
trunk/plugins/VeraControl/skin/Default/VeraControl.xml
trunk/plugins/VeraControl/skin/Default/VeraDialogDeviceControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraDialogDeviceControl.xml
Added Paths:
-----------
trunk/plugins/VeraControl/DeviceCam.cs
trunk/plugins/VeraControl/DeviceSceneController.cs
trunk/plugins/VeraControl/DeviceSystem.cs
trunk/plugins/VeraControl/DialogSceneControl.cs
trunk/plugins/VeraControl/releases/VeraControl_v0.6.0.1.mpe1
trunk/plugins/VeraControl/skin/Default/VeraDialogSceneControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraDialogSceneControl.xml
trunk/plugins/VeraControl/skin/Media/Vera/IR_Transmitter.png
trunk/plugins/VeraControl/skin/Media/Vera/USB_UIRT.png
trunk/plugins/VeraControl/skin/Media/Vera/Zwave.png
trunk/plugins/VeraControl/skin/Media/Vera/music_audio.png
trunk/plugins/VeraControl/skin/Media/Vera/plugins.png
trunk/plugins/VeraControl/skin/Media/Vera/users.png
Added: trunk/plugins/VeraControl/DeviceCam.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceCam.cs (rev 0)
+++ trunk/plugins/VeraControl/DeviceCam.cs 2012-01-15 23:50:18 UTC (rev 4405)
@@ -0,0 +1,88 @@
+/*
+ * Created by SharpDevelop.
+ * User: Bart
+ * Date: 7-1-2012
+ * Time: 21:42
+ *
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+using System;
+using System.Xml;
+
+namespace VeraControl.Properties
+{
+ /// <summary>
+ /// Description of DeviceCam.
+ /// </summary>
+ public class DeviceCam : DeviceGeneric
+ {
+ private string m_sIp = "127.0.0.1";
+ private string m_sUrl = "/";
+ private string m_sStream = "";
+ private string m_sVideoUrl = "";
+ private int m_refresh = 10;
+
+ public DeviceCam( XmlNode xn ): base (xn)
+ {
+ if (xn != null)
+ {
+ update(xn);
+ }
+ }
+
+ public override bool update(XmlNode xn)
+ {
+ m_sIp = helper.getAttrAsString(xn, "ip", m_sIp);
+ m_sUrl = helper.getAttrAsString(xn, "url", m_sUrl);
+ m_sStream = helper.getAttrAsString(xn, "streaming", m_sStream);
+ m_sVideoUrl = helper.getAttrAsString(xn, "videourls", m_sVideoUrl);
+
+ return base.update(xn);
+ }
+
+ public string imgUrl
+ {
+ get { return "http://" + m_sIp + "/" + m_sUrl.Replace("%2F", "/"); }
+ set { }
+ }
+
+ public int refreshRate
+ {
+ get { return m_refresh; }
+ set { m_refresh = value; }
+ }
+
+ private bool refreshDelayPassed(long lastcheck)
+ {
+ return ((helper.getSecondsSince1970() - refreshRate) > (lastcheck / 10000000));
+ }
+
+ public override string getIconName()
+ {
+ return "Ip_Camera";
+ }
+
+ public override bool newScreenUpdateWaitingAndClearFlag( )
+ {
+ // Invoking this method will clear the update ready flag -> so caller need to handle the update
+ // A cam device requires an update every refreshRate seconds
+ bool b = m_bScreenUpdateRequired || refreshDelayPassed(DateTime.Now.Ticks);
+ m_bScreenUpdateRequired = false;
+ if (b)
+ {
+ m_lLastUpdate = DateTime.Now.Ticks;
+ }
+ return b;
+ }
+
+ public override bool newUpdateSince(long lTimePreviousCheck)
+ {
+ bool b = (lTimePreviousCheck <= m_lLastUpdate) || refreshDelayPassed(m_lLastUpdate);
+ if (b)
+ {
+ m_lLastUpdate = DateTime.Now.Ticks;
+ }
+ return b;
+ }
+ }
+}
Modified: trunk/plugins/VeraControl/DeviceDimmer.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDimmer.cs 2012-01-14 17:51:27 UTC (rev 4404)
+++ trunk/plugins/VeraControl/DeviceDimmer.cs 2012-01-15 23:50:18 UTC (rev 4405)
@@ -57,14 +57,14 @@
{
get { return m_iLevel; }
set
- {
+ {
int newValue = value;
if (newValue > 100) {
newValue = 100;
} else {
if (newValue < 0) { newValue = 0; }
}
- if (id > 0) // Only send when a valid ID is found
+ if ((id > 0) && (newValue != m_iLevel)) // Only send when a valid ID is found
{
// Do something with vera
string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
@@ -97,9 +97,9 @@
{
string leveltxt = "0";
if (level > 0) { leveltxt = "25"; }
- if (level > 35) { leveltxt = "50"; }
- if (level > 65) { leveltxt = "75"; }
- if (level > 85) { leveltxt = "100"; }
+ if (level > 25) { leveltxt = "50"; }
+ if (level > 50) { leveltxt = "75"; }
+ if (level > 75) { leveltxt = "100"; }
return "Dimmable_Light_"+leveltxt;
}
Modified: trunk/plugins/VeraControl/DeviceGeneric.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-14 17:51:27 UTC (rev 4404)
+++ trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-15 23:50:18 UTC (rev 4405)
@@ -21,11 +21,13 @@
/// </summary>
public class DeviceGeneric
{
- private string m_sName = "unknown device";
- private int m_iId = 0;
- private string m_sAltId = "";
- private int m_iCategory = 0;
- private int m_iRoom = 0;
+ public long m_lLastUpdate = 0;
+ public bool m_bScreenUpdateRequired = false;
+ private string m_sName = "unknown device";
+ private int m_iId = 0;
+ private string m_sAltId = "";
+ private int m_iCategory = 0;
+ private int m_iRoom = 0;
// not connected (-2), none (-1), pending (0,1,5,6), success(4), error (2,3)
private DevState m_dsState = DevState.NONE;
@@ -56,7 +58,7 @@
if (m_iId == 0)
{
// void device no further processing needed
- return true;
+ return false;
}
// Make sure room exists
if (m_iRoom == 0 || !vera.status.isRoomFound(m_iRoom))
@@ -67,6 +69,11 @@
}
m_iRoom = 0;
}
+
+ // Set update flag
+ m_bScreenUpdateRequired = true;
+ m_lLastUpdate = DateTime.Now.Ticks;
+
return true;
}
@@ -176,5 +183,18 @@
{
return new string [] {"Off", "On"};
}
+
+ public virtual bool newScreenUpdateWaitingAndClearFlag( )
+ {
+ // Invoking this method will clear the update ready flag -> so caller need to handle the update
+ bool b = m_bScreenUpdateRequired;
+ m_bScreenUpdateRequired = false;
+ return b;
+ }
+
+ public virtual bool newUpdateSince(long lTimePreviousCheck)
+ {
+ return (lTimePreviousCheck <= m_lLastUpdate);
+ }
}
}
Added: trunk/plugins/VeraControl/DeviceSceneController.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSceneController.cs (rev 0)
+++ trunk/plugins/VeraControl/DeviceSceneController.cs 2012-01-15 23:50:18 UTC (rev 4405)
@@ -0,0 +1,70 @@
+/*
+ * Created by SharpDevelop.
+ * User: Bart
+ * Date: 8-1-2012
+ * Time: 0:15
+ *
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+using System;
+using System.Xml;
+
+namespace VeraControl.Properties
+{
+ /// <summary>
+ /// Description of DeviceSceneController.
+ /// </summary>
+ public class DeviceSceneController: DeviceGeneric
+ {
+ private bool m_bTripped = false;
+
+ public DeviceSceneController( XmlNode xn ): base (xn)
+ {
+ if (xn != null)
+ {
+ update(xn);
+ }
+ }
+
+ public override bool update(XmlNode xn)
+ {
+ m_bTripped = helper.getAttrAsBool(xn, "status", m_bTripped);
+ m_bTripped = helper.getAttrAsBool(xn, "tripped", m_bTripped);
+ return base.update(xn);
+ }
+
+ public override bool status
+ {
+ get { return m_bTripped; }
+ set { }
+ }
+
+ public bool tripped
+ {
+ get { return m_bTripped; }
+ set { }
+ }
+
+ public override int level
+ {
+ get { return (m_bTripped ? 1 : 0); }
+ set { }
+ }
+
+ public override string ToString()
+ {
+ return name + " [" + getStatusText() + "]";
+ }
+
+ public override string getIconName()
+ {
+ return "Motion_Sensor_" + (m_bTripped ? "100" : "0");
+ }
+
+ public override string getStatusText()
+ {
+ return (status ? "ACTIVE" : "standby");
+ }
+
+ }
+}
Added: trunk/plugins/VeraControl/DeviceSystem.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSystem.cs (rev 0)
+++ trunk/plugins/VeraControl/DeviceSystem.cs 2012-01-15 23:50:18 UTC (rev 4405)
@@ -0,0 +1,177 @@
+/*
+ * Created by SharpDevelop.
+ * User: Bart
+ * Date: 12-1-2012
+ * Time: 10:32
+ *
+ * To change this template use Tools | Options | Coding | Edit Standard Headers.
+ */
+using System;
+using System.Xml;
+// using VeraControl.Properties.Devstate;
+
+namespace VeraControl.Properties
+{
+ /// <summary>
+ /// Description of DeviceSystem.
+ /// </summary>
+ public class DeviceSystem
+ {
+ public DeviceSystem()
+ {
+ }
+
+ public VeraHelper helper = VeraHelper.Instance;
+
+ public long m_lLastUpdate = 0;
+ public bool m_bScreenUpdateRequired = false;
+ private bool m_bFullReload = true;
+ private string m_sVersion = "";
+ private string m_sModel = "";
+ private bool m_zWaveHeal = false;
+ private bool m_bMetric = true;
+ private string m_sSerial = "";
+ private string m_sFwd1Server = "";
+ private string m_sFwd2Server = "";
+ private string m_sLoadTime = "0";
+ private string m_sDataVersion = "0";
+ private string m_sComment = "";
+ private DevState m_dsVeraState = DevState.NONE;
+
+
+ public bool update(XmlNode xn)
+ {
+ m_bFullReload = helper.getAttrAsBool (xn, "full", m_bFullReload);
+ m_sVersion = helper.getAttrAsString (xn, "version", m_sVersion);
+ m_sModel = helper.getAttrAsString (xn, "model", m_sModel);
+ m_zWaveHeal = helper.getAttrAsBool (xn, "zwave_heal", m_zWaveHeal);
+ m_sSerial = helper.getAttrAsString (xn, "serial_number", m_sSerial);
+ m_sFwd1Server = helper.getAttrAsString (xn, "fwd1", m_sFwd1Server);
+ m_sFwd2Server = helper.getAttrAsString (xn, "fwd2", m_sFwd2Server);
+ m_sLoadTime = helper.getAttrAsString (xn, "loadtime", m_sLoadTime);
+
+ // Set update flag
+ string tempDataversion = helper.getAttrAsString (xn, "dataversion", m_sDataVersion);
+ DevState tempVeraState = helper.toDevState(helper.getAttrAsInt(xn, "state", -1));
+ string tempComment = helper.getAttrAsString (xn, "comment", "");
+
+ if ((m_sDataVersion != tempDataversion) || m_sComment != tempComment || m_dsVeraState != tempVeraState)
+ {
+ m_bScreenUpdateRequired = true;
+ m_lLastUpdate = DateTime.Now.Ticks;
+ }
+ m_sDataVersion = tempDataversion;
+ m_dsVeraState = tempVeraState;
+ m_sComment = tempComment;
+
+ m_dsVeraState = helper.toDevState(helper.getAttrAsInt(xn, "state", -1));
+ m_sComment = helper.getAttrAsString (xn, "comment", "");
+ m_bMetric = (helper.getAttrAsString(xn, "temperature", "C") == "C");
+
+ return true;
+ }
+
+ public void clearFullReloadFlag()
+ {
+ m_bFullReload = false;
+ }
+
+ public void setFullReloadFlag()
+ {
+ m_bFullReload = true;
+ }
+ public bool fullReload
+ {
+ get { return m_bFullReload; }
+ set { }
+ }
+
+ public string versionInfo
+ {
+ get { return m_sModel + " " + m_sVersion; }
+ set { }
+ }
+
+ public bool bZWaveHeal
+ {
+ get { return m_zWaveHeal; }
+ set { }
+ }
+
+ public string serialno
+ {
+ get { return m_sSerial; }
+ set { }
+ }
+
+ public string fwd
+ {
+ get { return m_sFwd1Server; }
+ set { }
+ }
+
+ public string fwdBackup
+ {
+ get { return m_sFwd2Server; }
+ set { }
+ }
+
+ public string loadtime
+ {
+ get { return m_sLoadTime; }
+ set { }
+ }
+
+ public string dataversion
+ {
+ get { return m_sDataVersion; }
+ set { }
+ }
+
+ public DevState state
+ {
+ get { return m_dsVeraState; }
+ set { }
+ }
+
+ public string comment
+ {
+ get { return m_sComment; }
+ set { }
+ }
+
+ public void reportConnectionError( string errmsg )
+ {
+ m_dsVeraState = DevState.CONNECTION_ERROR;
+ m_sComment = errmsg;
+ m_bScreenUpdateRequired = true;
+ m_lLastUpdate = DateTime.Now.Ticks;
+ }
+
+ public void clearConnectionError( )
+ {
+ m_dsVeraState = DevState.NONE;
+ m_sComment = "";
+ m_bScreenUpdateRequired = true;
+ m_lLastUpdate = DateTime.Now.Ticks;
+ }
+
+ public bool isMetric()
+ {
+ return m_bMetric;
+ }
+
+ public bool newScreenUpdateWaitingAndClearFlag( )
+ {
+ // Invoking this method will clear the update ready flag -> so caller need to handle the update
+ bool b = m_bScreenUpdateRequired;
+ m_bScreenUpdateRequired = false;
+ return b;
+ }
+
+ public bool newUpdateSince(float fTimePreviousCheck)
+ {
+ return (fTimePreviousCheck <= m_lLastUpdate);
+ }
+ }
+}
Modified: trunk/plugins/VeraControl/DialogDeviceControl.cs
===================================================================
--- trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-01-14 17:51:27 UTC (rev 4404)
+++ trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-01-15 23:50:18 UTC (rev 4405)
@@ -4,8 +4,8 @@
* Date: 24-12-2011
* Time: 14:17
*
- * Copyright: 2012 GPL - Bart Eversdijk
- * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
* E-mail: ba...@ev...
*/
using System;
@@ -27,47 +27,100 @@
/// </summar`y>
public class DialogDeviceControl : GUIDialogWindow
{
- [SkinControl(2)] protected GUIButtonControl btnClose = null;
- [SkinControl(4)] protected GUILabelControl lblHeading = null;
- [SkinControl(5)] protected GUIImage imgLogo = null;
+ [SkinControl(2)] protected GUIButtonControl btnClose = null;
+ [SkinControl(4)] protected GUILabelControl lblHeading = null;
+ [SkinControl(5)] protected GUIImage imgLogo = null;
- [SkinControlAttribute(6)] protected GUILabelControl label1=null;
+ [SkinControlAttribute(6)] protected GUILabelControl label1=null;
[SkinControlAttribute(7)] protected GUILabelControl label2=null;
[SkinControlAttribute(8)] protected GUILabelControl label3=null;
[SkinControl(10)] protected GUIButtonControl btnLeft = null;
- [SkinControl(11)] protected GUIButtonControl btnRight = null;
- [SkinControl(12)] protected GUIButtonControl btnMode1 = null;
+ [SkinControl(11)] protected GUIButtonControl btnRight = null;
+ [SkinControl(12)] protected GUIButtonControl btnMode1 = null;
[SkinControl(13)] protected GUIButtonControl btnMode2 = null;
[SkinControl(14)] protected GUIButtonControl btnMode3 = null;
- [SkinControl(15)] protected GUISliderControl slider = null;
- [SkinControl(20)] protected GUIImage camImage = null;
-
-
- DeviceGeneric myDev = null;
-
+ [SkinControl(15)] protected GUISliderControl slider = null;
+ [SkinControl(20)] protected GUIImage camImage = null;
+
+ [SkinControl(30)] protected GUIImage cmtImage = null;
+ [SkinControlAttribute(31)] protected GUILabelControl comment=null;
+
+ VeraHelper helper = new VeraHelper();
+ private DeviceGeneric myDev = null;
+ private long m_iLastUpdate = 0;
+
public DialogDeviceControl()
{
GetID = (int)1973;
}
- public void InitDialog(string strLine, DeviceGeneric dev)
- {
- //LoadSkin();
- AllocResources();
- InitControls();
+ public override bool Init()
+ {
+ bool bResult = Load(GUIGraphicsContext.Skin + @"\VeraDialogDeviceControl.xml");
+ return bResult;
+ }
- lblHeading.Label = strLine;
-
+
+ public void InitDialog(string strLine, DeviceGeneric dev)
+ {
+ //LoadSkin();
+ AllocResources();
+ InitControls();
+
+ lblHeading.Label = strLine;
myDev = dev;
+
+ if (!myDev.isControllable)
+ {
+ btnClose.SetNavigation(2,2,2,2);
+ }
+
+ updateStatus();
}
-
- public override bool Init()
- {
- bool bResult = Load(GUIGraphicsContext.Skin + @"\VeraDialogDeviceControl.xml");
- return bResult;
- }
+ public void updateStatus()
+ {
+ SetImage("Vera\\"+myDev.getIconName()+".png");
+
+ setComment(helper.getStateImage(myDev.commstate), myDev.comment);
+
+ if (myDev.isControllable)
+ {
+ if (myDev.GetType() == typeof(DeviceSprinkler))
+ {
+ SetText(myDev.name, myDev.getStatusText() + " - " + myDev.mode, myDev.getExtraText() );
+ SetActiveBut((myDev.status ? 1 : 0), (myDev.mode == "Auto" ? 0 : (myDev.mode == "Block" ? 2 : 1) ));
+ }
+ else if (myDev.GetType() == typeof(DeviceThermostat))
+ {
+ SetText(myDev.name, myDev.getStatusText(), myDev.getExtraText() );
+ SetActiveBut((myDev.status ? 1 : 0), (myDev.mode == "Auto" ? 0 :
+ (myDev.mode == "CoolOn" || myDev.mode == "Cool" ? 1 :
+ (myDev.mode == "HeatOn" || myDev.mode == "Heat" ? 2 : 3) )));
+ }
+ else
+ {
+ SetText(myDev.name, "", "");
+ SetActiveBut(myDev.status ? 1 : 0, -1);
+ }
+ SetButtons(myDev.getCommands());
+ SetSlider(myDev.level, myDev.maxLevel);
+ }
+ else
+ {
+ if (myDev.GetType() == typeof(DeviceCam))
+ {
+ DeviceCam cam = (DeviceCam) myDev;
+ SetCamImage(cam.imgUrl);
+ }
+ SetText(myDev.name, myDev.getStatusText(), myDev.getExtraText());
+ }
+ // save last update ticks
+ m_iLastUpdate = DateTime.Now.Ticks;
+ }
+
+
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
{
if (control == btnLeft)
@@ -134,7 +187,7 @@
{
btnLeft.NavigateUp = 12;
btnRight.NavigateUp = 14;
-
+
if (butTxt.Length < 5)
{
// if only 2 buttons required, use right iso middle button
@@ -176,10 +229,10 @@
{
btnMode1.TextColor = (iModeNr == 0 ? 0xFFFFFF00 : 0xFFFFFFFF );
btnMode1.TextColorNoFocus = (iModeNr == 0 ? 0x60FFFF00 : 0x60ffffff);
-
+
btnMode2.TextColor = (iModeNr == 1 ? 0xFFFFFF00 : 0xFFFFFFFF );
btnMode2.TextColorNoFocus = (iModeNr == 1 ? 0x60FFFF00 : 0x60ffffff);
-
+
btnMode3.TextColor = (iModeNr == 2 ? 0xFFFFFF00 : 0xFFFFFFFF );
btnMode3.TextColorNoFocus = (iModeNr == 2 ? 0x60FFFF00 : 0x60ffffff);
}
@@ -203,5 +256,29 @@
imgLogo.AllocResources();
imgLogo.KeepAspectRatio = true;
}
+
+ public void setComment(string img, string txt)
+ {
+ if (img != "") {
+ cmtImage.Dispose();
+ cmtImage.SetFileName(img);
+ cmtImage.KeepAspectRatio = true;
+ cmtImage.Visibility = System.Windows.Visibility.Visible;
+ cmtImage.AllocResources();
+ } else{
+ cmtImage.Visibility = System.Windows.Visibility.Hidden;
+ }
+ comment.Label = txt;
+ }
+
+ public override void Render(float timePassed)
+ {
+ if (myDev.newUpdateSince(m_iLastUpdate))
+ {
+ updateStatus();
+ }
+
+ base.Render(timePassed);
+ }
}
}
Added: trunk/plugins/VeraControl/DialogSceneControl.cs
===================================================================
--- trunk/plugins/VeraControl/DialogSceneControl.cs (rev 0)
+++ trunk/plugins/VeraControl/DialogSceneControl.cs 2012-01-15 23:50:18 UTC (rev 4405)
@@ -0,0 +1,120 @@
+/*
+ * Created by SharpDevelop.
+ * User: Bart
+ * Date: 24-12-2011
+ * Time: 14:17
+ *
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * E-mail: ba...@ev...
+ */
+using System;
+using System.Collections;
+using MediaPortal;
+using MediaPortal.Util;
+using MediaPortal.GUI.Library;
+using MediaPortal.Dialogs;
+using Alignment = MediaPortal.GUI.Library.GUIControl.Alignment;
+using VAlignment = MediaPortal.GUI.Library.GUIControl.VAlignment;
+using Action = MediaPortal.GUI.Library.Action;
+using VeraControl.Properties;
+
+namespace VeraControl
+{
+ /// <summary>
+ /// Description of DialogDeviceControl.
+ /// </summar`y>
+ public class DialogSceneControl : GUIDialogWindow
+ {
+ [SkinControl(2)] protected GUIButtonControl btnClose = null;
+ [SkinControl(4)] protected GUILabelControl lblHeading = null;
+ [SkinControl(5)] protected GUIImage imgLogo = null;
+
+ [SkinControlAttribute(6)] protected GUILabelControl label1=null;
+
+ [SkinControl(11)] protected GUIButtonControl btnRight = null;
+
+ [SkinControl(30)] protected GUIImage cmtImage = null;
+ [SkinControlAttribute(31)] protected GUILabelControl comment=null;
+
+ VeraHelper helper = new VeraHelper();
+ private Scene myScene = null;
+ private long m_iLastUpdate = 0;
+
+ public DialogSceneControl()
+ {
+ GetID = (int)1975;
+ }
+
+ public override bool Init()
+ {
+ bool bResult = Load(GUIGraphicsContext.Skin + @"\VeraDialogSceneControl.xml");
+ return bResult;
+ }
+
+
+ public void InitDialog(string strLine, Scene scene)
+ {
+ //LoadSkin();
+ AllocResources();
+ InitControls();
+
+ lblHeading.Label = strLine;
+ myScene = scene;
+
+ updateStatus();
+ }
+
+ public void updateStatus()
+ {
+ setComment(helper.getStateImage(myScene.commstate), myScene.comment);
+
+ label1.Label = myScene.name;
+
+ // save last update ticks
+ m_iLastUpdate = DateTime.Now.Ticks;
+ }
+
+ protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
+ {
+ if (control == btnRight)
+ {
+ if (myScene.id != 0) {
+ comment.Label = "Running...";
+ myScene.run();
+
+ }
+ }
+
+ // Back to the text button to switch from image view
+ if (control == btnClose)
+ {
+ PageDestroy();
+ }
+ base.OnClicked(controlId, control, actionType);
+ }
+
+ public void setComment(string img, string txt)
+ {
+ if (img != "") {
+ cmtImage.Dispose();
+ cmtImage.SetFileName(img);
+ cmtImage.KeepAspectRatio = true;
+ cmtImage.Visibility = System.Windows.Visibility.Visible;
+ cmtImage.AllocResources();
+ } else{
+ cmtImage.Visibility = System.Windows.Visibility.Hidden;
+ }
+ comment.Label = txt;
+ }
+
+ public override void Render(float timePassed)
+ {
+ if (myScene.newUpdateSince(m_iLastUpdate))
+ {
+ updateStatus();
+ }
+ base.Render(timePassed);
+ }
+ }
+}
Modified: trunk/plugins/VeraControl/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/VeraControl/Properties/AssemblyInfo.cs 2012-01-14 17:51:27 UTC (rev 4404)
+++ trunk/plugins/VeraControl/Properties/AssemblyInfo.cs 2012-01-15 23:50:18 UTC (rev 4405)
@@ -28,4 +28,4 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("0.5.0.1")]
+[assembly: AssemblyVersion("0.5.1.0")]
Modified: trunk/plugins/VeraControl/Scene.cs
===================================================================
--- trunk/plugins/VeraControl/Scene.cs 2012-01-14 17:51:27 UTC (rev 4404)
+++ trunk/plugins/VeraControl/Scene.cs 2012-01-15 23:50:18 UTC (rev 4405)
@@ -4,8 +4,8 @@
* Date: 22-12-2011
* Time: 13:50
*
- * Copyright: 2012 GPL - Bart Eversdijk
- * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
* E-mail: ba...@ev...
*/
using System;
@@ -28,11 +28,14 @@
}
public VeraHelper helper = VeraHelper.Instance;
+ private bool m_bScreenUpdateRequired = false;
private string m_sName = "unknown scene";
private int m_iId = 0;
private bool m_bActive = false;
private int m_iRoom = 0;
+ private long m_lLastUpdate = 0;
+
// not connected (-2), none (-1), pending (0,1,5,6), success(4), error (2,3)
private string m_sComment = ""; // red(error), green(success) or blue(pending) - icon/text
private DevState m_dsState = DevState.NONE;
@@ -47,6 +50,9 @@
m_sComment = helper.getAttrAsString(xn, "comment", m_sComment );
m_dsState = helper.toDevState(helper.getAttrAsInt(xn, "state", -1));
+ // Set update reqired flag
+ m_lLastUpdate = DateTime.Now.Ticks;
+ m_bScreenUpdateRequired = true;
return true;
}
@@ -55,7 +61,7 @@
get { return m_iId; }
set { }
}
-
+
public string name
{
get { return m_sName; }
@@ -72,7 +78,7 @@
get { return (commstate != DevState.NONE ? m_sComment : ""); }
set { }
}
-
+
public bool isActive()
{
return m_bActive;
@@ -102,7 +108,25 @@
}
VeraCommunication vera = VeraCommunication.Instance;
string cmd = "?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="+id;
- return vera.doVeraRequest(cmd, true);
+ return vera.doVeraRequest(cmd);
}
+
+ public bool newScreenUpdateWaitingAndClearFlag( )
+ {
+ // Invoking this method will clear the update ready flag -> so caller need to handle the update
+ bool b = m_bScreenUpdateRequired;
+ m_bScreenUpdateRequired = false;
+ if (m_dsState != DevState.NONE && (m_lLastUpdate < (DateTime.Now.Ticks - (10 * 10000000))))
+ {
+ m_dsState = DevState.NONE;
+ return true;
+ }
+ return b;
+ }
+
+ public virtual bool newUpdateSince(long lTimePreviousCheck)
+ {
+ return (lTimePreviousCheck <= m_lLastUpdate);
+ }
}
}
Modified: trunk/plugins/VeraControl/VeraCommunication.cs
===================================================================
--- trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-14 17:51:27 UTC (rev 4404)
+++ trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-15 23:50:18 UTC (rev 4405)
@@ -4,13 +4,14 @@
* Date: 21-12-2011
* Time: 22:26
*
- * Copyright: 2012 GPL - Bart Eversdijk
- * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
* E-mail: ba...@ev...
*/
using System;
using System.Net;
using System.IO;
+using System.Threading;
using System.Collections.Generic;
using System.Xml;
@@ -22,6 +23,7 @@
public class VeraStatus
{
+ public DeviceSystem system = new DeviceSystem();
public List<DeviceGeneric> devices = new List<DeviceGeneric>();
public List<Scene> scenes = new List<Scene>();
public List<Room> rooms = new List<Room>();
@@ -164,22 +166,29 @@
public sealed class VeraCommunication
{
private static volatile VeraCommunication instance;
- private static object syncRoot = new Object();
+ private static object syncRoot = new Object();
+ private VeraHelper helper = VeraHelper.Instance;
- private string m_sVeraIPAddress;
- private string m_sVeraTCPIPPort;
- private string m_sDataVersion = "";
- private bool m_bMetric = true;
- private DevState m_dsVeraState = DevState.NONE;
- private string m_sComment = "";
+ // Config data
+ private string m_sVeraIPAddress;
+ private string m_sVeraTCPIPPort;
+ private int m_iMaxRefreshDelay;
+
+ // Actual device information
private VeraStatus m_status = new VeraStatus();
- private long m_lLastUpdate = 0;
- private bool m_bUpdatePending = false;
+ // Communication status/control
+ private long m_lLastUpdate = 0;
+ private bool m_bUpdatePending = false;
+ private bool m_bScreenUpdateRequired = false; // Only true when a new update was received AND at least one device(staus) or scene was changed
+ private bool m_bLastUpdateFailed = false;
+ private string m_strLastUpdateError = "";
+ private WebClient m_webClient = new WebClient();
+
+ // Action control table
public int[] actionTriggerTable = new int[(int)Actiontrigger.LAST_ACTIONTRIGGER];
- private VeraHelper helper = VeraHelper.Instance;
-
+
public static VeraCommunication Instance
{
get
@@ -208,39 +217,132 @@
//m_sVeraIPAddress = "192.10.1.240";
// m_sVeraIPAddress = "demo.mios.com";
// m_sVeraTCPIPPort = "3480";
-
+
// Fill action table (config settings)
for (Actiontrigger i = 0; i < Actiontrigger.LAST_ACTIONTRIGGER; i++)
{
actionTriggerTable[(int)i] = xmlreader.GetValueAsInt("veracontroller", i.ToString(), 0);
}
+ m_iMaxRefreshDelay = int.Parse(xmlreader.GetValueAsString("veracontroller", "maxrefreshdelay", "60"));
+
+ // Set DownloadStringCompleted handler
+ m_webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(OnAsyncCompletedEventArgs);
}
}
- public bool updateCurrentStatus()
+ public void updateCurrentStatus(long lNow)
{
- if (m_bUpdatePending)
+ /* when to update in case connection gets lost --> keep updating with webClient timeout 180 sec....*/
+ /* TODO: watch-dog !!! last time > 4 * maxDelay force an update - to recover from hibernate */
+ if (m_bUpdatePending /* && m_lLastUpdate < ((lNow / 10000000) - (4 * m_iMaxRefreshDelay)) */)
{
- return false;
+ return;
}
+
m_bUpdatePending = true;
- string verastatus = doVeraRequest("?id=lu_sdata&output_format=xml");
- m_lLastUpdate = getSecondsSince1970();
+ string url = "?id=lu_sdata&loadtime=" + m_status.system.loadtime + "&dataversion=" + m_status.system.dataversion + "&minimumdelay=2000&timeout=" + m_iMaxRefreshDelay + "&output_format=xml";
+ doVeraRequest(url, OnAsyncCompletedEventArgs);
+ m_lLastUpda...
[truncated message content] |
|
From: <Ba...@us...> - 2012-01-17 23:06:28
|
Revision: 4408
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4408&view=rev
Author: BartEv
Date: 2012-01-17 23:06:18 +0000 (Tue, 17 Jan 2012)
Log Message:
-----------
Improved error handling
Modified Paths:
--------------
trunk/plugins/VeraControl/DeviceCam.cs
trunk/plugins/VeraControl/DeviceDimmer.cs
trunk/plugins/VeraControl/DeviceDoorlock.cs
trunk/plugins/VeraControl/DeviceGeneric.cs
trunk/plugins/VeraControl/DeviceSecurity.cs
trunk/plugins/VeraControl/DeviceSprinkler.cs
trunk/plugins/VeraControl/DeviceSwitch.cs
trunk/plugins/VeraControl/DeviceSystem.cs
trunk/plugins/VeraControl/DeviceThermostat.cs
trunk/plugins/VeraControl/DialogDeviceControl.cs
trunk/plugins/VeraControl/DialogSceneControl.cs
trunk/plugins/VeraControl/Scene.cs
trunk/plugins/VeraControl/VeraCommunication.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraControl.csproj
trunk/plugins/VeraControl/VeraHelper.cs
trunk/plugins/VeraControl/skin/Default/VeraDialogDeviceControl.xml
Added Paths:
-----------
trunk/plugins/VeraControl/BaseDevice.cs
Added: trunk/plugins/VeraControl/BaseDevice.cs
===================================================================
--- trunk/plugins/VeraControl/BaseDevice.cs (rev 0)
+++ trunk/plugins/VeraControl/BaseDevice.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -0,0 +1,175 @@
+/*
+ * Created by SharpDevelop.
+ * User: Bart
+ * Date: 17-1-2012
+ * Time: 19:12
+ *
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * E-mail: ba...@ev...
+ */
+using System;
+using System.Xml;
+
+namespace VeraControl.Properties
+{
+ /// <summary>
+ /// Description of BaseDevice.
+ /// </summary>
+ public class BaseDevice
+ {
+ public long m_lLastUpdate = 0;
+ public long m_lLastPendingUpdate = 0;
+ public bool m_bScreenUpdateRequired = false;
+ private string m_sName = "unknown device";
+ private int m_iId = 0;
+ private int m_iRoom = 0;
+
+ // not connected (-2), none (-1), pending (0,1,5,6), success(4), error (2,3)
+ private DevState m_dsState = DevState.NONE;
+ private string m_sComment = ""; // red(error), green(success) or blue(pending) - icon/text
+
+ public VeraHelper helper = VeraHelper.Instance;
+ public VeraCommunication vera = VeraCommunication.Instance;
+
+ public BaseDevice(XmlNode xn)
+ {
+ if (xn != null)
+ {
+ update(xn);
+ }
+ }
+
+ /// <summary>
+ /// Process Vera update information
+ /// </summary>
+ public virtual bool update(XmlNode xn)
+ {
+ m_sName = helper.getAttrAsString(xn, "name", m_sName);
+ m_iId = helper.getAttrAsInt (xn, "id", m_iId);
+ m_iRoom = helper.getAttrAsInt (xn, "room", m_iRoom);
+
+ string temp_sComment = helper.getAttrAsString(xn, "comment", m_sComment );
+ DevState temp_dsState = helper.toDevState(helper.getAttrAsInt(xn, "state", -1));
+ if (m_dsState != DevState.PENDING || temp_dsState != DevState.NONE || (temp_dsState == DevState.NONE && ((m_lLastPendingUpdate / TimeSpan.TicksPerSecond ) < (DateTime.Now.Ticks / TimeSpan.TicksPerSecond))))
+ { // If state was set to pending next update should contain a new state or still pending - so do not clear pending flag for at least 10 seconds
+ m_sComment = temp_sComment;
+ m_dsState = temp_dsState;
+ }
+ if (m_iId == 0)
+ {
+ // void device no further processing needed
+ return false;
+ }
+
+ // Set update flag
+ m_bScreenUpdateRequired = true;
+ m_lLastUpdate = DateTime.Now.Ticks;
+ return true;
+ }
+
+ /// <summary>
+ /// Returns the id of this device
+ /// </summary>
+ public int id
+ {
+ get { return m_iId; }
+ set { }
+ }
+
+ /// <summary>
+ /// Returns the name of this device
+ /// </summary>
+ public string name
+ {
+ get { return m_sName; }
+ set { }
+ }
+
+ /// <summary>
+ /// Returns true when this device is associated with the given room
+ /// </summary>
+ public bool inRoom(int id)
+ {
+ return (m_iRoom == id);
+ }
+
+ /// <summary>
+ /// Return the room is this device is associated with
+ /// </summary>
+ public int room
+ {
+ get { return m_iRoom; }
+ set { m_iRoom = value; }
+ }
+
+ /// <summary>
+ /// Return the communications state for this device
+ /// </summary>
+ public DevState commstate
+ {
+ get { return m_dsState; }
+ set { }
+ }
+
+ /// <summary>
+ /// Return the comment as reported by Vera for this device
+ /// </summary>
+ public string comment
+ {
+ get { return (commstate != DevState.NONE ? m_sComment : ""); }
+ set { }
+ }
+
+ /// <summary>
+ /// Set virtual device state to pending request
+ /// </summary>
+ public void reportPendingRequest()
+ {
+ m_dsState = DevState.PENDING;
+ m_sComment = "Sending command...";
+ m_bScreenUpdateRequired = true;
+ m_lLastUpdate = DateTime.Now.Ticks;
+ m_lLastPendingUpdate = m_lLastUpdate;
+ }
+
+ /// <summary>
+ /// Callback function for Ansync Web Client call on to report errors...
+ /// </summary>
+ public void reportRequestError(string message)
+ {
+ m_dsState = DevState.COMMAND_ERROR;
+ m_sComment = message;
+ m_bScreenUpdateRequired = true;
+ m_lLastUpdate = DateTime.Now.Ticks;
+ }
+
+ public void clearCommState()
+ {
+ m_dsState = DevState.NONE;
+ }
+ /// <summary>
+ /// True when an update was processed after the give time stamp
+ /// </summary>
+ public virtual bool newUpdateSince(long lTimePreviousCheck)
+ {
+ return (lTimePreviousCheck <= m_lLastUpdate);
+ }
+
+ /// <summary>
+ /// Invoking this method will clear the update ready flag -> so caller need to handle the screen update
+ /// </summary>
+ public virtual bool newScreenUpdateWaitingAndClearFlag( )
+ {
+ bool b = m_bScreenUpdateRequired;
+ m_bScreenUpdateRequired = false;
+ return b;
+ }
+
+ public override string ToString()
+ {
+ return name;
+ }
+
+ }
+}
Modified: trunk/plugins/VeraControl/DeviceCam.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceCam.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/DeviceCam.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -15,7 +15,7 @@
/// Description of DeviceCam.
/// </summary>
public class DeviceCam : DeviceGeneric
- {
+ { // TODO: add IP-cam control buttons
private string m_sIp = "127.0.0.1";
private string m_sUrl = "/";
private string m_sStream = "";
@@ -54,7 +54,7 @@
private bool refreshDelayPassed(long lastcheck)
{
- return ((helper.getSecondsSince1970() - refreshRate) > (lastcheck / 10000000));
+ return ((helper.getSecondsSince1970() - refreshRate) > (lastcheck / TimeSpan.TicksPerSecond));
}
public override string getIconName()
Modified: trunk/plugins/VeraControl/DeviceDimmer.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDimmer.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/DeviceDimmer.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -64,13 +64,14 @@
} else {
if (newValue < 0) { newValue = 0; }
}
- if ((id > 0) && (newValue != m_iLevel)) // Only send when a valid ID is found
- {
+ if (id > 0) // Only send when a valid ID is found
+ {
+ reportPendingRequest();
// Do something with vera
string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
"&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget" +
"&newLoadlevelTarget="+value;
- vera.doVeraRequest(cmd);
+ vera.doVeraCommandRequest(cmd, reportRequestError);
}
m_iLevel = newValue;
}
Modified: trunk/plugins/VeraControl/DeviceDoorlock.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDoorlock.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/DeviceDoorlock.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -41,13 +41,13 @@
set {
if (id > 0) // Only send when a valid ID is found
{
+ reportPendingRequest();
// Do something with vera
string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
"&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget" +
"&newTargetValue="+(value ? "1" : "0");
- vera.doVeraRequest(cmd);
+ vera.doVeraCommandRequest(cmd, reportRequestError);
}
- m_bStatus = value;
}
}
Modified: trunk/plugins/VeraControl/DeviceGeneric.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -14,29 +14,15 @@
namespace VeraControl.Properties
{
-
-
/// <summary>
/// Description of DeviceGeneric.
/// </summary>
- public class DeviceGeneric
+ public class DeviceGeneric : BaseDevice
{
- public long m_lLastUpdate = 0;
- public bool m_bScreenUpdateRequired = false;
- private string m_sName = "unknown device";
- private int m_iId = 0;
private string m_sAltId = "";
private int m_iCategory = 0;
- private int m_iRoom = 0;
- // not connected (-2), none (-1), pending (0,1,5,6), success(4), error (2,3)
- private DevState m_dsState = DevState.NONE;
- private string m_sComment = ""; // red(error), green(success) or blue(pending) - icon/text
-
- public VeraHelper helper = VeraHelper.Instance;
- public VeraCommunication vera = VeraCommunication.Instance;
-
- public DeviceGeneric(XmlNode xn)
+ public DeviceGeneric(XmlNode xn): base (xn)
{
if (xn != null)
{
@@ -44,97 +30,43 @@
}
}
- public virtual bool update(XmlNode xn)
+ public override bool update(XmlNode xn)
{
- m_sName = helper.getAttrAsString(xn, "name", m_sName);
- m_iId = helper.getAttrAsInt (xn, "id", m_iId);
m_sAltId = helper.getAttrAsString(xn, "altid", m_sAltId);
m_iCategory = helper.getAttrAsInt (xn, "category", m_iCategory);
- m_iRoom = helper.getAttrAsInt (xn, "room", m_iRoom);
- m_sComment = helper.getAttrAsString(xn, "comment", m_sComment );
- m_dsState = helper.toDevState(helper.getAttrAsInt(xn, "state", -1));
-
- if (m_iId == 0)
+ bool b = base.update(xn);
+ // Make sure the room exists
+ if (room == 0 || !vera.status.isRoomFound(room))
{
- // void device no further processing needed
- return false;
- }
- // Make sure room exists
- if (m_iRoom == 0 || !vera.status.isRoomFound(m_iRoom))
- {
if (!vera.status.isRoomFound(0))
{ // create dummy room to attach to
vera.rooms.Add(new Room(null));
}
- m_iRoom = 0;
+ room = 0;
}
-
- // Set update flag
- m_bScreenUpdateRequired = true;
- m_lLastUpdate = DateTime.Now.Ticks;
-
- return true;
+
+ return b;
}
-
- public int id
- {
- get { return m_iId; }
- set { }
- }
-
+
public string altid
{
get { return m_sAltId; }
set { }
}
-
- public string name
- {
- get { return m_sName; }
- set { }
- }
-
+
public int category
{
get { return m_iCategory; }
set { }
}
-
- public bool inRoom(int id)
- {
- return (m_iRoom == id);
- }
- public int room
- {
- get { return m_iRoom; }
- set { }
- }
-
- public override string ToString()
- {
- return name;
- }
-
public virtual bool isControllable
{
get { return false; }
set { }
}
- public virtual DevState commstate
- {
- get { return m_dsState; }
- set { }
- }
-
- public virtual string comment
- {
- get { return (commstate != DevState.NONE ? m_sComment : ""); }
- set { }
- }
-
public virtual bool status
{
get { return false; }
@@ -183,18 +115,5 @@
{
return new string [] {"Off", "On"};
}
-
- public virtual bool newScreenUpdateWaitingAndClearFlag( )
- {
- // Invoking this method will clear the update ready flag -> so caller need to handle the update
- bool b = m_bScreenUpdateRequired;
- m_bScreenUpdateRequired = false;
- return b;
- }
-
- public virtual bool newUpdateSince(long lTimePreviousCheck)
- {
- return (lTimePreviousCheck <= m_lLastUpdate);
- }
}
}
Modified: trunk/plugins/VeraControl/DeviceSecurity.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSecurity.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/DeviceSecurity.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -43,13 +43,13 @@
set {
if (id > 0) // Only send when a valid ID is found
{
+ reportPendingRequest();
// Do something with vera
string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
"&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&action=SetArmed" +
"&newArmedValue=" + (value ? "1" : "0");
- vera.doVeraRequest(cmd);
+ vera.doVeraCommandRequest(cmd, reportRequestError);
}
- m_bArmed = value;
}
}
Modified: trunk/plugins/VeraControl/DeviceSprinkler.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -49,13 +49,13 @@
set {
if (id > 0) // Only send when a valid ID is found
{
+ reportPendingRequest();
// Do something with vera
string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
"&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget" +
"&newTargetValue="+(value ? "1" : "0");
- vera.doVeraRequest(cmd);
+ vera.doVeraCommandRequest(cmd, reportRequestError);
}
- m_bStatus = value;
}
}
@@ -71,13 +71,13 @@
set {
if (id > 0) // Only send when a valid ID is found
{
+ reportPendingRequest();
// Do something with vera
string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
"&serviceId=urn:upnp-micasaverde-com:serviceId:Sprinkler1&action=" +
(value == "Auto" ? "SetModeAuto" : (value == "Block" ? "SetModeBlock" : "SetModeManual"));
- vera.doVeraRequest(cmd);
+ vera.doVeraCommandRequest(cmd, reportRequestError);
}
- m_sMode = value;
}
}
Modified: trunk/plugins/VeraControl/DeviceSwitch.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSwitch.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/DeviceSwitch.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -4,8 +4,8 @@
* Date: 22-12-2011
* Time: 14:25
*
- * Copyright: 2012 GPL - Bart Eversdijk
- * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
* E-mail: ba...@ev...
*/
using System;
@@ -22,7 +22,7 @@
private string m_sWatt = "-";
private string m_sKwh = "-";
- public DeviceSwitch( XmlNode xn ): base (xn)
+ public DeviceSwitch( XmlNode xn ): base (xn)
{
if (xn != null)
{
@@ -30,13 +30,13 @@
}
}
- public override bool update(XmlNode xn)
+ public override bool update(XmlNode xn)
{
m_bStatus = helper.getAttrAsBool (xn, "status", m_bStatus);
m_sWatt = helper.getAttrAsString(xn, "watts", m_sWatt);
m_sKwh = helper.getAttrAsString(xn, "kwh", m_sKwh);
- return base.update(xn);
+ return base.update(xn);
}
public string watts
@@ -48,16 +48,16 @@
public override bool status
{
get { return m_bStatus; }
- set {
- if (id > 0) // Only send when a valid ID is found
- {
- // Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
- "&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget" +
- "&newTargetValue="+(value ? "1" : "0");
- vera.doVeraRequest(cmd);
- }
- m_bStatus = value;
+ set {
+ if (id > 0) // Only send when a valid ID is found
+ {
+ reportPendingRequest();
+ // Do something with vera
+ string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ "&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget" +
+ "&newTargetValue="+(value ? "1" : "0");
+ vera.doVeraCommandRequest(cmd, reportRequestError);
+ }
}
}
Modified: trunk/plugins/VeraControl/DeviceSystem.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSystem.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/DeviceSystem.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -148,6 +148,14 @@
m_lLastUpdate = DateTime.Now.Ticks;
}
+ public void reportCommandError( string errmsg )
+ {
+ m_dsVeraState = DevState.COMMAND_ERROR;
+ m_sComment = errmsg;
+ m_bScreenUpdateRequired = true;
+ m_lLastUpdate = DateTime.Now.Ticks;
+ }
+
public void clearConnectionError( )
{
m_dsVeraState = DevState.NONE;
Modified: trunk/plugins/VeraControl/DeviceThermostat.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceThermostat.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/DeviceThermostat.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -60,14 +60,14 @@
set {
if (id > 0) // Only send when a valid ID is found
{
+ reportPendingRequest();
// Do something with vera
string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
"&serviceId=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget" +
"&NewModeTarget="+(value == "Off" ? "Off" : (value == "Cool" ? "CoolOn" : (value == "Heat" ? "HeatOn" : "AutoChangeOver"))
);
- vera.doVeraRequest(cmd);
+ vera.doVeraCommandRequest(cmd, reportRequestError);
}
- m_sMode = value;
}
}
Modified: trunk/plugins/VeraControl/DialogDeviceControl.cs
===================================================================
--- trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -46,9 +46,12 @@
[SkinControl(30)] protected GUIImage cmtImage = null;
[SkinControlAttribute(31)] protected GUILabelControl comment=null;
- VeraHelper helper = new VeraHelper();
- private DeviceGeneric myDev = null;
- private long m_iLastUpdate = 0;
+ private VeraHelper helper = new VeraHelper();
+ private DeviceGeneric myDev = null;
+ private long m_iLastUpdate = 0;
+ private bool m_bLevelUpdatePending = false;
+ private long m_lLastLevelUpdate = 0;
+ private int m_iDesiredLevel = 0;
public DialogDeviceControl()
{
@@ -60,7 +63,6 @@
bool bResult = Load(GUIGraphicsContext.Skin + @"\VeraDialogDeviceControl.xml");
return bResult;
}
-
public void InitDialog(string strLine, DeviceGeneric dev)
{
@@ -75,7 +77,7 @@
{
btnClose.SetNavigation(2,2,2,2);
}
-
+
updateStatus();
}
@@ -96,8 +98,8 @@
{
SetText(myDev.name, myDev.getStatusText(), myDev.getExtraText() );
SetActiveBut((myDev.status ? 1 : 0), (myDev.mode == "Auto" ? 0 :
- (myDev.mode == "CoolOn" || myDev.mode == "Cool" ? 1 :
- (myDev.mode == "HeatOn" || myDev.mode == "Heat" ? 2 : 3) )));
+ (myDev.mode == "CoolOn" || myDev.mode == "Cool" ? 1 :
+ (myDev.mode == "HeatOn" || myDev.mode == "Heat" ? 2 : 3) )));
}
else
{
@@ -105,7 +107,10 @@
SetActiveBut(myDev.status ? 1 : 0, -1);
}
SetButtons(myDev.getCommands());
- SetSlider(myDev.level, myDev.maxLevel);
+ if (!m_bLevelUpdatePending)
+ {
+ SetSlider(myDev.level, myDev.maxLevel);
+ }
}
else
{
@@ -120,52 +125,32 @@
m_iLastUpdate = DateTime.Now.Ticks;
}
-
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
{
- if (control == btnLeft)
- {
- myDev.level = myDev.minLevel;
- SetSlider( myDev.level, myDev.maxLevel );
- }
-
- if (control == btnRight)
- {
- myDev.level = myDev.maxLevel;
- SetSlider( myDev.level, myDev.maxLevel );
- }
-
- if (control == btnMode1)
- {
- myDev.mode = btnMode1.Label;
- SetActiveBut(-1, 0);
- }
- if (control == btnMode2)
- {
- myDev.mode = btnMode2.Label;
- SetActiveBut(-1, 1);
- }
- if (control == btnMode3)
- {
- myDev.mode = btnMode3.Label;
- SetActiveBut(-1, 2);
- }
-
- if (control == slider)
- {
- myDev.level = slider.IntValue;
- }
-
- // update button high lighting
- SetActiveBut( (slider.IntValue > 0 ? 1 : 0), -1);
-
- // update icon
- SetImage("Vera\\" + myDev.getIconName() + ".png");
-
- // Back to the text button to switch from image view
- if (control == btnClose)
- {
+ if (control == btnClose) {
PageDestroy();
+ } else {
+ if (control == btnLeft) {
+ myDev.level = myDev.minLevel;
+ }
+ if (control == btnRight) {
+ myDev.level = myDev.maxLevel;
+ }
+ if (control == btnMode1) {
+ myDev.mode = btnMode1.Label;
+ }
+ if (control == btnMode2) {
+ myDev.mode = btnMode2.Label;
+ }
+ if (control == btnMode3) {
+ myDev.mode = btnMode3.Label;
+ }
+ if (control == slider) {
+ // Do something with fast repeating level changes.... slow down communications
+ m_bLevelUpdatePending = true;
+ m_iDesiredLevel = slider.IntValue;
+ SliderDebouncer();
+ }
}
base.OnClicked(controlId, control, actionType);
}
@@ -197,9 +182,23 @@
}
}
+ public void SliderDebouncer()
+ {
+ if (m_lLastLevelUpdate < DateTime.Now.Ticks)
+ { // If minimum update delay (2 sec) has been passed
+ if (m_bLevelUpdatePending && myDev.level != m_iDesiredLevel)
+ {
+ myDev.level = m_iDesiredLevel;
+ slider.IntValue = m_iDesiredLevel;
+ m_lLastLevelUpdate = DateTime.Now.Ticks + (TimeSpan.TicksPerSecond * 2);
+ }
+ m_bLevelUpdatePending = false;
+ }
+ }
+
public void SetSlider(int iVal, int iMaxval)
{
- if (iVal >= 0)
+ if ((iVal >= 0) && !m_bLevelUpdatePending)
{
slider.SetRange(0, iMaxval);
slider.IntValue = iVal;
@@ -276,8 +275,8 @@
if (myDev.newUpdateSince(m_iLastUpdate))
{
updateStatus();
+ SliderDebouncer();
}
-
base.Render(timePassed);
}
}
Modified: trunk/plugins/VeraControl/DialogSceneControl.cs
===================================================================
--- trunk/plugins/VeraControl/DialogSceneControl.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/DialogSceneControl.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -80,9 +80,7 @@
if (control == btnRight)
{
if (myScene.id != 0) {
- comment.Label = "Running...";
myScene.run();
-
}
}
Modified: trunk/plugins/VeraControl/Scene.cs
===================================================================
--- trunk/plugins/VeraControl/Scene.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/Scene.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -17,116 +17,62 @@
/// <summary>
/// Description of Scene.
/// </summary>
- public class Scene
+ public class Scene : BaseDevice
{
- public Scene(XmlNode xn)
+ public Scene(XmlNode xn): base (xn)
{
if (xn != null)
{
update(xn);
}
}
- public VeraHelper helper = VeraHelper.Instance;
- private bool m_bScreenUpdateRequired = false;
- private string m_sName = "unknown scene";
- private int m_iId = 0;
private bool m_bActive = false;
- private int m_iRoom = 0;
- private long m_lLastUpdate = 0;
-
- // not connected (-2), none (-1), pending (0,1,5,6), success(4), error (2,3)
- private string m_sComment = ""; // red(error), green(success) or blue(pending) - icon/text
- private DevState m_dsState = DevState.NONE;
-
- public bool update(XmlNode xn)
+ public override bool update(XmlNode xn)
{
- m_sName = helper.getAttrAsString(xn, "name", m_sName);
- m_iId = helper.getAttrAsInt (xn, "id", m_iId);
- m_iRoom = helper.getAttrAsInt (xn, "room", m_iRoom);
- m_bActive = helper.getAttrAsBool (xn, "active", m_bActive);
+ m_bActive = helper.getAttrAsBool(xn, "active", m_bActive);
+ bool b = base.update(xn);
- m_sComment = helper.getAttrAsString(xn, "comment", m_sComment );
- m_dsState = helper.toDevState(helper.getAttrAsInt(xn, "state", -1));
-
- // Set update reqired flag
- m_lLastUpdate = DateTime.Now.Ticks;
- m_bScreenUpdateRequired = true;
- return true;
+ // Make sure the room exists or is 0
+ if (room != 0 && !vera.status.isRoomFound(room))
+ {
+ if (!vera.status.isRoomFound(0))
+ { // create dummy room to attach to
+ vera.rooms.Add(new Room(null));
+ }
+ room = 0;
+ }
+ return b;
}
- public int id
- {
- get { return m_iId; }
- set { }
- }
-
- public string name
- {
- get { return m_sName; }
- set { }
- }
-
- public virtual DevState commstate
- {
- get { return m_dsState; }
- set { }
- }
- public virtual string comment
- {
- get { return (commstate != DevState.NONE ? m_sComment : ""); }
- set { }
- }
-
public bool isActive()
{
return m_bActive;
}
- public bool inRoom(int id)
+ public void run()
{
- return (m_iRoom == id);
- }
-
- public int room
- {
- get { return m_iRoom; }
- set { }
- }
-
- public override string ToString()
- {
- return name;
- }
-
- public string run()
- {
if (id == 0)
{
- return "Unknown scene";
+ vera.status.system.reportCommandError("Unknown scene");
+ m_bScreenUpdateRequired = true;
}
- VeraCommunication vera = VeraCommunication.Instance;
+ reportPendingRequest();
string cmd = "?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="+id;
- return vera.doVeraRequest(cmd);
+ vera.doVeraCommandRequest(cmd, reportRequestError);
}
- public bool newScreenUpdateWaitingAndClearFlag( )
+ public override bool newScreenUpdateWaitingAndClearFlag( )
{
- // Invoking this method will clear the update ready flag -> so caller need to handle the update
- bool b = m_bScreenUpdateRequired;
- m_bScreenUpdateRequired = false;
- if (m_dsState != DevState.NONE && (m_lLastUpdate < (DateTime.Now.Ticks - (10 * 10000000))))
+ // Scenes are not reported Done by Vera so the will time out...
+ bool b = base.newScreenUpdateWaitingAndClearFlag();
+ if (commstate != DevState.NONE && (m_lLastUpdate < (DateTime.Now.Ticks - (10 * 10000000))))
{
- m_dsState = DevState.NONE;
+ clearCommState();
return true;
}
return b;
}
-
- public virtual bool newUpdateSince(long lTimePreviousCheck)
- {
- return (lTimePreviousCheck <= m_lLastUpdate);
- }
}
}
Modified: trunk/plugins/VeraControl/VeraCommunication.cs
===================================================================
--- trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-17 23:05:16 UTC (rev 4407)
+++ trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-17 23:06:18 UTC (rev 4408)
@@ -172,19 +172,20 @@
// Config data
private string m_sVeraIPAddress;
private string m_sVeraTCPIPPort;
- private int m_iMaxRefreshDelay;
+ private int m_iMaxRefreshDelay; // Maximun delay between 2 status updates in seconds
+ private int m_iMinRefreshDelay = 1000; // Minimun delay between 2 status updates in miliseconds
-
// Actual device information
private VeraStatus m_status = new VeraStatus();
// Communication status/control
private long m_lLastUpdate = 0;
- private bool m_bUpdatePending = false;
private bool m_bScreenUpdateRequired = false; // Only true when a new update was received AND at least one device(staus) or scene was changed
private bool m_bLastUpdateFailed = false;
private string m_strLastUpdateError = "";
- private WebClient m_webClient = new WebClient();
+ private WebClient m_webUpdateClient = new WebClient();
+ private WebClient m_webCommandClient = new WebClient();
+ private Action<string> m_webCommandClientReportError = null;
// Action control table
public int[] actionTriggerTable = new int[(int)Actiontrigger.LAST_ACTIONTRIGGER];
@@ -226,71 +227,113 @@
m_iMaxRefreshDelay = int.Parse(xmlreader.GetValueAsString("veracontroller", "maxrefreshdelay", "60"));
// Set DownloadStringCompleted handler
- m_webClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(OnAsyncCompletedEventArgs);
+ m_webUpdateClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(OnCompletedUpdateStatusRequest);
+ m_webCommandClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(OnCompletedCommandRequest);
}
}
- public void updateCurrentStatus(long lNow)
- {
- /* when to update in case connection gets lost --> keep updating with webClient timeout 180 sec....*/
- /* TODO: watch-dog !!! last time > 4 * maxDelay force an update - to recover from hibernate */
- if (m_bUpdatePending /* && m_lLastUpdate < ((lNow / 10000000) - (4 * m_iMaxRefreshDelay)) */)
- {
- return;
- }
-
- m_bUpdatePending = true;
- string url = "?id=lu_sdata&loadtime=" + m_status.system.loadtime + "&dataversion=" + m_status.system.dataversion + "&minimumdelay=2000&timeout=" + m_iMaxRefreshDelay + "&output_format=xml";
- doVeraRequest(url, OnAsyncCompletedEventArgs);
- m_lLastUpdate = helper.getSecondsSince1970();
- }
-
public bool isVeraAlive(string ip, string port)
{
string response = retrieveURL("http://" + ip + ":" + port + "/data_request?id...
[truncated message content] |
|
From: <Ba...@us...> - 2012-01-17 23:11:46
|
Revision: 4410
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4410&view=rev
Author: BartEv
Date: 2012-01-17 23:11:40 +0000 (Tue, 17 Jan 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/VeraControl/Scene.cs
trunk/plugins/VeraControl/VeraCommunication.cs
Modified: trunk/plugins/VeraControl/Scene.cs
===================================================================
--- trunk/plugins/VeraControl/Scene.cs 2012-01-17 23:11:15 UTC (rev 4409)
+++ trunk/plugins/VeraControl/Scene.cs 2012-01-17 23:11:40 UTC (rev 4410)
@@ -57,6 +57,7 @@
{
vera.status.system.reportCommandError("Unknown scene");
m_bScreenUpdateRequired = true;
+ return;
}
reportPendingRequest();
string cmd = "?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="+id;
Modified: trunk/plugins/VeraControl/VeraCommunication.cs
===================================================================
--- trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-17 23:11:15 UTC (rev 4409)
+++ trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-17 23:11:40 UTC (rev 4410)
@@ -565,14 +565,7 @@
get { return (helper.getSecondsSince1970() - m_lLastUpdate); }
set { }
}
-
- /*
- public bool metric
- {
- get { return m_bMetric; }
- set { }
- }
- */
+
public List<Scene> scenes
{
get { return m_status.scenes; }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Ba...@us...> - 2012-01-21 12:46:03
|
Revision: 4417
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4417&view=rev
Author: BartEv
Date: 2012-01-21 12:45:56 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------
Added WebCam movement control support
Modified Paths:
--------------
trunk/plugins/VeraControl/DeviceCam.cs
trunk/plugins/VeraControl/DeviceGeneric.cs
trunk/plugins/VeraControl/DialogDeviceControl.cs
trunk/plugins/VeraControl/skin/Default/VeraDialogDeviceControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraDialogDeviceControl.xml
Modified: trunk/plugins/VeraControl/DeviceCam.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceCam.cs 2012-01-21 10:50:48 UTC (rev 4416)
+++ trunk/plugins/VeraControl/DeviceCam.cs 2012-01-21 12:45:56 UTC (rev 4417)
@@ -18,11 +18,13 @@
{ // TODO: add IP-cam control buttons
private string m_sIp = "127.0.0.1";
private string m_sUrl = "/";
- private string m_sStream = "";
+ private string m_sStream = "";
private string m_sVideoUrl = "";
- private int m_refresh = 10;
+ private int m_refresh = 2;
+ private string m_sUser = "";
+ private string m_sPass = "";
- public DeviceCam( XmlNode xn ): base (xn)
+ public DeviceCam( XmlNode xn ): base (xn)
{
if (xn != null)
{
@@ -30,22 +32,44 @@
}
}
- public override bool update(XmlNode xn)
+ public override bool update(XmlNode xn)
{
m_sIp = helper.getAttrAsString(xn, "ip", m_sIp);
m_sUrl = helper.getAttrAsString(xn, "url", m_sUrl);
m_sStream = helper.getAttrAsString(xn, "streaming", m_sStream);
m_sVideoUrl = helper.getAttrAsString(xn, "videourls", m_sVideoUrl);
+ m_sUser = helper.getAttrAsString(xn, "username", "");
+ m_sPass = helper.getAttrAsString(xn, "password", "");
- return base.update(xn);
+ return base.update(xn);
}
+ private string passString
+ {
+ get {
+ if (m_sUser == "")
+ {
+ return "";
+ }
+ return m_sUser + ":" + m_sPass + "@";
+ }
+ set { }
+ }
+
public string imgUrl
{
- get { return "http://" + m_sIp + "/" + m_sUrl.Replace("%2F", "/"); }
+ get { return "http://" + passString + vera.vera_Address + "/data_request?id=cam_image¶meters=get_video_frame&Device_Num=" + id + "&rand=" + DateTime.Now.Ticks;
+ // return "http://" + passString + m_sIp + "/" + m_sUrl.Replace("%2F", "/");
+ }
set { }
}
+ public string streamUrl
+ {
+ get { return "http://" + passString + m_sIp + "/" + m_sStream.Replace("%2F", "/"); }
+ set { }
+ }
+
public int refreshRate
{
get { return m_refresh; }
@@ -84,5 +108,42 @@
}
return b;
}
+
+ private void move(string direction)
+ {
+ if (id == 0)
+ {
+ vera.status.system.reportCommandError("Unknown device");
+ m_bScreenUpdateRequired = true;
+ return;
+ }
+ string cmd = "?id=lu_action&DeviceNum=" + id + "&serviceId=urn:micasaverde-com:serviceId:PanTiltZoom1&action=" + direction;
+ vera.doVeraCommandRequest(cmd, reportRequestError);
+ }
+
+ public override void moveUp()
+ {
+ move("MoveUp");
+ }
+ public override void moveLeft()
+ {
+ move("MoveLeft");
+ }
+ public override void moveRight()
+ {
+ move("MoveRight");
+ }
+ public override void moveDown()
+ {
+ move("MoveDown");
+ }
+ public override void moveZoomIn()
+ {
+ move("ZoomIn");
+ }
+ public override void moveZoomOut()
+ {
+ move("ZoomOut");
+ }
}
}
Modified: trunk/plugins/VeraControl/DeviceGeneric.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-21 10:50:48 UTC (rev 4416)
+++ trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-21 12:45:56 UTC (rev 4417)
@@ -115,5 +115,31 @@
{
return new string [] {"Off", "On"};
}
+
+ // Overrides for Cam Device
+ public virtual void moveUp()
+ {
+ // do nothing
+ }
+ public virtual void moveLeft()
+ {
+ // do nothing
+ }
+ public virtual void moveRight()
+ {
+ // do nothing
+ }
+ public virtual void moveDown()
+ {
+ // do nothing
+ }
+ public virtual void moveZoomIn()
+ {
+ // do nothing
+ }
+ public virtual void moveZoomOut()
+ {
+ // do nothing
+ }
}
}
Modified: trunk/plugins/VeraControl/DialogDeviceControl.cs
===================================================================
--- trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-01-21 10:50:48 UTC (rev 4416)
+++ trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-01-21 12:45:56 UTC (rev 4417)
@@ -9,6 +9,7 @@
* E-mail: ba...@ev...
*/
using System;
+using System.Threading;
using System.Collections;
using MediaPortal;
using MediaPortal.Util;
@@ -35,15 +36,25 @@
[SkinControlAttribute(7)] protected GUILabelControl label2=null;
[SkinControlAttribute(8)] protected GUILabelControl label3=null;
- [SkinControl(10)] protected GUIButtonControl btnLeft = null;
- [SkinControl(11)] protected GUIButtonControl btnRight = null;
- [SkinControl(12)] protected GUIButtonControl btnMode1 = null;
- [SkinControl(13)] protected GUIButtonControl btnMode2 = null;
- [SkinControl(14)] protected GUIButtonControl btnMode3 = null;
- [SkinControl(15)] protected GUISliderControl slider = null;
- [SkinControl(20)] protected GUIImage camImage = null;
+ [SkinControl(10)] protected GUIButtonControl btnLeft = null;
+ [SkinControl(11)] protected GUIButtonControl btnRight = null;
+ [SkinControl(12)] protected GUIButtonControl btnMode1 = null;
+ [SkinControl(13)] protected GUIButtonControl btnMode2 = null;
+ [SkinControl(14)] protected GUIButtonControl btnMode3 = null;
+ [SkinControl(15)] protected GUISliderControl slider = null;
- [SkinControl(30)] protected GUIImage cmtImage = null;
+ [SkinControl(20)] protected GUIImage camImage1 = null;
+ [SkinControl(21)] protected GUIImage camImage2 = null;
+ [SkinControl(50)] protected GUIButtonControl btnCamUp = null;
+ [SkinControl(51)] protected GUIButtonControl btnCamLeft = null;
+ [SkinControl(52)] protected GUIButtonControl btnCamRight = null;
+ [SkinControl(53)] protected GUIButtonControl btnCamDown = null;
+ [SkinControl(55)] protected GUIButtonControl btnCamZmMin = null;
+ [SkinControl(56)] protected GUIButtonControl btnCamZmPlus = null;
+ [SkinControl(57)] protected GUILabelControl labelLoading = null;
+
+
+ [SkinControl(30)] protected GUIImage cmtImage = null;
[SkinControlAttribute(31)] protected GUILabelControl comment=null;
private VeraHelper helper = new VeraHelper();
@@ -52,6 +63,8 @@
private bool m_bLevelUpdatePending = false;
private long m_lLastLevelUpdate = 0;
private int m_iDesiredLevel = 0;
+ private bool m_bKeepUpdating = false;
+ private int _camUpdateDelay = 2;
public DialogDeviceControl()
{
@@ -79,6 +92,22 @@
}
updateStatus();
+
+ if (myDev.GetType() == typeof(DeviceCam))
+ {
+ btnCamUp.Visibility = System.Windows.Visibility.Visible;
+ btnCamLeft.Visibility = System.Windows.Visibility.Visible;
+ btnCamRight.Visibility = System.Windows.Visibility.Visible;
+ btnCamDown.Visibility = System.Windows.Visibility.Visible;
+ btnCamZmMin.Visibility = System.Windows.Visibility.Visible;
+ btnCamZmPlus.Visibility = System.Windows.Visibility.Visible;
+
+ btnClose.NavigateDown = 50;
+ btnClose.NavigateUp = 56;
+
+ imgLogo.Visibility = System.Windows.Visibility.Hidden;
+ startCamImageUpdater(((DeviceCam)dev).imgUrl);
+ }
}
public void updateStatus()
@@ -114,11 +143,6 @@
}
else
{
- if (myDev.GetType() == typeof(DeviceCam))
- {
- DeviceCam cam = (DeviceCam) myDev;
- SetCamImage(cam.imgUrl);
- }
SetText(myDev.name, myDev.getStatusText(), myDev.getExtraText());
}
// save last update ticks
@@ -128,6 +152,7 @@
protected override void OnClicked(int controlId, GUIControl control, Action.ActionType actionType)
{
if (control == btnClose) {
+ m_bKeepUpdating = false;
PageDestroy();
} else {
if (control == btnLeft) {
@@ -145,6 +170,25 @@
if (control == btnMode3) {
myDev.mode = btnMode3.Label;
}
+ // Cam only commands
+ if (control == btnCamUp) {
+ myDev.moveUp();
+ }
+ if (control == btnCamLeft) {
+ myDev.moveLeft();
+ }
+ if (control == btnCamRight) {
+ myDev.moveRight();
+ }
+ if (control == btnCamDown) {
+ myDev.moveDown();
+ }
+ if (control == btnCamZmMin) {
+ myDev.moveZoomOut();
+ }
+ if (control == btnCamZmPlus) {
+ myDev.moveZoomIn();
+ }
if (control == slider) {
// Do something with fast repeating level changes.... slow down communications
m_bLevelUpdatePending = true;
@@ -237,17 +281,55 @@
}
}
- public void SetCamImage(string url)
+ public int camUpdateDelay
{
-
- camImage.Dispose();
- camImage.SetFileName(url);
- camImage.AllocResources();
- camImage.KeepAspectRatio = true;
- camImage.Visibility = System.Windows.Visibility.Visible;
- imgLogo.Visibility = System.Windows.Visibility.Hidden;
+ get { return _camUpdateDelay; }
+ set { _camUpdateDelay = value; }
}
+ public void startCamImageUpdater(string url)
+ {
+ m_bKeepUpdating = true;
+ labelLoading.Visibility = System.Windows.Visibility.Visible;
+ new Thread (() =>
+ {
+ while (m_bKeepUpdating)
+ {
+ camImage1.Dispose();
+ camImage1.SetFileName(url+"&time="+DateTime.Now.Ticks);
+ camImage1.AllocResources();
+ camImage1.KeepAspectRatio = true;
+
+ while (!camImage1.Allocated)
+ {
+ Thread.Sleep(100);
+ }
+ camImage1.Visibility = System.Windows.Visibility.Visible;
+ camImage2.Visibility = System.Windows.Visibility.Hidden;
+ labelLoading.Visibility = System.Windows.Visibility.Hidden;
+
+ Thread.Sleep(_camUpdateDelay * 1000);
+
+ if (m_bKeepUpdating)
+ {
+ camImage2.Dispose();
+ camImage2.SetFileName(url+"&time="+DateTime.Now.Ticks);
+ camImage2.AllocResources();
+ camImage2.KeepAspectRatio = true;
+ while (!camImage2.Allocated)
+ {
+ Thread.Sleep(100);
+ }
+ camImage2.Visibility = System.Windows.Visibility.Visible;
+ camImage1.Visibility = System.Windows.Visibility.Hidden;
+ labelLoading.Visibility = System.Windows.Visibility.Hidden;
+
+ Thread.Sleep(_camUpdateDelay * 1000);
+ }
+ }
+ }).Start();
+ }
+
public void SetImage(string filename)
{
imgLogo.Dispose();
Modified: trunk/plugins/VeraControl/skin/Default/VeraDialogDeviceControl.xml
===================================================================
--- trunk/plugins/VeraControl/skin/Default/VeraDialogDeviceControl.xml 2012-01-21 10:50:48 UTC (rev 4416)
+++ trunk/plugins/VeraControl/skin/Default/VeraDialogDeviceControl.xml 2012-01-21 12:45:56 UTC (rev 4417)
@@ -237,15 +237,168 @@
</control>
<control>
+ <description>loading label</description>
+ <type>label</type>
+ <id>57</id>
+ <posX>400</posX>
+ <posY>240</posY>
+ <label>Loading image...</label>
+ <font>font13</font>
+ <textcolor>90FFFFFF</textcolor>
+ <visible>no</visible>
+ </control>
+ <control>
<type>image</type>
<id>20</id>
- <posX>240</posX>
+ <posX>340</posX>
<posY>160</posY>
<width>600</width>
<height>240</height>
<texture></texture>
<visible>no</visible>
</control>
-
+ <control>
+ <type>image</type>
+ <id>21</id>
+ <posX>340</posX>
+ <posY>160</posY>
+ <width>600</width>
+ <height>240</height>
+ <texture></texture>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Cam Up</description>
+ <type>button</type>
+ <id>50</id>
+ <posX>190</posX>
+ <posY>180</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>80</width>
+ <height>32</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>up</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>51</onleft>
+ <onright>52</onright>
+ <onup>2</onup>
+ <ondown>53</ondown>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Cam left</description>
+ <type>button</type>
+ <id>51</id>
+ <posX>140</posX>
+ <posY>220</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>80</width>
+ <height>32</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>left</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>52</onleft>
+ <onright>52</onright>
+ <onup>50</onup>
+ <ondown>52</ondown>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Cam right</description>
+ <type>button</type>
+ <id>52</id>
+ <posX>240</posX>
+ <posY>220</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>80</width>
+ <height>32</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>right</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>51</onleft>
+ <onright>51</onright>
+ <onup>50</onup>
+ <ondown>53</ondown>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Cam down</description>
+ <type>button</type>
+ <id>53</id>
+ <posX>190</posX>
+ <posY>260</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>80</width>
+ <height>32</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>down</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>51</onleft>
+ <onright>52</onright>
+ <onup>50</onup>
+ <ondown>55</ondown>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Zoom min</description>
+ <type>button</type>
+ <id>55</id>
+ <posX>140</posX>
+ <posY>320</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>80</width>
+ <height>32</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>zoom -</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>56</onleft>
+ <onright>56</onright>
+ <onup>53</onup>
+ <ondown>2</ondown>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Zoom plus</description>
+ <type>button</type>
+ <id>56</id>
+ <posX>240</posX>
+ <posY>320</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>80</width>
+ <height>32</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>zoom +</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>55</onleft>
+ <onright>55</onright>
+ <onup>53</onup>
+ <ondown>2</ondown>
+ <visible>no</visible>
+ </control>
+
</controls>
</window>
Modified: trunk/plugins/VeraControl/skin/DefaultWide/VeraDialogDeviceControl.xml
===================================================================
--- trunk/plugins/VeraControl/skin/DefaultWide/VeraDialogDeviceControl.xml 2012-01-21 10:50:48 UTC (rev 4416)
+++ trunk/plugins/VeraControl/skin/DefaultWide/VeraDialogDeviceControl.xml 2012-01-21 12:45:56 UTC (rev 4417)
@@ -239,15 +239,169 @@
<animation effect="fade" time="250">windowopen</animation>
</control>
+ <control>
+ <description>loading label</description>
+ <type>label</type>
+ <id>57</id>
+ <posX>630</posX>
+ <posY>280</posY>
+ <label>Loading image...</label>
+ <font>font13</font>
+ <textcolor>90FFFFFF</textcolor>
+ <visible>no</visible>
+ </control>
<control>
<type>image</type>
<id>20</id>
- <posX>450</posX>
+ <posX>550</posX>
<posY>200</posY>
<width>600</width>
<height>300</height>
<texture></texture>
<visible>no</visible>
+ </control>
+ <control>
+ <type>image</type>
+ <id>21</id>
+ <posX>550</posX>
+ <posY>200</posY>
+ <width>600</width>
+ <height>300</height>
+ <texture></texture>
+ <visible>no</visible>
</control>
+ <control>
+ <description>Cam Up</description>
+ <type>button</type>
+ <id>50</id>
+ <posX>335</posX>
+ <posY>220</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>130</width>
+ <height>50</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>up</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>51</onleft>
+ <onright>52</onright>
+ <onup>2</onup>
+ <ondown>53</ondown>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Cam left</description>
+ <type>button</type>
+ <id>51</id>
+ <posX>260</posX>
+ <posY>275</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>130</width>
+ <height>50</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>left</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>52</onleft>
+ <onright>52</onright>
+ <onup>50</onup>
+ <ondown>52</ondown>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Cam right</description>
+ <type>button</type>
+ <id>52</id>
+ <posX>400</posX>
+ <posY>275</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>130</width>
+ <height>50</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>right</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>51</onleft>
+ <onright>51</onright>
+ <onup>50</onup>
+ <ondown>53</ondown>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Cam down</description>
+ <type>button</type>
+ <id>53</id>
+ <posX>335</posX>
+ <posY>330</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>130</width>
+ <height>50</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>down</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>51</onleft>
+ <onright>52</onright>
+ <onup>50</onup>
+ <ondown>55</ondown>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Zoom min</description>
+ <type>button</type>
+ <id>55</id>
+ <posX>260</posX>
+ <posY>420</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>130</width>
+ <height>50</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>zoom -</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>56</onleft>
+ <onright>56</onright>
+ <onup>53</onup>
+ <ondown>2</ondown>
+ <visible>no</visible>
+ </control>
+ <control>
+ <description>Zoom plus</description>
+ <type>button</type>
+ <id>56</id>
+ <posX>400</posX>
+ <posY>420</posY>
+ <textXOff>29</textXOff>
+ <textYOff>6</textYOff>
+ <width>130</width>
+ <height>50</height>
+ <textureFocus>button_focus.png</textureFocus>
+ <textureNoFocus>button_nofocus.png</textureNoFocus>
+ <label>zoom +</label>
+ <font>font10</font>
+ <textalign>center</textalign>
+ <textvalign>middle</textvalign>
+ <onleft>55</onleft>
+ <onright>55</onright>
+ <onup>53</onup>
+ <ondown>2</ondown>
+ <visible>no</visible>
+ </control>
+
</controls>
</window>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Ba...@us...> - 2012-01-21 23:31:46
|
Revision: 4418
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4418&view=rev
Author: BartEv
Date: 2012-01-21 23:31:37 +0000 (Sat, 21 Jan 2012)
Log Message:
-----------
- complied with coding standards
- improved update Cam Images handler
- cleaned up messy code
Modified Paths:
--------------
trunk/plugins/VeraControl/BaseDevice.cs
trunk/plugins/VeraControl/DevCategories.cs
trunk/plugins/VeraControl/DeviceCam.cs
trunk/plugins/VeraControl/DeviceDimmer.cs
trunk/plugins/VeraControl/DeviceDoorlock.cs
trunk/plugins/VeraControl/DeviceGWeather.cs
trunk/plugins/VeraControl/DeviceGeneric.cs
trunk/plugins/VeraControl/DeviceHumidity.cs
trunk/plugins/VeraControl/DeviceLightSensor.cs
trunk/plugins/VeraControl/DevicePowerMeter.cs
trunk/plugins/VeraControl/DeviceSceneController.cs
trunk/plugins/VeraControl/DeviceSecurity.cs
trunk/plugins/VeraControl/DeviceSprinkler.cs
trunk/plugins/VeraControl/DeviceSwitch.cs
trunk/plugins/VeraControl/DeviceSystem.cs
trunk/plugins/VeraControl/DeviceTemperature.cs
trunk/plugins/VeraControl/DeviceThermostat.cs
trunk/plugins/VeraControl/DeviceWindowCovering.cs
trunk/plugins/VeraControl/DialogActionTrigger.cs
trunk/plugins/VeraControl/DialogDeviceControl.cs
trunk/plugins/VeraControl/DialogSceneControl.cs
trunk/plugins/VeraControl/Room.cs
trunk/plugins/VeraControl/Scene.cs
trunk/plugins/VeraControl/Section.cs
trunk/plugins/VeraControl/VeraCommunication.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraHelper.cs
trunk/plugins/VeraControl/VeraSetupForm.Designer.cs
trunk/plugins/VeraControl/VeraSetupForm.cs
Modified: trunk/plugins/VeraControl/BaseDevice.cs
===================================================================
--- trunk/plugins/VeraControl/BaseDevice.cs 2012-01-21 12:45:56 UTC (rev 4417)
+++ trunk/plugins/VeraControl/BaseDevice.cs 2012-01-21 23:31:37 UTC (rev 4418)
@@ -18,151 +18,131 @@
/// </summary>
public class BaseDevice
{
- public long m_lLastUpdate = 0;
- public long m_lLastPendingUpdate = 0;
- public bool m_bScreenUpdateRequired = false;
- private string m_sName = "unknown device";
- private int m_iId = 0;
- private int m_iRoom = 0;
+ public long _lastUpdate = 0;
+ public long _lastPendingUpdate = 0;
+ public bool _screenUpdateRequired = false;
+ private string _name = "unknown device";
+ private int _id = 0;
+ private int _room = 0;
// not connected (-2), none (-1), pending (0,1,5,6), success(4), error (2,3)
- private DevState m_dsState = DevState.NONE;
- private string m_sComment = ""; // red(error), green(success) or blue(pending) - icon/text
+ private DevState _dsState = DevState.NONE;
+ private string _comment = ""; // red(error), green(success) or blue(pending) - icon/text
- public VeraHelper helper = VeraHelper.Instance;
- public VeraCommunication vera = VeraCommunication.Instance;
+ public VeraHelper _helper = VeraHelper.Instance;
+ public VeraCommunication _vera = VeraCommunication.Instance;
public BaseDevice(XmlNode xn)
{
if (xn != null)
{
- update(xn);
+ Update(xn);
}
}
/// <summary>
/// Process Vera update information
/// </summary>
- public virtual bool update(XmlNode xn)
+ public virtual bool Update(XmlNode xn)
{
- m_sName = helper.getAttrAsString(xn, "name", m_sName);
- m_iId = helper.getAttrAsInt (xn, "id", m_iId);
- m_iRoom = helper.getAttrAsInt (xn, "room", m_iRoom);
+ _name = _helper.GetAttrAsString(xn, "name", _name);
+ _id = _helper.GetAttrAsInt (xn, "id", _id);
+ _room = _helper.GetAttrAsInt (xn, "room", _room);
- string temp_sComment = helper.getAttrAsString(xn, "comment", m_sComment );
- DevState temp_dsState = helper.toDevState(helper.getAttrAsInt(xn, "state", -1));
- if (m_dsState != DevState.PENDING || temp_dsState != DevState.NONE || (temp_dsState == DevState.NONE && ((m_lLastPendingUpdate / TimeSpan.TicksPerSecond ) < (DateTime.Now.Ticks / TimeSpan.TicksPerSecond))))
+ string tempComment = _helper.GetAttrAsString(xn, "comment", _comment );
+ DevState tempDsState = _helper.ToDevState(_helper.GetAttrAsInt(xn, "state", -1));
+ if (_dsState != DevState.PENDING || tempDsState != DevState.NONE || (tempDsState == DevState.NONE && ((_lastPendingUpdate / TimeSpan.TicksPerSecond ) < (DateTime.Now.Ticks / TimeSpan.TicksPerSecond))))
{ // If state was set to pending next update should contain a new state or still pending - so do not clear pending flag for at least 10 seconds
- m_sComment = temp_sComment;
- m_dsState = temp_dsState;
+ _comment = tempComment;
+ _dsState = tempDsState;
}
- if (m_iId == 0)
+ if (_id == 0)
{
// void device no further processing needed
return false;
}
// Set update flag
- m_bScreenUpdateRequired = true;
- m_lLastUpdate = DateTime.Now.Ticks;
+ _screenUpdateRequired = true;
+ _lastUpdate = DateTime.Now.Ticks;
return true;
}
- /// <summary>
- /// Returns the id of this device
- /// </summary>
public int id
{
- get { return m_iId; }
+ get { return _id; }
set { }
}
- /// <summary>
- /// Returns the name of this device
- /// </summary>
public string name
{
- get { return m_sName; }
+ get { return _name; }
set { }
}
- /// <summary>
- /// Returns true when this device is associated with the given room
- /// </summary>
- public bool inRoom(int id)
+ public bool InRoom(int id)
{
- return (m_iRoom == id);
+ return (_room == id);
}
- /// <summary>
- /// Return the room is this device is associated with
- /// </summary>
public int room
{
- get { return m_iRoom; }
- set { m_iRoom = value; }
+ get { return _room; }
+ set { _room = value; }
}
- /// <summary>
- /// Return the communications state for this device
- /// </summary>
public DevState commstate
{
- get { return m_dsState; }
+ get { return _dsState; }
set { }
}
- /// <summary>
- /// Return the comment as reported by Vera for this device
- /// </summary>
public string comment
{
- get { return (commstate != DevState.NONE ? m_sComment : ""); }
+ get { return (commstate != DevState.NONE ? _comment : ""); }
set { }
}
- /// <summary>
- /// Set virtual device state to pending request
- /// </summary>
- public void reportPendingRequest()
+ public void ReportPendingRequest()
{
- m_dsState = DevState.PENDING;
- m_sComment = "Sending command...";
- m_bScreenUpdateRequired = true;
- m_lLastUpdate = DateTime.Now.Ticks;
- m_lLastPendingUpdate = m_lLastUpdate;
+ _dsState = DevState.PENDING;
+ _comment = "Sending command...";
+ _screenUpdateRequired = true;
+ _lastUpdate = DateTime.Now.Ticks;
+ _lastPendingUpdate = _lastUpdate;
}
/// <summary>
/// Callback function for Ansync Web Client call on to report errors...
/// </summary>
- public void reportRequestError(string message)
+ public void ReportRequestError(string message)
{
- m_dsState = DevState.COMMAND_ERROR;
- m_sComment = message;
- m_bScreenUpdateRequired = true;
- m_lLastUpdate = DateTime.Now.Ticks;
+ _dsState = DevState.COMMAND_ERROR;
+ _comment = message;
+ _screenUpdateRequired = true;
+ _lastUpdate = DateTime.Now.Ticks;
}
- public void clearCommState()
+ public void ClearCommState()
{
- m_dsState = DevState.NONE;
+ _dsState = DevState.NONE;
}
+
/// <summary>
/// True when an update was processed after the give time stamp
/// </summary>
- public virtual bool newUpdateSince(long lTimePreviousCheck)
+ public virtual bool NewUpdateSince(long timePreviousCheck)
{
- return (lTimePreviousCheck <= m_lLastUpdate);
+ return (timePreviousCheck <= _lastUpdate);
}
/// <summary>
/// Invoking this method will clear the update ready flag -> so caller need to handle the screen update
/// </summary>
- public virtual bool newScreenUpdateWaitingAndClearFlag( )
+ public virtual bool NewScreenUpdateWaitingAndClearFlag()
{
- bool b = m_bScreenUpdateRequired;
- m_bScreenUpdateRequired = false;
+ bool b = _screenUpdateRequired;
+ _screenUpdateRequired = false;
return b;
}
@@ -170,6 +150,5 @@
{
return name;
}
-
}
}
Modified: trunk/plugins/VeraControl/DevCategories.cs
===================================================================
--- trunk/plugins/VeraControl/DevCategories.cs 2012-01-21 12:45:56 UTC (rev 4417)
+++ trunk/plugins/VeraControl/DevCategories.cs 2012-01-21 23:31:37 UTC (rev 4418)
@@ -22,30 +22,30 @@
{
if (xn != null)
{
- update(xn);
+ Update(xn);
}
}
- private string m_sName = "unknown category";
- private int m_iId = 0;
- public VeraHelper helper = VeraHelper.Instance;
+ private string _name = "unknown category";
+ private int _id = 0;
+ public VeraHelper _helper = VeraHelper.Instance;
- public bool update(XmlNode xn)
+ public bool Update(XmlNode xn)
{
- m_sName = helper.getAttrAsString(xn, "name", m_sName);
- m_iId = helper.getAttrAsInt (xn, "id", m_iId);
+ _name = _helper.GetAttrAsString(xn, "name", _name);
+ _id = _helper.GetAttrAsInt (xn, "id", _id);
return true;
}
public int id
{
- get { return m_iId; }
+ get { return _id; }
set { }
}
public string name
{
- get { return m_sName; }
+ get { return _name; }
set { }
}
Modified: trunk/plugins/VeraControl/DeviceCam.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceCam.cs 2012-01-21 12:45:56 UTC (rev 4417)
+++ trunk/plugins/VeraControl/DeviceCam.cs 2012-01-21 23:31:37 UTC (rev 4418)
@@ -15,50 +15,50 @@
/// Description of DeviceCam.
/// </summary>
public class DeviceCam : DeviceGeneric
- { // TODO: add IP-cam control buttons
- private string m_sIp = "127.0.0.1";
- private string m_sUrl = "/";
- private string m_sStream = "";
- private string m_sVideoUrl = "";
- private int m_refresh = 2;
- private string m_sUser = "";
- private string m_sPass = "";
+ {
+ private string _ip = "127.0.0.1";
+ private string _url = "/";
+ private string _stream = "";
+ private string _videoUrl = "";
+ private int _refreshRate = 2;
+ private string _user = "";
+ private string _pass = "";
- public DeviceCam( XmlNode xn ): base (xn)
+ public DeviceCam(XmlNode xn): base (xn)
{
if (xn != null)
{
- update(xn);
+ Update(xn);
}
}
- public override bool update(XmlNode xn)
+ public override bool Update(XmlNode xn)
{
- m_sIp = helper.getAttrAsString(xn, "ip", m_sIp);
- m_sUrl = helper.getAttrAsString(xn, "url", m_sUrl);
- m_sStream = helper.getAttrAsString(xn, "streaming", m_sStream);
- m_sVideoUrl = helper.getAttrAsString(xn, "videourls", m_sVideoUrl);
- m_sUser = helper.getAttrAsString(xn, "username", "");
- m_sPass = helper.getAttrAsString(xn, "password", "");
+ _ip = _helper.GetAttrAsString(xn, "ip", _ip);
+ _url = _helper.GetAttrAsString(xn, "url", _url);
+ _stream = _helper.GetAttrAsString(xn, "streaming", _stream);
+ _videoUrl = _helper.GetAttrAsString(xn, "videourls", _videoUrl);
+ _user = _helper.GetAttrAsString(xn, "username", "");
+ _pass = _helper.GetAttrAsString(xn, "password", "");
- return base.update(xn);
+ return base.Update(xn);
}
private string passString
{
get {
- if (m_sUser == "")
+ if (_user == "")
{
return "";
}
- return m_sUser + ":" + m_sPass + "@";
+ return _user + ":" + _pass + "@";
}
set { }
}
public string imgUrl
{
- get { return "http://" + passString + vera.vera_Address + "/data_request?id=cam_image¶meters=get_video_frame&Device_Num=" + id + "&rand=" + DateTime.Now.Ticks;
+ get { return "http://" + passString + _vera.veraAddress + "/data_request?id=cam_image¶meters=get_video_frame&Device_Num=" + id + "&rand=" + DateTime.Now.Ticks;
// return "http://" + passString + m_sIp + "/" + m_sUrl.Replace("%2F", "/");
}
set { }
@@ -66,84 +66,84 @@
public string streamUrl
{
- get { return "http://" + passString + m_sIp + "/" + m_sStream.Replace("%2F", "/"); }
+ get { return "http://" + passString + _ip + "/" + _stream.Replace("%2F", "/"); }
set { }
}
public int refreshRate
{
- get { return m_refresh; }
- set { m_refresh = value; }
+ get { return _refreshRate; }
+ set { _refreshRate = value; }
}
- private bool refreshDelayPassed(long lastcheck)
+ private bool HasRefreshDelayPassed(long lastcheck)
{
- return ((helper.getSecondsSince1970() - refreshRate) > (lastcheck / TimeSpan.TicksPerSecond));
+ return ((_helper.GetSecondsSince1970() - refreshRate) > (lastcheck / TimeSpan.TicksPerSecond));
}
- public override string getIconName()
+ public override string GetIconName()
{
return "Ip_Camera";
}
- public override bool newScreenUpdateWaitingAndClearFlag( )
+ public override bool NewScreenUpdateWaitingAndClearFlag( )
{
// Invoking this method will clear the update ready flag -> so caller need to handle the update
// A cam device requires an update every refreshRate seconds
- bool b = m_bScreenUpdateRequired || refreshDelayPassed(DateTime.Now.Ticks);
- m_bScreenUpdateRequired = false;
+ bool b = _screenUpdateRequired || HasRefreshDelayPassed(DateTime.Now.Ticks);
+ _screenUpdateRequired = false;
if (b)
{
- m_lLastUpdate = DateTime.Now.Ticks;
+ _lastUpdate = DateTime.Now.Ticks;
}
return b;
}
- public override bool newUpdateSince(long lTimePreviousCheck)
+ public override bool NewUpdateSince(long lTimePreviousCheck)
{
- bool b = (lTimePreviousCheck <= m_lLastUpdate) || refreshDelayPassed(m_lLastUpdate);
+ bool b = (lTimePreviousCheck <= _lastUpdate) || HasRefreshDelayPassed(_lastUpdate);
if (b)
{
- m_lLastUpdate = DateTime.Now.Ticks;
+ _lastUpdate = DateTime.Now.Ticks;
}
return b;
}
- private void move(string direction)
+ private void Move(string direction)
{
if (id == 0)
{
- vera.status.system.reportCommandError("Unknown device");
- m_bScreenUpdateRequired = true;
+ _vera.status.system.ReportCommandError("Unknown device");
+ _screenUpdateRequired = true;
return;
}
string cmd = "?id=lu_action&DeviceNum=" + id + "&serviceId=urn:micasaverde-com:serviceId:PanTiltZoom1&action=" + direction;
- vera.doVeraCommandRequest(cmd, reportRequestError);
+ _vera.DoVeraCommandRequest(cmd, ReportRequestError);
}
- public override void moveUp()
+ public override void MoveUp()
{
- move("MoveUp");
+ Move("MoveUp");
}
- public override void moveLeft()
+ public override void MoveLeft()
{
- move("MoveLeft");
+ Move("MoveLeft");
}
- public override void moveRight()
+ public override void MoveRight()
{
- move("MoveRight");
+ Move("MoveRight");
}
- public override void moveDown()
+ public override void MoveDown()
{
- move("MoveDown");
+ Move("MoveDown");
}
- public override void moveZoomIn()
+ public override void ZoomIn()
{
- move("ZoomIn");
+ Move("ZoomIn");
}
- public override void moveZoomOut()
+ public override void ZoomOut()
{
- move("ZoomOut");
+ Move("ZoomOut");
}
}
}
Modified: trunk/plugins/VeraControl/DeviceDimmer.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDimmer.cs 2012-01-21 12:45:56 UTC (rev 4417)
+++ trunk/plugins/VeraControl/DeviceDimmer.cs 2012-01-21 23:31:37 UTC (rev 4418)
@@ -4,8 +4,8 @@
* Date: 22-12-2011
* Time: 17:36
*
- * Copyright: 2012 GPL - Bart Eversdijk
- * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
* E-mail: ba...@ev...
*/
using System;
@@ -18,45 +18,45 @@
/// </summary>
public class DeviceDimmer : DeviceGeneric
{
- private int m_iLevel = 0;
- private string m_sWatt = "-";
- private string m_sKwh = "-";
+ private int _level = 0;
+ private string _watt = "-";
+ private string _kwh = "-";
- public DeviceDimmer( XmlNode xn ): base (xn)
+ public DeviceDimmer(XmlNode xn): base (xn)
{
if (xn != null)
{
- update(xn);
+ Update(xn);
}
}
- public override bool update(XmlNode xn)
+ public override bool Update(XmlNode xn)
{
- m_iLevel = helper.getAttrAsInt (xn, "level", m_iLevel);
- m_sWatt = helper.getAttrAsString(xn, "watts", m_sWatt);
- m_sKwh = helper.getAttrAsString(xn, "kwh", m_sKwh);
+ _level = _helper.GetAttrAsInt (xn, "level", _level);
+ _watt = _helper.GetAttrAsString(xn, "watts", _watt);
+ _kwh = _helper.GetAttrAsString(xn, "kwh", _kwh);
- return base.update(xn);
+ return base.Update(xn);
}
public string watts
{
- get { return m_sWatt; }
+ get { return _watt; }
set { }
}
public override bool status
{
- get { return (m_iLevel > 0); }
- set {
-
+ get { return (_level > 0); }
+ set {
+
}
}
public override int level
{
- get { return m_iLevel; }
- set
+ get { return _level; }
+ set
{
int newValue = value;
if (newValue > 100) {
@@ -65,15 +65,15 @@
if (newValue < 0) { newValue = 0; }
}
if (id > 0) // Only send when a valid ID is found
- {
- reportPendingRequest();
+ {
+ ReportPendingRequest();
// Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ string cmd = "?id=lu_action&DeviceNum="+id.ToString() +
"&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget" +
- "&newLoadlevelTarget="+value;
- vera.doVeraCommandRequest(cmd, reportRequestError);
+ "&newLoadlevelTarget=" + value;
+ _vera.DoVeraCommandRequest(cmd, ReportRequestError);
}
- m_iLevel = newValue;
+ _level = newValue;
}
}
@@ -85,7 +85,7 @@
public override string ToString()
{
- return name + " [" + getStatusText() + "]";
+ return name + " [" + GetStatusText() + "]";
}
public override bool isControllable
@@ -94,7 +94,7 @@
set { }
}
- public override string getIconName()
+ public override string GetIconName()
{
string leveltxt = "0";
if (level > 0) { leveltxt = "25"; }
@@ -102,18 +102,18 @@
if (level > 50) { leveltxt = "75"; }
if (level > 75) { leveltxt = "100"; }
- return "Dimmable_Light_"+leveltxt;
+ return "Dimmable_Light_" + leveltxt;
}
- public override string getExtraText()
+ public override string GetExtraText()
{
- return (m_sKwh != "" ? m_sKwh + "kWh" : "");
+ return (_kwh != "" ? _kwh + "kWh" : "");
}
- public override string getStatusText()
+ public override string GetStatusText()
{
- return ( status ? level.ToString() + "%" : "Off");
+ return (status ? level.ToString() + "%" : "Off");
}
}
}
Modified: trunk/plugins/VeraControl/DeviceDoorlock.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDoorlock.cs 2012-01-21 12:45:56 UTC (rev 4417)
+++ trunk/plugins/VeraControl/DeviceDoorlock.cs 2012-01-21 23:31:37 UTC (rev 4418)
@@ -18,42 +18,42 @@
/// </summary>
public class DeviceDoorlock : DeviceGeneric
{
- private bool m_bStatus = false;
+ private bool _status = false;
public DeviceDoorlock( XmlNode xn ): base (xn)
{
if (xn != null)
{
- update(xn);
+ Update(xn);
}
}
- public override bool update(XmlNode xn)
+ public override bool Update(XmlNode xn)
{
- m_bStatus = helper.getAttrAsBool(xn, "status", m_bStatus);
+ _status = _helper.GetAttrAsBool(xn, "status", _status);
- return base.update(xn);
+ return base.Update(xn);
}
public override bool status
{
- get { return m_bStatus; }
+ get { return _status; }
set {
if (id > 0) // Only send when a valid ID is found
{
- reportPendingRequest();
+ ReportPendingRequest();
// Do something with vera
string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
"&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget" +
"&newTargetValue="+(value ? "1" : "0");
- vera.doVeraCommandRequest(cmd, reportRequestError);
+ _vera.DoVeraCommandRequest(cmd, ReportRequestError);
}
}
}
public override int level
{
- get { return (m_bStatus ? 1 : 0); }
+ get { return (_status ? 1 : 0); }
set
{
status = (value > 0);
@@ -68,7 +68,7 @@
public override string ToString()
{
- return name + " [" + getStatusText() + "]";
+ return name + " [" + GetStatusText() + "]";
}
public override bool isControllable
@@ -77,12 +77,12 @@
set { }
}
- public override string getIconName()
+ public override string GetIconName()
{
- return "Door_" + (m_bStatus ? "LOCKED" : "UNLOCKED");
+ return "Door_" + (_status ? "LOCKED" : "UNLOCKED");
}
- public override string getStatusText()
+ public override string GetStatusText()
{
return (status ? "Locked" : "Unlocked");
}
Modified: trunk/plugins/VeraControl/DeviceGWeather.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGWeather.cs 2012-01-21 12:45:56 UTC (rev 4417)
+++ trunk/plugins/VeraControl/DeviceGWeather.cs 2012-01-21 23:31:37 UTC (rev 4418)
@@ -18,42 +18,42 @@
/// </summary>
public class DeviceGWeather : DeviceGeneric
{
- private string m_sCondition = "-";
- private string m_sWindCondition = "-";
+ private string _condition = "-";
+ private string _windCondition = "-";
- public DeviceGWeather( XmlNode xn ): base (xn)
+ public DeviceGWeather(XmlNode xn): base (xn)
{
if (xn != null)
{
- update(xn);
+ Update(xn);
}
}
- public override bool update(XmlNode xn)
+ public override bool Update(XmlNode xn)
{
- m_sCondition = helper.getAttrAsString(xn, "Condition", m_sCondition); // Google Weather Plugin
- m_sCondition = helper.getAttrAsString(xn, "condition", m_sCondition); // World Weather plugin
- m_sWindCondition = helper.getAttrAsString(xn, "WindCondition", m_sWindCondition);
- m_sWindCondition = helper.getAttrAsString(xn, "windcondition", m_sWindCondition);
+ _condition = _helper.GetAttrAsString(xn, "Condition", _condition); // Google Weather Plugin
+ _condition = _helper.GetAttrAsString(xn, "condition", _condition); // World Weather plugin
+ _windCondition = _helper.GetAttrAsString(xn, "WindCondition", _windCondition);
+ _windCondition = _helper.GetAttrAsString(xn, "windcondition", _windCondition);
- return base.update(xn);
+ return base.Update(xn);
}
public override string ToString()
{
- return name + " [" + getStatusText() + "]";
+ return name + " [" + GetStatusText() + "]";
}
- public override string getStatusText()
+ public override string GetStatusText()
{
- return m_sCondition.Replace("_", " ");
+ return _condition.Replace("_", " ");
}
- public override string getExtraText()
+ public override string GetExtraText()
{
- return m_sWindCondition;
+ return _windCondition;
}
- public override string getIconName()
+ public override string GetIconName()
{
return "location";
}
Modified: trunk/plugins/VeraControl/DeviceGeneric.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-21 12:45:56 UTC (rev 4417)
+++ trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-21 23:31:37 UTC (rev 4418)
@@ -19,29 +19,29 @@
/// </summary>
public class DeviceGeneric : BaseDevice
{
- private string m_sAltId = "";
- private int m_iCategory = 0;
+ private string _altId = "";
+ private int _category = 0;
public DeviceGeneric(XmlNode xn): base (xn)
{
if (xn != null)
{
- update(xn);
+ Update(xn);
}
}
- public override bool update(XmlNode xn)
+ public override bool Update(XmlNode xn)
{
- m_sAltId = helper.getAttrAsString(xn, "altid", m_sAltId);
- m_iCategory = helper.getAttrAsInt (xn, "category", m_iCategory);
+ _altId = _helper.GetAttrAsString(xn, "altid", _altId);
+ _category = _helper.GetAttrAsInt (xn, "category", _category);
- bool b = base.update(xn);
+ bool b = base.Update(xn);
// Make sure the room exists
- if (room == 0 || !vera.status.isRoomFound(room))
+ if (room == 0 || !_vera.status.IsRoomFound(room))
{
- if (!vera.status.isRoomFound(0))
+ if (!_vera.status.IsRoomFound(0))
{ // create dummy room to attach to
- vera.rooms.Add(new Room(null));
+ _vera.rooms.Add(new Room(null));
}
room = 0;
}
@@ -51,13 +51,13 @@
public string altid
{
- get { return m_sAltId; }
+ get { return _altId; }
set { }
}
public int category
{
- get { return m_iCategory; }
+ get { return _category; }
set { }
}
@@ -96,48 +96,48 @@
set { }
}
- public virtual string getIconName()
+ public virtual string GetIconName()
{
return "generic_sensor";
}
- public virtual string getStatusText()
+ public virtual string GetStatusText()
{
return "";
}
- public virtual string getExtraText()
+ public virtual string GetExtraText()
{
return "";
}
- public virtual string[] getCommands()
+ public virtual string [] GetCommands()
{
return new string [] {"Off", "On"};
}
- // Overrides for Cam Device
- public virtual void moveUp()
+ // Overridables for Cam Device
+ public virtual void MoveUp()
{
// do nothing
}
- public virtual void moveLeft()
+ public virtual void MoveLeft()
{
// do nothing
}
- public virtual void moveRight()
+ public virtual void MoveRight()
{
// do nothing
}
- public virtual void moveDown()
+ public virtual void MoveDown()
{
// do nothing
}
- public virtual void moveZoomIn()
+ public virtual void ZoomIn()
{
// do nothing
}
- public virtual void moveZoomOut()
+ public virtual void ZoomOut()
{
// do nothing
}
Modified: trunk/plugins/VeraControl/DeviceHumidity.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceHumidity.cs 2012-01-21 12:45:56 UTC (rev 4417)
+++ trunk/plugins/VeraControl/DeviceHumidity.cs 2012-01-21 23:31:37 UTC (rev 4418)
@@ -18,25 +18,25 @@
/// </summary>
public class DeviceHumidity : DeviceGeneric
{
- private int m_iLevel = 0;
+ private int _level = 0;
- public DeviceHumidity( XmlNode xn ): base (xn)
+ public DeviceHumidity(XmlNode xn): base (xn)
{
if (xn != null)
{
- update(xn);
+ Update(xn);
}
}
- public override bool update(XmlNode xn)
+ public override bool Update(XmlNode xn)
{
- m_iLevel = helper.getAttrAsInt(xn, "humidity", m_iLevel);
- return base.update(xn);
+ _level = _helper.GetAttrAsInt(xn, "humidity", _level);
+ return base.Update(xn);
}
public override int level
{
- get { return m_iLevel; }
+ get { return _level; }
set {}
}
@@ -51,12 +51,12 @@
return name + " [" + level.ToString() + "%]";
}
- public override string getIconName()
+ public override string GetIconName()
{
return "Humidity_Sensor";
}
- public override string getStatusText()
+ public override string GetStatusText()
{
return level + "%";
}
Modified: trunk/plugins/VeraControl/DeviceLightSensor.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceLightSensor.cs 2012-01-21 12:45:56 UTC (rev 4417)
+++ trunk/plugins/VeraControl/DeviceLightSensor.cs 2012-01-21 23:31:37 UTC (rev 4418)
@@ -18,32 +18,32 @@
/// </summary>
public class DeviceLightSensor : DeviceGeneric
{
- private int m_iLevel = 0;
+ private int _level = 0;
- public DeviceLightSensor( XmlNode xn ): base (xn)
+ public DeviceLightSensor(XmlNode xn): base (xn)
{
if (xn != null)
{
- update(xn);
+ Update(xn);
}
}
- public override bool update(XmlNode xn)
+ public override bool Update(XmlNode xn)
{
- m_iLevel = helper.getAttrAsInt(xn, "level", m_iLevel);
- m_iLevel = helper.getAttrAsInt(xn, "light", m_iLevel);
- return base.update(xn);
+ _level = _helper.GetAttrAsInt(xn, "level", _level);
+ _level = _helper.GetAttrAsInt(xn, "light", _level);
+ return base.Update(xn);
}
public override bool status
{
- get { return (m_iLevel > 0); }
+ get { return (_level > 0); }
set { }
}
public override int level
{
- get { return m_iLevel; }
+ get { return _level; }
set { }
}
@@ -55,15 +55,15 @@
public override string ToString()
{
- return name + " [" + getStatusText() + "]";
+ return name + " [" + GetStatusText() + "]";
}
- public override string getIconName()
+ public override string GetIconName()
{
return "Light_Sensor";
}
- public override string getStatusText()
+ public override string GetStatusText()
{
return level.ToString() + "%";
}
Modified: trunk/plugins/VeraControl/DevicePowerMeter.cs
===================================================================
--- trunk/plugins/VeraControl/DevicePowerMeter.cs 2012-01-21 12:45:56 UTC (rev 4417)
+++ trunk/plugins/VeraControl/DevicePowerMeter.cs 2012-01-21 23:31:37 UTC (rev 4418)
@@ -18,39 +18,39 @@
...
[truncated message content] |
|
From: <Ba...@us...> - 2012-01-23 23:04:54
|
Revision: 4424
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4424&view=rev
Author: BartEv
Date: 2012-01-23 23:04:46 +0000 (Mon, 23 Jan 2012)
Log Message:
-----------
Scene and device update improved
Modified Paths:
--------------
trunk/plugins/VeraControl/BaseDevice.cs
trunk/plugins/VeraControl/DeviceCam.cs
trunk/plugins/VeraControl/DeviceGeneric.cs
trunk/plugins/VeraControl/Scene.cs
trunk/plugins/VeraControl/VeraCommunication.cs
trunk/plugins/VeraControl/VeraControl.cs
Modified: trunk/plugins/VeraControl/BaseDevice.cs
===================================================================
--- trunk/plugins/VeraControl/BaseDevice.cs 2012-01-21 23:46:35 UTC (rev 4423)
+++ trunk/plugins/VeraControl/BaseDevice.cs 2012-01-23 23:04:46 UTC (rev 4424)
@@ -13,142 +13,170 @@
namespace VeraControl.Properties
{
- /// <summary>
- /// Description of BaseDevice.
- /// </summary>
- public class BaseDevice
- {
- public long _lastUpdate = 0;
- public long _lastPendingUpdate = 0;
- public bool _screenUpdateRequired = false;
- private string _name = "unknown device";
- private int _id = 0;
- private int _room = 0;
-
- // not connected (-2), none (-1), pending (0,1,5,6), success(4), error (2,3)
- private DevState _dsState = DevState.NONE;
- private string _comment = ""; // red(error), green(success) or blue(pending) - icon/text
-
- public VeraHelper _helper = VeraHelper.Instance;
- public VeraCommunication _vera = VeraCommunication.Instance;
-
- public BaseDevice(XmlNode xn)
- {
- if (xn != null)
- {
- Update(xn);
- }
- }
-
- /// <summary>
- /// Process Vera update information
- /// </summary>
- public virtual bool Update(XmlNode xn)
- {
- _name = _helper.GetAttrAsString(xn, "name", _name);
- _id = _helper.GetAttrAsInt (xn, "id", _id);
- _room = _helper.GetAttrAsInt (xn, "room", _room);
-
- string tempComment = _helper.GetAttrAsString(xn, "comment", _comment );
- DevState tempDsState = _helper.ToDevState(_helper.GetAttrAsInt(xn, "state", -1));
- if (_dsState != DevState.PENDING || tempDsState != DevState.NONE || (tempDsState == DevState.NONE && ((_lastPendingUpdate / TimeSpan.TicksPerSecond ) < (DateTime.Now.Ticks / TimeSpan.TicksPerSecond))))
- { // If state was set to pending next update should contain a new state or still pending - so do not clear pending flag for at least 10 seconds
- _comment = tempComment;
- _dsState = tempDsState;
- }
- if (_id == 0)
- {
- // void device no further processing needed
- return false;
- }
-
- // Set update flag
- _screenUpdateRequired = true;
- _lastUpdate = DateTime.Now.Ticks;
- return true;
- }
-
- public int id
- {
- get { return _id; }
- set { }
- }
-
- public string name
- {
- get { return _name; }
- set { }
- }
+ /// <summary>
+ /// Description of BaseDevice.
+ /// </summary>
+ public class BaseDevice
+ {
+ private long _lastUpdate = 0;
+ private long _lastPendingUpdate = 0;
+ private bool _screenUpdateRequired = false;
+ private string _name = "unknown device";
+ private int _id = 0;
+ private int _room = 0;
+
+ // not connected (-2), none (-1), pending (0,1,5,6), success(4), error (2,3)
+ private DevState _dsState = DevState.NONE;
+ private string _comment = ""; // red(error), green(success) or blue(pending) - icon/text
+
+ public VeraHelper _helper = VeraHelper.Instance;
+ public VeraCommunication _vera = VeraCommunication.Instance;
+
+ public BaseDevice(XmlNode xn)
+ {
+ if (xn != null)
+ {
+ Update(xn);
+ }
+ }
+
+ /// <summary>
+ /// Process Vera update information
+ /// </summary>
+ public virtual bool Update(XmlNode xn)
+ {
+ _name = _helper.GetAttrAsString(xn, "name", _name);
+ _id = _helper.GetAttrAsInt (xn, "id", _id);
+ _room = _helper.GetAttrAsInt (xn, "room", _room);
+ _comment = _helper.GetAttrAsString(xn, "comment", _comment );
+ _dsState = _helper.ToDevState(_helper.GetAttrAsInt(xn, "state", -1));
+
+ if (_id == 0)
+ {
+ // void device no further processing needed
+ return false;
+ }
+
+ // Set update flag
+ screenUpdateRequired = true;
+ lastUpdate = DateTime.Now.Ticks;
+ return true;
+ }
+
+ public virtual string GetIconName()
+ {
+ return "";
+ }
+
+ public virtual string GetStatusText()
+ {
+ return "";
+ }
+
+ public int id
+ {
+ get { return _id; }
+ set { }
+ }
+
+ public string name
+ {
+ get { return _name; }
+ set { }
+ }
- public bool InRoom(int id)
- {
- return (_room == id);
- }
-
- public int room
- {
- get { return _room; }
- set { _room = value; }
- }
-
- public DevState commstate
- {
- get { return _dsState; }
- set { }
- }
-
- public string comment
- {
- get { return (commstate != DevState.NONE ? _comment : ""); }
- set { }
- }
-
- public void ReportPendingRequest()
- {
- _dsState = DevState.PENDING;
- _comment = "Sending command...";
- _screenUpdateRequired = true;
- _lastUpdate = DateTime.Now.Ticks;
- _lastPendingUpdate = _lastUpdate;
- }
-
- /// <summary>
- /// Callback function for Ansync Web Client call on to report errors...
- /// </summary>
- public void ReportRequestError(string message)
- {
- _dsState = DevState.COMMAND_ERROR;
- _comment = message;
- _screenUpdateRequired = true;
- _lastUpdate = DateTime.Now.Ticks;
- }
-
- public void ClearCommState()
- {
- _dsState = DevState.NONE;
- }
-
- /// <summary>
- /// True when an update was processed after the give time stamp
- /// </summary>
- public virtual bool NewUpdateSince(long timePreviousCheck)
- {
- return (timePreviousCheck <= _lastUpdate);
- }
-
- /// <summary>
- /// Invoking this method will clear the update ready flag -> so caller need to handle the screen update
- /// </summary>
- public virtual bool NewScreenUpdateWaitingAndClearFlag()
- {
- bool b = _screenUpdateRequired;
- _screenUpdateRequired = false;
- return b;
- }
-
- public override string ToString()
- {
- return name;
- }
- }
+ public bool InRoom(int id)
+ {
+ return (_room == id);
+ }
+
+ public int room
+ {
+ get { return _room; }
+ set { _room = value; }
+ }
+
+ public DevState commstate
+ {
+ get { return _dsState; }
+ set { }
+ }
+
+ public string comment
+ {
+ get { return (commstate != DevState.NONE ? _comment : ""); }
+ set { }
+ }
+
+ public bool screenUpdateRequired
+ {
+ get { return _screenUpdateRequired; }
+ set {
+ if (value)
+ { // If at least one device report screen update required, Vera should take over this report
+ _vera.setScreenUpdateRequired();
+ }
+ _screenUpdateRequired = value;
+ }
+ }
+
+ public long lastUpdate
+ {
+ get { return _lastUpdate; }
+ set { _lastUpdate = value; }
+ }
+
+ public void ReportPendingRequest()
+ {
+ _dsState = DevState.PENDING;
+ _comment = "Sending command...";
+ screenUpdateRequired = true;
+ lastUpdate = DateTime.Now.Ticks;
+ _lastPendingUpdate = lastUpdate;
+ }
+
+ /// <summary>
+ /// Callback function for Ansync Web Client call on to report errors...
+ /// </summary>
+ public void ReportRequestError(string message)
+ {
+ _dsState = DevState.COMMAND_ERROR;
+ _comment = message;
+ screenUpdateRequired = true;
+ lastUpdate = DateTime.Now.Ticks;
+ }
+
+ public void ClearCommState()
+ {
+ if (_dsState != DevState.NONE)
+ {
+ _dsState = DevState.NONE;
+ screenUpdateRequired = true;
+ lastUpdate = DateTime.Now.Ticks;
+ }
+ }
+
+ /// <summary>
+ /// True when an update was processed after the give time stamp
+ /// </summary>
+ public virtual bool NewUpdateSince(long timePreviousCheck)
+ {
+ return (timePreviousCheck <= lastUpdate);
+ }
+
+ /// <summary>
+ /// Invoking this method will clear the update ready flag -> so caller need to handle the screen update
+ /// </summary>
+ public virtual bool NewScreenUpdateWaitingAndClearFlag()
+ {
+ bool b = screenUpdateRequired;
+ screenUpdateRequired = false;
+ return b;
+ }
+
+ public override string ToString()
+ {
+ return name;
+ }
+ }
}
Modified: trunk/plugins/VeraControl/DeviceCam.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceCam.cs 2012-01-21 23:46:35 UTC (rev 4423)
+++ trunk/plugins/VeraControl/DeviceCam.cs 2012-01-23 23:04:46 UTC (rev 4424)
@@ -90,21 +90,21 @@
{
// Invoking this method will clear the update ready flag -> so caller need to handle the update
// A cam device requires an update every refreshRate seconds
- bool b = _screenUpdateRequired || HasRefreshDelayPassed(DateTime.Now.Ticks);
- _screenUpdateRequired = false;
+ bool b = screenUpdateRequired || HasRefreshDelayPassed(DateTime.Now.Ticks);
+ screenUpdateRequired = false;
if (b)
{
- _lastUpdate = DateTime.Now.Ticks;
+ lastUpdate = DateTime.Now.Ticks;
}
return b;
}
public override bool NewUpdateSince(long lTimePreviousCheck)
{
- bool b = (lTimePreviousCheck <= _lastUpdate) || HasRefreshDelayPassed(_lastUpdate);
+ bool b = (lTimePreviousCheck <= lastUpdate) || HasRefreshDelayPassed(lastUpdate);
if (b)
{
- _lastUpdate = DateTime.Now.Ticks;
+ lastUpdate = DateTime.Now.Ticks;
}
return b;
}
@@ -114,7 +114,7 @@
if (id == 0)
{
_vera.status.system.ReportCommandError("Unknown device");
- _screenUpdateRequired = true;
+ screenUpdateRequired = true;
return;
}
string cmd = "?id=lu_action&DeviceNum=" + id + "&serviceId=urn:micasaverde-com:serviceId:PanTiltZoom1&action=" + direction;
Modified: trunk/plugins/VeraControl/DeviceGeneric.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-21 23:46:35 UTC (rev 4423)
+++ trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-23 23:04:46 UTC (rev 4424)
@@ -96,12 +96,12 @@
set { }
}
- public virtual string GetIconName()
+ public override string GetIconName()
{
return "generic_sensor";
}
- public virtual string GetStatusText()
+ public override string GetStatusText()
{
return "";
}
Modified: trunk/plugins/VeraControl/Scene.cs
===================================================================
--- trunk/plugins/VeraControl/Scene.cs 2012-01-21 23:46:35 UTC (rev 4423)
+++ trunk/plugins/VeraControl/Scene.cs 2012-01-23 23:04:46 UTC (rev 4424)
@@ -14,62 +14,60 @@
namespace VeraControl.Properties
{
- /// <summary>
- /// Description of Scene.
- /// </summary>
- public class Scene : BaseDevice
- {
- public Scene(XmlNode xn) : base (xn)
- {
- if (xn != null)
- {
- Update(xn);
- }
- }
-
- private bool _active = false;
-
- public override bool Update(XmlNode xn)
- {
- _active = _helper.GetAttrAsBool(xn, "active", _active);
- bool b = base.Update(xn);
-
- // Make sure the room exists or else make it 0
- if (room != 0 && !_vera.status.IsRoomFound(room))
- {
- room = 0;
- }
- return b;
- }
-
- public bool IsActive()
- {
- return _active;
- }
+ /// <summary>
+ /// Description of Scene.
+ /// </summary>
+ public class Scene : BaseDevice
+ {
+ public Scene(XmlNode xn) : base (xn)
+ {
+ if (xn != null)
+ {
+ Update(xn);
+ }
+ }
+
+ private bool _active = false;
+
+ public override bool Update(XmlNode xn)
+ {
+ _active = _helper.GetAttrAsBool(xn, "active", _active);
+ bool b = base.Update(xn);
+
+ // Make sure the room exists or else make it 0
+ if (room != 0 && !_vera.status.IsRoomFound(room))
+ {
+ room = 0;
+ }
+ return b;
+ }
+
+ public override string GetIconName()
+ {
+ return "Scenes";
+ }
+
+ public override string GetStatusText()
+ {
+ return (room == 0 ? "" : _vera.status.GetRoomById(room).name);
+ }
+
+ public bool IsActive()
+ {
+ return _active;
+ }
- public void Run()
- {
- if (id == 0)
- {
- _vera.status.system.ReportCommandError("Unknown scene");
- _screenUpdateRequired = true;
- return;
- }
- ReportPendingRequest();
- string cmd = "?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="+id;
- _vera.DoVeraCommandRequest(cmd, ReportRequestError);
- }
-
- public override bool NewScreenUpdateWaitingAndClearFlag( )
- {
- // Scenes are not reported Done by Vera so the will time out...
- bool b = base.NewScreenUpdateWaitingAndClearFlag();
- if (commstate != DevState.NONE && (_lastUpdate < (DateTime.Now.Ticks - (10 * 10000000))))
- {
- ClearCommState();
- return true;
- }
- return b;
- }
- }
+ public void Run()
+ {
+ if (id == 0)
+ {
+ _vera.status.system.ReportCommandError("Unknown scene");
+ screenUpdateRequired = true;
+ return;
+ }
+ ReportPendingRequest();
+ string cmd = "?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum="+id;
+ _vera.DoVeraCommandRequest(cmd, ReportRequestError);
+ }
+ }
}
Modified: trunk/plugins/VeraControl/VeraCommunication.cs
===================================================================
--- trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-21 23:46:35 UTC (rev 4423)
+++ trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-23 23:04:46 UTC (rev 4424)
@@ -23,12 +23,12 @@
public class VeraStatus
{
- public DeviceSystem system = new DeviceSystem();
- public List<DeviceGeneric> devices = new List<DeviceGeneric>();
- public List<Scene> scenes = new List<Scene>();
- public List<Room> rooms = new List<Room>();
- public List<DevCategories> categories = new List<DevCategories>();
- public List<Section> sections = new List<Section>();
+ public DeviceSystem system = new DeviceSystem();
+ public List<DeviceGeneric> devices = new List<DeviceGeneric>();
+ public List<Scene> scenes = new List<Scene>();
+ public List<Room> rooms = new List<Room>();
+ public List<DevCategories> categories = new List<DevCategories>();
+ public List<Section> sections = new List<Section>();
#region Vers get by id support functions
@@ -165,14 +165,14 @@
public sealed class VeraCommunication
{
- private static volatile VeraCommunication _instance;
+ private static volatile VeraCommunication _instance;
private static object _syncRoot = new Object();
private VeraHelper _helper = VeraHelper.Instance;
// Config data
private string _veraIPAddress;
private string _veraTCPIPPort;
- private int _maxRefreshDelay; // Maximun delay between 2 status updates in seconds
+ private int _maxRefreshDelay; // Maximun delay between 2 status updates in seconds
private int _minRefreshDelay = 1000; // Minimun delay between 2 status updates in miliseconds
// Actual device information
@@ -266,7 +266,7 @@
{
_webCommandClientErrorReporter = null;
status.system.ReportCommandError(e.Message);
- _screenUpdateRequired = true;
+ setScreenUpdateRequired();
}
}
@@ -285,7 +285,7 @@
// Show eror in MediaPortal Vera-main window
status.system.ReportCommandError("Request was canceled");
}
- _screenUpdateRequired = true;
+ setScreenUpdateRequired();
}
else if (e.Error != null)
{
@@ -300,7 +300,7 @@
// Show eror in MediaPortal Vera-main window
status.system.ReportCommandError(e.Error.Message);
}
- _screenUpdateRequired = true;
+ setScreenUpdateRequired();
}
else
{
@@ -317,7 +317,7 @@
// Show eror in MediaPortal Vera-main window
status.system.ReportCommandError(e.Result);
}
- _screenUpdateRequired = true;
+ setScreenUpdateRequired();
}
}
// Communication done clear error report handler
@@ -358,9 +358,9 @@
if (e.Error != null)
{
// Handle error here
- _lastUpdateFailed = true;
+ _lastUpdateFailed = true;
_lastUpdateErrorMessage = e.Error.Message;
- _screenUpdateRequired = true;
+ setScreenUpdateRequired();
}
else
{
@@ -399,7 +399,7 @@
if (_lastUpdateFailed)
{
_lastUpdateFailed = false;
- _screenUpdateRequired = true;
+ setScreenUpdateRequired();
_status.system.ClearConnectionError();
}
// Process system status first
@@ -436,6 +436,12 @@
// Process Scenes
xnList = xmlDoc.SelectNodes("/root/scenes/scene");
+ // State update of Scenes are not reported done, so they have to be cleaned manualy
+ // if a message is still valid and/or new message will be reported below
+ foreach (Scene scene in _status.scenes)
+ {
+ scene.ClearCommState();
+ }
foreach (XmlNode xn in xnList)
{
Scene sc = _status.GetSceneById( int.Parse(xn.Attributes["id"].Value) );
@@ -444,9 +450,6 @@
} else {
_status.scenes.Add(new Scene(xn));
}
-
- // At least one scene was found and thus screen update required
- _screenUpdateRequired = true;
}
// Process Categories
@@ -571,8 +574,6 @@
break;
}
}
- // At least one device update/new was found and thus screen update required
- _screenUpdateRequired = true;
}
}
@@ -635,6 +636,10 @@
return b;
}
+ public void setScreenUpdateRequired()
+ {
+ _screenUpdateRequired = true;
+ }
/// <summary>
/// A request is currently being handled by Vera, this request takes at least _minRefreshDelay msecs, at most _maxRefreshDelay seconds and will be finished the moment Vera detects a change.
/// As soon as this function returns false a new update request should be invoked (with UpdateCurrentStatus()), Vera will take care of the Refresh delays (by keeping open the http-connection)
Modified: trunk/plugins/VeraControl/VeraControl.cs
===================================================================
--- trunk/plugins/VeraControl/VeraControl.cs 2012-01-21 23:46:35 UTC (rev 4423)
+++ trunk/plugins/VeraControl/VeraControl.cs 2012-01-23 23:04:46 UTC (rev 4424)
@@ -35,212 +35,216 @@
namespace VeraControl
{
- public enum Actiontrigger
- {
- MUSIC_START_PLAYING = 0,
- MUSIC_PAUSED,
- MUSIC_PAUSE_RESUMED,
- MUSIC_STOPPED,
-
- VIDEO_START_PLAYING,
- VIDEO_PAUSED,
- VIDEO_PAUSE_RESUMED,
- VIDEO_STOPPED,
-
- TV_START_PLAYING,
- TV_PAUSED,
- TV_PAUSE_RESUMED,
- TV_STOPPED,
-
- RECORDING_START_PLAYING,
- RECORDING_PAUSED,
- RECORDING_PAUSE_RESUMED,
- RECORDING_STOPPED,
-
- RADIO_START_PLAYING,
- RADIO_PAUSED,
- RADIO_PAUSE_RESUMED,
- RADIO_STOPPED,
-
- UNKNOWN_START_PLAYING,
- UNKNOWN_PAUSED,
- UNKNOWN_PAUSE_RESUMED,
- UNKNOWN_STOPPED,
-
- MP_START_UP,
- MP_SHUTDOWN,
- MP_EXIT,
-
- LAST_ACTIONTRIGGER
- };
-
- /// <summary>
- /// Description of VeraControl.
- /// </summary>
- public class VeraControl : GUIInternalWindow, ISetupForm
- {
- [SkinControlAttribute(10)] protected GUILabelControl _title = null;
- [SkinControl(20)] protected GUISpinButton _catList = null;
- [SkinControl(40)] protected GUIListControl _leftList = null;
- [SkinControl(50)] protected GUIListControl _rightList = null;
- [SkinControl(60)] protected GUIButtonControl _actionButton = null;
- [SkinControl(70)] protected GUIToggleButtonControl _actionTriggerButton = null;
-
- [SkinControl(30)] protected GUIImage _cmtImage = null;
- [SkinControlAttribute(31)] protected GUILabelControl _comment = null;
-
- private int _pluginID = 1972;
- private VeraCommunication _vera = VeraCommunication.Instance;
- private int _selectedRoom = Int16.MaxValue;
- private int _selectedCategory = Int16.MaxValue;
- public Actiontrigger _lastAction = Actiontrigger.LAST_ACTIONTRIGGER;
- private VeraHelper _helper = new VeraHelper();
-
- public bool _enableSceneTrigger = false;
- private bool _lastUpdateFailed = false;
- private string _titleTxt = "Micasa Verde - Vera control";
-
- public VeraControl()
- {
- }
+ public enum Actiontrigger
+ {
+ MUSIC_START_PLAYING = 0,
+ MUSIC_PAUSED,
+ MUSIC_PAUSE_RESUMED,
+ MUSIC_STOPPED,
+
+ VIDEO_START_PLAYING,
+ VIDEO_PAUSED,
+ VIDEO_PAUSE_RESUMED,
+ VIDEO_STOPPED,
+
+ TV_START_PLAYING,
+ TV_PAUSED,
+ TV_PAUSE_RESUMED,
+ TV_STOPPED,
+
+ RECORDING_START_PLAYING,
+ RECORDING_PAUSED,
+ RECORDING_PAUSE_RESUMED,
+ RECORDING_STOPPED,
+
+ RADIO_START_PLAYING,
+ RADIO_PAUSED,
+ RADIO_PAUSE_RESUMED,
+ RADIO_STOPPED,
+
+ UNKNOWN_START_PLAYING,
+ UNKNOWN_PAUSED,
+ UNKNOWN_PAUSE_RESUMED,
+ UNKNOWN_STOPPED,
+
+ MP_START_UP,
+ MP_SHUTDOWN,
+ MP_EXIT,
+
+ LAST_ACTIONTRIGGER
+ };
+
+ /// <summary>
+ /// Description of VeraControl.
+ /// </summary>
+ public class VeraControl : GUIInternalWindow, ISetupForm
+ {
+ [SkinControlAttribute(10)] protected GUILabelControl _title = null;
+ [SkinControl(20)] protected GUISpinButton _catList = null;
+ [SkinControl(40)] protected GUIListControl _leftList = null;
+ [SkinControl(50)] protected GUIListControl _rightList = null;
+ [SkinControl(60)] protected GUIButtonControl _actionButton = null;
+ [SkinControl(70)] protected GUIToggleButtonControl _actionTriggerButton = null;
+
+ [SkinControl(30)] protected GUIImage _cmtImage = null;
+ [SkinControlAttribute(31)] protected GUILabelControl _comment = null;
+
+ const int ALL = Int16.MaxValue;
+ const int NO_SCENE_SELECTED = Int16.MaxValue;
+
+
+ private int _pluginID = 1972;
+ private VeraCommunication _vera = VeraCommunication.Instance;
+ private int _selectedRoom = ALL;
+ private int _selectedCategory = ALL;
+ public Actiontrigger _lastAction = Actiontrigger.LAST_ACTIONTRIGGER;
+ private VeraHelper _helper = new VeraHelper();
+
+ public bool _enableSceneTrigger = false;
+ private bool _lastUpdateFailed = false;
+ private string _titleTxt = "Micasa Verde - Vera control";
+
+ public VeraControl()
+ {
+ }
- #region ISetupForm Members
+ #region ISetupForm Members
- // Returns the name of the plugin which is shown in the plugin menu
- public string PluginName()
- {
- return "Vera Controller";
- }
+ // Returns the name of the plugin which is shown in the plugin menu
+ public string PluginName()
+ {
+ return "Vera Controller";
+ }
- // Returns the description of the plugin is shown in the plugin menu
- public string Description()
- {
- return "Micasa Verde Vera 2 controller, let Media Portal control your Z-wave devices";
- }
+ // Returns the description of the plugin is shown in the plugin menu
+ public string Description()
+ {
+ return "Micasa Verde Vera 2 controller, let Media Portal control your Z-wave devices";
+ }
- // Returns the author of the plugin which is shown in the plugin menu
- public string Author()
- {
- return "Bart Eversdijk";
- }
+ // Returns the author of the plugin which is shown in the plugin menu
+ public string Author()
+ {
+ return "Bart Eversdijk";
+ }
- // show the setup dialog
- public void ShowPlugin()
- {
- VeraSetupForm verasetup = new VeraSetupForm();
- verasetup.ShowDialog();
- }
+ // show the setup dialog
+ public void ShowPlugin()
+ {
+ VeraSetupForm verasetup = new VeraSetupForm();
+ verasetup.ShowDialog();
+ }
- // Indicates whether plugin can be enabled/disabled
- public bool CanEnable()
- {
- return true;
- }
+ // Indicates whether plugin can be enabled/disabled
+ public bool CanEnable()
+ {
+ return true;
+ }
- // Get Windows-ID
- public int GetWindowId()
- {
- // WindowID of windowplugin belonging to this setup
- // enter your own unique code
- return _pluginID;
- }
+ // Get Windows-ID
+ public int GetWindowId()
+ {
+ // WindowID of windowplugin belonging to this setup
+ // enter your own unique code
+ return _pluginID;
+ }
- // Indicates if plugin is enabled by default;
- public bool DefaultEnabled()
- {
- return true;
- }
+ // Indicates if plugin is enabled by default;
+ public bool DefaultEnabled()
+ {
+ return true;
+ }
- // indicates if a plugin has it's own setup screen
- public bool HasSetup()
- {
- return true;
- }
+ // indicates if a plugin has it's own setup screen
+ public bool HasSetup()
+ {
+ return true;
+ }
- /// <summary>
- /// If the plugin should have it's own button on the main menu of Mediaportal then it
- /// should return true to this method, otherwise if it should not be on home
- /// it should return false
- /// </summary>
- /// <param name="strButtonText">text the button should have</param>
- /// <param name="strButtonImage">image for the button, or empty for default</param>
- /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
- /// <param name="strPictureImage">subpicture for the button or empty for none</param>
- /// <returns>true : plugin needs it's own button on home
- /// false : plugin does not need it's own button on home</returns>
+ /// <summary>
+ /// If the plugin should have it's own button on the main menu of Mediaportal then it
+ /// should return true to this method, otherwise if it should not be on home
+ /// it should return false
+ /// </summary>
+ /// <param name="strButtonText">text the button should have</param>
+ /// <param name="strButtonImage">image for the button, or empty for default</param>
+ /// <param name="strButtonImageFocus">image for the button, or empty for default</param>
+ /// <param name="strPictureImage">subpicture for the button or empty for none</param>
+ /// <returns>true : plugin needs it's own button on home
+ /// false : plugin does not need it's own button on home</returns>
- public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
- {
- strButtonText = PluginName();
- strButtonImage = "hover_remote.png";
- strButtonImageFocus = "hover_remote.png";
- strPictureImage = "hover_remote.png";
- return true;
- }
+ public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
+ {
+ strButtonText = PluginName();
+ strButtonImage = "hover_remote.png";
+ strButtonImageFocus = "hover_remote.png";
+ strPictureImage = "hover_remote.png";
+ return true;
+ }
- // With GetID it will be an window-plugin / otherwise a process-plugin
- // Enter the id number here again
- public override int GetID
- {
- get { return _pluginID; }
- set { }
- }
+ // With GetID it will be an window-plugin / otherwise a process-plugin
+ // Enter the id number here again
+ public override int GetID
+ {
+ get { return _pluginID; }
+ set { }
+ }
- #endregion
+ #endregion
- public override bool Init()
- {
- _selectedRoom = Int16.MaxValue;
- _selectedCategory = Int16.MaxValue;
+ public override bool Init()
+ {
+ _selectedRoom = ALL;
+ _selectedCategory = ALL;
- using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
- {
- _enableSceneTrigger = xmlreader.GetValueAsBool("veracontroller", "enableSceneTrigger", false);
- }
-
- GUIWindowManager.OnNewAction += new OnActionHandler(OnNewAction);
-
- Player.PlayBackEnded += new Player.EndedHandler(g_Player_PlayBackEnded);
- Player.PlayBackStarted += new Player.StartedHandler(g_Player_PlayBackStarted);
- Player.PlayBackStopped += new Player.StoppedHandler(g_Player_PlayBackStopped);
+ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
+ {
+ _enableSceneTrigger = xmlreader.GetValueAsBool("veracontroller", "enableSceneTrigger", false);
+ }
+
+ GUIWindowManager.OnNewAction += new OnActionHandler(OnNewAction);
+
+ Player.PlayBackEnded += new Player.EndedHandler(g_Player_PlayBackEnded);
+ Player.PlayBackStarted += new Player.StartedHandler(g_Player_PlayBackStarted);
+ Player.PlayBackStopped += new Player.StoppedHandler(g_Player_PlayBackStopped);
- // Handle MP start-up trigger - do this is a different Thread to not block MP-start up
- new Thread( () => {
- _vera.UpdateCurrentStatus();
- // Run startup trigger after first upda...
[truncated message content] |
|
From: <Ba...@us...> - 2012-01-25 23:00:25
|
Revision: 4425
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4425&view=rev
Author: BartEv
Date: 2012-01-25 23:00:16 +0000 (Wed, 25 Jan 2012)
Log Message:
-----------
First stable release
Modified Paths:
--------------
trunk/plugins/VeraControl/DeviceCam.cs
trunk/plugins/VeraControl/DeviceSprinkler.cs
trunk/plugins/VeraControl/DeviceSystem.cs
trunk/plugins/VeraControl/DialogDeviceControl.cs
trunk/plugins/VeraControl/DialogSceneControl.cs
trunk/plugins/VeraControl/Scene.cs
trunk/plugins/VeraControl/VeraCommunication.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraControl.csproj
trunk/plugins/VeraControl/VeraHelper.cs
trunk/plugins/VeraControl/VeraSetupForm.Designer.cs
trunk/plugins/VeraControl/VeraSetupForm.cs
trunk/plugins/VeraControl/releases/VeraControl.xmp2
trunk/plugins/VeraControl/releases/update.xml
trunk/plugins/VeraControl/skin/Default/VeraControl.xml
trunk/plugins/VeraControl/skin/Default/VeraDialogDeviceControl.xml
trunk/plugins/VeraControl/skin/Default/VeraDialogSceneControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraDialogDeviceControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraDialogSceneControl.xml
trunk/plugins/VeraControl/skin/Media/Vera/Binary_Light_0.png
trunk/plugins/VeraControl/skin/Media/Vera/Binary_Light_100.png
trunk/plugins/VeraControl/skin/Media/Vera/Dimmable_Light_0.png
trunk/plugins/VeraControl/skin/Media/Vera/Dimmable_Light_100.png
trunk/plugins/VeraControl/skin/Media/Vera/Dimmable_Light_25.png
trunk/plugins/VeraControl/skin/Media/Vera/Dimmable_Light_50.png
trunk/plugins/VeraControl/skin/Media/Vera/Dimmable_Light_75.png
trunk/plugins/VeraControl/skin/Media/Vera/Door_Lock.png
trunk/plugins/VeraControl/skin/Media/Vera/Door_Lock_0.png
trunk/plugins/VeraControl/skin/Media/Vera/Door_Lock_100.png
trunk/plugins/VeraControl/skin/Media/Vera/Generic_IO.png
trunk/plugins/VeraControl/skin/Media/Vera/Humidity_Sensor.png
trunk/plugins/VeraControl/skin/Media/Vera/IR_Transmitter.png
trunk/plugins/VeraControl/skin/Media/Vera/Ip_Camera.png
trunk/plugins/VeraControl/skin/Media/Vera/Light_Sensor.png
trunk/plugins/VeraControl/skin/Media/Vera/Motion_Sensor_0.png
trunk/plugins/VeraControl/skin/Media/Vera/Motion_Sensor_100.png
trunk/plugins/VeraControl/skin/Media/Vera/Power_Meter.png
trunk/plugins/VeraControl/skin/Media/Vera/Scenes.png
trunk/plugins/VeraControl/skin/Media/Vera/Temperature_Sensor.png
trunk/plugins/VeraControl/skin/Media/Vera/Thermostat.png
trunk/plugins/VeraControl/skin/Media/Vera/USB_UIRT.png
trunk/plugins/VeraControl/skin/Media/Vera/default_panel.png
trunk/plugins/VeraControl/skin/Media/Vera/energy.png
trunk/plugins/VeraControl/skin/Media/Vera/findvera.png
trunk/plugins/VeraControl/skin/Media/Vera/generic_sensor.png
trunk/plugins/VeraControl/skin/Media/Vera/location.png
trunk/plugins/VeraControl/skin/Media/Vera/music_audio.png
trunk/plugins/VeraControl/skin/Media/Vera/plugins.png
trunk/plugins/VeraControl/skin/Media/Vera/users.png
Added Paths:
-----------
trunk/plugins/VeraControl/JSON.cs
trunk/plugins/VeraControl/releases/VeraControl_v0.9.0.1.mpe1
trunk/plugins/VeraControl/skin/Media/Vera/OpenList.png
trunk/plugins/VeraControl/skin/Media/Vera/Scenes_active.png
trunk/plugins/VeraControl/skin/Media/Vera/Sprinkler.png
trunk/plugins/VeraControl/skin/Media/Vera/state_command_error.png
trunk/plugins/VeraControl/skin/Media/Vera/state_connection_error.png
trunk/plugins/VeraControl/skin/Media/Vera/state_error.png
trunk/plugins/VeraControl/skin/Media/Vera/state_pending.png
trunk/plugins/VeraControl/skin/Media/Vera/state_success.png
Modified: trunk/plugins/VeraControl/DeviceCam.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceCam.cs 2012-01-23 23:04:46 UTC (rev 4424)
+++ trunk/plugins/VeraControl/DeviceCam.cs 2012-01-25 23:00:16 UTC (rev 4425)
@@ -58,7 +58,7 @@
public string imgUrl
{
- get { return "http://" + passString + _vera.veraAddress + "/data_request?id=cam_image¶meters=get_video_frame&Device_Num=" + id + "&rand=" + DateTime.Now.Ticks;
+ get { return _vera.veraAddress + "/data_request?id=cam_image¶meters=get_video_frame&Device_Num=" + id + "&rand=" + DateTime.Now.Ticks;
// return "http://" + passString + m_sIp + "/" + m_sUrl.Replace("%2F", "/");
}
set { }
Modified: trunk/plugins/VeraControl/DeviceSprinkler.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-01-23 23:04:46 UTC (rev 4424)
+++ trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-01-25 23:00:16 UTC (rev 4425)
@@ -100,7 +100,7 @@
public override string GetIconName()
{
- return "Humidity_Sensor";
+ return "Sprinkler";
}
public override string GetStatusText()
Modified: trunk/plugins/VeraControl/DeviceSystem.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSystem.cs 2012-01-23 23:04:46 UTC (rev 4424)
+++ trunk/plugins/VeraControl/DeviceSystem.cs 2012-01-25 23:00:16 UTC (rev 4425)
@@ -21,30 +21,30 @@
{
}
- public VeraHelper _helper = VeraHelper.Instance;
+ public VeraHelper _helper = VeraHelper.Instance;
- public long _lastUpdate = 0;
+ public long _lastUpdate = 0;
public bool _screenUpdateRequired = false;
- private bool _fullReload = true;
- private string _version = "";
- private string _model = "";
- private bool _zWaveHeal = false;
- private bool _metric = true;
- private string _serial = "";
- private string _fwd1Server = "";
- private string _fwd2Server = "";
- private string _loadTime = "0";
- private string _dataVersion = "0";
- private string _comment = "";
- private DevState _dsVeraState = DevState.NONE;
+ private bool _fullReload = true;
+ private string _version = "";
+ private string _model = "";
+ private bool _zWaveHeal = false;
+ private bool _metric = true;
+ private string _serial = "";
+ private string _fwd1Server = "";
+ private string _fwd2Server = "";
+ private string _loadTime = "0";
+ private string _dataVersion = "0";
+ private string _comment = "";
+ private DevState _dsVeraState = DevState.NONE;
public bool update(XmlNode xn)
{
_fullReload = _helper.GetAttrAsBool (xn, "full", _fullReload);
_version = _helper.GetAttrAsString (xn, "version", _version);
- _model = _helper.GetAttrAsString (xn, "model", _model);
- _zWaveHeal = _helper.GetAttrAsBool (xn, "zwave_heal", _zWaveHeal);
+ _model = _helper.GetAttrAsString (xn, "model", _model);
+ _zWaveHeal = _helper.GetAttrAsBool (xn, "zwave_heal", _zWaveHeal);
_serial = _helper.GetAttrAsString (xn, "serial_number", _serial);
_fwd1Server = _helper.GetAttrAsString (xn, "fwd1", _fwd1Server);
_fwd2Server = _helper.GetAttrAsString (xn, "fwd2", _fwd2Server);
Modified: trunk/plugins/VeraControl/DialogDeviceControl.cs
===================================================================
--- trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-01-23 23:04:46 UTC (rev 4424)
+++ trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-01-25 23:00:16 UTC (rev 4425)
@@ -254,7 +254,7 @@
{
_myDev.level = _desiredLevel;
_slider.IntValue = _desiredLevel;
- _lastLevelUpdate = DateTime.Now.Ticks + (TimeSpan.TicksPerSecond * 2);
+ _lastLevelUpdate = DateTime.Now.Ticks + (TimeSpan.TicksPerSecond * 2);
}
_levelUpdatePending = false;
}
Modified: trunk/plugins/VeraControl/DialogSceneControl.cs
===================================================================
--- trunk/plugins/VeraControl/DialogSceneControl.cs 2012-01-23 23:04:46 UTC (rev 4424)
+++ trunk/plugins/VeraControl/DialogSceneControl.cs 2012-01-25 23:00:16 UTC (rev 4425)
@@ -69,6 +69,11 @@
_label1.Label = _myScene.name;
+ _imgLogo.Dispose();
+ _imgLogo.SetFileName(@"Vera\" + _myScene.GetIconName() + ".png");
+ _imgLogo.AllocResources();
+ _imgLogo.KeepAspectRatio = true;
+
// save last update ticks
_lastUpdate = DateTime.Now.Ticks;
}
Added: trunk/plugins/VeraControl/JSON.cs
===================================================================
--- trunk/plugins/VeraControl/JSON.cs (rev 0)
+++ trunk/plugins/VeraControl/JSON.cs 2012-01-25 23:00:16 UTC (rev 4425)
@@ -0,0 +1,497 @@
+using System;
+using System.Collections;
+using System.Globalization;
+using System.Text;
+
+namespace VeraControl.Properties
+{
+ /// <summary>
+ /// This class encodes and decodes JSON strings.
+ /// Spec. details, see http://www.json.org/
+ ///
+ /// JSON uses Arrays and Objects. These correspond here to the datatypes ArrayList and Hashtable.
+ /// All numbers are parsed to doubles.
+ /// </summary>
+ public class JSON
+ {
+ public const int TOKEN_NONE = 0;
+ public const int TOKEN_CURLY_OPEN = 1;
+ public const int TOKEN_CURLY_CLOSE = 2;
+ public const int TOKEN_SQUARED_OPEN = 3;
+ public const int TOKEN_SQUARED_CLOSE = 4;
+ public const int TOKEN_COLON = 5;
+ public const int TOKEN_COMMA = 6;
+ public const int TOKEN_STRING = 7;
+ public const int TOKEN_NUMBER = 8;
+ public const int TOKEN_TRUE = 9;
+ public const int TOKEN_FALSE = 10;
+ public const int TOKEN_NULL = 11;
+
+ private const int BUILDER_CAPACITY = 2000;
+
+ /// <summary>
+ /// Parses the string json into a value
+ /// </summary>
+ /// <param name="json">A JSON string.</param>
+ /// <returns>An ArrayList, a Hashtable, a double, a string, null, true, or false</returns>
+ public static object JsonDecode(string json)
+ {
+ bool success = true;
+
+ return JsonDecode(json, ref success);
+ }
+
+ /// <summary>
+ /// Parses the string json into a value; and fills 'success' with the successfullness of the parse.
+ /// </summary>
+ /// <param name="json">A JSON string.</param>
+ /// <param name="success">Successful parse?</param>
+ /// <returns>An ArrayList, a Hashtable, a double, a string, null, true, or false</returns>
+ public static object JsonDecode(string json, ref bool success)
+ {
+ success = true;
+ if (json != null) {
+ char[] charArray = json.ToCharArray();
+ int index = 0;
+ object value = ParseValue(charArray, ref index, ref success);
+ return value;
+ } else {
+ return null;
+ }
+ }
+
+ /// <summary>
+ /// Converts a Hashtable / ArrayList object into a JSON string
+ /// </summary>
+ /// <param name="json">A Hashtable / ArrayList</param>
+ /// <returns>A JSON encoded string, or null if object 'json' is not serializable</returns>
+ public static string JsonEncode(object json)
+ {
+ StringBuilder builder = new StringBuilder(BUILDER_CAPACITY);
+ bool success = SerializeValue(json, builder);
+ return (success ? builder.ToString() : null);
+ }
+
+ protected static Hashtable ParseObject(char[] json, ref int index, ref bool success)
+ {
+ Hashtable table = new Hashtable();
+ int token;
+
+ // {
+ NextToken(json, ref index);
+
+ bool done = false;
+ while (!done) {
+ token = LookAhead(json, index);
+ if (token == JSON.TOKEN_NONE) {
+ success = false;
+ return null;
+ } else if (token == JSON.TOKEN_COMMA) {
+ NextToken(json, ref index);
+ } else if (token == JSON.TOKEN_CURLY_CLOSE) {
+ NextToken(json, ref index);
+ return table;
+ } else {
+
+ // name
+ string name = ParseString(json, ref index, ref success);
+ if (!success) {
+ success = false;
+ return null;
+ }
+
+ // :
+ token = NextToken(json, ref index);
+ if (token != JSON.TOKEN_COLON) {
+ success = false;
+ return null;
+ }
+
+ // value
+ object value = ParseValue(json, ref index, ref success);
+ if (!success) {
+ success = false;
+ return null;
+ }
+
+ table[name] = value;
+ }
+ }
+
+ return table;
+ }
+
+ protected static ArrayList ParseArray(char[] json, ref int index, ref bool success)
+ {
+ ArrayList array = new ArrayList();
+
+ // [
+ NextToken(json, ref index);
+
+ bool done = false;
+ while (!done) {
+ int token = LookAhead(json, index);
+ if (token == JSON.TOKEN_NONE) {
+ success = false;
+ return null;
+ } else if (token == JSON.TOKEN_COMMA) {
+ NextToken(json, ref index);
+ } else if (token == JSON.TOKEN_SQUARED_CLOSE) {
+ NextToken(json, ref index);
+ break;
+ } else {
+ object value = ParseValue(json, ref index, ref success);
+ if (!success) {
+ return null;
+ }
+
+ array.Add(value);
+ }
+ }
+
+ return array;
+ }
+
+ protected static object ParseValue(char[] json, ref int index, ref bool success)
+ {
+ switch (LookAhead(json, index)) {
+ case JSON.TOKEN_STRING:
+ return ParseString(json, ref index, ref success);
+ case JSON.TOKEN_NUMBER:
+ return ParseNumber(json, ref index, ref success);
+ case JSON.TOKEN_CURLY_OPEN:
+ return ParseObject(json, ref index, ref success);
+ case JSON.TOKEN_SQUARED_OPEN:
+ return ParseArray(json, ref index, ref success);
+ case JSON.TOKEN_TRUE:
+ NextToken(json, ref index);
+ return true;
+ case JSON.TOKEN_FALSE:
+ NextToken(json, ref index);
+ return false;
+ case JSON.TOKEN_NULL:
+ NextToken(json, ref index);
+ return null;
+ case JSON.TOKEN_NONE:
+ break;
+ }
+
+ success = false;
+ return null;
+ }
+
+ protected static string ParseString(char[] json, ref int index, ref bool success)
+ {
+ StringBuilder s = new StringBuilder(BUILDER_CAPACITY);
+ char c;
+
+ EatWhitespace(json, ref index);
+
+ // "
+ c = json[index++];
+
+ bool complete = false;
+ while (!complete) {
+
+ if (index == json.Length) {
+ break;
+ }
+
+ c = json[index++];
+ if (c == '"') {
+ complete = true;
+ break;
+ } else if (c == '\\') {
+
+ if (index == json.Length) {
+ break;
+ }
+ c = json[index++];
+ if (c == '"') {
+ s.Append('"');
+ } else if (c == '\\') {
+ s.Append('\\');
+ } else if (c == '/') {
+ s.Append('/');
+ } else if (c == 'b') {
+ s.Append('\b');
+ } else if (c == 'f') {
+ s.Append('\f');
+ } else if (c == 'n') {
+ s.Append('\n');
+ } else if (c == 'r') {
+ s.Append('\r');
+ } else if (c == 't') {
+ s.Append('\t');
+ } else if (c == 'u') {
+ int remainingLength = json.Length - index;
+ if (remainingLength >= 4) {
+ // parse the 32 bit hex into an integer codepoint
+ uint codePoint;
+ if (!(success = UInt32.TryParse(new string(json, index, 4), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out codePoint))) {
+ return "";
+ }
+ // convert the integer codepoint to a unicode char and add to string
+ s.Append(Char.ConvertFromUtf32((int)codePoint));
+ // skip 4 chars
+ index += 4;
+ } else {
+ break;
+ }
+ }
+
+ } else {
+ s.Append(c);
+ }
+
+ }
+
+ if (!complete) {
+ success = false;
+ return null;
+ }
+
+ return s.ToString();
+ }
+
+ protected static double ParseNumber(char[] json, ref int index, ref bool success)
+ {
+ EatWhitespace(json, ref index);
+
+ int lastIndex = GetLastIndexOfNumber(json, index);
+ int charLength = (lastIndex - index) + 1;
+
+ double number;
+ success = Double.TryParse(new string(json, index, charLength), NumberStyles.Any, CultureInfo.InvariantCulture, out number);
+
+ index = lastIndex + 1;
+ return number;
+ }
+
+ protected static int GetLastIndexOfNumber(char[] json, int index)
+ {
+ int lastIndex;
+
+ for (lastIndex = index; lastIndex < json.Length; lastIndex++) {
+ if ("0123456789+-.eE".IndexOf(json[lastIndex]) == -1) {
+ break;
+ }
+ }
+ return lastIndex - 1;
+ }
+
+ protected static void EatWhitespace(char[] json, ref int index)
+ {
+ for (; index < json.Length; index++) {
+ if (" \t\n\r".IndexOf(json[index]) == -1) {
+ break;
+ }
+ }
+ }
+
+ protected static int LookAhead(char[] json, int index)
+ {
+ int saveIndex = index;
+ return NextToken(json, ref saveIndex);
+ }
+
+ protected static int NextToken(char[] json, ref int index)
+ {
+ EatWhitespace(json, ref index);
+
+ if (index == json.Length) {
+ return JSON.TOKEN_NONE;
+ }
+
+ char c = json[index];
+ index++;
+ switch (c) {
+ case '{':
+ return JSON.TOKEN_CURLY_OPEN;
+ case '}':
+ return JSON.TOKEN_CURLY_CLOSE;
+ case '[':
+ return JSON.TOKEN_SQUARED_OPEN;
+ case ']':
+ return JSON.TOKEN_SQUARED_CLOSE;
+ case ',':
+ return JSON.TOKEN_COMMA;
+ case '"':
+ return JSON.TOKEN_STRING;
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+ case '-':
+ return JSON.TOKEN_NUMBER;
+ case ':':
+ return JSON.TOKEN_COLON;
+ }
+ index--;
+
+ int remainingLength = json.Length - index;
+
+ // false
+ if (remainingLength >= 5) {
+ if (json[index] == 'f' &&
+ json[index + 1] == 'a' &&
+ json[index + 2] == 'l' &&
+ json[index + 3] == 's' &&
+ json[index + 4] == 'e') {
+ index += 5;
+ return JSON.TOKEN_FALSE;
+ }
+ }
+
+ // true
+ if (remainingLength >= 4) {
+ if (json[index] == 't' &&
+ json[index + 1] == 'r' &&
+ json[index + 2] == 'u' &&
+ json[index + 3] == 'e') {
+ index += 4;
+ return JSON.TOKEN_TRUE;
+ }
+ }
+
+ // null
+ if (remainingLength >= 4) {
+ if (json[index] == 'n' &&
+ json[index + 1] == 'u' &&
+ json[index + 2] == 'l' &&
+ json[index + 3] == 'l') {
+ index += 4;
+ return JSON.TOKEN_NULL;
+ }
+ }
+
+ return JSON.TOKEN_NONE;
+ }
+
+ protected static bool SerializeValue(object value, StringBuilder builder)
+ {
+ bool success = true;
+
+ if (value is string) {
+ success = SerializeString((string)value, builder);
+ } else if (value is Hashtable) {
+ success = SerializeObject((Hashtable)value, builder);
+ } else if (value is ArrayList) {
+ success = SerializeArray((ArrayList)value, builder);
+ } else if (IsNumeric(value)) {
+ success = SerializeNumber(Convert.ToDouble(value), builder);
+ } else if ((value is Boolean) && ((Boolean)value == true)) {
+ builder.Append("true");
+ } else if ((value is Boolean) && ((Boolean)value == false)) {
+ builder.Append("false");
+ } else if (value == null) {
+ builder.Append("null");
+ } else {
+ success = false;
+ }
+ return success;
+ }
+
+ protected static bool SerializeObject(Hashtable anObject, StringBuilder builder)
+ {
+ builder.Append("{");
+
+ IDictionaryEnumerator e = anObject.GetEnumerator();
+ bool first = true;
+ while (e.MoveNext()) {
+ string key = e.Key.ToString();
+ object value = e.Value;
+
+ if (!first) {
+ builder.Append(", ");
+ }
+
+ SerializeString(key, builder);
+ builder.Append(":");
+ if (!SerializeValue(value, builder)) {
+ return false;
+ }
+
+ first = false;
+ }
+
+ builder.Append("}");
+ return true;
+ }
+
+ protected static bool SerializeArray(ArrayList anArray, StringBuilder builder)
+ {
+ builder.Append("[");
+
+ bool first = true;
+ for (int i = 0; i < anArray.Count; i++) {
+ object value = anArray[i];
+
+ if (!first) {
+ builder.Append(", ");
+ }
+
+ if (!SerializeValue(value, builder)) {
+ return false;
+ }
+
+ first = false;
+ }
+
+ builder.Append("]");
+ return true;
+ }
+
+ protected static bool SerializeString(string aString, StringBuilder builder)
+ {
+ builder.Append("\"");
+
+ char[] charArray = aString.ToCharArray();
+ for (int i = 0; i < charArray.Length; i++) {
+ char c = charArray[i];
+ if (c == '"') {
+ builder.Append("\\\"");
+ } else if (c == '\\') {
+ builder.Append("\\\\");
+ } else if (c == '\b') {
+ builder.Append("\\b");
+ } else if (c == '\f') {
+ builder.Append("\\f");
+ } else if (c == '\n') {
+ builder.Append("\\n");
+ } else if (c == '\r') {
+ builder.Append("\\r");
+ } else if (c == '\t') {
+ builder.Append("\\t");
+ } else {
+ int codepoint = Convert.ToInt32(c);
+ if ((codepoint >= 32) && (codepoint <= 126)) {
+ builder.Append(c);
+ } else {
+ builder.Append("\\u" + Convert.ToString(codepoint, 16).PadLeft(4, '0'));
+ }
+ }
+ }
+
+ builder.Append("\"");
+ return true;
+ }
+
+ protected static bool SerializeNumber(double number, StringBuilder builder)
+ {
+ builder.Append(Convert.ToString(number, CultureInfo.InvariantCulture));
+ return true;
+ }
+
+ /// <summary>
+ /// Determines if a given object is numeric in any way
+ /// (can be integer, double, null, etc).
+ ///
+ /// Thanks to mtighe for pointing out Double.TryParse to me.
+ /// </summary>
+ protected static bool IsNumeric(object o)
+ {
+ double result;
+
+ return (o == null) ? false : Double.TryParse(o.ToString(), out result);
+ }
+ }
+}
Modified: trunk/plugins/VeraControl/Scene.cs
===================================================================
--- trunk/plugins/VeraControl/Scene.cs 2012-01-23 23:04:46 UTC (rev 4424)
+++ trunk/plugins/VeraControl/Scene.cs 2012-01-25 23:00:16 UTC (rev 4425)
@@ -44,7 +44,7 @@
public override string GetIconName()
{
- return "Scenes";
+ return "Scenes" + (IsActive() ? "_active":"");
}
public override string GetStatusText()
Modified: trunk/plugins/VeraControl/VeraCommunication.cs
===================================================================
--- trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-23 23:04:46 UTC (rev 4424)
+++ trunk/plugins/VeraControl/VeraCommunication.cs 2012-01-25 23:00:16 UTC (rev 4425)
@@ -17,650 +17,684 @@
namespace VeraControl.Properties
{
- /// <summary>
- /// Description of VeraCommunication.
- /// </summary>
-
- public class VeraStatus
- {
- public DeviceSystem system = new DeviceSystem();
- public List<DeviceGeneric> devices = new List<DeviceGeneric>();
- public List<Scene> scenes = new List<Scene>();
- public List<Room> rooms = new List<Room>();
- public List<DevCategories> categories = new List<DevCategories>();
- public List<Section> sections = new List<Section>();
-
- #region Vers get by id support functions
+ /// <summary>
+ /// Description of VeraCommunication.
+ /// </summary>
+
+ public class VeraStatus
+ {
+ public DeviceSystem system = new DeviceSystem();
+ public List<DeviceGeneric> devices = new List<DeviceGeneric>();
+ public List<Scene> scenes = new List<Scene>();
+ public List<Room> rooms = new List<Room>();
+ public List<DevCategories> categories = new List<DevCategories>();
+ public List<Section> sections = new List<Section>();
+
+ #region Vers get by id support functions
- public void ClearAllLists()
- {
- devices.Clear();
- scenes.Clear();
- rooms.Clear();
- categories.Clear();
- sections.Clear();
- }
- public Room GetRoomById(int id)
- {
- foreach(Room room in rooms)
- {
- if (room.id == id)
- {
- return room;
- }
- }
- return new Room(null);
- }
-
- public Section GetSectionById(int id)
- {
- foreach(Section section in sections)
- {
- if (section.id == id)
- {
- return section;
- }
- }
- return new Section(null);
- }
-
- public DeviceGeneric GetDeviceById(int id)
- {
- foreach(DeviceGeneric dev in devices)
- {
- if (dev.id == id)
- {
- return dev;
- }
- }
- return new DeviceGeneric(null);
- }
+ public void ClearAllLists()
+ {
+ devices.Clear();
+ scenes.Clear();
+ rooms.Clear();
+ categories.Clear();
+ sections.Clear();
+ }
+ public Room GetRoomById(int id)
+ {
+ foreach(Room room in rooms)
+ {
+ if (room.id == id)
+ {
+ return room;
+ }
+ }
+ return new Room(null);
+ }
+
+ public Section GetSectionById(int id)
+ {
+ foreach(Section section in sections)
+ {
+ if (section.id == id)
+ {
+ return section;
+ }
+ }
+ return new Section(null);
+ }
+
+ public DeviceGeneric GetDeviceById(int id)
+ {
+ foreach(DeviceGeneric dev in devices)
+ {
+ if (dev.id == id)
+ {
+ return dev;
+ }
+ }
+ return new DeviceGeneric(null);
+ }
- public Scene GetSceneById(int id)
- {
- foreach(Scene scene in scenes)
- {
- if (scene.id == id)
- {
- return scene;
- }
- }
- return new Scene(null);
- }
-
- public DevCategories GetCategoryById(int id)
- {
- foreach(DevCategories cat in categories)
- {
- if (cat.id == id)
- {
- return cat;
- }
- }
- return new DevCategories(null);
- }
-
- public bool IsSectionFound(int id)
- {
- foreach(Section section in sections)
- {
- if (section.id == id)
- {
- return true;
- }
- }
- return false;
- }
-
- public bool IsRoomFound(int id)
- {
- foreach(Room room in rooms)
- {
- if (room.id == id)
- {
- return true;
- }
- }
- return false;
- }
-
- public bool IsDeviceFound(int id)
- {
- foreach(DeviceGeneric dev in devices)
- {
- if (dev.id == id)
- {
- return true;
- }
- }
- return false;
- }
+ public Scene GetSceneById(int id)
+ {
+ foreach(Scene scene in scenes)
+ {
+ if (scene.id == id)
+ {
+ return scene;
+ }
+ }
+ return new Scene(null);
+ }
+
+ public DevCategories GetCategoryById(int id)
+ {
+ foreach(DevCategories cat in categories)
+ {
+ if (cat.id == id)
+ {
+ return cat;
+ }
+ }
+ return new DevCategories(null);
+ }
+
+ public bool IsSectionFound(int id)
+ {
+ foreach(Section section in sections)
+ {
+ if (section.id == id)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public bool IsRoomFound(int id)
+ {
+ foreach(Room room in rooms)
+ {
+ if (room.id == id)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public bool IsDeviceFound(int id)
+ {
+ foreach(DeviceGeneric dev in devices)
+ {
+ if (dev.id == id)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
- public bool IsSceneFound(int id)
- {
- foreach(Scene scene in scenes)
- {
- if (scene.id == id)
- {
- return true;
- }
- }
- return false;
- }
-
- public bool IsCategoryFound(int id)
- {
- foreach(DevCategories cat in categories)
- {
- if (cat.id == id)
- {
- return true;
- }
- }
- return false;
- }
- #endregion
- }
-
-
- public sealed class VeraCommunication
- {
- private static volatile VeraCommunication _instance;
- private static object _syncRoot = new Object();
- private VeraHelper _helper = VeraHelper.Instance;
-
- // Config data
- private string _veraIPAddress;
- private string _veraTCPIPPort;
- private int _maxRefreshDelay; // Maximun delay between 2 status updates in seconds
- private int _minRefreshDelay = 1000; // Minimun delay between 2 status updates in miliseconds
-
- // Actual device information
- private VeraStatus _status = new VeraStatus();
-
- // Communication status/control
- private long _lastUpdate = 0;
- private bool _screenUpdateRequired = false; // Only true when a new update was received AND at least one device(staus) or scene was changed
- private bool _lastUpdateFailed = false;
- private string _lastUpdateErrorMessage = "";
- private WebClient _webUpdateClient = new WebClient();
- private WebClient _webCommandClient = new WebClient();
- private Action<string> _webCommandClientErrorReporter = null;
-
- // Action control table
- public int [] actionTriggerTable = new int[(int)Actiontrigger.LAST_ACTIONTRIGGER];
-
- public static VeraCommunication Instance
- {
- get
- {
- if (_instance == null)
- {
- lock (_syncRoot)
- {
- if (_instance == null)
- {
- _instance = new VeraCommunication();
- }
- }
- }
+ public bool IsSceneFound(int id)
+ {
+ foreach(Scene scene in scenes)
+ {
+ if (scene.id == id)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public bool IsCategoryFound(int id)
+ {
+ foreach(DevCategories cat in categories)
+ {
+ if (cat.id == id)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ #endregion
+ }
+
+
+ public sealed class VeraCommunication
+ {
+ private static volatile VeraCommunication _instance;
+ private static object _syncRoot = new Object();
+ private VeraHelper _helper = VeraHelper.Instance;
+
+ // Config data
+ private int _maxRefreshDelay; // Maximun delay between 2 status updates in seconds
+ private int _minRefreshDelay = 1000; // Minimun delay between 2 status updates in miliseconds
+
+ // Actual device information
+ private VeraStatus _status = new VeraS...
[truncated message content] |
|
From: <Ba...@us...> - 2012-01-28 20:18:52
|
Revision: 4428
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4428&view=rev
Author: BartEv
Date: 2012-01-28 20:18:43 +0000 (Sat, 28 Jan 2012)
Log Message:
-----------
Added RC command controls and help screen
Got clear of all the TAB's
Modified Paths:
--------------
trunk/plugins/VeraControl/BaseDevice.cs
trunk/plugins/VeraControl/DevCategories.cs
trunk/plugins/VeraControl/DeviceCam.cs
trunk/plugins/VeraControl/DeviceDimmer.cs
trunk/plugins/VeraControl/DeviceDoorlock.cs
trunk/plugins/VeraControl/DeviceGWeather.cs
trunk/plugins/VeraControl/DeviceGeneric.cs
trunk/plugins/VeraControl/DeviceHumidity.cs
trunk/plugins/VeraControl/DeviceLightSensor.cs
trunk/plugins/VeraControl/DevicePowerMeter.cs
trunk/plugins/VeraControl/DeviceSceneController.cs
trunk/plugins/VeraControl/DeviceSecurity.cs
trunk/plugins/VeraControl/DeviceSprinkler.cs
trunk/plugins/VeraControl/DeviceSwitch.cs
trunk/plugins/VeraControl/DeviceSystem.cs
trunk/plugins/VeraControl/DeviceTemperature.cs
trunk/plugins/VeraControl/DeviceThermostat.cs
trunk/plugins/VeraControl/DeviceWindowCovering.cs
trunk/plugins/VeraControl/DialogActionTrigger.cs
trunk/plugins/VeraControl/DialogDeviceControl.cs
trunk/plugins/VeraControl/DialogSceneControl.cs
trunk/plugins/VeraControl/JSON.cs
trunk/plugins/VeraControl/Room.cs
trunk/plugins/VeraControl/Scene.cs
trunk/plugins/VeraControl/Section.cs
trunk/plugins/VeraControl/VeraCommunication.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraHelper.cs
Modified: trunk/plugins/VeraControl/BaseDevice.cs
===================================================================
--- trunk/plugins/VeraControl/BaseDevice.cs 2012-01-28 09:50:54 UTC (rev 4427)
+++ trunk/plugins/VeraControl/BaseDevice.cs 2012-01-28 20:18:43 UTC (rev 4428)
@@ -18,19 +18,19 @@
/// </summary>
public class BaseDevice
{
- private long _lastUpdate = 0;
- private long _lastPendingUpdate = 0;
+ private long _lastUpdate = 0;
+ private long _lastPendingUpdate = 0;
private bool _screenUpdateRequired = false;
- private string _name = "unknown device";
- private int _id = 0;
- private int _room = 0;
+ private string _name = "unknown device";
+ private int _id = 0;
+ private int _room = 0;
// not connected (-2), none (-1), pending (0,1,5,6), success(4), error (2,3)
private DevState _dsState = DevState.NONE;
- private string _comment = ""; // red(error), green(success) or blue(pending) - icon/text
+ private string _comment = ""; // red(error), green(success) or blue(pending) - icon/text
- public VeraHelper _helper = VeraHelper.Instance;
- public VeraCommunication _vera = VeraCommunication.Instance;
+ public VeraHelper _helper = VeraHelper.Instance;
+ public VeraCommunication _vera = VeraCommunication.Instance;
public BaseDevice(XmlNode xn)
{
@@ -40,7 +40,7 @@
}
}
- /// <summary>
+ /// <summary>
/// Process Vera update information
/// </summary>
public virtual bool Update(XmlNode xn)
@@ -58,8 +58,8 @@
}
// Set update flag
- screenUpdateRequired = true;
- lastUpdate = DateTime.Now.Ticks;
+ screenUpdateRequired = true;
+ lastUpdate = DateTime.Now.Ticks;
return true;
}
@@ -75,14 +75,14 @@
public int id
{
- get { return _id; }
- set { }
+ get { return _id; }
+ set { }
}
public string name
{
- get { return _name; }
- set { }
+ get { return _name; }
+ set { }
}
public bool InRoom(int id)
@@ -93,19 +93,19 @@
public int room
{
get { return _room; }
- set { _room = value; }
+ set { _room = value; }
}
public DevState commstate
{
get { return _dsState; }
- set { }
+ set { }
}
public string comment
{
get { return (commstate != DevState.NONE ? _comment : ""); }
- set { }
+ set { }
}
public bool screenUpdateRequired
@@ -128,11 +128,11 @@
public void ReportPendingRequest()
{
- _dsState = DevState.PENDING;
- _comment = "Sending command...";
+ _dsState = DevState.PENDING;
+ _comment = "Sending command...";
screenUpdateRequired = true;
lastUpdate = DateTime.Now.Ticks;
- _lastPendingUpdate = lastUpdate;
+ _lastPendingUpdate = lastUpdate;
}
/// <summary>
@@ -140,19 +140,19 @@
/// </summary>
public void ReportRequestError(string message)
{
- _dsState = DevState.COMMAND_ERROR;
- _comment = message;
+ _dsState = DevState.COMMAND_ERROR;
+ _comment = message;
screenUpdateRequired = true;
- lastUpdate = DateTime.Now.Ticks;
+ lastUpdate = DateTime.Now.Ticks;
}
public void ClearCommState()
{
if (_dsState != DevState.NONE)
{
- _dsState = DevState.NONE;
- screenUpdateRequired = true;
- lastUpdate = DateTime.Now.Ticks;
+ _dsState = DevState.NONE;
+ screenUpdateRequired = true;
+ lastUpdate = DateTime.Now.Ticks;
}
}
Modified: trunk/plugins/VeraControl/DevCategories.cs
===================================================================
--- trunk/plugins/VeraControl/DevCategories.cs 2012-01-28 09:50:54 UTC (rev 4427)
+++ trunk/plugins/VeraControl/DevCategories.cs 2012-01-28 20:18:43 UTC (rev 4428)
@@ -13,45 +13,45 @@
namespace VeraControl.Properties
{
- /// <summary>
- /// Description of DevCategories.
- /// </summary>
- public class DevCategories
- {
- public DevCategories(XmlNode xn)
- {
- if (xn != null)
- {
- Update(xn);
- }
- }
-
- private string _name = "unknown category";
- private int _id = 0;
- public VeraHelper _helper = VeraHelper.Instance;
-
- public bool Update(XmlNode xn)
- {
- _name = _helper.GetAttrAsString(xn, "name", _name);
- _id = _helper.GetAttrAsInt (xn, "id", _id);
- return true;
- }
-
- public int id
- {
- get { return _id; }
- set { }
- }
-
- public string name
- {
- get { return _name; }
- set { }
- }
+ /// <summary>
+ /// Description of DevCategories.
+ /// </summary>
+ public class DevCategories
+ {
+ public DevCategories(XmlNode xn)
+ {
+ if (xn != null)
+ {
+ Update(xn);
+ }
+ }
+
+ private string _name = "unknown category";
+ private int _id = 0;
+ public VeraHelper _helper = VeraHelper.Instance;
+
+ public bool Update(XmlNode xn)
+ {
+ _name = _helper.GetAttrAsString(xn, "name", _name);
+ _id = _helper.GetAttrAsInt (xn, "id", _id);
+ return true;
+ }
+
+ public int id
+ {
+ get { return _id; }
+ set { }
+ }
+
+ public string name
+ {
+ get { return _name; }
+ set { }
+ }
- public override string ToString()
- {
- return name;
- }
- }
+ public override string ToString()
+ {
+ return name;
+ }
+ }
}
Modified: trunk/plugins/VeraControl/DeviceCam.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceCam.cs 2012-01-28 09:50:54 UTC (rev 4427)
+++ trunk/plugins/VeraControl/DeviceCam.cs 2012-01-28 20:18:43 UTC (rev 4428)
@@ -11,139 +11,145 @@
namespace VeraControl.Properties
{
- /// <summary>
- /// Description of DeviceCam.
- /// </summary>
- public class DeviceCam : DeviceGeneric
- {
- private string _ip = "127.0.0.1";
- private string _url = "/";
- private string _stream = "";
- private string _videoUrl = "";
- private int _refreshRate = 2;
- private string _user = "";
- private string _pass = "";
-
- public DeviceCam(XmlNode xn): base (xn)
- {
- if (xn != null)
- {
- Update(xn);
- }
- }
-
- public override bool Update(XmlNode xn)
- {
- _ip = _helper.GetAttrAsString(xn, "ip", _ip);
- _url = _helper.GetAttrAsString(xn, "url", _url);
- _stream = _helper.GetAttrAsString(xn, "streaming", _stream);
- _videoUrl = _helper.GetAttrAsString(xn, "videourls", _videoUrl);
- _user = _helper.GetAttrAsString(xn, "username", "");
- _pass = _helper.GetAttrAsString(xn, "password", "");
-
- return base.Update(xn);
- }
-
- private string passString
- {
- get {
- if (_user == "")
- {
- return "";
- }
- return _user + ":" + _pass + "@";
- }
- set { }
- }
-
- public string imgUrl
- {
- get { return _vera.veraAddress + "/data_request?id=cam_image¶meters=get_video_frame&Device_Num=" + id + "&rand=" + DateTime.Now.Ticks;
- // return "http://" + passString + m_sIp + "/" + m_sUrl.Replace("%2F", "/");
- }
- set { }
- }
-
- public string streamUrl
- {
- get { return "http://" + passString + _ip + "/" + _stream.Replace("%2F", "/"); }
- set { }
- }
-
- public int refreshRate
- {
- get { return _refreshRate; }
- set { _refreshRate = value; }
- }
-
- private bool HasRefreshDelayPassed(long lastcheck)
- {
- return ((_helper.GetSecondsSince1970() - refreshRate) > (lastcheck / TimeSpan.TicksPerSecond));
- }
-
- public override string GetIconName()
- {
- return "Ip_Camera";
- }
-
- public override bool NewScreenUpdateWaitingAndClearFlag( )
- {
- // Invoking this method will clear the update ready flag -> so caller need to handle the update
- // A cam device requires an update every refreshRate seconds
- bool b = screenUpdateRequired || HasRefreshDelayPassed(DateTime.Now.Ticks);
- screenUpdateRequired = false;
- if (b)
- {
- lastUpdate = DateTime.Now.Ticks;
- }
- return b;
- }
-
- public override bool NewUpdateSince(long lTimePreviousCheck)
- {
- bool b = (lTimePreviousCheck <= lastUpdate) || HasRefreshDelayPassed(lastUpdate);
- if (b)
- {
- lastUpdate = DateTime.Now.Ticks;
- }
- return b;
- }
-
- private void Move(string direction)
- {
- if (id == 0)
- {
- _vera.status.system.ReportCommandError("Unknown device");
- screenUpdateRequired = true;
- return;
- }
- string cmd = "?id=lu_action&DeviceNum=" + id + "&serviceId=urn:micasaverde-com:serviceId:PanTiltZoom1&action=" + direction;
- _vera.DoVeraCommandRequest(cmd, ReportRequestError);
- }
-
- public override void MoveUp()
- {
- Move("MoveUp");
- }
- public override void MoveLeft()
- {
- Move("MoveLeft");
- }
- public override void MoveRight()
- {
- Move("MoveRight");
- }
- public override void MoveDown()
- {
- Move("MoveDown");
- }
- public override void ZoomIn()
- {
- Move("ZoomIn");
- }
- public override void ZoomOut()
- {
- Move("ZoomOut");
- }
- }
+ /// <summary>
+ /// Description of DeviceCam.
+ /// </summary>
+ public class DeviceCam : DeviceGeneric
+ {
+ private string _ip = "127.0.0.1";
+ private string _url = "/";
+ private string _stream = "";
+ private string _videoUrl = "";
+ private int _refreshRate = 2;
+ private string _user = "";
+ private string _pass = "";
+
+ public DeviceCam(XmlNode xn): base (xn)
+ {
+ if (xn != null)
+ {
+ Update(xn);
+ }
+ }
+
+ public override bool Update(XmlNode xn)
+ {
+ _ip = _helper.GetAttrAsString(xn, "ip", _ip);
+ _url = _helper.GetAttrAsString(xn, "url", _url);
+ _stream = _helper.GetAttrAsString(xn, "streaming", _stream);
+ _videoUrl = _helper.GetAttrAsString(xn, "videourls", _videoUrl);
+ _user = _helper.GetAttrAsString(xn, "username", "");
+ _pass = _helper.GetAttrAsString(xn, "password", "");
+
+ return base.Update(xn);
+ }
+
+ private string passString
+ {
+ get {
+ if (_user == "")
+ {
+ return "";
+ }
+ return _user + ":" + _pass + "@";
+ }
+ set { }
+ }
+
+ public string imgUrl
+ {
+ get { return _vera.veraAddress + "/data_request?id=cam_image¶meters=get_video_frame&Device_Num=" + id + "&rand=" + DateTime.Now.Ticks;
+ // return "http://" + passString + m_sIp + "/" + m_sUrl.Replace("%2F", "/");
+ }
+ set { }
+ }
+
+ public string streamUrl
+ {
+ get { return "http://" + passString + _ip + "/" + _stream.Replace("%2F", "/"); }
+ set { }
+ }
+
+ public int refreshRate
+ {
+ get { return _refreshRate; }
+ set { _refreshRate = value; }
+ }
+
+ private bool HasRefreshDelayPassed(long lastcheck)
+ {
+ return ((_helper.GetSecondsSince1970() - refreshRate) > (lastcheck / TimeSpan.TicksPerSecond));
+ }
+
+ public override bool isControllable
+ {
+ get { return true; }
+ set { }
+ }
+
+ public override string GetIconName()
+ {
+ return "Ip_Camera";
+ }
+
+ public override bool NewScreenUpdateWaitingAndClearFlag( )
+ {
+ // Invoking this method will clear the update ready flag -> so caller need to handle the update
+ // A cam device requires an update every refreshRate seconds
+ bool b = screenUpdateRequired || HasRefreshDelayPassed(DateTime.Now.Ticks);
+ screenUpdateRequired = false;
+ if (b)
+ {
+ lastUpdate = DateTime.Now.Ticks;
+ }
+ return b;
+ }
+
+ public override bool NewUpdateSince(long lTimePreviousCheck)
+ {
+ bool b = (lTimePreviousCheck <= lastUpdate) || HasRefreshDelayPassed(lastUpdate);
+ if (b)
+ {
+ lastUpdate = DateTime.Now.Ticks;
+ }
+ return b;
+ }
+
+ private void Move(string direction)
+ {
+ if (id == 0)
+ {
+ _vera.status.system.ReportCommandError("Unknown device");
+ screenUpdateRequired = true;
+ return;
+ }
+ string cmd = "?id=lu_action&DeviceNum=" + id + "&serviceId=urn:micasaverde-com:serviceId:PanTiltZoom1&action=" + direction;
+ _vera.DoVeraCommandRequest(cmd, ReportRequestError);
+ }
+
+ public override void MoveUp()
+ {
+ Move("MoveUp");
+ }
+ public override void MoveLeft()
+ {
+ Move("MoveLeft");
+ }
+ public override void MoveRight()
+ {
+ Move("MoveRight");
+ }
+ public override void MoveDown()
+ {
+ Move("MoveDown");
+ }
+ public override void ZoomIn()
+ {
+ Move("ZoomIn");
+ }
+ public override void ZoomOut()
+ {
+ Move("ZoomOut");
+ }
+ }
}
Modified: trunk/plugins/VeraControl/DeviceDimmer.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDimmer.cs 2012-01-28 09:50:54 UTC (rev 4427)
+++ trunk/plugins/VeraControl/DeviceDimmer.cs 2012-01-28 20:18:43 UTC (rev 4428)
@@ -13,107 +13,104 @@
namespace VeraControl.Properties
{
- /// <summary>
- /// Description of DeviceDimmer.
- /// </summary>
- public class DeviceDimmer : DeviceGeneric
- {
- private int _level = 0;
- private string _watt = "-";
- private string _kwh = "-";
-
- public DeviceDimmer(XmlNode xn): base (xn)
- {
- if (xn != null)
- {
- Update(xn);
- }
- }
-
- public override bool Update(XmlNode xn)
- {
- _level = _helper.GetAttrAsInt (xn, "level", _level);
- _watt = _helper.GetAttrAsString(xn, "watts", _watt);
- _kwh = _helper.GetAttrAsString(xn, "kwh", _kwh);
-
- return base.Update(xn);
- }
-
- public string watts
- {
- get { return _watt; }
- set { }
- }
-
- public override bool status
- {
- get { return (_level > 0); }
- set {
-
- }
- }
-
- public override int level
- {
- get { return _level; }
- set
- {
- int newValue = value;
- if (newValue > 100) {
- newValue = 100;
- } else {
- if (newValue < 0) { newValue = 0; }
- }
- if (id > 0) // Only send when a valid ID is found
- {
- ReportPendingRequest();
- // Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString() +
- "&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget" +
- "&newLoadlevelTarget=" + value;
- _vera.DoVeraCommandRequest(cmd, ReportRequestError);
- }
- _level = newValue;
- }
- }
-
- public override int maxLevel
- {
- get { return 100; }
- set { }
- }
-
- public override string ToString()
- {
- return name + " [" + GetStatusText() + "]";
- }
-
- public override bool isControllable
- {
- get { return true; }
- set { }
- }
-
- public override string GetIconName()
- {
- string leveltxt = "0";
- if (level > 0) { leveltxt = "25"; }
- if (level > 25) { leveltxt = "50"; }
- if (level > 50) { leveltxt = "75"; }
- if (level > 75) { leveltxt = "100"; }
-
- return "Dimmable_Light_" + leveltxt;
- }
-
-
- public override string GetExtraText()
- {
- return (_kwh != "" ? _kwh + "kWh" : "");
- }
-
- public override string GetStatusText()
- {
- return (status ? level.ToString() + "%" : "Off");
- }
- }
+ /// <summary>
+ /// Description of DeviceDimmer.
+ /// </summary>
+ public class DeviceDimmer : DeviceGeneric
+ {
+ private int _level = 0;
+ private string _watt = "-";
+ private string _kwh = "-";
+
+ public DeviceDimmer(XmlNode xn): base (xn)
+ {
+ if (xn != null)
+ {
+ Update(xn);
+ }
+ }
+
+ public override bool Update(XmlNode xn)
+ {
+ _level = _helper.GetAttrAsInt (xn, "level", _level);
+ _watt = _helper.GetAttrAsString(xn, "watts", _watt);
+ _kwh = _helper.GetAttrAsString(xn, "kwh", _kwh);
+
+ return base.Update(xn);
+ }
+
+ public string watts
+ {
+ get { return _watt; }
+ set { }
+ }
+
+ public override bool status
+ {
+ get { return (_level > 0); }
+ set { level = (value ? maxLevel : minLevel); }
+ }
+
+ public override int level
+ {
+ get { return _level; }
+ set
+ {
+ int newValue = value;
+ if (newValue > maxLevel) {
+ newValue = maxLevel;
+ } else {
+ if (newValue < minLevel) { newValue = minLevel; }
+ }
+ if (id > 0) // Only send when a valid ID is found
+ {
+ ReportPendingRequest();
+ // Do something with vera
+ string cmd = "?id=lu_action&DeviceNum="+id.ToString() +
+ "&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget" +
+ "&newLoadlevelTarget=" + value;
+ _vera.DoVeraCommandRequest(cmd, ReportRequestError);
+ }
+ _level = newValue;
+ }
+ }
+
+ public override int maxLevel
+ {
+ get { return 100; }
+ set { }
+ }
+
+ public override string ToString()
+ {
+ return name + " [" + GetStatusText() + "]";
+ }
+
+ public override bool isControllable
+ {
+ get { return true; }
+ set { }
+ }
+
+ public override string GetIconName()
+ {
+ string leveltxt = "0";
+ if (level > 0) { leveltxt = "25"; }
+ if (level > 25) { leveltxt = "50"; }
+ if (level > 50) { leveltxt = "75"; }
+ if (level > 75) { leveltxt = "100"; }
+
+ return "Dimmable_Light_" + leveltxt;
+ }
+
+ public override string GetExtraText()
+ {
+ return (_kwh != "" ? _kwh + "kWh" : "");
+ }
+
+ public override string GetStatusText()
+ {
+ return (status ? level.ToString() + "%" : "Off");
+ }
+ }
}
Modified: trunk/plugins/VeraControl/DeviceDoorlock.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDoorlock.cs 2012-01-28 09:50:54 UTC (rev 4427)
+++ trunk/plugins/VeraControl/DeviceDoorlock.cs 2012-01-28 20:18:43 UTC (rev 4428)
@@ -13,79 +13,78 @@
namespace VeraControl.Properties
{
- /// <summary>
- /// Description of DeviceDoorlock.
- /// </summary>
- public class DeviceDoorlock : DeviceGeneric
- {
- private bool _status = false;
-
- public DeviceDoorlock( XmlNode xn ): base (xn)
- {
- if (xn != null)
- {
- Update(xn);
- }
- }
-
- public override bool Update(XmlNode xn)
- {
- _status = _helper.GetAttrAsBool(xn, "status", _status);
-
- return base.Update(xn);
- }
-
- public override bool status
- {
- get { return _status; }
- set {
- if (id > 0) // Only send when a valid ID is found
- {
- ReportPendingRequest();
- // Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
- "&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget" +
- "&newTargetValue="+(value ? "1" : "0");
- _vera.DoVeraCommandRequest(cmd, ReportRequestError);
- }
- }
- }
-
- public override int level
- {
- get { return (_status ? 1 : 0); }
- set
- {
- status = (value > 0);
- }
- }
-
- public override int maxLevel
- {
- get { return 1; }
- set { }
- }
-
- public override string ToString()
- {
- return name + " [" + GetStatusText() + "]";
- }
-
- public override bool isControllable
- {
- get { return true; }
- set { }
- }
-
- public override string GetIconName()
- {
- return "Door_" + (_status ? "LOCKED" : "UNLOCKED");
- }
-
- public override string GetStatusText()
- {
- return (status ? "Locked" : "Unlocked");
- }
-
- }
+ /// <summary>
+ /// Description of DeviceDoorlock.
+ /// </summary>
+ public class DeviceDoorlock : DeviceGeneric
+ {
+ private bool _status = false;
+
+ public DeviceDoorlock( XmlNode xn ): base (xn)
+ {
+ if (xn != null)
+ {
+ Update(xn);
+ }
+ }
+
+ public override bool Update(XmlNode xn)
+ {
+ _status = _helper.GetAttrAsBool(xn, "status", _status);
+
+ return base.Update(xn);
+ }
+
+ public override bool status
+ {
+ get { return _status; }
+ set {
+ if (id > 0) // Only send when a valid ID is found
+ {
+ ReportPendingRequest();
+ // Do something with vera
+ string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ "&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget" +
+ "&newTargetValue="+(value ? "1" : "0");
+ _vera.DoVeraCommandRequest(cmd, ReportRequestError);
+ }
+ }
+ }
+
+ public override int level
+ {
+ get { return (_status ? 1 : 0); }
+ set
+ {
+ status = (value > 0);
+ }
+ }
+
+ public override int maxLevel
+ {
+ get { return 1; }
+ set { }
+ }
+
+ public override string ToString()
+ {
+ return name + " [" + GetStatusText() + "]";
+ }
+
+ public override bool isControllable
+ {
+ get { return true; }
+ set { }
+ }
+
+ public override string GetIconName()
+ {
+ return "Door_" + (_status ? "LOCKED" : "UNLOCKED");
+ }
+
+ public override string GetStatusText()
+ {
+ return (status ? "Locked" : "Unlocked");
+ }
+ }
}
Modified: trunk/plugins/VeraControl/DeviceGWeather.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGWeather.cs 2012-01-28 09:50:54 UTC (rev 4427)
+++ trunk/plugins/VeraControl/DeviceGWeather.cs 2012-01-28 20:18:43 UTC (rev 4428)
@@ -13,49 +13,50 @@
namespace VeraControl.Properties
{
- /// <summary>
- /// Description of DeviceGWeather.
- /// </summary>
- public class DeviceGWeather : DeviceGeneric
- {
- private string _condition = "-";
- private string _windCondition = "-";
-
- public DeviceGWeather(XmlNode xn): base (xn)
- {
- if (xn != null)
- {
- Update(xn);
- }
- }
-
- public override bool Update(XmlNode xn)
- {
- _condition = _helper.GetAttrAsString(xn, "Condition", _condition); // Google Weather Plugin
- _condition = _helper.GetAttrAsString(xn, "condition", _condition); // World Weather plugin
- _windCondition = _helper.GetAttrAsString(xn, "WindCondition", _windCondition);
- _windCondition = _helper.GetAttrAsString(xn, "windcondition", _windCondition);
-
- return base.Update(xn);
- }
-
- public override string ToString()
- {
- return name + " [" + GetStatusText() + "]";
- }
-
- public override string GetStatusText()
- {
- return _condition.Replace("_", " ");
- }
- public override string GetExtraText()
- {
- return _windCondition;
- }
-
- public override string GetIconName()
- {
- return "location";
- }
- }
+ /// <summary>
+ /// Description of DeviceGWeather.
+ /// </summary>
+ public class DeviceGWeather : DeviceGeneric
+ {
+ private string _condition = "-";
+ private string _windCondition = "-";
+
+ public DeviceGWeather(XmlNode xn): base (xn)
+ {
+ if (xn != null)
+ {
+ Update(xn);
+ }
+ }
+
+ public override bool Update(XmlNode xn)
+ {
+ _condition = _helper.GetAttrAsString(xn, "Condition", _condition); // Google Weather Plugin
+ _condition = _helper.GetAttrAsString(xn, "condition", _condition); // World Weather plugin
+ _windCondition = _helper.GetAttrAsString(xn, "WindCondition", _windCondition);
+ _windCondition = _helper.GetAttrAsString(xn, "windcondition", _windCondition);
+
+ return base.Update(xn);
+ }
+
+ public override string ToString()
+ {
+ return name + " [" + GetStatusText() + "]";
+ }
+
+ public override string GetStatusText()
+ {
+ return _condition.Replace("_", " ");
+ }
+
+ public override string GetExtraText()
+ {
+ return _windCondition;
+ }
+
+ public override string GetIconName()
+ {
+ return "location";
+ }
+ }
}
Modified: trunk/plugins/VeraControl/DeviceGeneric.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-28 09:50:54 UTC (rev 4427)
+++ trunk/plugins/VeraControl/DeviceGeneric.cs 2012-01-28 20:18:43 UTC (rev 4428)
@@ -14,132 +14,157 @@
namespace VeraControl.Properties
{
- /// <summary>
- /// Description of DeviceGeneric.
- /// </summary>
- public class DeviceGeneric : BaseDevice
- {
- private string _altId = "";
- private int _category = 0;
-
- public DeviceGeneric(XmlNode xn): base (xn)
- {
- if (xn != null)
- {
- Update(xn);
- }
- }
-
- public override bool Update(XmlNode xn)
- {
- _altId = _helper.GetAttrAsString(xn, "altid", _altId);
- _category = _helper.GetAttrAsInt (xn, "category", _category);
-
- bool b = base.Update(xn);
- // Make sure the room exists
- if (room == 0 || !_vera.status.IsRoomFound(room))
- {
- if (!_vera.status.IsRoomFound(0))
- { // create dummy room to attach to
- _vera.rooms.Add(new Room(null));
- }
- room = 0;
- }
+ /// <summary>
+ /// Description of DeviceGeneric.
+ /// </summary>
+ public class DeviceGeneric : BaseDevice
+ {
+ private string _altId = "";
+ private int _category = 0;
+ private int _stepsize = 0;
+
+ public DeviceGeneric(XmlNode xn): base (xn)
+ {
+ if (xn != null)
+ {
+ Update(xn);
+ if (maxLevel > 0 && minLevel >= 0)
+ {
+ _stepsize = (int)Math.Max(1, Math.Round((decimal)((maxLevel - minLevel) / 10)));
+ }
+ }
+ }
+
+ public override bool Update(XmlNode xn)
+ {
+ _altId = _helper.GetAttrAsString(xn, "altid", _altId);
+ _category = _helper.GetAttrAsInt (xn, "category", _category);
+
+ bool b = base.Update(xn);
+ // Make sure the room exists
+ if (room == 0 || !_vera.status.IsRoomFound(room))
+ {
+ if (!_vera.status.IsRoomFound(0))
+ { // create dummy room to attach to
+ _vera.rooms.Add(new Room(null));
+ }
+ room = 0;
+ }
+ return b;
+ }
+
+ public string altid
+ {
+ get { return _altId; }
+ }
+
+ public int category
+ {
+ get { return _category; }
+ }
+
+ public virtual bool isControllable
+ {
+ get { return false; }
+ set { }
+ }
+
+ public virtual bool status
+ {
+ get { return false; }
+ set { }
+ }
+
+ public virtual int level
+ {
+ get { return 0; }
+ set { }
+ }
- return b;
- }
-
- public string altid
- {
- get { return _altId; }
- set { }
- }
-
- public int category
- {
- get { return _category; }
- set { }
- }
-
- public virtual bool isControllable
- {
- get { return false; }
- set { }
- }
-
- public virtual bool status
- {
- get { return false; }
- set { }
- }
-
- public virtual int level
- {
- get { return 0; }
- set { }
- }
-
- public virtual string mode
- {
- get { return ""; }
- set { }
- }
-
- public virtual int maxLevel
- {
- get { return -1; }
- set { }
- }
- public virtual int minLevel
- {
- get { return 0; }
- set { }
- }
-
- public override string GetIconName()
- {
- return "generic_sensor";
- }
-
- public override string GetStatusText()
- {
- return "";
- }
-
- public virtual string GetExtraText()
- {
- return "";
- }
+ public virtual int stepSize
+ {
+ get { return _stepsize; }
+ set { _stepsize = value; }
+ }
- public virtual string [] GetCommands()
- {
- return new string [] {"Off", "On"};
- }
-
- // Overridables for Cam Device
- public virtual void MoveUp()
- {
- // do nothing
- }
- public virtual void MoveLeft()
- {
- // do nothing
- }
- public virtual void Move...
[truncated message content] |
|
From: <Ba...@us...> - 2012-02-02 20:07:18
|
Revision: 4436
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4436&view=rev
Author: BartEv
Date: 2012-02-02 20:07:07 +0000 (Thu, 02 Feb 2012)
Log Message:
-----------
version 0.9.0.3
- Show device status of selected item also on main screen,
- Added the ability to show devices automatically when selecting a new room (= extra config option)
- bug fix: wrong scene dialog was shown in DefautWide skin
Modified Paths:
--------------
trunk/plugins/VeraControl/DeviceSystem.cs
trunk/plugins/VeraControl/DialogDeviceControl.cs
trunk/plugins/VeraControl/DialogSceneControl.cs
trunk/plugins/VeraControl/VeraCommunication.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraSetupForm.Designer.cs
trunk/plugins/VeraControl/VeraSetupForm.cs
trunk/plugins/VeraControl/releases/VeraControl.xmp2
trunk/plugins/VeraControl/releases/update.xml
trunk/plugins/VeraControl/skin/Default/VeraControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraControl.xml
Added Paths:
-----------
trunk/plugins/VeraControl/releases/VeraControl_v0.9.0.3.mpe1
Modified: trunk/plugins/VeraControl/DeviceSystem.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSystem.cs 2012-02-02 11:43:11 UTC (rev 4435)
+++ trunk/plugins/VeraControl/DeviceSystem.cs 2012-02-02 20:07:07 UTC (rev 4436)
@@ -80,6 +80,14 @@
{
_fullReload = true;
}
+
+ public bool FullReloadWaitingAndClearFlag()
+ {
+ // Invoking this method will clear the update ready flag -> so caller need to handle the update
+ bool b = fullReload;
+ ClearFullReloadFlag();
+ return b;
+ }
public bool fullReload
{
get { return _fullReload; }
Modified: trunk/plugins/VeraControl/DialogDeviceControl.cs
===================================================================
--- trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-02-02 11:43:11 UTC (rev 4435)
+++ trunk/plugins/VeraControl/DialogDeviceControl.cs 2012-02-02 20:07:07 UTC (rev 4436)
@@ -77,14 +77,16 @@
return Load(GUIGraphicsContext.Skin + @"\VeraDialogDeviceControl.xml");
}
- public void InitDialog(string headerText, DeviceGeneric dev)
+ public void ShowDialog(string headerText, DeviceGeneric dev)
{
+ Reset();
//LoadSkin();
AllocResources();
InitControls();
_lblHeading.Label = headerText;
_myDev = dev;
+
//Clean up the old camUpdateThread (if not finished yet)
if (_camUpdater != null)
{
@@ -121,6 +123,7 @@
_imgLogo.Visibility = System.Windows.Visibility.Hidden;
StartCamImageUpdater(((DeviceCam)dev).imgUrl);
}
+ DoModal(GUIWindowManager.ActiveWindow);
}
public void UpdateStatus()
Modified: trunk/plugins/VeraControl/DialogSceneControl.cs
===================================================================
--- trunk/plugins/VeraControl/DialogSceneControl.cs 2012-02-02 11:43:11 UTC (rev 4435)
+++ trunk/plugins/VeraControl/DialogSceneControl.cs 2012-02-02 20:07:07 UTC (rev 4436)
@@ -51,8 +51,9 @@
return Load(GUIGraphicsContext.Skin + @"\VeraDialogSceneControl.xml");
}
- public void InitDialog(string headerText, Scene scene)
+ public void ShowDialog(string headerText, Scene scene)
{
+ Reset();
//LoadSkin();
AllocResources();
InitControls();
@@ -61,6 +62,7 @@
_myScene = scene;
UpdateStatus();
+ DoModal(GUIWindowManager.ActiveWindow);
}
public void UpdateStatus()
Modified: trunk/plugins/VeraControl/VeraCommunication.cs
===================================================================
--- trunk/plugins/VeraControl/VeraCommunication.cs 2012-02-02 11:43:11 UTC (rev 4435)
+++ trunk/plugins/VeraControl/VeraCommunication.cs 2012-02-02 20:07:07 UTC (rev 4436)
@@ -360,11 +360,11 @@
else
{
ParseUpdateInfo(e.Result);
- // WebClient wc = new WebClient();
- // if (_status.system.dataversion == "0")
- // {
- //ParseUpdateInfo( wc.DownloadString(@"C:\Users\Bart\Documents\SharpDevelop Projects\VeraControl\testdata\text.xml"));
- // }
+// WebClient wc = new WebClient();
+// if (_status.system.dataversion == "0")
+// {
+// ParseUpdateInfo( wc.DownloadString(@"C:\Users\Bart\Documents\SharpDevelop Projects\VeraControl\testdata\text.xml"));
+// }
}
}
@@ -407,6 +407,7 @@
{
// We have a full refresh -> Clear all lists (to get clear of removed devices/scenes/catgories/rooms/etc...)
_status.ClearAllLists();
+
}
// Process Sections
@@ -568,7 +569,6 @@
_status.devices.Add(new DeviceSprinkler(xn));
break;
}
- /* Falltrough */
_status.devices.Add(new DeviceGeneric(xn));
break;
}
Modified: trunk/plugins/VeraControl/VeraControl.cs
===================================================================
--- trunk/plugins/VeraControl/VeraControl.cs 2012-02-02 11:43:11 UTC (rev 4435)
+++ trunk/plugins/VeraControl/VeraControl.cs 2012-02-02 20:07:07 UTC (rev 4436)
@@ -81,30 +81,34 @@
/// </summary>
public class VeraControl : GUIInternalWindow, ISetupForm
{
- [SkinControlAttribute(10)] protected GUILabelControl _title = null;
- [SkinControl(20)] protected GUISpinButton _catList = null;
- [SkinControl(40)] protected GUIListControl _leftList = null;
- [SkinControl(50)] protected GUIListControl _rightList = null;
- [SkinControl(60)] protected GUIButtonControl _actionButton = null;
- [SkinControl(70)] protected GUIToggleButtonControl _actionTriggerButton = null;
+ [SkinControlAttribute(10)] protected GUILabelControl _title = null;
+ [SkinControl(20)] protected GUISpinButton _catList = null;
+ [SkinControl(40)] protected GUIListControl _leftList = null;
+ [SkinControl(50)] protected GUIListControl _rightList = null;
+ [SkinControl(60)] protected GUIButtonControl _actionButton = null;
+ [SkinControl(70)] protected GUIToggleButtonControl _actionTriggerButton = null;
- [SkinControl(30)] protected GUIImage _cmtImage = null;
- [SkinControlAttribute(31)] protected GUILabelControl _comment = null;
+ [SkinControl(30)] protected GUIImage _systemStatusImage = null;
+ [SkinControlAttribute(31)] protected GUILabelControl _systemStatusText = null;
+ [SkinControl(32)] protected GUIImage _deviceStatusImage = null;
+ [SkinControlAttribute(33)] protected GUILabelControl _deviceStatusText = null;
- const int ALL = Int16.MaxValue;
- const int NO_SCENE_SELECTED = Int16.MaxValue;
+ const int ALL = Int16.MaxValue;
+ const int NO_SCENE_SELECTED = Int16.MaxValue;
+ private int _pluginID = 1972;
+ private VeraCommunication _vera = VeraCommunication.Instance;
- private int _pluginID = 1972;
- private VeraCommunication _vera = VeraCommunication.Instance;
- private int _selectedRoom = ALL;
- private int _selectedCategory = ALL;
- public Actiontrigger _lastAction = Actiontrigger.LAST_ACTIONTRIGGER;
- private VeraHelper _helper = new VeraHelper();
+ private int _selectedRoom = ALL;
+ private int _selectedCategory = ALL;
+ public Actiontrigger _lastAction = Actiontrigger.LAST_ACTIONTRIGGER;
+ private VeraHelper _helper = new VeraHelper();
+ private int _lastSelectedItemId = 0;
- public bool _enableSceneTrigger = false;
- private bool _lastUpdateFailed = false;
- private string _titleTxt = "Micasa Verde - Vera control";
+ public bool _enableSceneTrigger = false;
+ private bool _autoSelectRoom = true;
+ private bool _lastUpdateFailed = false;
+ private string _titleTxt = "Micasa Verde - Vera control";
public VeraControl()
{
@@ -201,7 +205,8 @@
using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
{
- _enableSceneTrigger = xmlreader.GetValueAsBool("veracontroller", "enableSceneTrigger", false);
+ _enableSceneTrigger = xmlreader.GetValueAsBool("veracontroller", "enableSceneTrigger", false);
+ _autoSelectRoom = xmlreader.GetValueAsBool("veracontroller", "AutoSelectRoom", true);
}
GUIWindowManager.OnNewAction += new OnActionHandler(OnNewAction);
@@ -223,6 +228,7 @@
handleActionTriggers(Actiontrigger.MP_START_UP);
}
}).Start();
+
return Load(GUIGraphicsContext.Skin+@"\VeraControl.xml");
}
@@ -305,10 +311,16 @@
{
switch(action.wID)
{
+ case Action.ActionType.ACTION_MOUSE_MOVE:
+ break;
+
case Action.ActionType.ACTION_CONTEXT_MENU:
case Action.ActionType.ACTION_SHOW_INFO:
showInfoDialog();
break;
+
+ default:
+ break;
}
}
}
@@ -510,13 +522,32 @@
_vera.UpdateCurrentStatus();
refreshNow();
+ // Auto update right side list
+ if (_autoSelectRoom && (_selectedRoom != _leftList.SelectedListItem.ItemId))
+ {
+ OnLeftlistCrtl(_leftList);
+ }
+
base.Render(timePassed);
}
public void refreshNow()
{
- if (_vera.NewScreenUpdateWaitingAndClearFlag())
+ int selectedItem = 0;
+ if (_rightList.SelectedListItem != null)
+ { // Prevent Eception in case we have an empty room
+ selectedItem = _rightList.SelectedListItem.ItemId;
+ }
+ else if (_lastSelectedItemId != 0)
{
+ // Clear message if we have an empty list for the first time
+ setDeviceStatus(DevState.NONE, "");
+ }
+ bool newSelectedItem = (selectedItem != _lastSelectedItemId) && (selectedItem != 0);
+ _lastSelectedItemId = selectedItem;
+
+ if (_vera.NewScreenUpdateWaitingAndClearFlag() || newSelectedItem)
+ {
// update system status
if (_vera.status.system.NewScreenUpdateWaitingAndClearFlag())
{
@@ -524,7 +555,7 @@
}
// if full reload has been found rebuild lists
- if (_vera.status.system.fullReload ) {
+ if (_vera.status.system.FullReloadWaitingAndClearFlag() ) {
listRooms(_selectedCategory, _selectedRoom);
if (_selectedRoom == ALL) {
listScenes(ALL);
@@ -540,7 +571,7 @@
if (item.ItemId > 0)
{ // ItemId > 0 so we have a device
DeviceGeneric dev = _vera.status.GetDeviceById(item.ItemId);
- if (dev.NewScreenUpdateWaitingAndClearFlag())
+ if (dev.NewScreenUpdateWaitingAndClearFlag() || (newSelectedItem && _lastSelectedItemId == item.ItemId))
{
fillinDeviceInfo(item, dev);
}
@@ -548,7 +579,7 @@
else
{ // ItemId < 0 so we have a scene
Scene scene = _vera.status.GetSceneById((item.ItemId * -1));
- if (scene.NewScreenUpdateWaitingAndClearFlag())
+ if (scene.NewScreenUpdateWaitingAndClearFlag() || (newSelectedItem && _lastSelectedItemId == item.ItemId))
{
fillinSceneInfo(item, scene);
}
@@ -583,17 +614,31 @@
private void setSystemStatus()
{
if (_vera.status.system.state != DevState.NONE) {
- _cmtImage.Dispose();
- _cmtImage.SetFileName(_helper.GetStateImage(_vera.status.system.state));
- _cmtImage.KeepAspectRatio = true;
- _cmtImage.Visibility = System.Windows.Visibility.Visible;
- _cmtImage.AllocResources();
+ _systemStatusImage.Dispose();
+ _systemStatusImage.SetFileName(_helper.GetStateImage(_vera.status.system.state));
+ _systemStatusImage.KeepAspectRatio = true;
+ _systemStatusImage.Visibility = System.Windows.Visibility.Visible;
+ _systemStatusImage.AllocResources();
} else{
- _cmtImage.Visibility = System.Windows.Visibility.Hidden;
+ _systemStatusImage.Visibility = System.Windows.Visibility.Hidden;
}
- _comment.Label = _vera.status.system.comment;
-
+ _systemStatusText.Label = _vera.status.system.comment;
}
+
+ private void setDeviceStatus(DevState state, string text)
+ {
+ if (state != DevState.NONE) {
+ _deviceStatusImage.Dispose();
+ _deviceStatusImage.SetFileName(_helper.GetStateImage(state));
+ _deviceStatusImage.KeepAspectRatio = true;
+ _deviceStatusImage.Visibility = System.Windows.Visibility.Visible;
+ _deviceStatusImage.AllocResources();
+ } else{
+ _deviceStatusImage.Visibility = System.Windows.Visibility.Hidden;
+ }
+ _deviceStatusText.Label = text;
+ }
+
private void listCategories()
{
@@ -689,6 +734,11 @@
item.ThumbnailImage = "Vera\\" + scene.GetIconName() + ".png";
Utils.SetDefaultIcons(item);
+
+ if (_lastSelectedItemId == (scene.id * -1))
+ {
+ setDeviceStatus(scene.commstate, scene.comment);
+ }
}
private void listDevices(int selectedRoom)
@@ -720,6 +770,11 @@
item.ThumbnailImage = "Vera\\" + dev.GetIconName() + ".png";
Utils.SetDefaultIcons(item);
+
+ if (_lastSelectedItemId == dev.id)
+ {
+ setDeviceStatus(dev.commstate, dev.comment);
+ }
}
private void OnLeftlistCrtl(GUIListControl control)
@@ -775,16 +830,15 @@
break;
case Action.ActionType.ACTION_SELECT_ITEM:
- DialogSceneControl dlg = (DialogSceneControl)GUIWindowManager.GetWindow((int)1975);
- dlg.InitDialog("Scene control", scene);
- dlg.DoModal(GUIWindowManager.ActiveWindow);
+ DialogSceneControl sceneDlg = (DialogSceneControl)GUIWindowManager.GetWindow((int)1975);
+ sceneDlg.ShowDialog("Scene control", scene);
break;
}
}
}
else
{ // We have a device as selected item
- DeviceGeneric dev = _vera.status.GetDeviceById(control.SelectedListItem.ItemId);
+ DeviceGeneric dev = _vera.status.GetDeviceById(control.SelectedListItem.ItemId);
switch (actionType)
{
@@ -807,9 +861,8 @@
break;
case Action.ActionType.ACTION_SELECT_ITEM:
- DialogDeviceControl dlg = (DialogDeviceControl)GUIWindowManager.GetWindow((int)1973);
- dlg.InitDialog(_vera.status.GetRoomById(dev.room).name, dev);
- dlg.DoModal(GUIWindowManager.ActiveWindow);
+ DialogDeviceControl deviceDlg = (DialogDeviceControl)GUIWindowManager.GetWindow((int)1973);
+ deviceDlg.ShowDialog(_vera.status.GetRoomById(dev.room).name, dev);
break;
}
}
@@ -875,7 +928,7 @@
"When navigating through the right side menu the following RC keys are available:\n" +
" [Play] will run the selected scene\n" +
" [Next]/[Prev] will switch off/on the selected device\n" +
- " [Fwd] / [Rew] will decrease/increase the level of the selected devive\n" +
+ " [Fwd] / [Rwd] will decrease/increase the level of the selected devive\n" +
" [i] show this info panel");
dlg.DoModal(GUIWindowManager.ActiveWindow);
}
Modified: trunk/plugins/VeraControl/VeraSetupForm.Designer.cs
===================================================================
--- trunk/plugins/VeraControl/VeraSetupForm.Designer.cs 2012-02-02 11:43:11 UTC (rev 4435)
+++ trunk/plugins/VeraControl/VeraSetupForm.Designer.cs 2012-02-02 20:07:07 UTC (rev 4436)
@@ -48,6 +48,7 @@
this.portnumber = new System.Windows.Forms.TextBox();
this.refreshdelay = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
+ this.autoSelectRoom = new System.Windows.Forms.CheckBox();
this.enableSceneTrigger = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
@@ -57,7 +58,7 @@
// btnOK
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.btnOK.Location = new System.Drawing.Point(31, 297);
+ this.btnOK.Location = new System.Drawing.Point(31, 345);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 12;
@@ -69,7 +70,7 @@
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
- this.btnCancel.Location = new System.Drawing.Point(231, 297);
+ this.btnCancel.Location = new System.Drawing.Point(231, 345);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 13;
@@ -273,16 +274,28 @@
//
// groupBox2
//
+ this.groupBox2.Controls.Add(this.autoSelectRoom);
this.groupBox2.Controls.Add(this.enableSceneTrigger);
this.groupBox2.Controls.Add(this.refreshdelay);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Location = new System.Drawing.Point(12, 203);
this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(309, 82);
+ this.groupBox2.Size = new System.Drawing.Size(309, 110);
this.groupBox2.TabIndex = 8;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Plug in settings";
//
+ // autoSelectRoom
+ //
+ this.autoSelectRoom.Checked = true;
+ this.autoSelectRoom.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.autoSelectRoom.Location = new System.Drawing.Point(20, 77);
+ this.autoSelectRoom.Name = "autoSelectRoom";
+ this.autoSelectRoom.Size = new System.Drawing.Size(270, 24);
+ this.autoSelectRoom.TabIndex = 12;
+ this.autoSelectRoom.Text = "Show devices in selected room immediately";
+ this.autoSelectRoom.UseVisualStyleBackColor = true;
+ //
// enableSceneTrigger
//
this.enableSceneTrigger.Location = new System.Drawing.Point(20, 47);
@@ -307,7 +320,7 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
- this.ClientSize = new System.Drawing.Size(332, 332);
+ this.ClientSize = new System.Drawing.Size(332, 380);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnCancel);
@@ -322,6 +335,7 @@
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
}
+ private System.Windows.Forms.CheckBox autoSelectRoom;
private System.Windows.Forms.Button buttonFind;
private System.Windows.Forms.RadioButton radioLocal;
private System.Windows.Forms.RadioButton radioRemote;
Modified: trunk/plugins/VeraControl/VeraSetupForm.cs
===================================================================
--- trunk/plugins/VeraControl/VeraSetupForm.cs 2012-02-02 11:43:11 UTC (rev 4435)
+++ trunk/plugins/VeraControl/VeraSetupForm.cs 2012-02-02 20:07:07 UTC (rev 4436)
@@ -47,10 +47,11 @@
{
using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
{
- IPaddress.Text = xmlreader.GetValueAsString("veracontroller", "ipaddress", "127.0.0.1");
- portnumber.Text = xmlreader.GetValueAsString("veracontroller", "portnumber", " 3480");
- refreshdelay.Text = xmlreader.GetValueAsString("veracontroller", "maxrefreshdelay", "60");
- enableSceneTrigger.Checked = xmlreader.GetValueAsBool("veracontroller", "enableSceneTrigger", false);
+ IPaddress.Text = xmlreader.GetValueAsString("veracontroller", "ipaddress", "127.0.0.1");
+ portnumber.Text = xmlreader.GetValueAsString("veracontroller", "portnumber", "3480");
+ refreshdelay.Text = xmlreader.GetValueAsString("veracontroller", "maxrefreshdelay", "60");
+ enableSceneTrigger.Checked = xmlreader.GetValueAsBool("veracontroller", "enableSceneTrigger", false);
+ autoSelectRoom.Checked = xmlreader.GetValueAsBool("veracontroller", "AutoSelectRoom", true);
radioRemote.Checked = xmlreader.GetValueAsBool("veracontroller", "remoteConnected", false);
radioLocal.Checked = !radioRemote.Checked;
@@ -67,16 +68,17 @@
{
using (MediaPortal.Profile.Settings xmlWriter = new MediaPortal.Profile.MPSettings())
{
- xmlWriter.SetValue("veracontroller", "ipaddress", IPaddress.Text);
- xmlWriter.SetValue("veracontroller", "portnumber", portnumber.Text);
- xmlWriter.SetValue("veracontroller", "maxrefreshdelay", refreshdelay.Text);
+ xmlWriter.SetValue("veracontroller", "ipaddress", IPaddress.Text);
+ xmlWriter.SetValue("veracontroller", "portnumber", portnumber.Text);
+ xmlWriter.SetValue("veracontroller", "maxrefreshdelay", refreshdelay.Text);
xmlWriter.SetValueAsBool("veracontroller", "enableSceneTrigger", enableSceneTrigger.Checked);
+ xmlWriter.SetValueAsBool("veracontroller", "AutoSelectRoom", autoSelectRoom.Checked);
xmlWriter.SetValueAsBool("veracontroller", "remoteConnected", radioRemote.Checked);
- xmlWriter.SetValue("veracontroller", "miosusername", Username.Text);
- xmlWriter.SetValue("veracontroller", "miospassword", Password.Text);
- xmlWriter.SetValue("veracontroller", "serialnumber", SerialNumber.Text);
+ xmlWriter.SetValue("veracontroller", "miosusername", Username.Text);
+ xmlWriter.SetValue("veracontroller", "miospassword", Password.Text);
+ xmlWriter.SetValue("veracontroller", "serialnumber", SerialNumber.Text);
}
}
Modified: trunk/plugins/VeraControl/releases/VeraControl.xmp2
===================================================================
--- trunk/plugins/VeraControl/releases/VeraControl.xmp2 2012-02-02 11:43:11 UTC (rev 4435)
+++ trunk/plugins/VeraControl/releases/VeraControl.xmp2 2012-02-02 20:07:07 UTC (rev 4436)
@@ -62,7 +62,7 @@
<FileItem InstallType="CopyFile" SystemFile="false" Modified="true">
<Param1 />
<UpdateOption>OverwriteIfOlder</UpdateOption>
- <LocalFileName>..\skin\Default\VeraDialogSceneControl.xml</LocalFileName>
+ <LocalFileName>..\skin\DefaultWide\VeraDialogSceneControl.xml</LocalFileName>
<ZipFileName>Installer{CopyFile}\{cced0cd3-b45e-4cf1-af86-d268fa728b06}-VeraDialogSceneControl.xml</ZipFileName>
<DestinationFilename>%Skin%\DefaultWide\VeraDialogSceneControl.xml</DestinationFilename>
</FileItem>
@@ -865,7 +865,7 @@
<Major>0</Major>
<Minor>9</Minor>
<Build>0</Build>
- <Revision>2</Revision>
+ <Revision>3</Revision>
</Version>
<ExtensionDescription>Control your Vera controller from MediaPortal.
@@ -885,37 +885,53 @@
- Vera 2 v1.1.1267
+ - Vera 2 v1.1.1362
+
- Vera 2 v1.5.255
-
-
-
-
-
-
-
-
-
-
</ExtensionDescription>
<VersionDescription>[9.0.0.1]
+
- Real time Vera status update
+
-Threated communication (no-screen-lockups)
+
- IP Cam support
+
- Improved error handling
+
- Improved Cam image updater
+
- Clean up code (coding standard complience)
+
- Supports remote connection (via fwd1.mios.com)
+
- New image set
+
- Improved config screen (Vera-box look)
+
- first: stable release
-[9.0.0.2]
+
+
+[0.9.0.2]
+
- Added a help screen (! button = context menu)
-- Added RC commands to control devices/scenes without the need of opening the dialog</VersionDescription>
+
+- Added RC commands to control devices/scenes without the need of opening the dialog
+
+
+
+[0.9.0.3]
+
+ - Show device status of selected item also on main screen,
+
+ - Added the ability to show devices automatically when selecting a new room (= extra config option)
+
+ - bug fix: wrong scene dialog was shown in DefautWide skin</VersionDescription>
<DevelopmentStatus>Stable</DevelopmentStatus>
- <OnlineLocation>https://mp-plugins.svn.sourceforge.net/svnroot/mp-plugins/trunk/plugins/VeraControl/releases/VeraControl_v0.9.0.2.mpe1</OnlineLocation>
- <ReleaseDate>2012-01-28T22:51:05</ReleaseDate>
+ <OnlineLocation>https://mp-plugins.svn.sourceforge.net/svnroot/mp-plugins/trunk/plugins/VeraControl/releases/VeraControl_v0.9.0.3.mpe1</OnlineLocation>
+ <ReleaseDate>2012-01-30T22:51:05</ReleaseDate>
<Tags>home automation,
z-wave,
micasaverde,
@@ -1007,10 +1023,17 @@
<FileItem InstallType="CopyFile" SystemFile="false" Modified="true">
<Param1 />
<UpdateOption>OverwriteIfOlder</UpdateOption>
- <LocalFileName>..\skin\Default\VeraDialogSceneControl.xml</LocalFileName>
+ <LocalFileName>..\skin\DefaultWide\VeraDialogSceneControl.xml</LocalFileName>
<ZipFileName>Installer{CopyFile}\{cced0cd3-b45e-4cf1-af86-d268fa728b06}-VeraDialogSceneControl.xml</ZipFileName>
<DestinationFilename>%Skin%\DefaultWide\VeraDialogSceneControl.xml</DestinationFilename>
</FileItem>
+ <FileItem InstallType="CopyFile" SystemFile="false" Modified="true">
+ <Param1 />
+ <UpdateOption>OverwriteIfOlder</UpdateOption>
+ <LocalFileName>..\skin\Default\VeraDialogSceneControl.xml</LocalFileName>
+ <ZipFileName>Installer{CopyFile}\{77a408e1-11da-4375-83bb-6b197c362f88}-VeraDialogSceneControl.xml</ZipFileName>
+ <DestinationFilename>%Skin%\Default\VeraDialogSceneControl.xml</DestinationFilename>
+ </FileItem>
<FileItem InstallType="CopyFile" SystemFile="false" Modified="false">
<Param1 />
<UpdateOption>OverwriteIfOlder</UpdateOption>
Added: trunk/plugins/VeraControl/releases/VeraControl_v0.9.0.3.mpe1
===================================================================
(Binary files differ)
Property changes on: trunk/plugins/VeraControl/releases/VeraControl_v0.9.0.3.mpe1
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/plugins/VeraControl/releases/update.xml
===================================================================
--- trunk/plugins/VeraControl/releases/update.xml 2012-02-02 11:43:11 UTC (rev 4435)
+++ trunk/plugins/VeraControl/releases/update.xml 2012-02-02 20:07:07 UTC (rev 4436)
@@ -1177,5 +1177,152 @@
</ProjectSettings>
<IsSkin>false</IsSkin>
</PackageClass>
+ <PackageClass>
+ <Version>2.0</Version>
+ <Groups>
+ <Items>
+ <GroupItem Name="Default">
+ <DisplayName>Default</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>Default</Description>
+ <Files>
+ <Items />
+ </Files>
+ </GroupItem>
+ <GroupItem Name="IconsDefault">
+ <DisplayName>IconsDefault</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>IconsDefault</Description>
+ <Files>
+ <Items />
+ </Files>
+ </GroupItem>
+ <GroupItem Name="IconsDefaultWide">
+ <DisplayName>IconsDefaultWide</DisplayName>
+ <DefaulChecked>true</DefaulChecked>
+ <Description>IconsDefaultWide</Description>
+ <Files>
+ <Items />
+ </Files>
+ </GroupItem>
+ </Items>
+ </Groups>
+ <Sections>
+ <Items />
+ </Sections>
+ <Dependencies>
+ <Items>
+ <DependencyItem>
+ <Type>MediaPortal</Type>
+ <Id />
+ <MinVersion>
+ <Major>1</Major>
+ <Minor>1</Minor>
+ <Build>6</Build>
+ <Revision>27644</Revision>
+ </MinVersion>
+ <MaxVersion>
+ <Major>1</Major>
+ <Minor>1</Minor>
+ <Build>6</Build>
+ <Revision>27644</Revision>
+ </MaxVersion>
+ <WarnOnly>false</WarnOnly>
+ <Message>requires MediaPortal version 1.1.6.27644 to 1.1.6.27644</Message>
+ <Name>MediaPortal</Name>
+ </DependencyItem>
+ </Items>
+ </Dependencies>
+ <PluginDependencies>
+ <Items>
+ <PluginDependencyItem AssemblyName="VeraControl.dll">
+ <CompatibleVersion>
+ <Items>
+ <CompatibleVersio...
[truncated message content] |
|
From: <Ba...@us...> - 2012-02-17 23:12:58
|
Revision: 4456
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4456&view=rev
Author: BartEv
Date: 2012-02-17 23:12:46 +0000 (Fri, 17 Feb 2012)
Log Message:
-----------
- Added multi box support
- Added fallback to remote connectionType
- Move scene trigger to side action menu
- Added sort options
- Added filter options
- Add vie by category option
Modified Paths:
--------------
trunk/plugins/VeraControl/BaseDevice.cs
trunk/plugins/VeraControl/DevCategories.cs
trunk/plugins/VeraControl/DeviceCam.cs
trunk/plugins/VeraControl/DeviceDimmer.cs
trunk/plugins/VeraControl/DeviceDoorlock.cs
trunk/plugins/VeraControl/DeviceGWeather.cs
trunk/plugins/VeraControl/DeviceGeneric.cs
trunk/plugins/VeraControl/DeviceHumidity.cs
trunk/plugins/VeraControl/DeviceLightSensor.cs
trunk/plugins/VeraControl/DevicePowerMeter.cs
trunk/plugins/VeraControl/DeviceSceneController.cs
trunk/plugins/VeraControl/DeviceSecurity.cs
trunk/plugins/VeraControl/DeviceSprinkler.cs
trunk/plugins/VeraControl/DeviceSwitch.cs
trunk/plugins/VeraControl/DeviceSystem.cs
trunk/plugins/VeraControl/DeviceTemperature.cs
trunk/plugins/VeraControl/DeviceThermostat.cs
trunk/plugins/VeraControl/DeviceWindowCovering.cs
trunk/plugins/VeraControl/DialogActionTrigger.cs
trunk/plugins/VeraControl/DialogDeviceControl.cs
trunk/plugins/VeraControl/Room.cs
trunk/plugins/VeraControl/Scene.cs
trunk/plugins/VeraControl/Section.cs
trunk/plugins/VeraControl/VeraCommunication.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraControl.csproj
trunk/plugins/VeraControl/VeraSetupForm.Designer.cs
trunk/plugins/VeraControl/VeraSetupForm.cs
trunk/plugins/VeraControl/skin/Default/VeraControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraControl.xml
Modified: trunk/plugins/VeraControl/BaseDevice.cs
===================================================================
--- trunk/plugins/VeraControl/BaseDevice.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/BaseDevice.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -18,22 +18,23 @@
/// </summary>
public class BaseDevice
{
- private long _lastUpdate = 0;
- private long _lastPendingUpdate = 0;
- private bool _screenUpdateRequired = false;
- private string _name = "unknown device";
- private int _id = 0;
- private int _room = 0;
+ private long _lastUpdate = 0;
+ private long _lastPendingUpdate = 0;
+ private bool _screenUpdateRequired = false;
+ private string _name = "unknown device";
+ private int _id = 0;
+ private int _room = 0;
// not connected (-2), none (-1), pending (0,1,5,6), success(4), error (2,3)
- private DevState _dsState = DevState.NONE;
- private string _comment = ""; // red(error), green(success) or blue(pending) - icon/text
+ private DevState _dsState = DevState.NONE;
+ private string _comment = ""; // red(error), green(success) or blue(pending) - icon/text
- public VeraHelper _helper = VeraHelper.Instance;
- public VeraCommunication _vera = VeraCommunication.Instance;
+ public VeraHelper _helper = VeraHelper.Instance;
+ public VeraBox _myVeraBox = null;
- public BaseDevice(XmlNode xn)
+ public BaseDevice(XmlNode xn, int veraid)
{
+ _myVeraBox = VeraCommunication.Instance.boxes[veraid];
if (xn != null)
{
Update(xn);
@@ -49,7 +50,7 @@
_id = _helper.GetAttrAsInt (xn, "id", _id);
_room = _helper.GetAttrAsInt (xn, "room", _room);
_comment = _helper.GetAttrAsString(xn, "comment", _comment );
- _dsState = _helper.ToDevState(_helper.GetAttrAsInt(xn, "state", -1));
+ _dsState = _helper.ToDevState (_helper.GetAttrAsInt(xn, "state", -1));
if (_id == 0)
{
@@ -57,6 +58,16 @@
return false;
}
+ if (room == _myVeraBox.zeroId || !_myVeraBox.status.IsRoomFound(room))
+ {
+ room = _myVeraBox.zeroId;
+ if (!_myVeraBox.status.IsRoomFound(room))
+ { // create dummy room to attach to
+ _myVeraBox.rooms.Add(new Room(null, _myVeraBox.myId));
+ _myVeraBox.rooms[_myVeraBox.rooms.Count - 1].section = _myVeraBox.rooms[0].section;
+ }
+ }
+
// Set update flag
screenUpdateRequired = true;
lastUpdate = DateTime.Now.Ticks;
@@ -75,37 +86,69 @@
public int id
{
- get { return _id; }
- set { }
+ get
+ {
+ if (_myVeraBox == null)
+ {
+ return 0;
+ }
+ return (VeraCommunication.IDMASK * _myVeraBox.myId) + _id;
+ }
}
+ public int internalId
+ {
+ get { return _id; }
+ }
+
+ /// <summary>
+ /// Unique id based on Vera's serial id, so wil also stand on vera config/id changes. Should be used when id is stored over MP session (like in config files)
+ /// </summary>
+ public long configChangeProofId
+ {
+ get
+ {
+ if (_myVeraBox == null)
+ {
+ return 0;
+ }
+ return (long)((long)VeraCommunication.IDMASK * (long)_myVeraBox.status.system.serialno) + (long)_id;
+ }
+ }
+
public string name
{
- get { return _name; }
- set { }
+ get { return _name; }
}
public bool InRoom(int id)
{
- return (_room == id);
+ return (room == id);
}
public int room
{
- get { return _room; }
- set { _room = value; }
+ get {
+ if (_myVeraBox == null)
+ {
+ return 0;
+ }
+ return _room + (VeraCommunication.IDMASK * _myVeraBox.myId);
+ }
+ set
+ {
+ _room = value % VeraCommunication.IDMASK;
+ }
}
public DevState commstate
{
get { return _dsState; }
- set { }
}
public string comment
{
get { return (commstate != DevState.NONE ? _comment : ""); }
- set { }
}
public bool screenUpdateRequired
@@ -114,7 +157,7 @@
set {
if (value)
{ // If at least one device report screen update required, Vera should take over this report
- _vera.setScreenUpdateRequired();
+ _myVeraBox.setScreenUpdateRequired();
}
_screenUpdateRequired = value;
}
Modified: trunk/plugins/VeraControl/DevCategories.cs
===================================================================
--- trunk/plugins/VeraControl/DevCategories.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DevCategories.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -4,8 +4,8 @@
* Date: 22-12-2011
* Time: 14:14
*
- * Copyright: 2012 GPL - Bart Eversdijk
- * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
* E-mail: ba...@ev...
*/
using System;
@@ -20,16 +20,28 @@
{
public DevCategories(XmlNode xn)
{
- if (xn != null)
+ if (xn != null)
{
Update(xn);
}
}
- private string _name = "unknown category";
- private int _id = 0;
- public VeraHelper _helper = VeraHelper.Instance;
+ public DevCategories(int id)
+ {
+ _id = id;
+ }
+ public DevCategories(int id, string nm)
+ {
+ _id = id;
+ _name = nm;
+ }
+
+ private string _name = "unknown category";
+ private int _id = 0;
+ public VeraHelper _helper = VeraHelper.Instance;
+
+
public bool Update(XmlNode xn)
{
_name = _helper.GetAttrAsString(xn, "name", _name);
@@ -40,15 +52,90 @@
public int id
{
get { return _id; }
- set { }
}
-
+
public string name
{
- get { return _name; }
- set { }
+ get { return _name; }
+ set { _name = value; }
}
+
+ public string GetIconName()
+ {
+ switch (id)
+ {
+ case 1: // Interface
+ return "USB_UIRT";
+
+ case 2: // Dimmer
+ return "Dimmable_Light_100";
+
+ case 3: // Switch
+ return "Binary_Light_100";
+
+ case 4: // Generic Sensor
+ return "generic_sensor";
+
+ case 5: // Thermostat
+ return "Thermostat";
+
+ case 6: // Web Cam
+ return "Ip_Camera";
+
+ case 7:
+ return "Door_Lock_100";
+
+ case 8: // Window covering
+ return "Window_Covering";
+
+ case 9: // Remote control
+ case 10: // Ir TX
+ return "IR_Transmitter";
+
+ case 12: // Motion Sensor
+ return "Motion_Sensor_100";
+
+ case 11: // Generic IO
+ case 13: // Serial port
+ return "Generic_IO";
+
+ case 14: // Scene controller
+ return "Scenes_active";
+
+ case 15: // AV
+ return "music_audio";
+
+ case 16: // Humidity
+ return "Humidity_Sensor";
+
+ case 17: // Temperature
+ return "Temperature_Sensor";
+
+ case 18: // Light sensor
+ return "Light_Sensor";
+
+ case 19: // Z-wave
+ return "Zwave";
+
+ case 20: // Insteon
+ return "Insteon";
+
+ case 21: // Power meter
+ return "Power_Meter";
+
+ case 101: // Special Sprinkler device not support by Vera's UI
+ return "Sprinkler";
+
+ case 102: // Special (Google) Weather device not support by Vera's UI
+ return "location";
+
+ case 0:
+ default:
+ return "generic_sensor";
+ }
+ }
+
public override string ToString()
{
return name;
Modified: trunk/plugins/VeraControl/DeviceCam.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceCam.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DeviceCam.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -24,7 +24,7 @@
private string _user = "";
private string _pass = "";
- public DeviceCam(XmlNode xn): base (xn)
+ public DeviceCam(XmlNode xn, int verabox): base (xn, verabox)
{
if (xn != null)
{
@@ -53,21 +53,18 @@
}
return _user + ":" + _pass + "@";
}
- set { }
}
public string imgUrl
{
- get { return _vera.veraAddress + "/data_request?id=cam_image¶meters=get_video_frame&Device_Num=" + id + "&rand=" + DateTime.Now.Ticks;
+ get { return _myVeraBox.veraAddress + "/data_request?id=cam_image¶meters=get_video_frame&Device_Num=" + internalId.ToString() + "&rand=" + DateTime.Now.Ticks;
// return "http://" + passString + m_sIp + "/" + m_sUrl.Replace("%2F", "/");
}
- set { }
}
public string streamUrl
{
get { return "http://" + passString + _ip + "/" + _stream.Replace("%2F", "/"); }
- set { }
}
public int refreshRate
@@ -84,14 +81,8 @@
public override bool isControllable
{
get { return true; }
- set { }
}
- public override string GetIconName()
- {
- return "Ip_Camera";
- }
-
public override bool NewScreenUpdateWaitingAndClearFlag( )
{
// Invoking this method will clear the update ready flag -> so caller need to handle the update
@@ -119,12 +110,12 @@
{
if (id == 0)
{
- _vera.status.system.ReportCommandError("Unknown device");
+ _myVeraBox.status.system.ReportCommandError("Unknown device");
screenUpdateRequired = true;
return;
}
- string cmd = "?id=lu_action&DeviceNum=" + id + "&serviceId=urn:micasaverde-com:serviceId:PanTiltZoom1&action=" + direction;
- _vera.DoVeraCommandRequest(cmd, ReportRequestError);
+ string cmd = "?id=lu_action&DeviceNum=" + internalId + "&serviceId=urn:micasaverde-com:serviceId:PanTiltZoom1&action=" + direction;
+ _myVeraBox.DoVeraCommandRequest(cmd, ReportRequestError);
}
public override void MoveUp()
Modified: trunk/plugins/VeraControl/DeviceDimmer.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDimmer.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DeviceDimmer.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -22,7 +22,7 @@
private string _watt = "-";
private string _kwh = "-";
- public DeviceDimmer(XmlNode xn): base (xn)
+ public DeviceDimmer(XmlNode xn, int verabox): base (xn, verabox)
{
if (xn != null)
{
@@ -42,7 +42,6 @@
public string watts
{
get { return _watt; }
- set { }
}
public override bool status
@@ -66,10 +65,10 @@
{
ReportPendingRequest();
// Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString() +
+ string cmd = "?id=lu_action&DeviceNum="+internalId.ToString() +
"&serviceId=urn:upnp-org:serviceId:Dimming1&action=SetLoadLevelTarget" +
"&newLoadlevelTarget=" + value;
- _vera.DoVeraCommandRequest(cmd, ReportRequestError);
+ _myVeraBox.DoVeraCommandRequest(cmd, ReportRequestError);
}
_level = newValue;
}
@@ -78,7 +77,6 @@
public override int maxLevel
{
get { return 100; }
- set { }
}
public override string ToString()
@@ -89,7 +87,6 @@
public override bool isControllable
{
get { return true; }
- set { }
}
public override string GetIconName()
@@ -105,12 +102,49 @@
public override string GetExtraText()
{
- return (_kwh != "" ? _kwh + "kWh" : "");
+ return ((_kwh != "" && _kwh != "-") ? "Power usage " + _kwh + " kWh" : "");
}
public override string GetStatusText()
{
return (status ? level.ToString() + "%" : "Off");
}
+
+ public override string mode
+ {
+ get {
+ string strmode = "Off";
+ if (level > 0) { strmode = "25%"; }
+ if (level > 25) { strmode = "50%"; }
+ if (level > 50) { strmode = "75%"; }
+ if (level > 75) { strmode = "0n"; }
+ return strmode;
+ }
+ set {
+ switch (value)
+ {
+ case "Off":
+ level = 0;
+ break;
+ case "25%":
+ level = 25;
+ break;
+ case "50%":
+ level = 50;
+ break;
+ case "75%":
+ level = 75;
+ break;
+ case "On":
+ level = 100;
+ break;
+ }
+ }
+ }
+
+ public override string [] GetCommands()
+ {
+ return new string [] {"Off", "On", "25%", "75%", "50%"};
+ }
}
}
Modified: trunk/plugins/VeraControl/DeviceDoorlock.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDoorlock.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DeviceDoorlock.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -20,7 +20,7 @@
{
private bool _status = false;
- public DeviceDoorlock( XmlNode xn ): base (xn)
+ public DeviceDoorlock( XmlNode xn, int verabox ): base (xn, verabox)
{
if (xn != null)
{
@@ -43,10 +43,10 @@
{
ReportPendingRequest();
// Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ string cmd = "?id=lu_action&DeviceNum="+internalId.ToString()+
"&serviceId=urn:micasaverde-com:serviceId:DoorLock1&action=SetTarget" +
"&newTargetValue="+(value ? "1" : "0");
- _vera.DoVeraCommandRequest(cmd, ReportRequestError);
+ _myVeraBox.DoVeraCommandRequest(cmd, ReportRequestError);
}
}
}
@@ -63,7 +63,6 @@
public override int maxLevel
{
get { return 1; }
- set { }
}
public override string ToString()
@@ -74,7 +73,6 @@
public override bool isControllable
{
get { return true; }
- set { }
}
public override string GetIconName()
Modified: trunk/plugins/VeraControl/DeviceGWeather.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGWeather.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DeviceGWeather.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -21,7 +21,7 @@
private string _condition = "-";
private string _windCondition = "-";
- public DeviceGWeather(XmlNode xn): base (xn)
+ public DeviceGWeather(XmlNode xn, int verabox): base (xn, verabox)
{
if (xn != null)
{
@@ -35,8 +35,15 @@
_condition = _helper.GetAttrAsString(xn, "condition", _condition); // World Weather plugin
_windCondition = _helper.GetAttrAsString(xn, "WindCondition", _windCondition);
_windCondition = _helper.GetAttrAsString(xn, "windcondition", _windCondition);
+
+ bool ret = base.Update(xn);
+ category = 102; // Override Vera's Cateogry with Speical ID code
- return base.Update(xn);
+ if (!_myVeraBox.status.IsCategoryFound(category))
+ { // create this category if it does not exists
+ _myVeraBox.categories.Add(new DevCategories(category, "Weather"));
+ }
+ return ret;
}
public override string ToString()
Modified: trunk/plugins/VeraControl/DeviceGeneric.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceGeneric.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DeviceGeneric.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -10,6 +10,7 @@
*/
using System;
using System.Xml;
+using System.Collections;
using System.Collections.Generic;
namespace VeraControl.Properties
@@ -23,7 +24,7 @@
private int _category = 0;
private int _stepsize = 0;
- public DeviceGeneric(XmlNode xn): base (xn)
+ public DeviceGeneric(XmlNode xn, int verabox): base (xn, verabox)
{
if (xn != null)
{
@@ -40,33 +41,53 @@
_altId = _helper.GetAttrAsString(xn, "altid", _altId);
_category = _helper.GetAttrAsInt (xn, "category", _category);
- bool b = base.Update(xn);
- // Make sure the room exists
- if (room == 0 || !_vera.status.IsRoomFound(room))
+ return base.Update(xn);
+ }
+
+ public bool PassesFilter(VeraFilterStyle filter)
+ {
+ switch (filter)
{
- if (!_vera.status.IsRoomFound(0))
- { // create dummy room to attach to
- _vera.rooms.Add(new Room(null));
- }
- room = 0;
+ case VeraFilterStyle.UNKNOWN_DEVICES:
+ return isControllable|| !new ArrayList(new int [] {0}).Contains(category);
+
+ case VeraFilterStyle.GENERIC_DEVICES:
+ return isControllable || !new ArrayList(new int [] {0,1,11,12}).Contains(category);
+
+ case VeraFilterStyle.REMOTE_DEVICES:
+ return isControllable || !new ArrayList(new int [] {0,1,10,11,12,13,15,19,20}).Contains(category);
+
+ case VeraFilterStyle.SCENE_CONTROLLERS:
+ return isControllable || !new ArrayList(new int [] {0,1,10,11,12,13,14,15,19,20}).Contains(category);
+
+ case VeraFilterStyle.CONTROLABLE_ONLY:
+ return isControllable;
+
+ default:
+ case VeraFilterStyle.NONE:
+ return true;
}
- return b;
}
-
+
public string altid
{
get { return _altId; }
}
-
+
+ public bool InCategory(int id)
+ {
+ return (category == id);
+ }
+
public int category
{
get { return _category; }
+ set { _category = value; }
}
public virtual bool isControllable
{
get { return false; }
- set { }
}
public virtual bool status
@@ -92,7 +113,7 @@
if (stepSize > 0)
{
level += stepSize;
- }
+ }
}
public virtual void DecreaseLevel()
@@ -100,7 +121,7 @@
if (stepSize > 0)
{
level -= stepSize;
- }
+ }
}
public virtual string mode
@@ -123,7 +144,7 @@
public override string GetIconName()
{
- return "generic_sensor";
+ return new DevCategories(category).GetIconName();
}
public override string GetStatusText()
Modified: trunk/plugins/VeraControl/DeviceHumidity.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceHumidity.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DeviceHumidity.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -20,7 +20,7 @@
{
private int _level = 0;
- public DeviceHumidity(XmlNode xn) : base (xn)
+ public DeviceHumidity(XmlNode xn, int verabox) : base (xn, verabox)
{
if (xn != null)
{
@@ -37,13 +37,11 @@
public override int level
{
get { return _level; }
- set {}
}
public override int maxLevel
{
get { return 100; }
- set { }
}
public override string ToString()
@@ -51,11 +49,6 @@
return name + " [" + level.ToString() + "%]";
}
- public override string GetIconName()
- {
- return "Humidity_Sensor";
- }
-
public override string GetStatusText()
{
return level + "%";
Modified: trunk/plugins/VeraControl/DeviceLightSensor.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceLightSensor.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DeviceLightSensor.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -20,7 +20,7 @@
{
private int _level = 0;
- public DeviceLightSensor(XmlNode xn) : base (xn)
+ public DeviceLightSensor(XmlNode xn, int verabox) : base (xn, verabox)
{
if (xn != null)
{
@@ -38,19 +38,16 @@
public override bool status
{
get { return (_level > 0); }
- set { }
}
public override int level
{
get { return _level; }
- set { }
}
public override int maxLevel
{
get { return 100; }
- set { }
}
public override string ToString()
Modified: trunk/plugins/VeraControl/DevicePowerMeter.cs
===================================================================
--- trunk/plugins/VeraControl/DevicePowerMeter.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DevicePowerMeter.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -21,7 +21,7 @@
private int _level = 0;
private string _kwh = "";
- public DevicePowerMeter(XmlNode xn) : base (xn)
+ public DevicePowerMeter(XmlNode xn, int verabox) : base (xn, verabox)
{
if (xn != null)
{
@@ -39,25 +39,21 @@
public string watts
{
get { return _level.ToString(); }
- set { }
}
public override bool status
{
get { return (_level > 0); }
- set { }
}
public override int level
{
get { return _level; }
- set { }
}
public override int maxLevel
{
get { return 1000; }
- set { }
}
public override string ToString()
@@ -65,14 +61,9 @@
return name + " [" + GetStatusText() + "]";
}
- public override string GetIconName()
- {
- return "Power_Meter";
- }
-
public override string GetExtraText()
{
- return (_kwh != "" ? _kwh + "kWh" : "");
+ return ((_kwh != "" && _kwh != "-") ? "Power usage " + _kwh + " kWh" : "");
}
public override string GetStatusText()
Modified: trunk/plugins/VeraControl/DeviceSceneController.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSceneController.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DeviceSceneController.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -18,7 +18,7 @@
{
private bool _isTripped = false;
- public DeviceSceneController( XmlNode xn ) : base (xn)
+ public DeviceSceneController( XmlNode xn, int verabox ) : base (xn, verabox)
{
if (xn != null)
{
@@ -36,19 +36,16 @@
public override bool status
{
get { return _isTripped; }
- set { }
}
public bool isTripped
{
get { return _isTripped; }
- set { }
}
public override int level
{
get { return (_isTripped ? 1 : 0); }
- set { }
}
public override string ToString()
@@ -58,7 +55,7 @@
public override string GetIconName()
{
- return "Motion_Sensor_" + (_isTripped ? "100" : "0");
+ return "Scenes" + (_isTripped ? "_active" : "");
}
public override string GetStatusText()
Modified: trunk/plugins/VeraControl/DeviceSecurity.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSecurity.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DeviceSecurity.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -22,7 +22,7 @@
private bool _isTripped = false;
private bool _isArmed = true;
- public DeviceSecurity(XmlNode xn) : base (xn)
+ public DeviceSecurity(XmlNode xn, int verabox) : base (xn, verabox)
{
if (xn != null)
{
@@ -45,10 +45,10 @@
{
ReportPendingRequest();
// Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
+ string cmd = "?id=lu_action&DeviceNum=" + internalId.ToString() +
"&serviceId=urn:micasaverde-com:serviceId:SecuritySensor1&action=SetArmed" +
"&newArmedValue=" + (value ? "1" : "0");
- _vera.DoVeraCommandRequest(cmd, ReportRequestError);
+ _myVeraBox.DoVeraCommandRequest(cmd, ReportRequestError);
}
}
}
@@ -56,7 +56,6 @@
public bool isTripped
{
get { return _isTripped; }
- set { }
}
public override int level
@@ -68,13 +67,11 @@
public override int maxLevel
{
get { return 1; }
- set { }
}
public override bool isControllable
{
get { return true; }
- set { }
}
public override string ToString()
Modified: trunk/plugins/VeraControl/DeviceSprinkler.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-02-17 15:42:33 UTC (rev 4455)
+++ trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-02-17 23:12:46 UTC (rev 4456)
@@ -4,8 +4,8 @@
* Date: 3-1-2012
* Time: 16:26
*
- * Copyright: 2012 GPL - Bart Eversdijk
- * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
* E-mail: ba...@ev...
*/
using System;
@@ -25,7 +25,7 @@
private string _operationMode = "-";
private string _condition = "-";
- public DeviceSprinkler(XmlNode xn) : base (xn)
+ public DeviceSprinkler(XmlNode xn, int verabox) : base (xn, verabox)
{
if (xn != null)
{
@@ -33,29 +33,39 @@
}
}
- public override bool Update(XmlNode xn)
+ public override bool Update(XmlNode xn)
{
_status = _helper.GetAttrAsBool (xn, "status", _status);
_mode = _helper.GetAttrAsString(xn, "Mode", _mode);
_shortMode = _helper.GetAttrAsString(xn, "ShortMode", _shortMode);
_operationMode = _helper.GetAttrAsString(xn, "OperationMode", _operationMode);
_condition = _helper.GetAttrAsString(xn, "Condition", _condition);
- return base.Update(xn);
+
+ bool ret = base.Update(xn);
+ category = 101; // Override Vera's Cateogry with Speical ID code
+
+ if (!_myVeraBox.status.IsCategoryFound(category))
+ {
+ // create this category if it does not exists
+ _myVeraBox.categories.Add(new DevCategories(category, "Sprinklers"));
+ }
+
+ return ret;
}
public override bool status
{
get { return _status; }
- set {
- if (id > 0) // Only send when a valid ID is found
- {
- ReportPendingRequest();
- // Do something with vera
- string cmd = "?id=lu_action&DeviceNum="+id.ToString()+
- "&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget" +
- "&newTargetValue="+(value ? "1" : "0");
- _vera.DoVeraCommandRequest(cmd, ReportRequestError);
- }
+ set {
+ if (id > 0) // Only send when a valid ID is found
+ {
+ ReportPendingRequest();
+ // Do something with vera
+ string cmd = "?id=lu_action&DeviceNum=" + internalId.ToString() +
+ "&serviceId=urn:upnp-org:serviceId:SwitchPower1&action=SetTarget" +
+ "&newTargetValue="+(value ? "1" : "0");
+ _myVeraBox.DoVeraCommandRequest(cmd, ReportRequestError);
+ }
}
}
@@ -68,16 +78,16 @@
public override string mode
{
get { return _mode; }
- set {
- if (id > 0) // Only send when a valid ID is found
- {
- ReportPendingRequest();
- // Do something with vera...
[truncated message content] |
|
From: <Ba...@us...> - 2012-02-19 22:21:53
|
Revision: 4457
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4457&view=rev
Author: BartEv
Date: 2012-02-19 22:21:45 +0000 (Sun, 19 Feb 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/VeraControl/BaseDevice.cs
trunk/plugins/VeraControl/DevCategories.cs
trunk/plugins/VeraControl/DeviceDimmer.cs
trunk/plugins/VeraControl/DeviceSecurity.cs
trunk/plugins/VeraControl/DeviceThermostat.cs
trunk/plugins/VeraControl/DeviceWindowCovering.cs
trunk/plugins/VeraControl/Properties/AssemblyInfo.cs
trunk/plugins/VeraControl/Room.cs
trunk/plugins/VeraControl/Section.cs
trunk/plugins/VeraControl/VeraCommunication.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraSetupForm.Designer.cs
trunk/plugins/VeraControl/VeraSetupForm.cs
trunk/plugins/VeraControl/releases/VeraControl.xmp2
trunk/plugins/VeraControl/skin/Default/VeraControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraControl.xml
trunk/plugins/VeraControl/skin/Media/Vera/Window_Covering.png
trunk/plugins/VeraControl/skin/Media/Vera/music_audio.png
Added Paths:
-----------
trunk/plugins/VeraControl/VeraBox.cs
trunk/plugins/VeraControl/skin/Media/Vera/Motion_Sensor_bypass.png
trunk/plugins/VeraControl/skin/Media/Vera/Window_Covering_0.png
trunk/plugins/VeraControl/skin/Media/Vera/Window_Covering_100.png
trunk/plugins/VeraControl/skin/Media/Vera/Window_Covering_25.png
trunk/plugins/VeraControl/skin/Media/Vera/Window_Covering_50.png
trunk/plugins/VeraControl/skin/Media/Vera/Window_Covering_75.png
trunk/plugins/VeraControl/skin/Media/Vera/back.png
trunk/plugins/VeraControl/skin/Media/Vera/room.png
Modified: trunk/plugins/VeraControl/BaseDevice.cs
===================================================================
--- trunk/plugins/VeraControl/BaseDevice.cs 2012-02-17 23:12:46 UTC (rev 4456)
+++ trunk/plugins/VeraControl/BaseDevice.cs 2012-02-19 22:21:45 UTC (rev 4457)
@@ -49,7 +49,7 @@
_name = _helper.GetAttrAsString(xn, "name", _name);
_id = _helper.GetAttrAsInt (xn, "id", _id);
_room = _helper.GetAttrAsInt (xn, "room", _room);
- _comment = _helper.GetAttrAsString(xn, "comment", _comment );
+ _comment = _helper.GetAttrAsString(xn, "comment", _comment );
_dsState = _helper.ToDevState (_helper.GetAttrAsInt(xn, "state", -1));
if (_id == 0)
Modified: trunk/plugins/VeraControl/DevCategories.cs
===================================================================
--- trunk/plugins/VeraControl/DevCategories.cs 2012-02-17 23:12:46 UTC (rev 4456)
+++ trunk/plugins/VeraControl/DevCategories.cs 2012-02-19 22:21:45 UTC (rev 4457)
@@ -37,7 +37,7 @@
_name = nm;
}
- private string _name = "unknown category";
+ private string _name = "Generic";
private int _id = 0;
public VeraHelper _helper = VeraHelper.Instance;
@@ -74,8 +74,8 @@
case 3: // Switch
return "Binary_Light_100";
- case 4: // Generic Sensor
- return "generic_sensor";
+ case 4: // Security Sensor
+ return "Motion_Sensor_100";
case 5: // Thermostat
return "Thermostat";
@@ -93,8 +93,8 @@
case 10: // Ir TX
return "IR_Transmitter";
- case 12: // Motion Sensor
- return "Motion_Sensor_100";
+ case 12: // Generic Sensor
+ return "generic_sensor";
case 11: // Generic IO
case 13: // Serial port
Modified: trunk/plugins/VeraControl/DeviceDimmer.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceDimmer.cs 2012-02-17 23:12:46 UTC (rev 4456)
+++ trunk/plugins/VeraControl/DeviceDimmer.cs 2012-02-19 22:21:45 UTC (rev 4457)
@@ -117,7 +117,7 @@
if (level > 0) { strmode = "25%"; }
if (level > 25) { strmode = "50%"; }
if (level > 50) { strmode = "75%"; }
- if (level > 75) { strmode = "0n"; }
+ if (level > 75) { strmode = "On"; }
return strmode;
}
set {
Modified: trunk/plugins/VeraControl/DeviceSecurity.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSecurity.cs 2012-02-17 23:12:46 UTC (rev 4456)
+++ trunk/plugins/VeraControl/DeviceSecurity.cs 2012-02-19 22:21:45 UTC (rev 4457)
@@ -81,7 +81,7 @@
public override string GetIconName()
{
- return "Motion_Sensor_" + (_isTripped ? "100" : "0");
+ return "Motion_Sensor_" + (status ? (_isTripped ? "100" : "0") : "bypass");
}
public override string GetStatusText()
Modified: trunk/plugins/VeraControl/DeviceThermostat.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceThermostat.cs 2012-02-17 23:12:46 UTC (rev 4456)
+++ trunk/plugins/VeraControl/DeviceThermostat.cs 2012-02-19 22:21:45 UTC (rev 4457)
@@ -63,8 +63,7 @@
// Do something with vera
string cmd = "?id=lu_action&DeviceNum=" + internalId.ToString( )+
"&serviceId=urn:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget" +
- "&NewModeTarget=" + (value == "Off" ? "Off" : (value == "Cool" ? "CoolOn" : (value == "Heat" ? "HeatOn" : "AutoChangeOver"))
- );
+ "&NewModeTarget=" + (value == "Off" ? "Off" : (value == "Cool" ? "CoolOn" : (value == "Heat" ? "HeatOn" : "AutoChangeOver")));
_myVeraBox.DoVeraCommandRequest(cmd, ReportRequestError);
}
}
Modified: trunk/plugins/VeraControl/DeviceWindowCovering.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceWindowCovering.cs 2012-02-17 23:12:46 UTC (rev 4456)
+++ trunk/plugins/VeraControl/DeviceWindowCovering.cs 2012-02-19 22:21:45 UTC (rev 4457)
@@ -4,8 +4,8 @@
* Date: 24-12-2011
* Time: 23:56
*
- * Copyright: 2012 GPL - Bart Eversdijk
- * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
* E-mail: ba...@ev...
*/
using System;
@@ -18,12 +18,65 @@
/// </summary>
public class DeviceWindowCovering : DeviceDimmer
{
- public DeviceWindowCovering(XmlNode xn, int verabox) : base (xn, verabox)
+ public DeviceWindowCovering(XmlNode xn, int verabox) : base (xn, verabox)
{
if (xn != null)
{
Update(xn);
}
}
+
+ public override string GetIconName()
+ {
+ string leveltxt = "0";
+ if (level > 0) { leveltxt = "25"; }
+ if (level > 25) { leveltxt = "50"; }
+ if (level > 50) { leveltxt = "75"; }
+ if (level > 75) { leveltxt = "100"; }
+
+ return "Window_Covering_" + leveltxt;
+ }
+
+ public override string GetStatusText()
+ {
+ return (status ? (level == 100 ? "Closed" : level.ToString() + "%") : "Opened");
+ }
+
+ public override string mode
+ {
+ get {
+ string strmode = "Open";
+ if (level > 0) { strmode = "25%"; }
+ if (level > 25) { strmode = "50%"; }
+ if (level > 50) { strmode = "75%"; }
+ if (level > 75) { strmode = "Close"; }
+ return strmode;
+ }
+ set {
+ switch (value)
+ {
+ case "Open":
+ level = 0;
+ break;
+ case "25%":
+ level = 25;
+ break;
+ case "50%":
+ level = 50;
+ break;
+ case "75%":
+ level = 75;
+ break;
+ case "Close":
+ level = 100;
+ break;
+ }
+ }
+ }
+
+ public override string [] GetCommands()
+ {
+ return new string [] {"Open", "Close", "25%", "75%", "50%"};
+ }
}
}
Modified: trunk/plugins/VeraControl/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/VeraControl/Properties/AssemblyInfo.cs 2012-02-17 23:12:46 UTC (rev 4456)
+++ trunk/plugins/VeraControl/Properties/AssemblyInfo.cs 2012-02-19 22:21:45 UTC (rev 4457)
@@ -28,4 +28,4 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("0.5.1.0")]
+[assembly: AssemblyVersion("1.0.1.0")]
Modified: trunk/plugins/VeraControl/Room.cs
===================================================================
--- trunk/plugins/VeraControl/Room.cs 2012-02-17 23:12:46 UTC (rev 4456)
+++ trunk/plugins/VeraControl/Room.cs 2012-02-19 22:21:45 UTC (rev 4457)
@@ -61,7 +61,8 @@
public int id
{
- get {
+ get
+ {
if (_myVeraBox == null)
{
return 0;
@@ -82,7 +83,8 @@
public int section
{
- get {
+ get
+ {
if (_myVeraBox == null)
{
return 0;
Modified: trunk/plugins/VeraControl/Section.cs
===================================================================
--- trunk/plugins/VeraControl/Section.cs 2012-02-17 23:12:46 UTC (rev 4456)
+++ trunk/plugins/VeraControl/Section.cs 2012-02-19 22:21:45 UTC (rev 4457)
@@ -42,7 +42,8 @@
public int id
{
- get {
+ get
+ {
if (_myVeraBox == null)
{
return 0;
Added: trunk/plugins/VeraControl/VeraBox.cs
===================================================================
--- trunk/plugins/VeraControl/VeraBox.cs (rev 0)
+++ trunk/plugins/VeraControl/VeraBox.cs 2012-02-19 22:21:45 UTC (rev 4457)
@@ -0,0 +1,728 @@
+/*
+ * Created by SharpDevelop.
+ * User: Bart
+ * Date: 10-2-2012
+ * Time: 16:41
+ *
+ *
+ * Copyright: 2012 GPL - Bart Eversdijk
+ * MediaPort plugin - MicasaVerde (TM) Vera Controller
+ * E-mail: ba...@ev...
+ */
+using System;
+using System.Net;
+using System.IO;
+using System.Threading;
+using System.Collections.Generic;
+using System.Xml;
+
+namespace VeraControl.Properties
+{
+ public enum ConnectionType
+ {
+ RemoteOnly = -1,
+ Auto = 0,
+ LocalOnly = 1
+ }
+
+ public class VeraStatus
+ {
+ public DeviceSystem system = new DeviceSystem();
+ public List<DeviceGeneric> devices = new List<DeviceGeneric>();
+ public List<Scene> scenes = new List<Scene>();
+ public List<Room> rooms = new List<Room>();
+ public List<DevCategories> categories = new List<DevCategories>();
+ public List<Section> sections = new List<Section>();
+
+ #region Vers get by id support functions
+
+ public void ClearAllLists()
+ {
+ devices.Clear();
+ scenes.Clear();
+ rooms.Clear();
+ categories.Clear();
+ sections.Clear();
+ }
+ public Room GetRoomById(int id)
+ {
+ foreach(Room room in rooms)
+ {
+ if (room.id == id)
+ {
+ return room;
+ }
+ }
+ return new Room(null, 0);
+ }
+
+ public Section GetSectionById(int id)
+ {
+ foreach(Section section in sections)
+ {
+ if (section.id == id)
+ {
+ return section;
+ }
+ }
+ return new Section(null, 0);
+ }
+
+ public DeviceGeneric GetDeviceById(int id)
+ {
+ foreach(DeviceGeneric dev in devices)
+ {
+ if (dev.id == id)
+ {
+ return dev;
+ }
+ }
+ return new DeviceGeneric(null, 0);
+ }
+
+ public Scene GetSceneById(int id)
+ {
+ foreach(Scene scene in scenes)
+ {
+ if (scene.id == id)
+ {
+ return scene;
+ }
+ }
+ return new Scene(null, 0);
+ }
+
+ public DevCategories GetCategoryById(int id)
+ {
+ foreach(DevCategories cat in categories)
+ {
+ if (cat.id == id)
+ {
+ return cat;
+ }
+ }
+ return new DevCategories(null);
+ }
+
+ public bool IsSectionFound(int id)
+ {
+ foreach(Section section in sections)
+ {
+ if (section.id == id)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public bool IsRoomFound(int id)
+ {
+ foreach(Room room in rooms)
+ {
+ if (room.id == id)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public bool IsDeviceFound(int id)
+ {
+ foreach(DeviceGeneric dev in devices)
+ {
+ if (dev.id == id)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public bool IsSceneFound(int id)
+ {
+ foreach(Scene scene in scenes)
+ {
+ if (scene.id == id)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public bool IsCategoryFound(int id)
+ {
+ foreach(DevCategories cat in categories)
+ {
+ if (cat.id == id)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ #endregion
+ }
+
+ /// <summary>
+ /// Description of VeraBox.
+ /// </summary>
+ public class VeraBox
+ {
+ private VeraHelper _helper = VeraHelper.Instance;
+
+ // Actual device information
+ private VeraStatus _status = new VeraStatus();
+
+ // Config data
+ public int _maxRefreshDelay; // Maximun delay between 2 status updates in seconds
+ public int _minRefreshDelay = 1000; // Minimun delay between 2 status updates in miliseconds
+ private int _myVeraId = 0;
+ public bool _oldStyleConfig = false; // Read config settings in 0.9.0.3 or previous style
+
+ // Communication status/control
+ private long _lastUpdate = 0;
+ private bool _screenUpdateRequired = false; // Only true when a new update was received AND at least one device(staus) or scene was changed
+ private bool _lastUpdateFailed = false;
+ private string _lastUpdateErrorMessage = "";
+ public WebClient _webUpdateClient = new WebClient();
+ public WebClient _webCommandClient = new WebClient();
+ private Action<string> _webCommandClientErrorReporter = null;
+
+ // Connection information
+ private int _serial = -1;
+ private string _ip = "";
+ private string _name = "";
+ private string _realLocalVeraAddress = null;
+ private string _realRemoteVeraAddress = null;
+ private string _discreteVeraAddress = null;
+ private ConnectionType _connectionType = ConnectionType.Auto;
+ private bool _fallBackConnection = false;
+
+ public VeraBox(int id, int maxRefresh, int minRefresh)
+ {
+ _myVeraId = id;
+ _maxRefreshDelay = maxRefresh;
+ _minRefreshDelay = minRefresh;
+
+ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
+ {
+ // Set DownloadStringCompleted handler
+ _webUpdateClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(OnCompletedUpdateStatusRequest);
+ _webCommandClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(OnCompletedCommandRequest);
+ }
+ }
+
+ public void DoVeraCommandRequest(string param, Action<string> errorReporter)
+ {
+ // If a request was pending just cancel the previous request (user is informed about the progress)
+ string url = veraAddress + "/data_request" + param + "&time=" + DateTime.Now.Ticks;
+
+ // Callback thus ASynchronised call (do NOT wait for response)
+ try {
+ _webCommandClientErrorReporter = errorReporter;
+ _webCommandClient.CancelAsync(); // Cancel any current pending Async calls...
+ _webCommandClient.DownloadStringAsync(new Uri(url));
+
+ } catch( Exception e )
+ {
+ _webCommandClientErrorReporter = null;
+ status.system.ReportCommandError(e.Message);
+ setScreenUpdateRequired();
+ }
+ }
+
+ public void OnCompletedCommandRequest(object sender, DownloadStringCompletedEventArgs e)
+ {
+ if (e.Cancelled)
+ {
+ // Communication cancel for some reason, no valid data to be expected
+ if (_webCommandClientErrorReporter != null)
+ {
+ // Send error to dialog message handler
+ _webCommandClientErrorReporter("Request was canceled");
+ }
+ else
+ {
+ // Show eror in MediaPortal Vera-main window
+ status.system.ReportCommandError("Request was canceled");
+ }
+ setScreenUpdateRequired();
+ }
+ else if (e.Error != null)
+ {
+ // Handle error here
+ if (_webCommandClientErrorReporter != null)
+ {
+ // Send error to dialog message handler
+ _webCommandClientErrorReporter(e.Error.Message);
+ }
+ else
+ {
+ // Show eror in MediaPortal Vera-main window
+ status.system.ReportCommandError(e.Error.Message);
+ }
+ setScreenUpdateRequired();
+ }
+ else
+ {
+ // Communication succes full -> no parse Vera response...
+ if (!e.Result.ToUpper().Contains("<OK>OK</OK>") && !e.Result.ToUpper().Contains("<JOBID>"))
+ {
+ if (_webCommandClientErrorReporter != null)
+ {
+ // Send error to dialog message handler
+ _webCommandClientErrorReporter(e.Result);
+ }
+ else
+ {
+ // Show eror in MediaPortal Vera-main window
+ status.system.ReportCommandError(e.Result);
+ }
+ setScreenUpdateRequired();
+ }
+ }
+ // Communication done clear error report handler
+ _webCommandClientErrorReporter = null;
+ }
+
+ public void UpdateCurrentStatus()
+ {
+ /* Keep updating with webClient timeout 180 sec, even when last time did fail or connection was lost....*/
+ if (!_webUpdateClient.IsBusy && (!_lastUpdateFailed || (_lastUpdate + 30 < _helper.GetSecondsSince1970())))
+ {
+ string url = veraAddress + "/data_request" +
+ "?id=lu_sdata&loadtime=" + _status.system.loadtime +
+ "&dataversion=" + _status.system.dataversion +
+ "&minimumdelay=" + _minRefreshDelay +
+ "&timeout=" + _maxRefreshDelay +
+ "&output_format=xml" +
+ "&time=" + DateTime.Now.Ticks;
+
+ // Callback thus ASynchronised call (do NOT wait for response)
+ try {
+ _webUpdateClient.CancelAsync(); // Cancel any current pending Async calls...
+ _webUpdateClient.DownloadStringAsync(new Uri(url));
+ } catch( Exception e )
+ {
+ _lastUpdateFailed = true;
+ _lastUpdateErrorMessage = e.Message;
+ }
+ _lastUpdate = _helper.GetSecondsSince1970();
+ }
+ }
+
+ public void OnCompletedUpdateStatusRequest(object sender, DownloadStringCompletedEventArgs e)
+ {
+ if (!e.Cancelled)
+ {
+ // Communication cancel for some reason, no valid data to be expected
+ if (e.Error != null)
+ {
+ // Handle error here
+ _lastUpdateFailed = true;
+ _lastUpdateErrorMessage = e.Error.Message;
+ setScreenUpdateRequired();
+ }
+ else
+ {
+ ParseUpdateInfo(e.Result);
+ // WebClient wc = new WebClient();
+ // if (_status.system.dataversion == "0")
+ // {
+ // ParseUpdateInfo( wc.DownloadString(@"C:\Users\Bart\Documents\SharpDevelop Projects\VeraControl\testdata\text.xml"));
+ // }
+ }
+ }
+
+ // update timer again (took some time to get the data)
+ _lastUpdate = _helper.GetSecondsSince1970();
+ }
+
+ public void ParseUpdateInfo(string veraresponse)
+ {
+ var xmlDoc = new XmlDocument();
+ try {
+ xmlDoc.LoadXml(veraresponse);
+ } catch (Exception)
+ {
+ // Parser failed so incorrect data received (could be an interrupted data transfer)
+ return;
+ }
+ // Parse header
+ XmlNode rootnode = xmlDoc.SelectSingleNode("/root");
+ if (rootnode == null)
+ {
+ // Not a status update, just return
+ return;
+ }
+
+ if (!_screenUpdateRequired)
+ {
+ // Clear flag, only when previous update was already handled (might be some new or remove devices/scenes to be displayed)
+ _status.system.ClearFullReloadFlag();
+ }
+ if (_lastUpdateFailed)
+ {
+ _lastUpdateFailed = false;
+ setScreenUpdateRequired();
+ _status.system.ClearConnectionError();
+ }
+ // Process system status first
+ _status.system.update(rootnode);
+ if (_status.system.fullReload)
+ {
+ // We have a full refresh -> Clear all lists (to get clear of removed devices/scenes/catgories/rooms/etc...)
+ _status.ClearAllLists();
+
+ }
+
+ // Process Sections
+ XmlNodeList xnList = xmlDoc.SelectNodes("/root/sections/section");
+ foreach (XmlNode xn in xnList)
+ {
+ Section sc = _status.GetSectionById( makeId(xn.Attributes["id"].Value) );
+ if (sc.id != 0) {
+ sc.Update(xn);
+ } else {
+ _status.sections.Add(new Section(xn, _myVeraId));
+ }
+ }
+
+ // Process Rooms
+ xnList = xmlDoc.SelectNodes("/root/rooms/room");
+ foreach (XmlNode xn in xnList)
+ {
+ Room room = _status.GetRoomById( makeId(xn.Attributes["id"].Value) );
+ if (room.id != 0) {
+ room.Update(xn);
+ } else {
+ _status.rooms.Add(new Room(xn, _myVeraId));
+ }
+ }
+
+ // Process Scenes
+ xnList = xmlDoc.SelectNodes("/root/scenes/scene");
+ // State update of Scenes are not reported done, so they have to be cleaned manualy
+ // if a message is still valid and/or new message will be reported below
+ foreach (Scene scene in _status.scenes)
+ {
+ scene.ClearCommState();
+ }
+ foreach (XmlNode xn in xnList)
+ {
+ Scene sc = _status.GetSceneById( makeId(xn.Attributes["id"].Value) );
+ if (sc.id != 0) {
+ sc.Update(xn);
+ } else {
+ _status.scenes.Add(new Scene(xn, _myVeraId));
+ }
+ }
+
+ // Process Categories - categories are general not Box specific
+ xnList = xmlDoc.SelectNodes("/root/categories/categorie");
+ foreach (XmlNode xn in xnList)
+ {
+ DevCategories cat = _status.GetCategoryById( int.Parse(xn.Attributes["id"].Value) );
+ if (cat.id != 0) {
+ cat.Update(xn);
+ } else {
+ _status.categories.Add(new DevCategories(xn));
+ }
+ }
+
+ // Process Devices
+ xnList = xmlDoc.SelectNodes("/root/devices/device");
+ foreach (XmlNode xn in xnList)
+ {
+ DeviceGeneric dev = _status.GetDeviceById( makeId(xn.Attributes["id"].Value) );
+ if (dev.id != 0) {
+ // update existing device
+ dev.Update(xn);
+ } else {
+ _status.system.SetFullReloadFlag();
+
+ // catids: http://wiki.micasaverde.com/index.php/Luup_UPNP_Files
+ switch (xn.Attributes["category"].Value)
+ {
+ //case "1": // TODO: Implement interface device ?
+ // m_status.devices.Add(new DeviceInterface(xn));
+ // break;
+
+ case "2":
+ _status.devices.Add(new DeviceDimmer(xn, _myVeraId));
+ break;
+
+ case "3":
+ case "11": // Generic IO
+ _status.devices.Add(new DeviceSwitch(xn, _myVeraId));
+ break;
+
+ case "4": // Generic Sensor
+ case "12": // Motion Sensor
+ _status.devices.Add(new DeviceSecurity(xn, _myVeraId));
+ break;
+
+ case "5":
+ _status.devices.Add(new DeviceThermostat(xn, _myVeraId, _status.system.IsMetric()));
+ break;
+
+ case "6":
+ _status.devices.Add(new DeviceCam(xn, _myVeraId));
+ break;
+
+ case "7":
+ _status.devices.Add(new DeviceDoorlock(xn, _myVeraId));
+ break;
+
+ case "8":
+ _status.devices.Add(new DeviceWindowCovering(xn, _myVeraId));
+ break;
+
+ //case "9":
+ // m_status.devices.Add(new DeviceRemoteControl(xn, veraId));
+ // break;
+
+ //case "10":
+ // m_status.devices.Add(new DeviceIrTx(xn, veraId));
+ // break;
+
+ //case "13":
+ // m_status.devices.Add(new DeviceSerialPort(xn, veraId));
+ // break
+
+ case "14":
+ _status.devices.Add(new DeviceSceneController(xn, _myVeraId));
+ break;
+
+ // case "15":
+ // m_status.devices.Add(new DeviceAV(xn, veraId));
+ // break;
+
+ case "16":
+ _status.devices.Add(new DeviceHumidity(xn, _myVeraId));
+ break;
+
+ case "17":
+ _status.devices.Add(new DeviceTemperature(xn, _myVeraId, _status.system.IsMetric()));
+ break;
+
+ case "18":
+ _status.devices.Add(new DeviceLightSensor(xn, _myVeraId));
+ break;
+
+ //case "19":
+ // m_status.devices.Add(new DeviceZwaveInt(xn, veraId));
+ // break
+ //case "20":
+ // m_status.devices.Add(new DeviceInsteonInt(xn, veraId));
+ // break
+
+ case "21":
+ _status.devices.Add(new DevicePowerMeter(xn, _myVeraId));
+ break;
+
+ case "0":
+ default:
+ // Check for Google Weather Device
+ if (xn.Attributes["WindCondition"] != null || xn.Attributes["windcondition"] != null)
+ {
+ _status.devices.Add(new DeviceGWeather(xn, _myVeraId));
+ break;
+ }
+ // Check for Bart's sprinkler Device
+ if (xn.Attributes["OperationMode"] != null)
+ {
+ _status.devices.Add(new DeviceSprinkler(xn, _myVeraId));
+ break;
+ }
+ _status.devices.Add(new DeviceGeneric(xn, _myVeraId));
+ break;
+ }
+ }
+ }
+ }
+
+ public long SecondsSinceLastUpdate
+ {
+ get { return (_helper.GetSecondsSince1970() - _lastUpdate); }
+ }
+
+ public List<Scene> scenes
+ {
+ get { return _status.scenes; }
+ }
+
+ public List<DeviceGeneric> devices
+ {
+ get { return _status.devices; }
+ }
+
+ public List<Room> rooms
+ {
+ get { return _status.rooms; }
+ }
+
+ public List<DevCategories> categories
+ {
+ get { return _status.categories; }
+ }
+
+ public List<Section> sections
+ {
+ get { return _status.sections; }
+ }
+
+ public bool lastUpdateFailed
+ {
+ get { return _lastUpdateFailed; }
+ set { _lastUpdateFailed = value; }
+ }
+
+ public string lastUpdateError
+ {
+ get { return _lastUpdateErrorMessage; }
+ }
+
+ public string name
+ {
+ get {
+ if (_name == "" || _name == "-")
+ {
+ return (_connectionType == ConnectionType.RemoteOnly ? _serial.ToString() : _ip);
+ }
+ return _name;
+ }
+ }
+
+ /// <summary>
+ /// Invoking this method will clear the update ready flag -> so caller need to handle the screen update
+ /// </summary>
+ /// <returns>When true a screen update shall be preformed by the caller</returns>
+ public bool NewScreenUpdateWaitingAndClearFlag()
+ {
+ bool b = _screenUpdateRequired;
+ _screenUpdateRequired = false;
+ return b;
+ }
+
+ public void setScreenUpdateRequired()
+ {
+ _screenUpdateRequired = true;
+ }
+ /// <summary>
+ /// A request is currently being handled by Vera, this request takes at least _minRefreshDelay msecs, at most _maxRefreshDelay seconds and will be finished the moment Vera detects a change.
+ /// As soon as this function returns false a new update request should be invoked (with UpdateCurrentStatus()), Vera will take care of the Refresh delays (by keeping open the http-connection)
+ /// </summary>
+ public bool updatePending
+ {
+ get { return _webUpdateClient.IsBusy; }
+ }
+
+
+ public VeraStatus status
+ {
+ get { return _status; }
+ }
+
+ public int myId
+ {
+ get { return _myVeraId; }
+ }
+
+ public int zeroId
+ {
+ get { return makeId(0); }
+ }
+
+ public int makeId(int id)
+ {
+ return (_myVeraId * VeraCommunication.IDMASK) + id;
+ }
+
+ public int makeId(string id)
+ {
+ return makeId(int.Parse(id));
+ }
+
+ public ConnectionType connectionType
+ {
+ get { return _connectionType; }
+ }
+
+ public bool inFallback
+ {
+ get { return (_connectionType == ConnectionType.Auto ? _fallBack...
[truncated message content] |
|
From: <Ba...@us...> - 2012-10-06 20:09:08
|
Revision: 4511
http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4511&view=rev
Author: BartEv
Date: 2012-10-06 20:09:02 +0000 (Sat, 06 Oct 2012)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/VeraControl/DeviceSprinkler.cs
trunk/plugins/VeraControl/VeraBox.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraHelper.cs
Modified: trunk/plugins/VeraControl/DeviceSprinkler.cs
===================================================================
--- trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-09-09 20:42:42 UTC (rev 4510)
+++ trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-10-06 20:09:02 UTC (rev 4511)
@@ -56,7 +56,7 @@
public override bool status
{
get { return _status; }
- set {
+ set {
if (id > 0) // Only send when a valid ID is found
{
ReportPendingRequest();
Modified: trunk/plugins/VeraControl/VeraBox.cs
===================================================================
--- trunk/plugins/VeraControl/VeraBox.cs 2012-09-09 20:42:42 UTC (rev 4510)
+++ trunk/plugins/VeraControl/VeraBox.cs 2012-10-06 20:09:02 UTC (rev 4511)
@@ -15,6 +15,7 @@
using System.Threading;
using System.Collections.Generic;
using System.Xml;
+using System.Linq;
namespace VeraControl.Properties
{
@@ -46,122 +47,77 @@
}
public Room GetRoomById(int id)
{
- foreach(Room room in rooms)
+ var room = from r in rooms where r.id == id select r;
+ if (room.Count() > 0)
{
- if (room.id == id)
- {
- return room;
- }
+ return room.First();
}
return new Room(null, 0);
}
public Section GetSectionById(int id)
{
- foreach(Section section in sections)
+ var section = from s in sections where s.id == id select s;
+ if (section.Count() > 0)
{
- if (section.id == id)
- {
- return section;
- }
+ return section.First();
}
return new Section(null, 0);
}
public DeviceGeneric GetDeviceById(int id)
{
- foreach(DeviceGeneric dev in devices)
+ var device = from d in devices where d.id == id select d;
+ if (device.Count() > 0)
{
- if (dev.id == id)
- {
- return dev;
- }
+ return device.First();
}
return new DeviceGeneric(null, 0);
}
public Scene GetSceneById(int id)
{
- foreach(Scene scene in scenes)
+ var scene = from s in scenes where s.id == id select s;
+ if (scene.Count() > 0)
{
- if (scene.id == id)
- {
- return scene;
- }
+ return scene.First();
}
return new Scene(null, 0);
}
public DevCategories GetCategoryById(int id)
{
- foreach(DevCategories cat in categories)
+ var cat = from c in categories where c.id == id select c;
+ if (cat.Count() > 0)
{
- if (cat.id == id)
- {
- return cat;
- }
+ return cat.First();
}
return new DevCategories(null);
}
public bool IsSectionFound(int id)
{
- foreach(Section section in sections)
- {
- if (section.id == id)
- {
- return true;
- }
- }
- return false;
+ return ((from s in sections where s.id == id select s).Count() > 0);
}
public bool IsRoomFound(int id)
{
- foreach(Room room in rooms)
- {
- if (room.id == id)
- {
- return true;
- }
- }
- return false;
+ return ((from r in rooms where r.id == id select r).Count() > 0);
}
public bool IsDeviceFound(int id)
{
- foreach(DeviceGeneric dev in devices)
- {
- if (dev.id == id)
- {
- return true;
- }
- }
- return false;
+ return ((from d in devices where d.id == id select d).Count() > 0);
}
public bool IsSceneFound(int id)
{
- foreach(Scene scene in scenes)
- {
- if (scene.id == id)
- {
- return true;
- }
- }
- return false;
+ return ((from s in scenes where s.id == id select s).Count() > 0);
}
public bool IsCategoryFound(int id)
{
- foreach(DevCategories cat in categories)
- {
- if (cat.id == id)
- {
- return true;
- }
- }
- return false;
+ return ((from c in categories where c.id == id select c).Count() > 0);
}
#endregion
}
@@ -433,6 +389,9 @@
}
}
+ // TODO: Add non standard json devices; http://192.10.1.240:3480/data_request?id=user_data&output_format=xml
+ // Dynamic create controls based on the supplied information
+
// Process Devices
xnList = xmlDoc.SelectNodes("/root/devices/device");
foreach (XmlNode xn in xnList)
Modified: trunk/plugins/VeraControl/VeraControl.cs
===================================================================
--- trunk/plugins/VeraControl/VeraControl.cs 2012-09-09 20:42:42 UTC (rev 4510)
+++ trunk/plugins/VeraControl/VeraControl.cs 2012-10-06 20:09:02 UTC (rev 4511)
@@ -147,7 +147,7 @@
public VeraControl()
{
- // TO DO: remove this sleep
+ // TODO: remove this sleep
// Thread.Sleep(5000);
}
@@ -254,7 +254,7 @@
Player.PlayBackEnded += new Player.EndedHandler(g_Player_PlayBackEnded);
Player.PlayBackStarted += new Player.StartedHandler(g_Player_PlayBackStarted);
Player.PlayBackStopped += new Player.StoppedHandler(g_Player_PlayBackStopped);
-
+
// Handle MP start-up trigger - do this is a different Thread to not block MP-start up
new Thread( () => {
_vera.UpdateStatusOfAllBoxes();
@@ -325,7 +325,14 @@
#region Action Trigger Detection
private void OnNewAction(Action action)
{
-
+ switch(action.wID)
+ { // This switch is for debug purposes (set breakpoint on next switch to debug Actions add ignore mouse/key actions)
+ case Action.ActionType.ACTION_KEY_PRESSED:
+ case Action.ActionType.ACTION_MOUSE_CLICK:
+ case Action.ActionType.ACTION_MOUSE_DOUBLECLICK:
+ case Action.ActionType.ACTION_MOUSE_MOVE:
+ return;
+ }
// Handle global action responders first (Scene triggers need to be handled also when we are not visible)
switch(action.wID)
{
@@ -347,6 +354,25 @@
}
break;
+ // Handle play button in pause mode
+ case Action.ActionType.ACTION_PLAY:
+ case Action.ActionType.ACTION_MUSIC_PLAY:
+ if (Player.IsMusic && _lastAction == Actiontrigger.MUSIC_PAUSED) {
+ HandleActionTriggers(Actiontrigger.MUSIC_PAUSE_RESUMED);
+ } else if (Player.IsRadio && _lastAction == Actiontrigger.RADIO_PAUSED) {
+ HandleActionTriggers(Actiontrigger.RADIO_PAUSE_RESUMED);
+ } else if (Player.IsTVRecording && _lastAction == Actiontrigger.RECORDING_PAUSED) {
+ HandleActionTriggers(Actiontrigger.RECORDING_PAUSE_RESUMED);
+ } else if ((Player.IsTV || Player.IsTimeShifting) && _lastAction == Actiontrigger.TV_PAUSED) {
+ HandleActionTriggers(Actiontrigger.TV_PAUSE_RESUMED);
+ } else if (Player.IsVideo && _lastAction == Actiontrigger.VIDEO_PAUSED) {
+ HandleActionTriggers(Actiontrigger.VIDEO_PAUSE_RESUMED);
+ } else {
+ if (_lastAction == Actiontrigger.UNKNOWN_PAUSED)
+ HandleActionTriggers(Actiontrigger.UNKNOWN_PAUSE_RESUMED);
+ }
+ break;
+
case Action.ActionType.ACTION_EXIT:
HandleActionTriggers(Actiontrigger.MP_EXIT);
break;
Modified: trunk/plugins/VeraControl/VeraHelper.cs
===================================================================
--- trunk/plugins/VeraControl/VeraHelper.cs 2012-09-09 20:42:42 UTC (rev 4510)
+++ trunk/plugins/VeraControl/VeraHelper.cs 2012-10-06 20:09:02 UTC (rev 4511)
@@ -34,7 +34,7 @@
}
private static volatile VeraHelper _instance;
- private static object _syncRoot = new Object();
+ private static object _syncRoot = new Object();
public static VeraHelper Instance
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2013-08-13 09:30:52
|
Revision: 4615
http://sourceforge.net/p/mp-plugins/code/4615
Author: bartev
Date: 2013-08-13 09:30:50 +0000 (Tue, 13 Aug 2013)
Log Message:
-----------
Modified Paths:
--------------
trunk/plugins/VeraControl/DevCategories.cs
trunk/plugins/VeraControl/Properties/AssemblyInfo.cs
trunk/plugins/VeraControl/VeraBox.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/skin/Default/VeraControl.xml
trunk/plugins/VeraControl/skin/Default/VeraDialogActionTrigger.xml
trunk/plugins/VeraControl/skin/Default/VeraDialogDeviceControl.xml
trunk/plugins/VeraControl/skin/Default/VeraDialogSceneControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraControl.xml
trunk/plugins/VeraControl/skin/DefaultWide/VeraDialogDeviceControl.xml
Added Paths:
-----------
trunk/plugins/VeraControl/skin/Titan/
trunk/plugins/VeraControl/skin/Titan/VeraControl.xml
trunk/plugins/VeraControl/skin/Titan/VeraDialogActionTrigger.xml
trunk/plugins/VeraControl/skin/Titan/VeraDialogDeviceControl.xml
trunk/plugins/VeraControl/skin/Titan/VeraDialogSceneControl.xml
Modified: trunk/plugins/VeraControl/DevCategories.cs
===================================================================
--- trunk/plugins/VeraControl/DevCategories.cs 2013-07-24 08:12:30 UTC (rev 4614)
+++ trunk/plugins/VeraControl/DevCategories.cs 2013-08-13 09:30:50 UTC (rev 4615)
@@ -62,9 +62,9 @@
public string GetIconName()
- {
+ { //reference : http://wiki.micasaverde.com/index.php/Luup_UPNP_Files#Device_Categories
switch (id)
- {
+ {
case 1: // Interface
return "USB_UIRT";
Modified: trunk/plugins/VeraControl/Properties/AssemblyInfo.cs
===================================================================
--- trunk/plugins/VeraControl/Properties/AssemblyInfo.cs 2013-07-24 08:12:30 UTC (rev 4614)
+++ trunk/plugins/VeraControl/Properties/AssemblyInfo.cs 2013-08-13 09:30:50 UTC (rev 4615)
@@ -14,7 +14,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Bart Eversdijk")]
[assembly: AssemblyProduct("VeraControl")]
-[assembly: AssemblyCopyright("Copyright 2012")]
+[assembly: AssemblyCopyright("Copyright 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -28,4 +28,4 @@
//
// You can specify all the values or you can use the default the Revision and
// Build Numbers by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.1.0")]
+[assembly: AssemblyVersion("1.1.0.0")]
Modified: trunk/plugins/VeraControl/VeraBox.cs
===================================================================
--- trunk/plugins/VeraControl/VeraBox.cs 2013-07-24 08:12:30 UTC (rev 4614)
+++ trunk/plugins/VeraControl/VeraBox.cs 2013-08-13 09:30:50 UTC (rev 4615)
@@ -403,7 +403,7 @@
} else {
_status.system.SetFullReloadFlag();
- // catids: http://wiki.micasaverde.com/index.php/Luup_UPNP_Files
+ // catids: http://wiki.micasaverde.com/index.php/Luup_UPNP_Files#Device_Categories
switch (xn.Attributes["category"].Value)
{
//case "1": // TODO: Implement interface device ?
Modified: trunk/plugins/VeraControl/VeraControl.cs
===================================================================
--- trunk/plugins/VeraControl/VeraControl.cs 2013-07-24 08:12:30 UTC (rev 4614)
+++ trunk/plugins/VeraControl/VeraControl.cs 2013-08-13 09:30:50 UTC (rev 4615)
@@ -30,7 +30,7 @@
using System.Windows;
using MediaPortal.Common.Utils;
-[assembly: CompatibleVersion("1.1.6.27644")]
+[assembly: CompatibleVersion("1.3.100.0","1.1.6.27644")]
[assembly: UsesSubsystem("MP.SkinEngine")]
[assembly: UsesSubsystem("MP.Config")]
@@ -93,11 +93,11 @@
[SkinControlAttribute(33)] protected GUILabelControl _deviceStatusText = null;
[SkinControl(500)] protected GUIButtonControl _actionVeraSelectButton = null;
- [SkinControl(501)] protected GUIToggleButtonControl _actionTriggerButton = null;
+ [SkinControl(501)] protected GUICheckButton _actionTriggerButton = null;
[SkinControl(502)] protected GUIButtonControl _actionSceneEditButton = null;
[SkinControl(503)] protected GUIButtonControl _actionFilterButton = null;
[SkinControl(504)] protected GUIButtonControl _actionSortButton = null;
- [SkinControl(505)] protected GUIToggleButtonControl _actionAutoRoomButton = null;
+ [SkinControl(505)] protected GUICheckButton _actionAutoRoomButton = null;
[SkinControl(506)] protected GUIButtonControl _actionViewButton = null;
@@ -126,7 +126,7 @@
private VeraFilterStyle _selectedFilterOption = VeraFilterStyle.NONE;
private bool [] _lastUpdateFailed = new bool[100];
- private string _titleTxt = "Micasa Verde - Vera control";
+ private string _titleTxt = "Selected: ";
private SortItem [] _sortOptions = new SortItem [] {
new SortItem(VeraSortStyle.NO, "No Sorting, keep Vera's sorting", "No"),
@@ -296,7 +296,7 @@
OnActionSceneEditButton((GUIButtonControl)control);
if (control == _actionTriggerButton)
- OnActionTrigger((GUIToggleButtonControl)control);
+ OnActionTrigger((GUICheckButton)control);
if(control == _actionVeraSelectButton)
{
@@ -313,7 +313,7 @@
OnActionSortButton((GUIButtonControl)control);
if (control == _actionAutoRoomButton)
- OnActionAutoRoomButton((GUIToggleButtonControl)control);
+ OnActionAutoRoomButton((GUICheckButton)control);
if (control == _actionViewButton)
OnActionViewButton((GUIButtonControl)control);
@@ -1105,7 +1105,7 @@
} else {
_flowList.SelectedListItemIndex = 0;
}
- _title.Label = _titleTxt + " - Scenes";
+ _title.Label = _titleTxt + "Scenes";
}
private void FillinSceneInfo(GUIListItem item, Scene scene)
@@ -1144,7 +1144,7 @@
}
}
}
- _title.Label = _titleTxt + " - " + _vera.GetRoomById(selectedRoom).name;
+ _title.Label = _titleTxt + _vera.GetRoomById(selectedRoom).name;
}
private void ListDevicesPerCategory(int selectedCategory)
@@ -1182,7 +1182,7 @@
}
}
}
- _title.Label = _titleTxt + " - " + _vera.GetCategoryById(selectedCategory).name;
+ _title.Label = _titleTxt + _vera.GetCategoryById(selectedCategory).name;
}
private void FillinDeviceInfo(GUIListItem item, DeviceGeneric dev)
@@ -1324,7 +1324,7 @@
}
}
- private void OnActionTrigger(GUIToggleButtonControl control)
+ private void OnActionTrigger(GUICheckButton control)
{
_enableSceneTrigger = control.Selected;
@@ -1480,7 +1480,7 @@
}
}
- private void OnActionAutoRoomButton(GUIToggleButtonControl control)
+ private void OnActionAutoRoomButton(GUICheckButton control)
{
_autoSelectRoom = control.Selected;
Modified: trunk/plugins/VeraControl/skin/Default/VeraControl.xml
===================================================================
--- trunk/plugins/VeraControl/skin/Default/VeraControl.xml 2013-07-24 08:12:30 UTC (rev 4614)
+++ trunk/plugins/VeraControl/skin/Default/VeraControl.xml 2013-08-13 09:30:50 UTC (rev 4615)
@@ -9,17 +9,20 @@
<id>1</id>
<posX>0</posX>
<posY>0</posY>
- <width>720</width>
- <height>576</height>
+ <width>960</width>
+ <height>720</height>
<texture>background.png</texture>
</control>
+
+<import>common.time.xml</import>
+<import>common.window.xml</import>
<control>
<description>an Image</description>
<type>image</type>
<id>2</id>
- <posX>10</posX>
- <posY>320</posY>
+ <posX>120</posX>
+ <posY>520</posY>
<width>150</width>
<height>180</height>
<texture>hover_remote.png</texture>
@@ -29,9 +32,9 @@
<type>image</type>
<id>30</id>
<posX>300</posX>
- <posY>530</posY>
- <width>20</width>
- <height>20</height>
+ <posY>650</posY>
+ <width>25</width>
+ <height>25</height>
<texture></texture>
<visible>no</visible>
</control>
@@ -41,7 +44,7 @@
<type>label</type>
<id>31</id>
<posX>320</posX>
- <posY>530</posY>
+ <posY>650</posY>
<label></label>
<font>font13</font>
<textcolor>90FFFFFF</textcolor>
@@ -51,9 +54,9 @@
<type>image</type>
<id>32</id>
<posX>300</posX>
- <posY>500</posY>
- <width>20</width>
- <height>20</height>
+ <posY>620</posY>
+ <width>25</width>
+ <height>25</height>
<texture></texture>
<visible>no</visible>
</control>
@@ -63,7 +66,7 @@
<type>label</type>
<id>33</id>
<posX>320</posX>
- <posY>500</posY>
+ <posY>620</posY>
<label></label>
<font>font13</font>
<textcolor>90FFFFFF</textcolor>
@@ -74,7 +77,7 @@
<type>actiongroup</type>
<visible>!Control.HasFocus(200)</visible>
<dimColor>00ffffff</dimColor>
- <width>263</width>
+ <width>960</width>
<height>473</height>
<buttonX>0</buttonX>
<buttonY>0</buttonY>
@@ -88,28 +91,28 @@
<type>image</type>
<posX>15</posX>
<posY>63</posY>
- <width>206</width>
+ <width>290</width>
<height>472</height>
<texture>Backslide.png</texture>
<colorDiffuse>fffffffff</colorDiffuse>
<visible>!Control.HasFocus(20)+!Control.HasFocus(40)+!Control.HasFocus(50)</visible>
- <animation effect="slide" time="150" start="-300,0" reversible="false">visible</animation>
- <animation effect="slide" time="150" end="-300,0" reversible="false">hidden</animation>
+ <animation effect="slide" time="70" start="-300,0" reversible="false">visible</animation>
+ <animation effect="slide" time="70" end="-300,0" reversible="false">hidden</animation>
</control>
<control>
<description>group element</description>
<type>group</type>
<visible>!Control.HasFocus(20)+!Control.HasFocus(40)+!Control.HasFocus(50)</visible>
- <posX>40</posX>
- <posY>97</posY>
+ <posX>37</posX>
+ <posY>121</posY>
<layout>StackLayout</layout>
- <animation effect="slide" time="150" start="-300,0" reversible="false">visible</animation>
- <animation effect="slide" time="150" end="-300,0" reversible="false">hidden</animation>
+ <animation effect="slide" time="70" start="-300,0" reversible="false">visible</animation>
+ <animation effect="slide" time="70" end="-300,0" reversible="false">hidden</animation>
<control>
<id>500</id>
<description>Box Selector</description>
<type>button</type>
- <onup>505</onup>
+ <onup>506</onup>
<ondown>501</ondown>
<onright>40</onright>
<label>Box:</label>
@@ -117,15 +120,11 @@
<control>
<id>501</id>
<description>Enable disable scene triggers</description>
- <type>togglebutton</type>
+ <type>checkbutton</type>
<onup>500</onup>
<ondown>502</ondown>
<onright>40</onright>
<label>Scene Triggers</label>
- <textureFocus>togglebutton-on-focus.png</textureFocus>
- <textureNoFocus>togglebutton-on-nofocus.png</textureNoFocus>
- <AltTextureFocus>togglebutton-off-focus.png</AltTextureFocus>
- <AltTextureNoFocus>togglebutton-off-nofocus.png</AltTextureNoFocus>
</control>
<control>
<id>502</id>
@@ -157,15 +156,11 @@
<control>
<id>505</id>
<description>Instant Update Room List</description>
- <type>togglebutton</type>
+ <type>checkbutton</type>
<onup>504</onup>
<ondown>506</ondown>
<onright>40</onright>
<label>Show list on focus</label>
- <textureFocus>togglebutton-on-focus.png</textureFocus>
- <textureNoFocus>togglebutton-on-nofocus.png</textureNoFocus>
- <AltTextureFocus>togglebutton-off-focus.png</AltTextureFocus>
- <AltTextureNoFocus>togglebutton-off-nofocus.png</AltTextureNoFocus>
</control>
<control>
<id>506</id>
@@ -189,7 +184,7 @@
<id>20</id>
<label>Section:</label>
<posX>30</posX>
- <posY>55</posY>
+ <posY>75</posY>
<onleft>500</onleft>
<onright>50</onright>
<ondown>40</ondown>
@@ -209,8 +204,8 @@
<showrange>no</showrange>
<reverse>no</reverse>
<cycleItems>yes</cycleItems>
- <height>34</height>
- <width>250</width>
+ <height>40</height>
+ <width>300</width>
<font>font12</font>
<shadowAngle>45</shadowAngle>
<shadowDistance>1</shadowDistance>
@@ -236,9 +231,9 @@
<type>listcontrol</type>
<id>40</id>
<posX>30</posX>
- <posY>85</posY>
- <height>300</height>
- <width>250</width>
+ <posY>150</posY>
+ <height>430</height>
+ <width>400</width>
<spinx>300</spinx>
<onup>20</onup>
<ondown>20</ondown>
@@ -261,74 +256,35 @@
<keepaspectratio>yes</keepaspectratio>
</control>
</control>
+ <control>
+ <description>Cover Flow view</description>
+ <animation effect="fade" time="150">WindowOpen</animation>
+ <animation effect="fade" time="250">WindowClose</animation>
+ <animation effect="slide" time="550" start="1960,0">WindowOpen</animation>
+ <animation effect="slide" time="250" end="1960,0">WindowClose</animation>
- <control>
- <description>Cover Flow view</description>
<type>coverflow</type>
- <colordiffuse>90ffffff</colordiffuse>
- <dimColor>90ffffff</dimColor>
<id>41</id>
<posX>0</posX>
<posY>160</posY>
- <width>720</width>
+ <width>950</width>
<height>576</height>
<onup>20</onup>
- <onleft>500</onleft>
- <selectedCard>0</selectedCard>
- <cardWidth>270</cardWidth>
- <cardHeight>270</cardHeight>
- <angle>65</angle>
- <sideShift>200</sideShift>
+ <onleft>500</onleft>
+ <cardWidth>270</cardWidth>
+ <cardHeight>270</cardHeight>
+ <sideShift>380</sideShift>
<sideGap>90</sideGap>
- <sideDepth>400</sideDepth>
- <offsetY>0</offsetY>
- <selectedOffsetY>0</selectedOffsetY>
- <speed>8</speed>
- <backgroundDiffuse>FF000000</backgroundDiffuse>
- <background>-</background>
- <showBackground>no</showBackground>
- <foregroundHeight>576</foregroundHeight>
- <foregroundWidth>720</foregroundWidth>
- <foregroundX>0</foregroundX>
- <foregroundY>0</foregroundY>
- <foregroundDiffuse>FF000000</foregroundDiffuse>
- <foreground>coverflow_foreground.png</foreground>
- <showForeground>no</showForeground>
- <showFrame>no</showFrame>
- <frame>Picture_cover2.png</frame>
- <frameFocus>Picture_cover2.png</frameFocus>
- <frameWidth>270</frameWidth>
- <frameHeight>270</frameHeight>
- <spinSpeed>8</spinSpeed>
- <unfocusedAlpha>FF</unfocusedAlpha>
- <folderPrefix>[</folderPrefix>
- <folderSuffix>]</folderSuffix>
- <font1>font15</font1>
- <font2>font10</font2>
- <label1>...</label1>
- <label2></label2>
- <textColor>FFFFFFFF</textColor>
- <remoteColor>FFFF0000</remoteColor>
- <playedColor>FFA0D0FF</playedColor>
- <downloadColor>FF00FF00</downloadColor>
- <selectedColor>FFFFFFFF</selectedColor>
- <shadowAngle>45</shadowAngle>
- <shadowDistance>0</shadowDistance>
- <shadowColor>FF000000</shadowColor>
- <label1YOff>-30</label1YOff>
- <label2YOff>330</label2YOff>
- <pageSize>5</pageSize>
- <keepaspectratio>yes</keepaspectratio>
- <scrollbarBackground>bar_hor.png</scrollbarBackground>
- <scrollbarLeft>mouse_left_horizontal.png</scrollbarLeft>
- <scrollbarRight>mouse_right_horizontal.png</scrollbarRight>
- <scrollbarYOff>285</scrollbarYOff>
- <showScrollbar>no</showScrollbar>
- <cards mask="Picturethumbmask.png">Picturethumbmask.png</cards>
- </control>
+ <sideDepth>550</sideDepth>
+ <angle>65</angle>
+ <selectedOffsetY>120</selectedOffsetY>
+ <offsetY>160</offsetY>
+ <label1YOff>-3000</label1YOff>
+ <font1>font14</font1>
+ <showScrollbar>no</showScrollbar>
+ <showFrame>no</showFrame>
+ </control>
-
-
<control>
<description>group element</description>
<type>group</type>
@@ -341,10 +297,10 @@
<description>right control</description>
<type>listcontrol</type>
<id>50</id>
- <posX>300</posX>
- <posY>55</posY>
- <height>460</height>
- <width>300</width>
+ <posX>500</posX>
+ <posY>150</posY>
+ <height>500</height>
+ <width>400</width>
<onleft>40</onleft>
<onright>500</onright>
<scrollOffset>5</scrollOffset>
@@ -372,10 +328,12 @@
<control>
<type>label</type>
- <posX>200</posX>
- <posY>17</posY>
+ <posX>20</posX>
+ <posY>10</posY>
<label>Micasa Verde - Vera control</label>
<id>10</id>
+ <font>font11</font>
+ <textcolor>ff6FAFE1</textcolor>
</control>
</controls>
</window>
Modified: trunk/plugins/VeraControl/skin/Default/VeraDialogActionTrigger.xml
===================================================================
--- trunk/plugins/VeraControl/skin/Default/VeraDialogActionTrigger.xml 2013-07-24 08:12:30 UTC (rev 4614)
+++ trunk/plugins/VeraControl/skin/Default/VeraDialogActionTrigger.xml 2013-08-13 09:30:50 UTC (rev 4615)
@@ -9,8 +9,8 @@
<description>Heading text label</description>
<type>label</type>
<id>4</id>
- <posX>239</posX>
- <posY>89</posY>
+ <posX>245</posX>
+ <posY>130</posY>
<label>181</label>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
@@ -18,26 +18,26 @@
<control>
<type>image</type>
<id>0</id>
- <width>720</width>
- <height>576</height>
+ <width>960</width>
+ <height>720</height>
<texture>black.png</texture>
<colordiffuse>40ffffff</colordiffuse>
</control>
<control>
<type>image</type>
<id>0</id>
- <posX>115</posX>
- <posY>64</posY>
- <width>545</width>
- <height>365</height>
+ <posX>210</posX>
+ <posY>100</posY>
+ <width>550</width>
+ <height>440</height>
<texture>context_background.png</texture>
</control>
<control>
<description>Exit button</description>
<type>button</type>
<id>2</id>
- <posX>585</posX>
- <posY>77</posY>
+ <posX>690</posX>
+ <posY>130</posY>
<width>40</width>
<height>40</height>
<textureFocus>dialogue_shutdown_focus.png</textureFocus>
@@ -56,8 +56,8 @@
<description>Play label</description>
<type>label</type>
<id>0</id>
- <posX>280</posX>
- <posY>130</posY>
+ <posX>380</posX>
+ <posY>170</posY>
<label>2553</label>
<font>font10</font>
<textcolor>80FFFFFF</textcolor>
@@ -66,8 +66,8 @@
<description>Paused label</description>
<type>label</type>
<id>0</id>
- <posX>370</posX>
- <posY>130</posY>
+ <posX>470</posX>
+ <posY>170</posY>
<label>19011</label>
<font>font10</font>
<textcolor>80FFFFFF</textcolor>
@@ -76,8 +76,8 @@
<description>Resume label</description>
<type>label</type>
<id>0</id>
- <posX>460</posX>
- <posY>130</posY>
+ <posX>560</posX>
+ <posY>170</posY>
<label>732</label>
<font>font10</font>
<textcolor>80FFFFFF</textcolor>
@@ -86,8 +86,8 @@
<description>Stop label</description>
<type>label</type>
<id>0</id>
- <posX>550</posX>
- <posY>130</posY>
+ <posX>650</posX>
+ <posY>170</posY>
<label>2552</label>
<font>font10</font>
<textcolor>80FFFFFF</textcolor>
@@ -99,8 +99,8 @@
<description>Music label</description>
<type>label</type>
<id>0</id>
- <posX>150</posX>
- <posY>160</posY>
+ <posX>260</posX>
+ <posY>200</posY>
<label>249</label>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
@@ -109,8 +109,8 @@
<control>
<description>Music started</description>
<id>20</id>
- <posX>280</posX>
- <posY>160</posY>
+ <posX>380</posX>
+ <posY>200</posY>
<onleft>23</onleft>
<onright>21</onright>
<onup>50</onup>
@@ -140,8 +140,8 @@
<control>
<description>Music paused</description>
<id>21</id>
- <posX>370</posX>
- <posY>160</posY>
+ <posX>470</posX>
+ <posY>200</posY>
<onup>51</onup>
<ondown>26</ondown>
<onleft>20</onleft>
@@ -171,8 +171,8 @@
<control>
<description>Music resumed</description>
<id>22</id>
- <posX>460</posX>
- <posY>160</posY>
+ <posX>560</posX>
+ <posY>200</posY>
<onup>52</onup>
<ondown>27</ondown>
<onleft>21</onleft>
@@ -202,8 +202,8 @@
<control>
<description>Music stopped</description>
<id>23</id>
- <posX>550</posX>
- <posY>160</posY>
+ <posX>650</posX>
+ <posY>200</posY>
<onup>2</onup>
<ondown>28</ondown>
<onleft>22</onleft>
@@ -235,8 +235,8 @@
<description>Video label</description>
<type>label</type>
<id>0</id>
- <posX>150</posX>
- <posY>190</posY>
+ <posX>260</posX>
+ <posY>230</posY>
<label>291</label>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
@@ -244,8 +244,8 @@
<control>
<description>Video start</description>
<id>25</id>
- <posX>280</posX>
- <posY>190</posY>
+ <posX>380</posX>
+ <posY>230</posY>
<onup>20</onup>
<ondown>30</ondown>
<onleft>28</onleft>
@@ -275,8 +275,8 @@
<control>
<description>Video paused</description>
<id>26</id>
- <posX>370</posX>
- <posY>190</posY>
+ <posX>470</posX>
+ <posY>230</posY>
<onup>21</onup>
<ondown>31</ondown>
<onleft>25</onleft>
@@ -306,8 +306,8 @@
<control>
<description>Video resumed</description>
<id>27</id>
- <posX>460</posX>
- <posY>190</posY>
+ <posX>560</posX>
+ <posY>230</posY>
<onup>22</onup>
<ondown>32</ondown>
<onleft>26</onleft>
@@ -337,8 +337,8 @@
<control>
<description>Video stopped</description>
<id>28</id>
- <posX>550</posX>
- <posY>190</posY>
+ <posX>650</posX>
+ <posY>230</posY>
<onup>23</onup>
<ondown>33</ondown>
<onleft>27</onleft>
@@ -370,8 +370,8 @@
<description>TV label</description>
<type>label</type>
<id>0</id>
- <posX>150</posX>
- <posY>220</posY>
+ <posX>260</posX>
+ <posY>260</posY>
<label>605</label>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
@@ -379,8 +379,8 @@
<control>
<description>TV start</description>
<id>30</id>
- <posX>280</posX>
- <posY>220</posY>
+ <posX>380</posX>
+ <posY>260</posY>
<onup>25</onup>
<ondown>35</ondown>
<onleft>33</onleft>
@@ -410,8 +410,8 @@
<control>
<description>TV paused</description>
<id>31</id>
- <posX>370</posX>
- <posY>220</posY>
+ <posX>470</posX>
+ <posY>260</posY>
<onup>26</onup>
<ondown>36</ondown>
<onleft>30</onleft>
@@ -441,8 +441,8 @@
<control>
<description>TV resumed</description>
<id>32</id>
- <posX>460</posX>
- <posY>220</posY>
+ <posX>560</posX>
+ <posY>260</posY>
<onup>27</onup>
<ondown>37</ondown>
<onleft>31</onleft>
@@ -472,8 +472,8 @@
<control>
<description>TV stopped</description>
<id>33</id>
- <posX>550</posX>
- <posY>220</posY>
+ <posX>650</posX>
+ <posY>260</posY>
<onup>28</onup>
<ondown>38</ondown>
<onleft>32</onleft>
@@ -505,8 +505,8 @@
<description>Recordings label</description>
<type>label</type>
<id>0</id>
- <posX>150</posX>
- <posY>250</posY>
+ <posX>260</posX>
+ <posY>290</posY>
<label>652</label>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
@@ -514,8 +514,8 @@
<control>
<description>Recordings start</description>
<id>35</id>
- <posX>280</posX>
- <posY>250</posY>
+ <posX>380</posX>
+ <posY>290</posY>
<onup>30</onup>
<ondown>40</ondown>
<onleft>38</onleft>
@@ -545,8 +545,8 @@
<control>
<description>Recordings paused</description>
<id>36</id>
- <posX>370</posX>
- <posY>250</posY>
+ <posX>470</posX>
+ <posY>290</posY>
<onup>31</onup>
<ondown>41</ondown>
<onleft>35</onleft>
@@ -576,8 +576,8 @@
<control>
<description>Recordings resumed</description>
<id>37</id>
- <posX>460</posX>
- <posY>250</posY>
+ <posX>560</posX>
+ <posY>290</posY>
<onup>32</onup>
<ondown>42</ondown>
<onleft>36</onleft>
@@ -607,8 +607,8 @@
<control>
<description>Recordings stopped</description>
<id>38</id>
- <posX>550</posX>
- <posY>250</posY>
+ <posX>650</posX>
+ <posY>290</posY>
<onup>33</onup>
<ondown>43</ondown>
<onleft>37</onleft>
@@ -640,8 +640,8 @@
<description>Radio label</description>
<type>label</type>
<id>0</id>
- <posX>150</posX>
- <posY>280</posY>
+ <posX>260</posX>
+ <posY>320</posY>
<label>862</label>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
@@ -649,8 +649,8 @@
<control>
<description>Radio start</description>
<id>40</id>
- <posX>280</posX>
- <posY>280</posY>
+ <posX>380</posX>
+ <posY>320</posY>
<onup>35</onup>
<ondown>45</ondown>
<onleft>43</onleft>
@@ -680,8 +680,8 @@
<control>
<description>Radio paused</description>
<id>41</id>
- <posX>370</posX>
- <posY>280</posY>
+ <posX>470</posX>
+ <posY>320</posY>
<onup>36</onup>
<ondown>46</ondown>
<onleft>40</onleft>
@@ -711,8 +711,8 @@
<control>
<description>Radio resumed</description>
<id>42</id>
- <posX>460</posX>
- <posY>280</posY>
+ <posX>560</posX>
+ <posY>320</posY>
<onup>37</onup>
<ondown>47</ondown>
<onleft>41</onleft>
@@ -742,8 +742,8 @@
<control>
<description>Radio stopped</description>
<id>43</id>
- <posX>550</posX>
- <posY>280</posY>
+ <posX>650</posX>
+ <posY>320</posY>
<onup>38</onup>
<ondown>48</ondown>
<onleft>42</onleft>
@@ -775,8 +775,8 @@
<description>Unknown label</description>
<type>label</type>
<id>0</id>
- <posX>150</posX>
- <posY>310</posY>
+ <posX>260</posX>
+ <posY>350</posY>
<label>2014</label>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
@@ -784,8 +784,8 @@
<control>
<description>Unknown start</description>
<id>45</id>
- <posX>280</posX>
- <posY>310</posY>
+ <posX>380</posX>
+ <posY>350</posY>
<onup>40</onup>
<ondown>50</ondown>
<onleft>48</onleft>
@@ -815,8 +815,8 @@
<control>
<description>Unknown paused</description>
<id>46</id>
- <posX>370</posX>
- <posY>310</posY>
+ <posX>470</posX>
+ <posY>350</posY>
<onup>41</onup>
<ondown>51</ondown>
<onleft>45</onleft>
@@ -846,8 +846,8 @@
<control>
<description>Unknown resumed</description>
<id>47</id>
- <posX>460</posX>
- <posY>310</posY>
+ <posX>560</posX>
+ <posY>350</posY>
<onup>42</onup>
<ondown>52</ondown>
<onleft>46</onleft>
@@ -877,8 +877,8 @@
<control>
<description>Unknown stopped</description>
<id>48</id>
- <posX>550</posX>
- <posY>310</posY>
+ <posX>650</posX>
+ <posY>350</posY>
<onup>43</onup>
<ondown>100</ondown>
<onleft>47</onleft>
@@ -910,8 +910,8 @@
<description>Startup label</description>
<type>label</type>
<id>0</id>
- <posX>280</posX>
- <posY>340</posY>
+ <posX>380</posX>
+ <posY>380</posY>
<label>3017</label>
<font>font10</font>
<textcolor>80FFFFFF</textcolor>
@@ -920,8 +920,8 @@
<description>Sleep label</description>
<type>label</type>
<id>0</id>
- <posX>370</posX>
- <posY>340</posY>
+ <posX>470</posX>
+ <posY>380</posY>
<label>1032</label>
<font>font10</font>
<textcolor>80FFFFFF</textcolor>
@@ -930,8 +930,8 @@
<description>Exit label</description>
<type>label</type>
<id>0</id>
- <posX>460</posX>
- <posY>340</posY>
+ <posX>560</posX>
+ <posY>380</posY>
<label>1030</label>
<font>font10</font>
<textcolor>80FFFFFF</textcolor>
@@ -941,8 +941,8 @@
<description>MediaPortal label</description>
<type>label</type>
<id>0</id>
- <posX>150</posX>
- <posY>370</posY>
+ <posX>260</posX>
+ <posY>410</posY>
<label>MediaPortal</label>
<font>font13</font>
<textcolor>FFFFFFFF</textcolor>
@@ -950,8 +950,8 @@
<control>
<description>MediaPortal start</description>
<id>50</id>
- <posX>280</posX>
- <posY>370</posY>
+ <posX>380</posX>
+ <posY>410</posY>
<onup>45</onup>
<ondown>20</ondown>
<onleft>100</onleft>
@@ -981,8 +981,8 @@
<control>
<description>MediaPortal Sleep</description>
<id>51</id>
- <posX>370</posX>
- <posY>370</posY>
+ <posX>470</posX>
+ <posY>410</posY>
<onup>46</onup>
<ondown>21</ondown>
<onleft>50</onleft>
@...
[truncated message content] |
|
From: <ba...@us...> - 2013-08-19 19:54:21
|
Revision: 4619
http://sourceforge.net/p/mp-plugins/code/4619
Author: bartev
Date: 2013-08-19 19:54:19 +0000 (Mon, 19 Aug 2013)
Log Message:
-----------
Fixed UTF8 strings
Modified Paths:
--------------
trunk/plugins/VeraControl/VeraControl.csproj
trunk/plugins/VeraControl/VeraHelper.cs
Modified: trunk/plugins/VeraControl/VeraControl.csproj
===================================================================
--- trunk/plugins/VeraControl/VeraControl.csproj 2013-08-19 19:50:54 UTC (rev 4618)
+++ trunk/plugins/VeraControl/VeraControl.csproj 2013-08-19 19:54:19 UTC (rev 4619)
@@ -73,6 +73,7 @@
<Reference Include="System.ServiceModel.Web">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
+ <Reference Include="System.Web" />
<Reference Include="System.Web.Extensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
Modified: trunk/plugins/VeraControl/VeraHelper.cs
===================================================================
--- trunk/plugins/VeraControl/VeraHelper.cs 2013-08-19 19:50:54 UTC (rev 4618)
+++ trunk/plugins/VeraControl/VeraHelper.cs 2013-08-19 19:54:19 UTC (rev 4619)
@@ -10,6 +10,9 @@
*/
using System;
using System.Xml;
+using System.Text;
+using System.Web;
+using System.IO;
namespace VeraControl.Properties
{
@@ -126,7 +129,10 @@
{
return def;
}
- return xn.Attributes[key].Value;
+
+ // Vera send UTF8 strings in ASCII format convert them to real UTF8 strings.
+ byte[] bytes = Encoding.Default.GetBytes(HttpUtility.UrlDecode(xn.Attributes[key].Value));
+ return Encoding.UTF8.GetString(bytes);
}
public long GetSecondsSince1970()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2014-08-14 21:47:13
|
Revision: 4870
http://sourceforge.net/p/mp-plugins/code/4870
Author: bartev
Date: 2014-08-14 21:47:03 +0000 (Thu, 14 Aug 2014)
Log Message:
-----------
Added direct scene trigger control and MP 1.8.x support
Modified Paths:
--------------
trunk/plugins/VeraControl/DialogActionTrigger.cs
trunk/plugins/VeraControl/DialogDeviceControl.cs
trunk/plugins/VeraControl/VeraControl.cs
trunk/plugins/VeraControl/VeraControl.csproj
trunk/plugins/VeraControl/VeraControl.sln
Modified: trunk/plugins/VeraControl/DialogActionTrigger.cs
===================================================================
--- trunk/plugins/VeraControl/DialogActionTrigger.cs 2014-08-14 21:45:58 UTC (rev 4869)
+++ trunk/plugins/VeraControl/DialogActionTrigger.cs 2014-08-14 21:47:03 UTC (rev 4870)
@@ -63,7 +63,18 @@
[SkinControlAttribute(50)] protected GUISpinButton _spMPStart = null;
[SkinControlAttribute(51)] protected GUISpinButton _spMPSleep = null;
[SkinControlAttribute(52)] protected GUISpinButton _spMPExit = null;
-
+
+ [SkinControlAttribute(60)] protected GUISpinButton _spNumkey0 = null;
+ [SkinControlAttribute(61)] protected GUISpinButton _spNumkey1 = null;
+ [SkinControlAttribute(62)] protected GUISpinButton _spNumkey2 = null;
+ [SkinControlAttribute(63)] protected GUISpinButton _spNumkey3 = null;
+ [SkinControlAttribute(64)] protected GUISpinButton _spNumkey4 = null;
+ [SkinControlAttribute(65)] protected GUISpinButton _spNumkey5 = null;
+ [SkinControlAttribute(66)] protected GUISpinButton _spNumkey6 = null;
+ [SkinControlAttribute(67)] protected GUISpinButton _spNumkey7 = null;
+ [SkinControlAttribute(68)] protected GUISpinButton _spNumkey8 = null;
+ [SkinControlAttribute(69)] protected GUISpinButton _spNumkey9 = null;
+
private VeraCommunication _vera = VeraCommunication.Instance;
public DialogActionTrigger()
@@ -84,7 +95,9 @@
_spRecStart, _spRecPause, _spRecResume, _spRecStop,
_spRadioStart, _spRadioPause, _spRadioResume, _spRadioStop,
_spUnknownStart, _spUnknownPause, _spUnknownResume, _spUnknownStop,
- _spMPStart, _spMPSleep, _spMPExit
+ _spMPStart, _spMPSleep, _spMPExit,
+ _spNumkey0, _spNumkey1, _spNumkey2, _spNumkey3, _spNumkey4,
+ _spNumkey5, _spNumkey6, _spNumkey7, _spNumkey8, _spNumkey9
};
// (P)re load spin contor
@@ -153,7 +166,9 @@
_spRecStart, _spRecPause, _spRecResume, _spRecStop,
_spRadioStart, _spRadioPause, _spRadioResume, _spRadioStop,
_spUnknownStart, _spUnknownPause, _spUnknownResume, _spUnknownStop,
- _spMPStart, _spMPSleep, _spMPExit
+ _spMPStart, _spMPSleep, _spMPExit,
+ _spNumkey0, _spNumkey1, _spNumkey2, _spNumkey3, _spNumkey4,
+ _spNumkey5, _spNumkey6, _spNumkey7, _spNumkey8, _spNumkey9
};
for (int i = 0; i < spinList.Length; i++)
{
Modified: trunk/plugins/VeraControl/DialogDeviceControl.cs
===================================================================
--- trunk/plugins/VeraControl/DialogDeviceControl.cs 2014-08-14 21:45:58 UTC (rev 4869)
+++ trunk/plugins/VeraControl/DialogDeviceControl.cs 2014-08-14 21:47:03 UTC (rev 4870)
@@ -9,6 +9,7 @@
* E-mail: ba...@ev...
*/
using System;
+using System.Windows;
using System.Threading;
using System.Collections;
using MediaPortal;
Modified: trunk/plugins/VeraControl/VeraControl.cs
===================================================================
--- trunk/plugins/VeraControl/VeraControl.cs 2014-08-14 21:45:58 UTC (rev 4869)
+++ trunk/plugins/VeraControl/VeraControl.cs 2014-08-14 21:47:03 UTC (rev 4870)
@@ -72,6 +72,17 @@
MP_SHUTDOWN,
MP_EXIT,
+ NUMKEY_0,
+ NUMKEY_1,
+ NUMKEY_2,
+ NUMKEY_3,
+ NUMKEY_4,
+ NUMKEY_5,
+ NUMKEY_6,
+ NUMKEY_7,
+ NUMKEY_8,
+ NUMKEY_9,
+
LAST_ACTIONTRIGGER
};
@@ -117,6 +128,7 @@
private long _lastSystemStatusChg = 0;
private int _lastSystemStatusId = 0;
+ private int _directSceneState = 0; // 1 = 1 star = pressed, 2 = 2 stars pressen '0' - '9' num key pressen --> waiting for # to confirm
public bool _enableSceneTrigger = false;
private bool _autoSelectRoom = true;
private bool _viewPerCategory = false;
@@ -238,6 +250,7 @@
{
_selectedRoom = ALL;
_selectedSection = ALL;
+
using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.MPSettings())
{
@@ -327,12 +340,20 @@
{
switch(action.wID)
{ // This switch is for debug purposes (set breakpoint on next switch to debug Actions add ignore mouse/key actions)
- case Action.ActionType.ACTION_KEY_PRESSED:
case Action.ActionType.ACTION_MOUSE_CLICK:
case Action.ActionType.ACTION_MOUSE_DOUBLECLICK:
case Action.ActionType.ACTION_MOUSE_MOVE:
return;
}
+
+
+ switch(action.wID)
+ {
+
+ default:
+ break;
+ }
+
// Handle global action responders first (Scene triggers need to be handled also when we are not visible)
switch(action.wID)
{
@@ -385,6 +406,80 @@
HandleActionTriggers(Actiontrigger.MP_SHUTDOWN);
break;
+ // This case is for handling direct scene request **<num>#
+ case Action.ActionType.ACTION_KEY_PRESSED:
+ // 1 = 1 star = pressed, 2 = 2 stars pressed, '0' - '9' num key pressed --> waiting for # to confirm
+ if (action.m_key.KeyChar == '*' && _directSceneState <= 1)
+ {
+ this._directSceneState++;
+
+ // TODO: prevent key-pressed action from begin handled further by MP
+ break;
+ }
+
+ if (_directSceneState == 2 && action.m_key.KeyChar >= '0' && action.m_key.KeyChar <= '9')
+ {
+ // Store selected scene key number
+ this._directSceneState = action.m_key.KeyChar;
+
+ // TODO: prevent key-pressed action from begin handled further by MP
+ break;
+ }
+
+ if (_directSceneState >= '0' && _directSceneState <= '9' && action.m_key.KeyChar == '#')
+ {
+ #region Yes we have a go for Scene execution!
+ Log.Info("Action Key pressed run scene for key: " + this._directSceneState);
+ switch (this._directSceneState)
+ {
+ case '0':
+ HandleActionTriggers(Actiontrigger.NUMKEY_0);
+ break;
+
+ case '1':
+ HandleActionTriggers(Actiontrigger.NUMKEY_1);
+ break;
+
+ case '2':
+ HandleActionTriggers(Actiontrigger.NUMKEY_2);
+ break;
+
+ case '3':
+ HandleActionTriggers(Actiontrigger.NUMKEY_3);
+ break;
+
+ case '4':
+ HandleActionTriggers(Actiontrigger.NUMKEY_4);
+ break;
+
+ case '5':
+ HandleActionTriggers(Actiontrigger.NUMKEY_5);
+ break;
+
+ case '6':
+ HandleActionTriggers(Actiontrigger.NUMKEY_6);
+ break;
+
+ case '7':
+ HandleActionTriggers(Actiontrigger.NUMKEY_7);
+ break;
+
+ case '8':
+ HandleActionTriggers(Actiontrigger.NUMKEY_8);
+ break;
+
+ case '9':
+ HandleActionTriggers(Actiontrigger.NUMKEY_9);
+ break;
+ }
+ #endregion
+ // TODO: prevent key-pressed action from begin handled further by MP
+ }
+
+ // Reset direct scene state
+ _directSceneState = 0;
+ break;
+
// Resume ? how to determine (Plug in init?)
default:
break;
@@ -402,6 +497,7 @@
case Action.ActionType.ACTION_MOUSE_MOVE:
break;
+ // Handle menu info key
case Action.ActionType.ACTION_CONTEXT_MENU:
case Action.ActionType.ACTION_SHOW_INFO:
ShowInfoDialog();
Modified: trunk/plugins/VeraControl/VeraControl.csproj
===================================================================
--- trunk/plugins/VeraControl/VeraControl.csproj 2014-08-14 21:45:58 UTC (rev 4869)
+++ trunk/plugins/VeraControl/VeraControl.csproj 2014-08-14 21:47:03 UTC (rev 4870)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup>
<ProjectGuid>{B403D22F-BFFF-41F5-846E-E60586CFB39F}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -7,7 +7,7 @@
<OutputType>Library</OutputType>
<RootNamespace>VeraControl</RootNamespace>
<AssemblyName>VeraControl</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<AppDesignerFolder>Properties</AppDesignerFolder>
<SourceAnalysisOverrideSettingsFile>C:\Users\Bart\AppData\Roaming\ICSharpCode/SharpDevelop4\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile>
@@ -47,29 +47,32 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Utils">
- <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath>
+ <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath>
</Reference>
<Reference Include="Core">
- <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath>
+ <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\Core.dll</HintPath>
</Reference>
<Reference Include="Dialogs">
- <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\Dialogs.dll</HintPath>
+ <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\plugins\Windows\Dialogs.dll</HintPath>
</Reference>
<Reference Include="MediaFoundation">
- <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\MediaFoundation.dll</HintPath>
+ <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\MediaFoundation.dll</HintPath>
</Reference>
+ <Reference Include="PresentationCore">
+ <RequiredTargetFramework>3.0</RequiredTargetFramework>
+ </Reference>
<Reference Include="RemotePlugins">
- <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\RemotePlugins.dll</HintPath>
+ <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\RemotePlugins.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Drawing" />
- <Reference Include="System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+ <Reference Include="System.Runtime.Serialization">
<RequiredTargetFramework>3.0</RequiredTargetFramework>
</Reference>
- <Reference Include="System.Runtime.Serialization.Formatters.Soap, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <Reference Include="System.Runtime.Serialization.Formatters.Soap" />
<Reference Include="System.ServiceModel.Web">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
@@ -77,16 +80,18 @@
<Reference Include="System.Web.Extensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
+ <Reference Include="System.Windows" />
<Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="Utils">
- <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Utils.dll</HintPath>
+ <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\Utils.dll</HintPath>
</Reference>
<Reference Include="WindowPlugins">
- <HintPath>..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\WindowPlugins.dll</HintPath>
+ <HintPath>..\..\..\..\..\Program Files %28x86%29\Team MediaPortal\MediaPortal\plugins\Windows\WindowPlugins.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Modified: trunk/plugins/VeraControl/VeraControl.sln
===================================================================
--- trunk/plugins/VeraControl/VeraControl.sln 2014-08-14 21:45:58 UTC (rev 4869)
+++ trunk/plugins/VeraControl/VeraControl.sln 2014-08-14 21:47:03 UTC (rev 4870)
@@ -1,7 +1,7 @@
-Microsoft Visual Studio Solution File, Format Version 10.00
-# Visual Studio 2008
-# SharpDevelop 4.1.0.8000
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+# SharpDevelop 4.4
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VeraControl", "VeraControl.csproj", "{B403D22F-BFFF-41F5-846E-E60586CFB39F}"
EndProject
Global
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|