Пример #1
0
        // ----------------------------------------------------------
        //
        public void procParsing()
        {
            Utility.Utility.LogWrite("procParsing");

            m_read_rawdata.initObj();
            while (m_pool_orderinput_rawdata.pop(ref m_read_rawdata)) // pop from pool list
            {
                Utility.Utility.LogWrite("m_read_rawdata : " + m_read_rawdata);
                // set ref
                ObjOrderInputSerialRawDataBuf buf_obj = m_read_rawdata;
                if (null != buf_obj)
                {
                    // notify
                    sendMyNotify(SerialPortOrderInput.SERIAL_PORT_NOTIFY_WHAT.RAW_DATA_STREAM, buf_obj);

                    // parsing
                    SerialPortOrderInput serial_port = m_read_rawdata.m_caller_serial_port;
                    if (null != serial_port)
                    {
                        ParserOrderInputBase parser = serial_port.getOrderParser();

                        Utility.Utility.LogWrite("procParsing parser : " + parser);

                        if (null != parser) // 파서가 지정되어 있을때만 파싱 요청한다
                        {
                            Utility.Utility.LogWrite("buf_obj.m_data_buf : " + System.Text.Encoding.Default.GetString(buf_obj.m_data_buf));
                            serial_port.saveRawDataToParsing(buf_obj.m_data_buf, 0, buf_obj.m_data_len);
                        }
                    }

                    // reset read object
                    buf_obj.initObj();
                }
            }
        }
Пример #2
0
 public void setRawDataInfo(SerialPortOrderInput _caller_serial, byte[] _buf, int _offset, int _len)
 {
     caller_serial = _caller_serial;
     buf           = _buf;
     offset        = _offset;
     len           = _len;
     Debug.WriteLine("caller_serial : " + caller_serial);
 }
Пример #3
0
 // ----------------------------------------------------------
 //
 public void sendTestData(String _input_port_num, byte[] _recv_buf, int _recv_offset, int _recv_length)
 {
     if (null != _input_port_num && m_dic_order_input_listen_serial_port.ContainsKey(_input_port_num))
     {
         SerialPortOrderInput sel_port = m_dic_order_input_listen_serial_port[_input_port_num];
         if (null != sel_port)
         {
             sel_port.onReceivedData(_recv_buf, _recv_offset, _recv_length);
         }
     }
 }
Пример #4
0
        // ----------------------------------------------------------
        //
        public void connectSerialPorts()
        {
            // ----------------------------------
            // disconnect
            disconnectSerialPorts();

            Utility.Utility.LogWrite("connectSerialPorts");
            // ----------------------------------
            // input config
            if (null == m_pool_input_config)
            {
                m_pool_input_config = new PoolConfigOrderInput(Kons.ShopCallpass.AppMain.AppCore.ORDER_INPUT_CONFIG_COUNT);
            }
            m_pool_input_config.loadObjectAll();

            // connect to order-input port
            m_order_input_listen_serial_port_list = new SerialPortOrderInput[m_pool_input_config.COUNT];
            for (int i = 0; i < m_order_input_listen_serial_port_list.Length; i++)
            {
                try
                {
                    ObjConfigOrderInput input_config = m_pool_input_config.getObject(i);
                    if (null != input_config && input_config.IS_USE)
                    {
                        int input_type = Kons.Utility.KnUtil.parseInt32(input_config.m_input_type);

                        Utility.Utility.LogWrite("input_type : " + input_type);

                        ParserOrderInputBase parser = null;
                        switch (ParserOrderInputBase.obtainParserType(input_type))
                        {
                        case ParserOrderInputBase.PARSER_TYPE.BAEMIN:
                            parser = new ParserOrderInputCommon();
                            break;

                        case ParserOrderInputBase.PARSER_TYPE.OKPOS:
                            parser = new ParserOrderInputCommon();
                            break;

                        case ParserOrderInputBase.PARSER_TYPE.DELGEN:
                            parser = new ParserOrderInputCommon();
                            break;

                        case ParserOrderInputBase.PARSER_TYPE.POSFEED:
                            parser = new ParserOrderInputCommon();
                            break;

                        case ParserOrderInputBase.PARSER_TYPE.EASYPOS:
                            parser = new ParserOrderInputCommon();
                            break;

                        case ParserOrderInputBase.PARSER_TYPE.YOGIYO:
                            parser = new ParserOrderInputCommon();
                            break;

                        case ParserOrderInputBase.PARSER_TYPE.BEDALTONG:
                            parser = new ParserOrderInputCommon();
                            break;

                        case ParserOrderInputBase.PARSER_TYPE.ETC:
                            parser = new ParserOrderInputCommon();
                            break;
                        }

                        // 입력포트 시작 - 읽기(listen) 대기 포트번호를 가지고 열어둔다
                        m_order_input_listen_serial_port_list[i] = new SerialPortOrderInput(input_config.m_listen_port_num, input_config.m_listen_port_baud, parser, input_config.m_conn_print_port_num);
                        Utility.Utility.LogWrite("parser : " + parser);
                        m_order_input_listen_serial_port_list[i].Notify += onNotifyOrderInputSerialPort;

                        m_order_input_listen_serial_port_list[i].connectSerialPort();
                        Utility.Utility.LogWrite("가즈아!!");
                        // dictionary
                        m_dic_order_input_listen_serial_port.Add(input_config.m_listen_port_num, m_order_input_listen_serial_port_list[i]);

                        // count
                        m_connected_input_port_count++;
                    }
                }
                catch (Exception err)
                {
                    Utility.Utility.LogWrite("connectSerialPorts여기서 예외 발생함 : " + err.Message);
                    ModelAppDevice device = new ModelAppDevice();
                    device.writeLog(err.Message);
                }
            }
        }