Beispiel #1
0
        public static PhysicalInterfacesInfo PhysicalInterfaces(IBMWIoTP.ApiClient cli, EventTypeInfo evnt)
        {
            Console.WriteLine("Physical Interfaces sample request");
            Console.WriteLine("Add Draft PhysicalInterfaces");
            PhysicalInterfaceDraft draft = new PhysicalInterfaceDraft();

            draft.name        = "TempPI";
            draft.description = "new PhysicalInterfaces for temp";
            PhysicalInterfacesInfo newPI = cli.AddDraftPhysicalInterfaces(draft);

            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(newPI));
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Get all Draft PhysicalInterfaces");
            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.GetAllDraftPhysicalInterfaces()));
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Update Draft PhysicalInterfaces");
            newPI.description = "changed to new discription";
            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.UpdateDraftPhysicalInterfaces(newPI)));
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Get Draft PhysicalInterfaces");
            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.GetDraftPhysicalInterfaces(newPI.id)));
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Map PhysicalInterfaces EventType");
            EventTypeBind bind = new EventTypeBind();

            bind.eventTypeId = evnt.id;
            bind.eventId     = "temperature";
            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.MapDraftPhysicalInterfacesEvent(newPI.id, bind)));
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Get all Mapping PhysicalInterfaces EventType");
            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.GetAllDraftPhysicalInterfacesMappedEvents(newPI.id)));
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Delete Mapping PhysicalInterfaces EventType");
            cli.DeleteDraftPhysicalInterfacesMappedEvents(newPI.id, bind.eventId);
            Console.WriteLine("===============================================================================");
            Console.WriteLine("Get All active PhysicalInterfaces");
            PhysicalInterfacesCollection coll = cli.GetAllActivePhysicalInterfaces();

            Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(coll));
            Console.WriteLine("===============================================================================");
            if (coll.results.Count > 0)
            {
                Console.WriteLine("Get active PhysicalInterfaces");
                Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.GetActivePhysicalInterfaces(coll.results[0].id)));
                Console.WriteLine("===============================================================================");
                Console.WriteLine("Get active PhysicalInterfaces Events ");
                Console.WriteLine(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(cli.GetActivePhysicalInterfacesEvents(coll.results[0].id)));
                Console.WriteLine("===============================================================================");
            }
            return(newPI);
        }