public void OwnTypes() { //Added the follow to automatically own Speech Base types that have no owner. OSAEObjectType oType = OSAEObjectTypeManager.ObjectTypeLoad("IPCAM"); if (oType.OwnedBy == "") { OSAEObjectTypeManager.ObjectTypeUpdate(oType.Name, oType.Name, oType.Description, pName, oType.BaseType, oType.Owner, oType.SysType, oType.Container, oType.HideRedundant, oType.Tooltip); Log.Info("IPCam Plugin took ownership of the IPCAM Object Type."); } else { Log.Info("IPCam Plugin correctly owns the IPCAM Object Type."); } oType = OSAEObjectTypeManager.ObjectTypeLoad("IP CAMERA"); if (oType.OwnedBy == "") { OSAEObjectTypeManager.ObjectTypeUpdate(oType.Name, oType.Name, oType.Description, pName, oType.BaseType, oType.Owner, oType.SysType, oType.Container, oType.HideRedundant, oType.Tooltip); Log.Info("IPCam Plugin took ownership of the IP CAMERA Object Type."); } else { Log.Info("IPCam Plugin correctly owns the IP CAMERA Object Type."); } }
public void OwnTypes() { //Added the follow to automatically own Speech Base types that have no owner. OSAEObjectType oType = OSAEObjectTypeManager.ObjectTypeLoad("ANDROID"); if (oType.OwnedBy == "") { OSAEObjectTypeManager.ObjectTypeUpdate(oType.Name, oType.Name, oType.Description, pName, oType.BaseType, oType.Owner, oType.SysType, oType.Container, oType.HideRedundant); Log.Info("Android Plugin took ownership of the ANDROID Object Type."); } else { Log.Info("Android Plugin correctly owns the ANDROID Object Type."); } oType = OSAEObjectTypeManager.ObjectTypeLoad("ANDROID DEVICE"); if (oType.OwnedBy == "") { OSAEObjectTypeManager.ObjectTypeUpdate(oType.Name, oType.Name, oType.Description, pName, oType.BaseType, oType.Owner, oType.SysType, oType.Container, oType.HideRedundant); Log.Info("Android Plugin took ownership of the ANDROID DEVICE Object Type."); } else { Log.Info("Android Plugin correctly owns the ANDROID DEVICE Object Type."); } }
public void OwnTypes() { //Added the follow to automatically own WUnderground Base types that have no owner. OSAEObjectType oType = OSAEObjectTypeManager.ObjectTypeLoad("WUNDERGROUND"); if (oType.OwnedBy == "") { OSAEObjectTypeManager.ObjectTypeUpdate(oType.Name, oType.Name, oType.Description, pName, oType.BaseType, oType.Owner, oType.SysType, oType.Container, oType.HideRedundant, oType.Tooltip); Log.Info("WUnderground Plugin took ownership of the WUNDERGROUND Object Type."); } else { Log.Info("WUnderground Plugin correctly owns the WUNDERGROUND Object Type."); } //Added the follow for SYSTEM to automatically own Weather Base types that have no owner. oType = OSAEObjectTypeManager.ObjectTypeLoad("WUNDERGROUND"); if (oType.OwnedBy == "") { OSAEObjectTypeManager.ObjectTypeUpdate(oType.Name, oType.Name, oType.Description, "SYSTEM", oType.BaseType, oType.Owner, oType.SysType, oType.Container, oType.HideRedundant, oType.Tooltip); Log.Info("SYSTEM took ownership of the WEATHER Object Type."); } else { Log.Info("SYSTEM Plugin correctly owns the WEATHER Object Type."); } }
protected void btnUpdate_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.ObjectTypeUpdate(hdnSelectedObjectName.Text, txtName.Text, txtDescr.Text, ddlOwnedBy.SelectedValue, ddlBaseType.SelectedValue, owner, systype, container, hideevents); hdnSelectedObjectName.Text = txtName.Text; loadObjectTypes(); }
public override void RunInterface(string pluginName) { pName = pluginName; OSAEObjectTypeManager.ObjectTypeUpdate("KILLAWATT MODULE", "KILLAWATT MODULE", "Kill-A-Watt Module", pName, "KILLAWATT MODULE", 0, 0, 0, 1); xb = new xbee(Int32.Parse(OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "Port").Value)); xb.xbeePacketReceived += new xbee.xbeePacketReceivedEventHandler(xb_xbeePacketReceived); }
public override void RunInterface(string pluginName) { this.Log.Debug("Running interface"); pName = pluginName; OSAEObjectTypeManager.ObjectTypeUpdate("XBMC SYSTEM", "XBMC SYSTEM", "XBMC System", pluginName, "XBMC SYSTEM", 0, 0, 0, 1); OSAEObjectCollection XBMCInstances = OSAEObjectManager.GetObjectsByType("XBMC System"); foreach (OSAEObject obj in XBMCInstances) { string ip = "", username = "", password = ""; int port = 0; foreach (OSAEObjectProperty p in obj.Properties) { switch (p.Name) { case "IP": ip = p.Value; break; case "Port": port = Int32.Parse(p.Value); break; case "Username": username = p.Value; break; case "Password": password = p.Value; break; } } this.Log.Debug("Creating new XBMC System connection: " + obj.Name + " - " + ip); try { XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password); if (system.Connect()) { Systems.Add(system); } } catch (Exception ex) { this.Log.Error("Error connecting to XBMC system: " + ex.Message + " - " + ex.InnerException.Message); } } Clock = new System.Timers.Timer(); Clock.Interval = 5000; Clock.Elapsed += new ElapsedEventHandler(Timer_Tick); Clock.Start(); }
public override void RunInterface(string pluginName) { pName = pluginName; Log = new General.OSAELog(pName); Log.Info("Running Interface!"); OSAEObjectType objt = OSAEObjectTypeManager.ObjectTypeLoad("RADIO THERMOSTAT DEVICE"); OSAEObjectTypeManager.ObjectTypeUpdate(objt.Name, objt.Name, "Radio Thermostat Device", pName, "RADIO THERMOSTAT DEVICE", objt.Owner, objt.SysType, objt.Container, objt.HideRedundant); OSAEObjectCollection devices = OSAEObjectManager.GetObjectsByType("RADIO THERMOSTAT DEVICE"); foreach (OSAEObject obj in devices) { ThermostatLib.SystemInfo si = ThermostatLib.SystemInfo.Load(obj.Address); Log.Info("---------------------------------"); Log.Info("Device Name: " + ThermostatLib.SystemInfo.LoadSystemName(obj.Address)); Log.Info("API Version: " + si.ApiVersion.ToString()); Log.Info("Firmware Version: " + si.FirmwareVersion); Log.Info("UUID: " + si.UUID); Log.Info("WLAN Version: " + si.WlanFirmwareVersion); Log.Info("Model: " + ThermostatLib.SystemInfo.LoadModelName(obj.Address)); Log.Info("Operating Mode: " + ThermostatLib.SystemInfo.LoadOperatingMode(obj.Address)); ThermostatLib.Services services = ThermostatLib.Services.Load(obj.Address); string service = ""; foreach (ThermostatLib.HttpdHandler handler in services.Handlers) { service = ""; service += handler.Url + " ("; if (handler.AllowsGet && handler.AllowsPost) { service += "GET, POST"; } else { if (handler.AllowsGet) { service += "GET"; } if (handler.AllowsPost) { service += "POST"; } } service += ")"; Log.Info("Service: " + service); } } Clock = new System.Timers.Timer(); Clock.Interval = Int32.Parse(OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "Poll Interval").Value) * 60000; Clock.Start(); Clock.Elapsed += new ElapsedEventHandler(Timer_Tick); }
public override void RunInterface(string pluginName) { pName = pluginName; Log = new General.OSAELog(pName); OSAEObjectType objt = OSAEObjectTypeManager.ObjectTypeLoad("KILLAWATT MODULE"); OSAEObjectTypeManager.ObjectTypeUpdate(objt.Name, objt.Name, objt.Description, pName, "THING", objt.Owner, objt.SysType, objt.Container, objt.HideRedundant, objt.Tooltip); xb = new xbee(Int32.Parse(OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "Port").Value)); xb.xbeePacketReceived += new xbee.xbeePacketReceivedEventHandler(xb_xbeePacketReceived); }
public void OwnTypes() { //Added the follow to automatically own PubNub Base types that have no owner. OSAEObjectType oType = OSAEObjectTypeManager.ObjectTypeLoad("PUBNUB"); if (oType.OwnedBy == "") { OSAEObjectTypeManager.ObjectTypeUpdate(oType.Name, oType.Name, oType.Description, gAppName, oType.BaseType, oType.Owner, oType.SysType, oType.Container, oType.HideRedundant); Log.Info("PubNub Plugin took ownership of the PubNub Object Type."); } else { Log.Info("The PubNub Plugin correctly owns the PubNub Object Type."); } }
public void OwnTypes() { //Added the follow to automatically own Speech Base types that have no owner. OSAEObjectType oType = OSAEObjectTypeManager.ObjectTypeLoad("NETWORK MONITOR"); if (oType.OwnedBy == "") { OSAEObjectTypeManager.ObjectTypeUpdate(oType.Name, oType.Name, oType.Description, gAppName, oType.BaseType, oType.Owner, oType.SysType, oType.Container, oType.HideRedundant, oType.Tooltip); Log.Info("Network Monitor Plugin took ownership of the NETWORK MONITOR Object Type."); } else { Log.Info("Network Monitor Plugin correctly owns the NETWORK MONITOR Object Type."); } }
public override void RunInterface(string pluginName) { Log.Info("Starting Android plugin"); pName = pluginName; OSAEObjectTypeManager.ObjectTypeUpdate("Android Device", "Android Device", "Android Device", pluginName, "Android Device", false, false, false, true); //connect to devices OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("Android Device"); foreach (OSAEObject obj in objects) { createdevice(obj); } Log.Debug("Run Interface Complete"); }
public override void RunInterface(string pluginName) { log("Running interface", true); pName = pluginName; OSAEObjectTypeManager.ObjectTypeUpdate("Android Device", "Android Device", "Android Device", pluginName, "Android Device", 0, 0, 0, 1); //connect to devices OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("Android Device"); foreach (OSAEObject obj in objects) { createdevice(obj); } log("Run Interface Complete", true); }
public override void RunInterface(string pluginName) { logging.AddToLog("Running interface", false); pName = pluginName; OSAEObjectTypeManager.ObjectTypeUpdate("XBMC SYSTEM", "XBMC SYSTEM", "XBMC System", pluginName, "XBMC SYSTEM", 0, 0, 0, 1); OSAEObjectCollection XBMCInstances = OSAEObjectManager.GetObjectsByType("XBMC System"); foreach (OSAEObject obj in XBMCInstances) { string ip = "", username = "", password = ""; int port = 0; foreach (OSAEObjectProperty p in obj.Properties) { switch (p.Name) { case "IP": ip = p.Value; break; case "Port": port = Int32.Parse(p.Value); break; case "Username": username = p.Value; break; case "Password": password = p.Value; break; } } logging.AddToLog("Creating new XBMC System connection: " + obj.Name + " - " + ip, false); XBMCSystem system = new XBMCSystem(obj.Name, ip, port, username, password); system.Connect(); Systems.Add(system); } //Clock = new System.Timers.Timer(); //Clock.Interval = 5000; //Clock.Start(); //Clock.Elapsed += new ElapsedEventHandler(Timer_Tick); }
public override void RunInterface(string pluginName) { pName = pluginName; Log = new General.OSAELog(pName); Log.Info("Initializing Plugin"); OSAEObjectType objt = OSAEObjectTypeManager.ObjectTypeLoad("SQUEEZEBOX"); OSAEObjectTypeManager.ObjectTypeUpdate(objt.Name, objt.Name, objt.Description, pName, "SQUEEZEBOX", objt.Owner, objt.SysType, objt.Container, objt.HideRedundant); sbsAddress = OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "Server Address").Value; sbsPort = Int32.Parse(OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "CLI Port").Value); ttsSave = OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "TTS Save Path").Value; ttsPlay = OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "TTS Play Path").Value; Log.Info("address: " + sbsAddress); Log.Info("port: " + sbsPort); sbs.mHost = sbsAddress; sbs.mPort = sbsPort; StringCollection players = sbs.GetPlayers(); OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("SQUEEZEBOX"); Log.Info("Found " + sbs.GetPlayerCount().ToString() + " players"); foreach (string player in players) { Log.Info("Found player: " + player); string[] sb = player.Split(' '); bool found = false; foreach (OSAEObject obj in objects) { if (obj.Address == sb[0]) { Log.Info("Found matching object: " + obj.Name); found = true; } } if (!found) { Log.Info("No object found. Adding to OSA"); OSAEObjectManager.ObjectAdd(sb[1], "", sb[1], "SQUEEZEBOX", sb[0], "", 30, true); } } }
public override void RunInterface(string pluginName) { pName = pluginName; logging.AddToLog("Initializing Plugin", true); OSAEObjectTypeManager.ObjectTypeUpdate("SQUEEZEBOX", "SQUEEZEBOX", "Squeezebox", pName, "SQUEEZEBOX", 0, 0, 0, 1); sbsAddress = OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "Server Address").Value; sbsPort = Int32.Parse(OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "CLI Port").Value); ttsSave = OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "TTS Save Path").Value; ttsPlay = OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "TTS Play Path").Value; logging.AddToLog("address: " + sbsAddress, true); logging.AddToLog("port: " + sbsPort, true); sbs.mHost = sbsAddress; sbs.mPort = sbsPort; StringCollection players = sbs.GetPlayers(); OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("SQUEEZEBOX"); logging.AddToLog("Found " + sbs.GetPlayerCount().ToString() + " players", true); foreach (string player in players) { logging.AddToLog("Found player: " + player, true); string[] sb = player.Split(' '); bool found = false; foreach (OSAEObject obj in objects) { if (obj.Address == sb[0]) { logging.AddToLog("Found matching object: " + obj.Name, true); found = true; } } if (!found) { logging.AddToLog("No object found. Adding to OSA", true); OSAEObjectManager.ObjectAdd(sb[1], sb[1], "SQUEEZEBOX", sb[0], "", true); } } }
public override void RunInterface(string pluginName) { log("Running interface", true); pName = pluginName; OSAEObjectTypeManager.ObjectTypeUpdate("MediaCenter Device", "MediaCenter Device", "MediaCenter Device", pluginName, "MediaCenter Device", 0, 0, 0, 1); //heartbeat to check online devices int interval; bool isNum = Int32.TryParse(OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "Poll Interval").Value, out interval); Clock = new System.Timers.Timer(); if (isNum) { Clock.Interval = interval * 1000; } else { Clock.Interval = 60000; } Clock.Start(); Clock.Elapsed += new ElapsedEventHandler(Timer_Tick); //connect to devices OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("MediaCenter Device"); foreach (OSAEObject obj in objects) { createdevice(obj); } this.updateThread = new Thread(new ThreadStart(update)); this.updateThread.Start(); log("Run Interface Complete", true); }
protected void btnUpdate_Click(object sender, EventArgs e) { OSAEObjectTypeManager.ObjectTypeUpdate(hdnSelectedObjectName.Text, txtName.Text, txtDescr.Text, ddlOwnedBy.SelectedValue, ddlBaseType.SelectedValue, chkOwner.Checked, chkSysType.Checked, chkContainer.Checked, chkHideEvents.Checked); hdnSelectedObjectName.Text = txtName.Text; loadObjectTypes(); }
public override void RunInterface(string pluginName) { pName = pluginName; Log = new General.OSAELog(pName); Log.Debug("Running interface"); OSAEObjectType objt = OSAEObjectTypeManager.ObjectTypeLoad("ONKYO RECEIVER"); OSAEObjectTypeManager.ObjectTypeUpdate(objt.Name, objt.Name, objt.Description, pName, "THING", objt.Owner, objt.SysType, objt.Container, objt.HideRedundant); _UDPListen = new UDPListen(); _UDPSend = new UDPSend(); _UDPListen.OnkyoDevice += new DelegateOnkyoReply(OnkyoMessageHandler); _UDPListen.Listen(); _UDPSend.Send(); OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("ONKYO RECEIVER"); foreach (OSAEObject obj in objects) { Receiver r = new Receiver(obj.Name); foreach (OSAEObjectProperty prop in obj.Properties) { switch (prop.Name) { case "Communication Type": r.Type = prop.Value; break; case "IP": r.IP = prop.Value; break; case "Network Port": try { r.NetworkPort = Int32.Parse(prop.Value); } catch { r.NetworkPort = 0; } break; case "COM Port": try { r.ComPort = Int32.Parse(prop.Value); } catch { r.ComPort = 0; } break; } } receivers.Add(r); Log.Debug("Added receiver to list: " + r.Name); try { if (r.Type == "Network" && r.IP != "" && r.NetworkPort != 0) { Log.Debug("Creating TCP Client: ip-" + r.IP + " port-" + r.NetworkPort); r.tcpClient = new TcpClient(r.IP, r.NetworkPort); //get a network stream from server r.clientSockStream = r.tcpClient.GetStream(); // create new writer and reader stream to send and receive r.clientStreamWriter = new StreamWriter(r.clientSockStream); r.clientStreamReader = new StreamReader(r.clientSockStream); //Start listening r.Connect(); } else if (r.Type == "Serial" && r.ComPort != 0) { //not implemented } else { Log.Info(r.Name + " - Properties not set"); } } catch (Exception ex) { Log.Error("Error creating connection to receiver", ex); } } Log.Info("Run Interface Complete"); }
public override void RunInterface(string pluginName) { logging.AddToLog("Running interface", false); pName = pluginName; OSAEObjectTypeManager.ObjectTypeUpdate("ONKYO RECEIVER", "ONKYO RECEIVER", "Onkyo Receiver", pluginName, "ONKYO RECEIVER", 0, 0, 0, 1); _UDPListen = new UDPListen(); _UDPSend = new UDPSend(); _UDPListen.OnkyoDevice += new DelegateOnkyoReply(OnkyoMessageHandler); _UDPListen.Listen(); _UDPSend.Send(); OSAEObjectCollection objects = OSAEObjectManager.GetObjectsByType("ONKYO RECEIVER"); foreach (OSAEObject obj in objects) { Receiver r = new Receiver(obj.Name); foreach (OSAEObjectProperty prop in obj.Properties) { switch (prop.Name) { case "Communication Type": r.Type = prop.Value; break; case "IP": r.IP = prop.Value; break; case "Network Port": try { r.NetworkPort = Int32.Parse(prop.Value); } catch { r.NetworkPort = 0; } break; case "COM Port": try { r.ComPort = Int32.Parse(prop.Value); } catch { r.ComPort = 0; } break; } } receivers.Add(r); logging.AddToLog("Added receiver to list: " + r.Name, false); try { if (r.Type == "Network" && r.IP != "" && r.NetworkPort != 0) { logging.AddToLog("Creating TCP Client: ip-" + r.IP + " port-" + r.NetworkPort, false); r.tcpClient = new TcpClient(r.IP, r.NetworkPort); //get a network stream from server r.clientSockStream = r.tcpClient.GetStream(); // create new writer and reader stream to send and receive r.clientStreamWriter = new StreamWriter(r.clientSockStream); r.clientStreamReader = new StreamReader(r.clientSockStream); //Start listening r.Connect(); } else if (r.Type == "Serial" && r.ComPort != 0) { //not implemented } else { logging.AddToLog(r.Name + " - Properties not set", true); } } catch (Exception ex) { logging.AddToLog("Error creating connection to receiver: " + ex.Message, true); } } logging.AddToLog("Run Interface Complete", false); }
public override void RunInterface(string pluginName) { pName = pluginName; Log = new General.OSAELog(pName); Log.Info("Starting J-Works plugin"); if (OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "Polling Inverval").Value != "") { pollInterval = UInt32.Parse(OSAEObjectPropertyManager.GetObjectPropertyValue(pName, "Polling Interval").Value); } // point subobject classes at this instance (I think) OSAEObjectTypeManager.ObjectTypeUpdate("JWORKS INPUT", "JWORKS INPUT", "J-Works Input", pName, "JWORKS INPUT", false, false, false, true); OSAEObjectTypeManager.ObjectTypeUpdate("JWORKS OUTPUT", "JWORKS OUTPUT", "J-Works Output", pName, "JWORKS OUTPUT", false, false, false, true); // enumerate JSB34x inputs and outputs short numDevs = Jsb34xNumberOfModules(); StringBuilder sb = new StringBuilder(32); Jsb34xDllVersion(sb, 32); string DllVersion = sb.ToString(); for (short dev = 1; dev <= numDevs; ++dev) { sb.Clear(); Jsb34xSerialNumber(dev, sb, 32); String serial = sb.ToString(); sb.Clear(); Jsb34xFirmwareVersion(serial, sb, 32); string firmwareVersion = sb.ToString(); sb.Clear(); Jsb34xDriverVersion(serial, sb, 32); string driverVersion = sb.ToString(); Jsb34xOpenAllRelays(serial); JSB34Xs.Add(serial); JSB34XState.Add(0); byte numInputs = Jsb34xMaxInputs(serial); byte numOutputs = Jsb34xMaxRelays(serial); Log.Info("Found JSB34x device " + serial + " " + driverVersion + " " + DllVersion + " " + firmwareVersion + " with " + numInputs + " inputs, " + numOutputs + " outputs."); for (byte inp = 1; inp <= numInputs; ++inp) { AddIO(serial + "_I" + inp, Direction.Input, serial, inp); } for (byte outp = 1; outp <= numOutputs; ++outp) { AddIO(serial + "_O" + outp, Direction.Output, serial, outp); } } // enumerate JSB38x /39x inputs numDevs = Jsb383NumberOfModules(); sb.Clear(); Jsb383DllVersion(sb, 32); DllVersion = sb.ToString(); for (short dev = 1; dev <= numDevs; ++dev) { sb.Clear(); Jsb383SerialNumber(dev, sb, 32); String serial = sb.ToString(); sb.Clear(); Jsb383FirmwareVersion(serial, sb, 32); string firmwareVersion = sb.ToString(); sb.Clear(); Jsb383DriverVersion(serial, sb, 32); string driverVersion = sb.ToString(); JSB383s.Add(serial); JSB383State.Add(0); byte numInputs = Jsb383MaxInputs(serial); Log.Info("Found JSB38x / JSB39x device " + serial + " " + driverVersion + " " + DllVersion + " " + firmwareVersion + " with " + numInputs + " inputs."); for (byte inp = 1; inp <= numInputs; ++inp) { AddIO(serial + "_I" + inp, Direction.Input, serial, inp); } } if (pollInterval > 0) { timer.Interval = pollInterval; timer.Elapsed += new ElapsedEventHandler(Poll); timer.Start(); } }