Пример #1
0
 private DemoReader(Parcel parcel)
 {
     _reader         = (CAENRFIDReader)parcel.ReadValue(Java.Lang.Class.FromType(typeof(DemoReader)).ClassLoader);
     ReaderName      = parcel.ReadString();
     Serial          = parcel.ReadString();
     FirmwareRelease = parcel.ReadString();
 }
Пример #2
0
        private void StartReceivingTags()
        {
            CAENRFIDReader reader = Reader.GetReader();

            CAENRFIDLogicalSource source = null;

            source           = reader.GetSource("Source_0");
            source.ReadCycle = 0;

            source.Selected_EPC_C1G2 = CAENRFIDLogicalSourceConstants.EPCC1G2AllSELECTED;
            source
            .EventInventoryTag(
                new byte[0],
                (short)0x0,
                (short)0x0,
                (short)0x7);
        }
Пример #3
0
        public DemoReader(CAENRFIDReader caenReader, string readerName, string serialNum, string fwRel,
                          CAENRFIDPort connType)
        {
            _reader         = caenReader;
            ReaderName      = readerName;
            Serial          = serialNum;
            FirmwareRelease = fwRel;

            try
            {
                SetRegulation(_reader.RFRegulation);
            }
            catch (CAENRFIDException e)
            {
            }

            ConnectionType = connType;
        }
Пример #4
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            this.InformationStatusToolStripStatusLabel.Text = "connecting ...";

            try
            {
                Application.DoEvents();
                MyReader = null;
                GC.Collect();
                MyReader = new CAENRFIDReader();
                MyReader.Connect(CAENRFIDPort.CAENRFID_TCP, this.IPtextBox1.Text);
                CAENRFIDReaderInfo info = MyReader.GetReaderInfo();
                MyReader.GetFirmwareRelease();
                MyReader.SetProtocol(CAENRFIDProtocol.CAENRFID_EPC_C1G2);
                this.status = true;
            }
            catch
            {
                this.status = false;
            }

            if (this.status)
            {
                IPtextBox1.Enabled = false;
                buttonConnect.Enabled = false;
                this.InformationStatusToolStripStatusLabel.Text = "connection successful!";
            }
            else
            {
                try
                {
                    MyReader.Disconnect();
                }
                catch
                {
                }

                this.InformationStatusToolStripStatusLabel.Text = "CONNECTION REFUSED!!!";
            }
        }
Пример #5
0
 private void buttonDisconnect_Click(object sender, EventArgs e)
 {
     try
     {
         checkBox0.Enabled = true;
         checkBox1.Enabled = true;
         checkBox2.Enabled = true;
         checkBox3.Enabled = true;
         this.MyReader.Disconnect();
         this.MyReader = null;
         IPtextBox1.Enabled = true;
         buttonConnect.Enabled = true;
         InformationStatusToolStripStatusLabel.Text = "input TCP/IP address";
     }
     catch
     {
     }
 }
Пример #6
0
        public static M3ClientInitializationStatus Init()
        {
            //Берём из реестра данные о соединении и сборке
            configuration = new ClientConfiguration();
            //Сохраняем в реестре новую версию сборки
            configuration.Build = ClientConfiguration.DefaultBuild;
            configuration.Save();
            //Интернационализация
            i8n.Init();
            i8n.strings.SetLanguage(configuration.Language);

            web = new RfidWebClient(configuration);

            try
            {
                reader = new CAENRFIDReader();
                reader.Connect(CAENRFIDPort.CAENRFID_RS232, "MOC1");
                System.Threading.Thread.Sleep(500);
                M3Client.source = M3Client.reader.GetSources()[0];
            }
            catch (CAENRFIDException e)
            {
                return M3ClientInitializationStatus.ReaderNotReady;
            }

            if (configuration.Server == String.Empty || configuration.DeviceKey == String.Empty)
            {
                return M3ClientInitializationStatus.ClientConfigurationMissing;
            }

            return M3ClientInitializationStatus.Ok;
        }
Пример #7
0
        protected override async void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            string          ip  = null;
            BluetoothDevice dev = null;

            switch (requestCode)
            {
            case AddReaderBt:
                if (resultCode == Result.Ok)
                {
                    dev = (BluetoothDevice)((Intent)data).GetParcelableExtra("BT_DEVICE");

                    _tcpBtWaitProgressDialog = ProgressDialog.Show(this,
                                                                   "Connection ", "Connecting to " + dev.Name, true,
                                                                   true);

                    await Task.Run(() =>
                    {
                        BluetoothSocket sock;
                        CAENRFIDReader reader   = null;
                        CAENRFIDReaderInfo info = null;
                        string fwrel            = null;

                        bool no_connection = true;

                        try
                        {
                            sock = dev.CreateRfcommSocketToServiceRecord(_myUuid);

                            reader = new CAENRFIDReader();


                            reader.Connect(sock);
                            var state = dev.BondState;

                            while (state != Bond.Bonded)
                            {
                                state = dev.BondState;
                            }


                            info  = reader.ReaderInfo;
                            fwrel = reader.FirmwareRelease;

                            DemoReader dr = new DemoReader(reader, info.Model,
                                                           info.SerialNumber, fwrel, CAENRFIDPort.CaenrfidBt);
                            Readers.Add(dr);
                        }
                        catch (CAENRFIDException e)
                        {
                            Log.Error(TAG, "Exception " + e.Message);

                            Toast.MakeText(ApplicationContext, "Failed", ToastLength.Long);
                        }
                    });


                    UpdateReadersList();
                    _tcpBtWaitProgressDialog.Dismiss();
                }
                break;
            }
        }