예제 #1
0
 static public void TERM()
 {
     if (m_access)
     {
         if ((G.AS.DEBUG_MODE & 1) != 0)
         {
             DBGMODE.HID_CLOSE();
             m_access = false;
             return;
         }
         HID_CLOSE();
         m_access = false;
     }
 }
예제 #2
0
        static private int HID_ENUM(uint vid, uint pid, out int pcnt)
        {
            if ((G.AS.DEBUG_MODE & 1) != 0)
            {
                DBGMODE.HID_ENUM(vid, pid, out pcnt);
                return(1);
            }
            int    ret;
            IntPtr buf = new IntPtr();

            buf  = Marshal.AllocHGlobal(4);
            ret  = _HID_ENUM(vid, pid, buf);;
            pcnt = Marshal.ReadInt32(buf);
            Marshal.FreeHGlobal(buf);

            return(ret);
        }
예제 #3
0
 /************************************************************/
 static public bool CMDOUT64(int cmd, int par1, int par2, int par3, int par4, byte[] obuf, byte[] ibuf)
 {
     byte[] commandPacket = new byte[64];
     commandPacket[0] = (byte)cmd;
     commandPacket[1] = (byte)par1;
     commandPacket[2] = (byte)par2;
     commandPacket[3] = (byte)par3;
     commandPacket[4] = (byte)par4;
     if (obuf != null)
     {
         for (int i = 0; i < obuf.Length; i++)
         {
             commandPacket[5 + i] = obuf[i];
         }
     }
     if ((G.AS.DEBUG_MODE & 1) != 0)
     {
         DBGMODE.WRITE_HID(commandPacket);
         if (ibuf != null)
         {
             DBGMODE.READ_HID(ibuf);
         }
         return(true);
     }
     if (WRITE_HID(commandPacket, commandPacket.Length) == 0)
     {
         //	return(false);
     }
     if (ibuf != null)
     {
         if (READ_HID(commandPacket, commandPacket.Length) == 0)
         {
             return(false);
         }
         for (int i = 0; i < commandPacket.Length; i++)
         {
             if (i >= ibuf.Length)
             {
                 break;
             }
             ibuf[i] = commandPacket[i];
         }
     }
     return(true);
 }
예제 #4
0
        /************************************************************/
        static public bool CMDOUT(int cmd, int par1, int par2, int par3, int par4, byte[] buf)
        {
            byte[] commandPacket = new byte[16];
            commandPacket[0] = (byte)cmd;
            commandPacket[1] = (byte)par1;
            commandPacket[2] = (byte)par2;
            commandPacket[3] = (byte)par3;
            commandPacket[4] = (byte)par4;

            if ((G.AS.DEBUG_MODE & 1) != 0)
            {
                DBGMODE.WRITE_HID(commandPacket);
                if (buf != null)
                {
                    DBGMODE.READ_HID(buf);
                }
                return(true);
            }
            if (WRITE_HID(commandPacket, commandPacket.Length) == 0)
            {
                //			Toast.makeText(TEST24Activity.this, "USB COMMUNICATION ERROR!!!", Toast.LENGTH_SHORT).show();
                //	return(false);
            }
            if (buf != null)
            {
                if (READ_HID(commandPacket, commandPacket.Length) == 0)
                {
                    return(false);
                }
                for (int i = 0; i < commandPacket.Length; i++)
                {
                    if (i >= buf.Length)
                    {
                        break;
                    }
                    buf[i] = commandPacket[i];
                }
            }
            return(true);
        }
예제 #5
0
        /************************************************************/
        static public bool CMDOUT05(int cmd, int par1, int par2, int par3, int par4, int par5)
        {
            byte[] commandPacket = new byte[16];
            commandPacket[0] = (byte)cmd;
            commandPacket[1] = (byte)par1;
            commandPacket[2] = (byte)par2;
            commandPacket[3] = (byte)par3;
            commandPacket[4] = (byte)par4;
            commandPacket[5] = (byte)par5;

            if ((G.AS.DEBUG_MODE & 1) != 0)
            {
                DBGMODE.WRITE_HID(commandPacket);
                return(true);
            }
            if (WRITE_HID(commandPacket, commandPacket.Length) == 0)
            {
                //			Toast.makeText(TEST24Activity.this, "USB COMMUNICATION ERROR!!!", Toast.LENGTH_SHORT).show();
                //	return(false);
            }
            return(true);
        }
예제 #6
0
        static public bool INIT()
        {
            int cnt;
            int ret;

            // 0x04D8, // Vendor ID
            // 0x003F, // Product ID(uSCOPE)
            // 0xEF22, // Product ID(SENSOR.BIG)
            // 0xEED8, // Product ID(SENSOR.MINI)
            if ((ret = HID_ENUM(0x04D8, 0xEED8, out cnt)) == 0)
            {
                return(false);
            }
            if (cnt <= 0)
            {
                G.mlog("#sCRTデバイスに接続できません.");
                return(false);
            }
            if ((G.AS.DEBUG_MODE & 1) != 0)
            {
                if (DBGMODE.HID_OPEN(0x04D8, 0xEED8, 0) == 0)
                {
                    return(false);
                }
                DEV_TYPE = 0;
                m_access = true;
                return(true);
            }
            if (HID_OPEN(0x04D8, 0xEED8, 0) == 0)
            {
                G.mlog("ERROR @ HID_OPEN");
                return(false);
            }
            DEV_TYPE = 0;
            m_access = true;
            return(true);
        }