Exemplo n.º 1
0
 public static bool Open(int device)
 {
     if ((device < 0) || (device > 3))
     {
         throw new Exception("Invalid device");
     }
     if (m_refCounts[device]++ == 0)
     {
         return(K8055D.OpenDevice((long)device) == device);
     }
     return(true);
 }
Exemplo n.º 2
0
 public static void Write(int device, long data)
 {
     if (!m_busy)
     {
         if ((device < 0) || (device > 3))
         {
             throw new Exception("Invalid device");
         }
         if (m_refCounts[device] == 0)
         {
             throw new Exception("Device is not open");
         }
         K8055D.SetCurrentDevice((long)device);
         K8055D.WriteAllDigital(data);
     }
 }
Exemplo n.º 3
0
 public static void Close(int device)
 {
     if ((device < 0) || (device > 3))
     {
         throw new Exception("Invalid device");
     }
     if (m_refCounts[device] == 1)
     {
         K8055D.SetCurrentDevice((long)device);
         K8055D.CloseDevice();
         m_refCounts[device] = 0;
     }
     else if (m_refCounts[device] > 1)
     {
         m_refCounts[device]--;
     }
 }
Exemplo n.º 4
0
 public static long Read(int device)
 {
     if (m_busy)
     {
         return(0L);
     }
     if ((device < 0) || (device > 3))
     {
         throw new Exception("Invalid device");
     }
     if (m_refCounts[device] == 0)
     {
         throw new Exception("Device is not open");
     }
     K8055D.SetCurrentDevice((long)device);
     return(K8055D.ReadAllDigital());
 }
Exemplo n.º 5
0
        public static long SearchDevices()
        {
            int num;

            m_busy = true;
            for (num = 0; num < m_refCounts.Length; num++)
            {
                K8055D.SetCurrentDevice((long)num);
                K8055D.CloseDevice();
            }
            long num2 = K8055D.SearchDevices();

            for (num = 0; num < m_refCounts.Length; num++)
            {
                if (m_refCounts[num] > 0)
                {
                    K8055D.OpenDevice((long)num);
                }
            }
            m_busy = false;
            return(num2);
        }
Exemplo n.º 6
0
 public static void Version()
 {
     K8055D.Version();
 }