Esempio n. 1
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);
     }
 }
Esempio n. 2
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]--;
     }
 }
Esempio n. 3
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());
 }
Esempio n. 4
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);
        }