protected void btnAdd_Click(object sender, EventArgs e) { int owner = 0, container = 0, systype = 0, hideevents = 0; if (chkOwner.Checked) { owner = 1; } if (chkContainer.Checked) { container = 1; } if (chkSysType.Checked) { systype = 1; } if (chkHideEvents.Checked) { hideevents = 1; } OSAEObjectTypeManager.ObjectTypeAdd(txtName.Text, txtDescr.Text, ddlOwnedBy.SelectedValue, ddlBaseType.SelectedValue, owner, systype, container, hideevents); txtName.Text = ""; txtDescr.Text = ""; chkOwner.Checked = false; chkContainer.Checked = false; chkSysType.Checked = false; chkHideEvents.Checked = false; ddlOwnedBy.SelectedValue = ""; ddlBaseType.SelectedValue = ""; loadObjectTypes(); }
protected void btnAdd_Click(object sender, EventArgs e) { OSAEObjectTypeManager.ObjectTypeAdd(txtName.Text, txtDescr.Text, ddlOwnedBy.SelectedValue, ddlBaseType.SelectedValue, chkOwner.Checked, chkSysType.Checked, chkContainer.Checked, chkHideEvents.Checked); txtName.Text = ""; txtDescr.Text = ""; chkOwner.Checked = false; chkContainer.Checked = false; chkSysType.Checked = false; chkHideEvents.Checked = false; ddlOwnedBy.SelectedValue = ""; ddlBaseType.SelectedValue = ""; loadObjectTypes(); }
public void discoverDevices() { this.Log.Info(objName + " is performing Device Discovery..."); List <string> fDev = mySonyLib.Locator.LocateDevices(); if (fDev.Count > 0) { this.Log.Info("Discovery found: " + fDev.Count + " Device(s)"); for (int i = 0; i < fDev.Count; i++) { string selDev = fDev[i]; try { this.Log.Info("Building Object from Document: " + selDev); mySonyDevice.BuildFromDocument(new Uri(selDev)); } catch (Exception e) { this.Log.Error("ERROR - Building Object for " + mySonyDevice.Name, e); return; } this.Log.Info("Checking if Object " + mySonyDevice.Name + " is SONY Compatiable"); if (mySonyDevice.Ircc.ControlUrl != null) { if (!CheckObjByName(mySonyDevice.Name.ToString())) { try { this.Log.Info("Creating Sony Object Type for: " + mySonyDevice.Name); OSAEObjectTypeManager.ObjectTypeAdd(mySonyDevice.Name, "Sony Device", "Sony", mySonyDevice.Name, true, false, false, true); OSAEObjectTypeManager.ObjectTypeMethodAdd(mySonyDevice.Name, "REGISTER", "Register", "", "", "", "", "Executing this Method will Register this device wity OSA"); OSAEObjectTypeManager.ObjectTypeStateAdd(mySonyDevice.Name, "ON", "Online", "This state represents that the Sony Device is Online"); OSAEObjectTypeManager.ObjectTypeStateAdd(mySonyDevice.Name, "OFF", "OffLine", "This state represents that the Sony Device is Offline"); OSAEObjectTypeManager.ObjectTypePropertyAdd(mySonyDevice.Name, "DocumentURL", "String", "String", "", false, true, "Enter the URL to the Sony Device Document"); OSAEObjectTypeManager.ObjectTypePropertyAdd(mySonyDevice.Name, "Current_Channel", "String", "String", "", false, false, "This will contain the current channel"); OSAEObjectTypeManager.ObjectTypePropertyAdd(mySonyDevice.Name, "Current_Volume", "String", "String", "", false, false, "This will contain the current Volume Level"); OSAEObjectTypeManager.ObjectTypePropertyAdd(mySonyDevice.Name, "Current_Status", "String", "String", "", false, false, "This will contain the current Device Status"); OSAEObjectTypeManager.ObjectTypePropertyAdd(mySonyDevice.Name, "Registered", "Boolean", "String", "FALSE", false, true, "Select True/False if this device is registered"); OSAEObjectTypeManager.ObjectTypePropertyAdd(mySonyDevice.Name, "Online", "Boolean", "String", "FALSE", false, true, "Select True/False if this device is Online"); this.Log.Info("Sony Object Type was Created: " + mySonyDevice.Name); this.Log.Info("Creating Object for " + mySonyDevice.Name); OSAEObjectManager.ObjectAdd(mySonyDevice.Name, "Sony Device", "Sony Device", mySonyDevice.Name, mySonyDevice.IPAddress, "", 30, true); OSAEObjectStateManager.ObjectStateSet(mySonyDevice.Name, "OFF", "Sony"); OSAEObjectPropertyManager.ObjectPropertySet(mySonyDevice.Name, "DocumentURL", mySonyDevice.DocumentUrl, "Sony"); OSAEObjectManager.ObjectUpdate(mySonyDevice.Name, mySonyDevice.Name, "Sony Device", "Sony Device", mySonyDevice.Name, mySonyDevice.IPAddress, "", 30, true); this.Log.Info("Sony Object Created: " + mySonyDevice.Name); foreach (APILibrary.SonyCommands sCmd in mySonyDevice.Commands) { string cName = sCmd.name;; string cValue = sCmd.value; OSAEObjectTypeManager.ObjectTypeMethodAdd(mySonyDevice.Name, cName.ToUpper(), cName, "", "", "", "", "Retrieved Method from Device"); this.Log.Info("Created Method: " + cName + " for device " + mySonyDevice.Name); if (cName == "ChannelUp") { OSAEObjectTypeManager.ObjectTypeMethodAdd(mySonyDevice.Name, "SETCHANNEL", "Set Channel", "Channel #", "", "", "", "Executing this method will set the entered channel on the device"); this.Log.Info("Created Method: Set Channel for device " + mySonyDevice.Name); } } OSAEObjectTypeManager.ObjectTypeMethodAdd(mySonyDevice.Name, "GETSTATUS", "Get Status", "", "", "", "", "Executing this method will retrieve the current status from the Sony Device"); this.Log.Info("Created Method: Get Status for device " + mySonyDevice.Name); OSAEObjectTypeManager.ObjectTypeMethodAdd(mySonyDevice.Name, "SENDTEXT", "Send Text", "Text", "", "", "", "Executing this method will send the netered text to the Sony Device"); this.Log.Info("Created Method: Send Text for device " + mySonyDevice.Name); OSAEObjectTypeManager.ObjectTypeMethodAdd(mySonyDevice.Name, "GETTEXT", "Get Text", "", "", "", "", "Executing this method will check if the Sony device is accepting a Text input"); this.Log.Info("Created Method: Get Text for device " + mySonyDevice.Name); if (debug) { this.Log.Debug("Run the Register method for the : " + mySonyDevice.Name + " Object to register this device!"); } } catch (Exception ex) { this.Log.Error("An error occurred!!!: " + ex.Message); if (debug) { this.Log.Debug("An Error occured in the Object Creation for: " + mySonyDevice.Name); } } } else { this.Log.Error("The object " + mySonyDevice.Name + " already exist. Object NOT Created"); } } else { this.Log.Debug("The object " + mySonyDevice.Name + " is NOT compatiable"); } } } else { this.Log.Error("The Sony Discovery Method did NOT find any devices"); } }