Inheritance: IDevice
Exemplo n.º 1
0
		static public void Add (Device device)
		{
			spinLock.Enter ();

			if (deviceCount < MaxDevices)
				devices[deviceCount++] = device;

			spinLock.Exit ();
		}
Exemplo n.º 2
0
		static public Device[] GetChildrenOf (Device device)
		{
			spinLock.Enter ();

			uint count = 0;
			for (uint i = 0; i < deviceCount; i++)
				if (devices[i] == device.Parent)
					count++;

			Device[] children = new Device[count];

			count = 0;
			for (uint i = 0; i < deviceCount; i++)
				if (devices[i] == device.Parent)
					children[count++] = devices[i];

			spinLock.Exit ();

			return children;
		}
Exemplo n.º 3
0
		static public Device[] GetDevices ()
		{
			spinLock.Enter ();

			Device[] list = new Device[deviceCount];

			for (uint i = 0; i < deviceCount; i++)
				list[i] = devices[i];

			spinLock.Exit ();

			return list;
		}
Exemplo n.º 4
0
		static public Device[] GetOnlineDevices ()
		{
			spinLock.Enter ();

			uint count = 0;
			for (uint i = 0; i < deviceCount; i++)
				if (devices[i].Status == DeviceStatus.Online)
					count++;

			Device[] children = new Device[count];

			count = 0;
			for (uint i = 0; i < deviceCount; i++)
				if (devices[i].Status == DeviceStatus.Online)
					children[count++] = devices[i];

			spinLock.Exit ();

			return children;
		}
Exemplo n.º 5
0
		//static public Device[] GetDevicesOf (Type type)
		//{
		//    spinLock.Enter ();

		//    uint count = 0;
		//    for (uint i = 0; i < deviceCount; i++) {
		//        Type a = devices[i].GetType ();

		//        if ((a.IsSubclassOf (type)) || (a == type) || (a.IsAssignableFrom (type)) || (type.IsAssignableFrom (a)))
		//            count++;
		//    }

		//    Device[] list = new Device[count];

		//    count = 0;
		//    for (uint i = 0; i < deviceCount; i++) {
		//        Type a = devices[i].GetType ();

		//        if ((a.IsSubclassOf (type)) || (a == type) || (a.IsAssignableFrom (type)) || (type.IsAssignableFrom (a)))
		//            list[count++] = devices[i];
		//    }

		//    spinLock.Exit ();

		//    return list;
		//}

		//static public Device[] GetDevicesOf (Type type, string name)
		//{
		//    spinLock.Enter ();

		//    uint count = 0;
		//    for (uint i = 0; i < deviceCount; i++)
		//        if (devices[i].Name == name) {
		//            Type a = devices[i].GetType ();

		//            if ((a.IsSubclassOf (type)) || (a == type) || (a.IsAssignableFrom (type)) || (type.IsAssignableFrom (a)))
		//                count++;
		//        }

		//    Device[] list = new Device[count];

		//    count = 0;
		//    for (uint i = 0; i < deviceCount; i++)
		//        if (devices[i].Name == name) {
		//            Type a = devices[i].GetType ();

		//            if ((a.IsSubclassOf (type)) || (a == type) || (a.IsAssignableFrom (type)) || (type.IsAssignableFrom (a)))
		//                list[count++] = devices[i];
		//        }

		//    spinLock.Exit ();

		//    return list;
		//}

		static public Device[] GetOnlineDevicesWithName (string name)
		{
			spinLock.Enter ();

			uint count = 0;
			for (uint i = 0; i < deviceCount; i++)
				if ((devices[i].Status == DeviceStatus.Online) && (devices[i].Name == name))
					count++;


			Device[] list = new Device[count];

			count = 0;
			for (uint i = 0; i < deviceCount; i++)
				if ((devices[i].Status == DeviceStatus.Online) && (devices[i].Name == name))
					list[count++] = devices[i];

			spinLock.Exit ();

			return list;
		}
Exemplo n.º 6
0
        public Device(Device parent, string name, DeviceStatus deviceStatus)
        {
            this.parent = parent;
            this.name = name;
			this.deviceStatus = deviceStatus;           
        }
Exemplo n.º 7
0
        public Device()
        {
            name = string.Empty;            
            parent = null;
			deviceStatus = DeviceStatus.Error;
        }