示例#1
0
            public void OnConnectionStateChanged(Connection.CallbackConnectionState State)
            {
                if (State != Connection.CallbackConnectionState.Connected)
                {
                    Console.WriteLine("Still waiting for being connected, new state: " + State.ToString());
                    return;
                }

                Console.WriteLine("Connected. Starting data source test.");
                DataHandler = new LWTSD.DataSource(Connection, false);

                // Some thermometers
                for (int i = 0; i < 3; i++)
                {
                    LWTSD.ResourceTypes.ResourceInteger Point = new LWTSD.ResourceTypes.ResourceInteger();
                    Point.Path          = "thermometers/temp" + i.ToString();
                    Point.Displayname   = "Temperature " + i.ToString();
                    Point.Description   = "A temperature";
                    Point.Unit          = "Celcius";
                    Point.SupportsRead  = true;
                    Point.SupportsWrite = false;
                    Point.Value         = 20 + i;
                    Point.MinExclusive  = 3;
                    DataHandler.AddResource(Point);
                }

                // Some writables
                for (int i = 0; i < 3; i++)
                {
                    LWTSD.ResourceTypes.ResourceInteger Point = new LWTSD.ResourceTypes.ResourceInteger();
                    Point.Path          = "writables/item" + i.ToString();
                    Point.Displayname   = "Writable " + i.ToString();
                    Point.Description   = "A writable thingy";
                    Point.Unit          = "Unknown";
                    Point.SupportsRead  = true;
                    Point.SupportsWrite = true;
                    Point.Value         = i + 1;
                    Point.MinExclusive  = 0;
                    Point.MaxExclusive  = 10;
                    DataHandler.AddResource(Point);
                }

                SourceStarted = true;
            }
示例#2
0
 public CDODataStorageEntity(Connection Uplink, JID Orchestrator)
 {
     LowlevelSource    = new LWTSD.DataSource(Uplink, true);
     SessionController = new CDO.CDOController(Uplink, Orchestrator, SessionStarted, SessionTerminated);
 }