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 @@ /// </summary> public class DevicePowerMeter : DeviceGeneric { - private int m_iLevel = 0; - private string m_sKwh = ""; + private int _level = 0; + private string _kwh = ""; - public DevicePowerMeter( XmlNode xn ): base (xn) + public DevicePowerMeter(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, "watts", m_iLevel); - m_sKwh = helper.getAttrAsString(xn, "kwh", m_sKwh); - return base.update(xn); + _level = _helper.GetAttrAsInt (xn, "watts", _level); + _kwh = _helper.GetAttrAsString(xn, "kwh", _kwh); + return base.Update(xn); } public string watts { - get { return m_iLevel.ToString(); } + get { return _level.ToString(); } set { } } 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 { } } @@ -62,20 +62,20 @@ public override string ToString() { - return name + " [" + getStatusText() + "]"; + return name + " [" + GetStatusText() + "]"; } - public override string getIconName() + public override string GetIconName() { return "Power_Meter"; } - 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 level.ToString() + "W"; } Modified: trunk/plugins/VeraControl/DeviceSceneController.cs =================================================================== --- trunk/plugins/VeraControl/DeviceSceneController.cs 2012-01-21 12:45:56 UTC (rev 4417) +++ trunk/plugins/VeraControl/DeviceSceneController.cs 2012-01-21 23:31:37 UTC (rev 4418) @@ -16,52 +16,52 @@ /// </summary> public class DeviceSceneController: DeviceGeneric { - private bool m_bTripped = false; + private bool _isTripped = false; public DeviceSceneController( XmlNode xn ): base (xn) { if (xn != null) { - update(xn); + Update(xn); } } - public override bool update(XmlNode 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); + _isTripped = _helper.GetAttrAsBool(xn, "status", _isTripped); + _isTripped = _helper.GetAttrAsBool(xn, "tripped", _isTripped); + return base.Update(xn); } public override bool status { - get { return m_bTripped; } + get { return _isTripped; } set { } } - public bool tripped + public bool isTripped { - get { return m_bTripped; } + get { return _isTripped; } set { } } public override int level { - get { return (m_bTripped ? 1 : 0); } + get { return (_isTripped ? 1 : 0); } set { } } public override string ToString() { - return name + " [" + getStatusText() + "]"; + return name + " [" + GetStatusText() + "]"; } - public override string getIconName() + public override string GetIconName() { - return "Motion_Sensor_" + (m_bTripped ? "100" : "0"); + return "Motion_Sensor_" + (_isTripped ? "100" : "0"); } - public override string getStatusText() + public override string GetStatusText() { return (status ? "ACTIVE" : "standby"); } Modified: trunk/plugins/VeraControl/DeviceSecurity.cs =================================================================== --- trunk/plugins/VeraControl/DeviceSecurity.cs 2012-01-21 12:45:56 UTC (rev 4417) +++ trunk/plugins/VeraControl/DeviceSecurity.cs 2012-01-21 23:31:37 UTC (rev 4418) @@ -17,52 +17,52 @@ /// <summary> /// Description of DeviceSecurity. /// </summary> - public class DeviceSecurity: DeviceGeneric + public class DeviceSecurity : DeviceGeneric { - private bool m_bTripped = false; - private bool m_bArmed = true; + private bool _isTripped = false; + private bool _isArmed = true; - public DeviceSecurity( XmlNode xn ): base (xn) + public DeviceSecurity(XmlNode xn): base (xn) { if (xn != null) { - update(xn); + Update(xn); } } - public override bool update(XmlNode xn) + public override bool Update(XmlNode xn) { - m_bTripped = helper.getAttrAsBool(xn, "tripped", m_bTripped); - m_bArmed = helper.getAttrAsBool(xn, "armed", m_bArmed); - return base.update(xn); + _isTripped = _helper.GetAttrAsBool(xn, "tripped", _isTripped); + _isArmed = _helper.GetAttrAsBool(xn, "armed", _isArmed); + return base.Update(xn); } public override bool status { - get { return m_bArmed; } + get { return _isArmed; } 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:SecuritySensor1&action=SetArmed" + "&newArmedValue=" + (value ? "1" : "0"); - vera.doVeraCommandRequest(cmd, reportRequestError); + _vera.DoVeraCommandRequest(cmd, ReportRequestError); } } } - public bool tripped + public bool isTripped { - get { return m_bTripped; } + get { return _isTripped; } set { } } public override int level { - get { return (m_bArmed ? 1 : 0); } - set { status = (value > 0); } + get { return (_isArmed ? 1 : 0); } + set { status = (value > 0); } } public override int maxLevel @@ -77,20 +77,20 @@ } public override string ToString() { - return name + " [" + getStatusText() + "]"; + return name + " [" + GetStatusText() + "]"; } - public override string getIconName() + public override string GetIconName() { - return "Motion_Sensor_" + (m_bTripped ? "100" : "0"); + return "Motion_Sensor_" + (_isTripped ? "100" : "0"); } - public override string getStatusText() + public override string GetStatusText() { - return (status ? ( tripped ? "TRIPPED" : "standby") : "bypass"); + return (status ? ( isTripped ? "TRIPPED" : "standby") : "bypass"); } - public override string[] getCommands() + public override string [] GetCommands() { return new string [] {"Bypass", "Arm"}; } Modified: trunk/plugins/VeraControl/DeviceSprinkler.cs =================================================================== --- trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-01-21 12:45:56 UTC (rev 4417) +++ trunk/plugins/VeraControl/DeviceSprinkler.cs 2012-01-21 23:31:37 UTC (rev 4418) @@ -19,71 +19,71 @@ /// </summary> public class DeviceSprinkler : DeviceGeneric { - private bool m_bStatus = false; - private string m_sMode = "-"; - private string m_sShortMode = "-"; - private string m_sOperationMode = "-"; - private string m_sCondition = "-"; + private bool _status = false; + private string _mode = "-"; + private string _shortMode = "-"; + private string _operationMode = "-"; + private string _condition = "-"; - public DeviceSprinkler( XmlNode xn ): base (xn) + public DeviceSprinkler(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); - 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); + _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); } 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:upnp-org:serviceId:SwitchPower1&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); } } public override string mode { - get { return m_sMode; } + get { return _mode; } 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:upnp-micasaverde-com:serviceId:Sprinkler1&action=" + (value == "Auto" ? "SetModeAuto" : (value == "Block" ? "SetModeBlock" : "SetModeManual")); - vera.doVeraCommandRequest(cmd, reportRequestError); + _vera.DoVeraCommandRequest(cmd, ReportRequestError); } } } public override string ToString() { - return name + " [" + m_sShortMode + "]"; + return name + " [" + _shortMode + "]"; } public override bool isControllable @@ -98,22 +98,22 @@ set { } } - public override string getIconName() + public override string GetIconName() { return "Humidity_Sensor"; } - public override string getStatusText() + public override string GetStatusText() { - return m_sOperationMode.Replace("_", " "); + return _operationMode.Replace("_", " "); } - public override string getExtraText() + public override string GetExtraText() { - return m_sCondition; + return _condition; } - public override string [] getCommands() + public override string [] GetCommands() { return new string [] {"Off", "On", "Auto", "Block", "Manual"}; } Modified: trunk/plugins/VeraControl/DeviceSwitch.cs =================================================================== --- trunk/plugins/VeraControl/DeviceSwitch.cs 2012-01-21 12:45:56 UTC (rev 4417) +++ trunk/plugins/VeraControl/DeviceSwitch.cs 2012-01-21 23:31:37 UTC (rev 4418) @@ -18,52 +18,52 @@ /// </summary> public class DeviceSwitch : DeviceGeneric { - private bool m_bStatus = false; - private string m_sWatt = "-"; - private string m_sKwh = "-"; + private bool _status = false; + private string _watt = "-"; + private string _kwh = "-"; - public DeviceSwitch( XmlNode xn ): base (xn) + public DeviceSwitch(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); - m_sWatt = helper.getAttrAsString(xn, "watts", m_sWatt); - m_sKwh = helper.getAttrAsString(xn, "kwh", m_sKwh); + _status = _helper.GetAttrAsBool (xn, "status", _status); + _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_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:upnp-org:serviceId:SwitchPower1&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); } } @@ -75,7 +75,7 @@ public override string ToString() { - return name + " [" + getStatusText()+ "]"; + return name + " [" + GetStatusText()+ "]"; } public override bool isControllable @@ -84,17 +84,17 @@ set { } } - public override string getIconName() + public override string GetIconName() { - return "Binary_Light_" + (m_bStatus ? "100" : "0"); + return "Binary_Light_" + (_status ? "100" : "0"); } - 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 ? "On" : "Off"); } Modified: trunk/plugins/VeraControl/DeviceSystem.cs =================================================================== --- trunk/plugins/VeraControl/DeviceSystem.cs 2012-01-21 12:45:56 UTC (rev 4417) +++ trunk/plugins/VeraControl/DeviceSystem.cs 2012-01-21 23:31:37 UTC (rev 4418) @@ -21,165 +21,165 @@ { } - public VeraHelper helper = VeraHelper.Instance; + 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 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; 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); + _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); + _serial = _helper.GetAttrAsString (xn, "serial_number", _serial); + _fwd1Server = _helper.GetAttrAsString (xn, "fwd1", _fwd1Server); + _fwd2Server = _helper.GetAttrAsString (xn, "fwd2", _fwd2Server); + _loadTime = _helper.GetAttrAsString (xn, "loadtime", _loadTime); // 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", ""); + string tempDataversion = _helper.GetAttrAsString (xn, "dataversion", _dataVersion); + 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) + if ((_dataVersion != tempDataversion) || _comment != tempComment || _dsVeraState != tempVeraState) { - m_bScreenUpdateRequired = true; - m_lLastUpdate = DateTime.Now.Ticks; + _screenUpdateRequired = true; + _lastUpdate = DateTime.Now.Ticks; } - m_sDataVersion = tempDataversion; - m_dsVeraState = tempVeraState; - m_sComment = tempComment; + _dataVersion = tempDataversion; + _dsVeraState = tempVeraState; + _comment = tempComment; - m_dsVeraState = helper.toDevState(helper.getAttrAsInt(xn, "state", -1)); - m_sComment = helper.getAttrAsString (xn, "comment", ""); - m_bMetric = (helper.getAttrAsString(xn, "temperature", "C") == "C"); + _dsVeraState = _helper.ToDevState(_helper.GetAttrAsInt(xn, "state", -1)); + _comment = _helper.GetAttrAsString (xn, "comment", ""); + _metric = (_helper.GetAttrAsString(xn, "temperature", "C") == "C"); return true; } - public void clearFullReloadFlag() + public void ClearFullReloadFlag() { - m_bFullReload = false; + _fullReload = false; } - public void setFullReloadFlag() + public void SetFullReloadFlag() { - m_bFullReload = true; + _fullReload = true; } public bool fullReload { - get { return m_bFullReload; } + get { return _fullReload; } set { } } public string versionInfo { - get { return m_sModel + " " + m_sVersion; } + get { return _model + " " + _version; } set { } } - public bool bZWaveHeal + public bool zWaveHeal { - get { return m_zWaveHeal; } + get { return _zWaveHeal; } set { } } public string serialno { - get { return m_sSerial; } + get { return _serial; } set { } } public string fwd { - get { return m_sFwd1Server; } + get { return _fwd1Server; } set { } } public string fwdBackup { - get { return m_sFwd2Server; } + get { return _fwd2Server; } set { } } public string loadtime { - get { return m_sLoadTime; } + get { return _loadTime; } set { } } public string dataversion { - get { return m_sDataVersion; } + get { return _dataVersion; } set { } } public DevState state { - get { return m_dsVeraState; } + get { return _dsVeraState; } set { } } public string comment { - get { return m_sComment; } + get { return _comment; } set { } } - public void reportConnectionError( string errmsg ) + public void ReportConnectionError(string errmsg) { - m_dsVeraState = DevState.CONNECTION_ERROR; - m_sComment = errmsg; - m_bScreenUpdateRequired = true; - m_lLastUpdate = DateTime.Now.Ticks; + _dsVeraState = DevState.CONNECTION_ERROR; + _comment = errmsg; + _screenUpdateRequired = true; + _lastUpdate = DateTime.Now.Ticks; } - public void reportCommandError( string errmsg ) + public void ReportCommandError(string errmsg) { - m_dsVeraState = DevState.COMMAND_ERROR; - m_sComment = errmsg; - m_bScreenUpdateRequired = true; - m_lLastUpdate = DateTime.Now.Ticks; + _dsVeraState = DevState.COMMAND_ERROR; + _comment = errmsg; + _screenUpdateRequired = true; + _lastUpdate = DateTime.Now.Ticks; } - public void clearConnectionError( ) + public void ClearConnectionError() { - m_dsVeraState = DevState.NONE; - m_sComment = ""; - m_bScreenUpdateRequired = true; - m_lLastUpdate = DateTime.Now.Ticks; + _dsVeraState = DevState.NONE; + _comment = ""; + _screenUpdateRequired = true; + _lastUpdate = DateTime.Now.Ticks; } - public bool isMetric() + public bool IsMetric() { - return m_bMetric; + return _metric; } - public bool newScreenUpdateWaitingAndClearFlag( ) + 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; + bool b = _screenUpdateRequired; + _screenUpdateRequired = false; return b; } - public bool newUpdateSince(float fTimePreviousCheck) + public bool NewUpdateSince(float timePreviousCheck) { - return (fTimePreviousCheck <= m_lLastUpdate); + return (timePreviousCheck <= _lastUpdate); } } } Modified: trunk/plugins/VeraControl/DeviceTemperature.cs =================================================================== --- trunk/plugins/VeraControl/DeviceTemperature.cs 2012-01-21 12:45:56 UTC (rev 4417) +++ trunk/plugins/VeraControl/DeviceTemperature.cs 2012-01-21 23:31:37 UTC (rev 4418) @@ -18,55 +18,55 @@ /// </summary> public class DeviceTemperature : DeviceGeneric { - public string m_sTemp = "0"; // public thermostat class - private bool m_bMetric = true; + public string _temperature = "0"; // public thermostat class + private bool _metric = true; - public DeviceTemperature( XmlNode xn, bool bMetric ): base (xn) + public DeviceTemperature(XmlNode xn, bool metric): base (xn) { - m_bMetric = bMetric; + _metric = metric; if (xn != null) { - update(xn); + Update(xn); } } - public override bool update(XmlNode xn) + public override bool Update(XmlNode xn) { - m_sTemp = helper.getAttrAsString(xn, "temperature", m_sTemp); - return base.update(xn); + _temperature = _helper.GetAttrAsString(xn, "temperature", _temperature); + return base.Update(xn); } public override int level { - get { return int.Parse(m_sTemp); } + get { return int.Parse(_temperature); } set { } } public override int maxLevel { - get { return (m_bMetric ? 100 : 212); } + get { return (_metric ? 100 : 212); } set { } } public override int minLevel { - get { return (m_bMetric ? -22 : -7); } + get { return (_metric ? -22 : -7); } set { } } public override string ToString() { - return name + " [" + getStatusText() + "]"; + return name + " [" + GetStatusText() + "]"; } - public override string getIconName() + public override string GetIconName() { return "Temperature_Sensor"; } - public override string getStatusText() + public override string GetStatusText() { - return m_sTemp + (m_bMetric ? "°C" : "°F"); + return _temperature + (_metric ? "°C" : "°F"); } } Modified: trunk/plugins/VeraControl/DeviceThermostat.cs =================================================================== --- trunk/plugins/VeraControl/DeviceThermostat.cs 2012-01-21 12:45:56 UTC (rev 4417) +++ trunk/plugins/VeraControl/DeviceThermostat.cs 2012-01-21 23:31:37 UTC (rev 4418) @@ -18,28 +18,28 @@ /// </summary> public class DeviceThermostat : DeviceTemperature { - 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", + private bool _metric = true; + private string _fanMode = ""; + private string _hvacState = "Off"; // "Off', "Idle", "Heating", "Cooling", "FanOnly", "PendingHeat", "PendingCool", "Vent" + private string _mode = "Off"; // "Off', "InDeadBand", "HeatOn", "CoolOn", "AutoChangeOver", "AuxHeatOn", "EconomyHeatOn", "EmergencyHeatOn", // "AuxCoolOn", "EconomyCoolOn", "BuildingProtection", "EnergySavingsHeating", "EnergySavingsCooling" - public DeviceThermostat( XmlNode xn, bool bMetric ): base (xn, bMetric) + public DeviceThermostat(XmlNode xn, bool metric) : base (xn, metric) { - m_bMetric = bMetric; + _metric = metric; if (xn != null) { - update(xn); + Update(xn); } } - public override bool update(XmlNode xn) + public override bool Update(XmlNode xn) { - 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); + _temperature = _helper.GetAttrAsString(xn, "temperature", _temperature); + _fanMode = _helper.GetAttrAsString(xn, "fanmode", _fanMode); + _hvacState = _helper.GetAttrAsString(xn, "hvacstate", _hvacState); + _mode = _helper.GetAttrAsString(xn, "mode", _mode); + return base.Update(xn); } public override bool status @@ -56,17 +56,17 @@ public override string mode { - get { return m_sMode; } + get { return _mode; } 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:upnp-org:serviceId:HVAC_UserOperatingMode1&action=SetModeTarget" + "&NewModeTarget="+(value == "Off" ? "Off" : (value == "Cool" ? "CoolOn" : (value == "Heat" ? "HeatOn" : "AutoChangeOver")) ); - vera.doVeraCommandRequest(cmd, reportRequestError); + _vera.DoVeraCommandRequest(cmd, ReportRequestError); } } } @@ -88,22 +88,22 @@ set { } } - public override string getStatusText() + public override string GetStatusText() { return mode; } - public override string getExtraText() + public override string GetExtraText() { - return m_sHvacState + " - Fan : " + m_sFanMode + " - " + m_sTemp + (m_bMetric ? "°C" : "°F") ; + return _hvacState + " - Fan : " + _fanMode + " - " + _temperature + (_metric ? "°C" : "°F") ; } - public override string getIconName() + public override string GetIconName() { return "Thermostat"; } - public override string [] getCommands() + public override string [] GetCommands() { return new string [] {"Off", "On", "Auto", "Heat", "Cool"}; } Modified: trunk/plugins/VeraControl/DeviceWindowCovering.cs =================================================================== --- trunk/plugins/VeraControl/DeviceWindowCovering.cs 2012-01-21 12:45:56 UTC (rev 4417) +++ trunk/plugins/VeraControl/DeviceWindowCovering.cs 2012-01-21 23:31:37 UTC (rev 4418) @@ -18,15 +18,15 @@ /// </summary> public class DeviceWindowCovering : DeviceDimmer { - public DeviceWindowCovering( XmlNode xn ): base (xn) + public DeviceWindowCovering(XmlNode xn) : base (xn) { if (xn != null) { - update(xn); + Update(xn); } } - public override string getIconName() + public override string GetIconName() { return "Window_Covering"; } Modified: trunk/plugins/VeraControl/DialogActionTrigger.cs =================================================================== --- trunk/plugins/VeraControl/DialogActionTrigger.cs 2012-01-21 12:45:56 UTC (rev 4417) +++ trunk/plugins/VeraControl/DialogActionTrigger.cs 2012-01-21 23:31:37 UTC (rev 4418) @@ -26,75 +26,74 @@ /// </summary> public class DialogActionTrigger : GUIDialogWindow { - [SkinControl(2)] protected GUIButtonControl btnClose = null; - [SkinControl(4)] protected GUILabelControl lblHeading = null; - [SkinControl(100)] protected GUIButtonControl btnStore = null; + [SkinControl(2)] protected GUIButtonControl _btnClose = null; + [SkinControl(4)] protected GUILabelControl _lblHeading = null; + [SkinControl(100)] protected GUIButtonControl _btnStore = null; - [SkinControlAttribute(20)] protected GUISpinButton spMusicStart = null; - [SkinControlAttribute(21)] protected GUISpinButton spMusicPause = null; - [SkinControlAttribute(22)] protected GUISpinButton spMusicResume = null; - [SkinControlAttribute(23)] protected GUISpinButton spMusicStop = null; + [SkinControlAttribute(20)] protected GUISpinButton _spMusicStart = null; + [SkinControlAttribute(21)] protected GUISpinButton _spMusicPause = null; + [SkinControlAttribute(22)] protected GUISpinButton _spMusicResume = null; + [SkinControlAttribute(23)] protected GUISpinButton _spMusicStop = null; - [SkinControlAttribute(25)] protected GUISpinButton spVideoStart = null; - [SkinControlAttribute(26)] protected GUISpinButton spVideoPause = null; - [SkinControlAttribute(27)] protected GUISpinButton spVideoResume = null; - [SkinControlAttribute(28)] protected GUISpinButton spVideoStop = null; + [SkinControlAttribute(25)] protected GUISpinButton _spVideoStart = null; + [SkinControlAttribute(26)] protected GUISpinButton _spVideoPause = null; + [SkinControlAttribute(27)] protected ... [truncated message content] |