Beispiel #1
0
        /// <summary>
        /// Инициализация устройства
        /// </summary>
        public bool Initialize(string ComPort)
        {
            bool res = false;

            try
            {
                int s = PRIM21K.OpenDLL(Encoding.GetEncoding(866).GetBytes(" "), Encoding.GetEncoding(866).GetBytes(""), Encoding.GetEncoding(866).GetBytes(ComPort), 0);
                s = PRIM21K.GetStatus();
                PRIM21K.CloseDLL();
                LastAnswer    = GetError(s);
                LastErrorCode = s;

                if (s == 0)
                {
                    res   = true;
                    Model = KKMModel.PRIM21K;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(res);
        }
Beispiel #2
0
        private int TestPrint(string text)
        {
            byte[] b = Encoding.GetEncoding(866).GetBytes(text);

            int i = PRIM21K.OpenDLL(Encoding.GetEncoding(866).GetBytes(" "), Encoding.GetEncoding(866).GetBytes(""), Encoding.GetEncoding(866).GetBytes(ComPort), 0);

            if (i != 0)
            {
                PRIM21K.CloseDLL();
                return(i);
            }

            i = PRIM21K.GetStatus();

            if (i != 0)
            {
                PRIM21K.CloseDLL();
                return(i);
            }

            i = PRIM21K.GetStatus();

            if (i != 0)
            {
                PRIM21K.CloseDLL();
                return(i);
            }

            i = PRIM21K.FreeDoc(b, Convert.ToUInt32(b.Length));

            if (i != 0)
            {
                PRIM21K.CloseDLL();
                return(i);
            }

            i = PRIM21K.FreeDocCutPlus(5);

            if (i != 0)
            {
                PRIM21K.CloseDLL();
                return(i);
            }

            i = PRIM21K.CutFDoc();

            if (i != 0)
            {
                PRIM21K.CloseDLL();
                return(i);
            }

            PRIM21K.CloseDLL();
            return(i);
        }