예제 #1
0
파일: D.cs 프로젝트: osamu-hasegawa/vSCOPE
        static public bool INIT()
        {
            int cnt;

            if (HID_ENUM(0x04D8, 0x003F, out cnt) != 0)
            {
                if (cnt <= 0)
                {
                    //G.mlog("CAN NOT DETECT USB HID DEVICE");
                    G.mlog("#s顕微鏡装置に接続できません.");
                    return(false);
                }
#if true
                if ((G.AS.DEBUG_MODE & 1) != 0)
                {
                    if (DBGMODE.HID_OPEN(0x04D8, 0x003F, 0) == 0)
                    {
                        return(false);
                    }
                    m_access = true;
                    return(true);
                }
#endif
                if (HID_OPEN(0x04D8, 0x003F, 0) == 0)
                {
                    G.mlog("ERROR @ HID_OPEN");
                    return(false);
                }
            }
            m_access = true;
            return(true);
        }
예제 #2
0
파일: D.cs 프로젝트: osamu-hasegawa/vSCOPE
        static public void TERM()
        {
            if (m_access)
            {
                for (int q = 0; q < 2; q++)
                {
                    SET_LED_STS(q, 0);
                }
                for (int q = 0; q < 4; q++)
                {
                    SET_STG_TRQ(q, 0);
                }
#if true
                if ((G.AS.DEBUG_MODE & 1) != 0)
                {
                    DBGMODE.HID_CLOSE();
                    m_access = false;
                    return;
                }
#endif

                HID_CLOSE();
                m_access = false;
            }
        }
예제 #3
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (G.FORM02 != null)
     {
         G.FORM02.cam_close();
         //G.FORM02.m_bcontinuous = false;
         //G.FORM02.Stop();
         //G.FORM02.DestroyCamera();
         G.FORM02.Close();
         //G.FORM02.Dispose();
         G.FORM02 = null;
     }
     if (true)
     {
         G.FORM10.LED_SET(0, false);
         G.FORM10.LED_SET(1, false);
         G.FORM10.LED_SET(2, false);
     }
     //---
     if (this.Left <= -32000 || this.Top <= -32000)
     {
         //最小化時は更新しない
     }
     else
     {
         G.AS.APP_F01_LFT = this.Left;
         G.AS.APP_F01_TOP = this.Top;
     }
     //---
     G.AS.AUT_BEF_PATH = G.SS.AUT_BEF_PATH;
     G.AS.BEFORE_PATH  = G.SS.BEFORE_PATH;
     G.AS.PLM_AUT_FOLD = G.SS.PLM_AUT_FOLD;
     G.AS.MOZ_CND_FOLD = G.SS.MOZ_CND_FOLD;
     //---
     if (G.SS.ETC_UIF_LEVL == 0 || G.SS.ETC_UIF_LEVL == 1)
     {
         G.SS.ETC_UIF_BACK = G.SS.ETC_UIF_LEVL;
     }
     //---
     G.AS.save(G.AS);
     G.SS.save(G.SS);
     //---
     if (G.AS.DEBUG_MODE != 0)
     {
         DBGMODE.TERM();
     }
 }
예제 #4
0
파일: D.cs 프로젝트: osamu-hasegawa/vSCOPE
        static private int HID_ENUM(uint vid, uint pid, out int pcnt)
        {
#if true
            if ((G.AS.DEBUG_MODE & 1) != 0)
            {
                DBGMODE.HID_ENUM(vid, pid, out pcnt);
                return(1);
            }
#endif
            //TEST00(0,0,(IntPtr)0);
            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);
        }
예제 #5
0
파일: D.cs 프로젝트: osamu-hasegawa/vSCOPE
        /************************************************************/
        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 true
            if ((G.AS.DEBUG_MODE & 1) != 0)
            {
                DBGMODE.WRITE_HID(commandPacket);
                if (buf != null)
                {
                    DBGMODE.READ_HID(buf);
                }
                return(true);
            }
#endif
            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);
        }