예제 #1
0
        /**
         * Fungsi untuk mengirim data ke ledcenterM via network
         * pastikan IP sesuai, jika belum gunakan untuk membaca
         * settingan network pada devicenya
         */
        public int SendTextToNetwork(String message = "")
        {
            int ret    = 0;
            int icolor = 3000;

            m_dwIPAddr = GetIP(IPAddr);
            if (0 != m_dwIPAddr)
            {
                m_dwIDCode = GetIP(IDCode);
                if (0 != m_dwIDCode)
                {
                    try
                    {
                        IntPtr iPtr = Marshal.StringToHGlobalAnsi(message);
                        ret = CP5200.CP5200_Net_SendText(m_nCardID, 0, iPtr, icolor, 16, 45, 14, 3, 0);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }

            return(ret);
        }
예제 #2
0
        // fungsi untuk inisialisasi communication
        // jika 0 => single, 1 => 2 window
        // screen ukuran 64x16
        public int InitComm(int modeWindow = 0)
        {
            int    nRet = 0;
            string strPort;

            if (0 == m_nCommType)
            {
                strPort = "COM" + m_nPort;
                nRet    = CP5200.CP5200_RS232_InitEx(Marshal.StringToHGlobalAnsi(strPort), m_nBaudrate, m_nTimeout);

                int rt = 0;
                if (modeWindow == 0)
                {
                    // format reactangle (left,up,right,down)
                    rt = CP5200.CP5200_RS232_SplitScreen(Convert.ToByte(1), 64, 32, 1, new int[] { 0, 0, 64, 16 });
                }
                else
                {
                    // format reactangle (left,up,right,down)
                    rt = CP5200.CP5200_RS232_SplitScreen(Convert.ToByte(1), 64, 32, 2, new int[] { 0, 0, 32, 16, 32, 0, 64, 16 });
                }
            }
            else
            {
                m_dwIPAddr = GetIP(IPAddr);
                if (0 != m_dwIPAddr)
                {
                    m_dwIDCode = GetIP(IDCode);
                    if (0 != m_dwIDCode)
                    {
                        CP5200.CP5200_Net_Init(m_dwIPAddr, m_nIPPort, m_dwIDCode, m_nTimeout);
                        //CP5200.CP5200_Program_SetWindowProperty(0,0)
                        int rt = 0;
                        if (modeWindow == 0)
                        {
                            // format reactangle (left,up,right,down)
                            rt = CP5200.CP5200_Net_SplitScreen(Convert.ToByte(1), 64, 32, 1, new int[] { 0, 0, 64, 16 });
                        }
                        else
                        {
                            // format reactangle (left,up,right,down)
                            rt = CP5200.CP5200_Net_SplitScreen(Convert.ToByte(1), 64, 32, 2, new int[] { 0, 0, 32, 16, 32, 0, 64, 16 });
                        }

                        if (rt != 0)
                        {
                            MessageBox.Show("Failed split window");
                        }

                        nRet = 1;
                    }
                }
            }

            return(nRet);
        }
예제 #3
0
        public int SendPicture(int width = 0, int height = 0, string picture = null)
        {
            int ret = 0;

            if (0 == m_nCommType)
            {
                ret = CP5200.CP5200_RS232_SendPicture(m_nCardID, 0, 0, 0, width, height, Marshal.StringToHGlobalAnsi(picture), 1, 0, 3, 0);
            }
            else
            {
                ret = CP5200.CP5200_Net_SendPicture(m_nCardID, 0, 0, 0, width, height, Marshal.StringToHGlobalAnsi(picture), 1, 0, 3, 0);
            }

            return(ret);
        }
예제 #4
0
        public int SendStaticText(int width = 0, int height = 0, string message = "")
        {
            int ret = 0;

            if (0 == m_nCommType)
            {
                ret = CP5200.CP5200_RS232_SendStatic(m_nCardID, 0, Marshal.StringToHGlobalAnsi(message), Color.FromArgb(255, 0, 0).ToArgb(), 16, 0, 0, 0, width, height);
            }
            else
            {
                ret = CP5200.CP5200_Net_SendStatic(m_nCardID, 0, Marshal.StringToHGlobalAnsi(message), Color.FromArgb(255, 0, 0).ToArgb(), 16, 0, 0, 0, width, height);
            }

            return(ret);
        }
예제 #5
0
        /**
         * Fungsi untuk mengirim data ke ledcenterM via COM
         * pastikan COMx sesuai, lihat pada device manager
         * gunakan kabel RS232 to USB
         */
        public int SendTextToCom(String message = "")
        {
            int icolor = 3000;
            int ret    = 0;

            try
            {
                IntPtr iPtr = Marshal.StringToHGlobalAnsi(message);
                ret = CP5200.CP5200_RS232_SendText(m_nCardID, 0, iPtr, icolor, 16, 3, 0, 3, 0);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return(ret);
        }
예제 #6
0
        // Create image temporary & send image to device
        public int SendImg(TextImage img, int effect, int windowNumber)
        {
            m_nWindowNo = windowNumber;
            int ret = 0;

            if (0 == m_nCommType)
            {
                ret = CP5200.CP5200_RS232_SendPicture(m_nCardID, m_nWindowNo, 0, 0, img.Width, img.Height,
                                                      Marshal.StringToHGlobalAnsi(img.path), 0, effect, 3, 0);
            }
            else
            {
                ret = CP5200.CP5200_Net_SendPicture(m_nCardID, m_nWindowNo, 0, 0, img.Width, img.Height,
                                                    Marshal.StringToHGlobalAnsi(img.path), 0, effect, 3, 0);
            }
            return(ret);
        }
예제 #7
0
        public int SplitWindow(int width = 0, int height = 0, int windCnt = 0)
        {
            int ret = 0;

            int[] nWndRect = new int[4];
            nWndRect[0] = 0;
            nWndRect[1] = 0;
            nWndRect[2] = width;
            nWndRect[3] = height;

            if (0 == m_nCommType)
            {
                ret = CP5200.CP5200_RS232_SplitScreen(m_nCardID, width, height, windCnt, nWndRect);
            }
            else
            {
                ret = CP5200.CP5200_Net_SplitScreen(m_nCardID, width, height, windCnt, nWndRect);
            }

            return(ret);
        }