Exemplo n.º 1
0
        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.");
            }
        }
Exemplo n.º 2
0
    private void loadDetails()
    {
        OSAEObject obj = OSAEObjectManager.GetObjectByName(gvObjects.DataKeys[Int32.Parse(hdnSelectedRow.Text)]["object_name"].ToString());

        txtName.Text               = obj.Name;
        txtDescr.Text              = obj.Description;
        txtAddress.Text            = obj.Address;
        ddlContainer.SelectedValue = obj.Container;
        if (obj.State.Value != "")
        {
            ddlState.SelectedValue = obj.State.Value;
        }
        ddlType.SelectedValue = obj.Type;
        if (obj.Enabled == 1)
        {
            chkEnabled.Checked = true;
        }
        else
        {
            chkEnabled.Checked = false;
        }

        OSAEObjectType objtype = OSAEObjectTypeManager.ObjectTypeLoad(obj.Type);

        txtOwned.Text = objtype.OwnedBy;
    }
Exemplo n.º 3
0
        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.");
            }
        }
Exemplo n.º 4
0
        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.");
            }
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
    private void loadDetails()
    {
        OSAEObjectType type = OSAEObjectTypeManager.ObjectTypeLoad(gvObjectTypes.DataKeys[Int32.Parse(hdnSelectedRow.Text)]["object_type"].ToString());

        txtName.Text              = type.Name;
        txtDescr.Text             = type.Description;
        ddlOwnedBy.SelectedValue  = type.OwnedBy;
        ddlBaseType.SelectedValue = type.BaseType;
        chkContainer.Checked      = type.Container;
        chkHideEvents.Checked     = type.HideRedundant;
        chkOwner.Checked          = type.Owner;
        chkSysType.Checked        = type.SysType;
    }
Exemplo n.º 8
0
        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.");
            }
        }
Exemplo n.º 9
0
        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.");
            }
        }
    private void loadDetails()
    {
        OSAEObjectType type = OSAEObjectTypeManager.ObjectTypeLoad(gvObjectTypes.DataKeys[gvObjectTypes.SelectedIndex]["object_type"].ToString());

        txtName.Text  = type.Name;
        txtDescr.Text = type.Description;
        try
        { ddlOwnedBy.SelectedValue = type.OwnedBy; }
        catch
        { }
        ddlBaseType.SelectedValue = type.BaseType;
        chkContainer.Checked      = type.Container;
        chkHideEvents.Checked     = type.HideRedundant;
        chkOwner.Checked          = type.Owner;
        chkSysType.Checked        = type.SysType;
        applyObjectSecurity(type.Name);
    }
Exemplo n.º 11
0
        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);
                }
            }
        }
Exemplo n.º 12
0
    private void loadDetails()
    {
        OSAEObject obj = OSAEObjectManager.GetObjectByName(gvObjects.DataKeys[gvObjects.SelectedIndex]["object_name"].ToString());

        txtName.Text               = obj.Name;
        txtAlias.Text              = obj.Alias;
        txtDescr.Text              = obj.Description;
        txtAddress.Text            = obj.Address;
        txtTrustLevel.Text         = obj.MinTrustLevel.ToString();
        ddlContainer.SelectedValue = obj.Container;
        if (obj.State.Value != "")
        {
            ddlState.SelectedValue = obj.State.Value;
        }

        ddlType.SelectedValue = obj.Type;
        chkEnabled.Checked    = obj.Enabled;

        OSAEObjectType objtype = OSAEObjectTypeManager.ObjectTypeLoad(obj.Type);

        txtOwned.Text = objtype.OwnedBy;
        applyObjectSecurity(obj.Name, obj.MinTrustLevel.ToString());
    }
Exemplo n.º 13
0
        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");
        }