Ejemplo n.º 1
1
		static void Main(string[] args)
		{
			Console.WriteLine("Start");
			IPAddress IP = new IPAddress(new byte[] { 192, 168, 16, 91 });
			// For a communication in plain mode
			//byte com_type = SpringCardIWM2_Network_Device.COM_TYPE_PLAIN;
			//byte[] key = null;

			// For a secured communication
			byte com_type = SpringCardIWM2_Network_Device.COM_TYPE_SECURED_OPERATION;
			// In which cas you have to provide a security key
			byte[] key = new byte[16] {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
			

			SpringCardIWM2_Network_Reader reader = new SpringCardIWM2_Network_Reader(IP, 3999, com_type, key);
			reader.SetShowCrypto(true);
			reader.SetBadgeReceivedCallback(new BadgeReceivedCallback(cb));
			reader.Start();
		}
Ejemplo n.º 2
0
		/* This method is called when the user click on the '+' button */
		void BtPlusClick(object sender, EventArgs e)
		{
			/* Show the form enabling to specify a device */
			/* ------------------------------------------ */
			AddDeviceForm form = new AddDeviceForm();
			DialogResult dr = form.ShowDialog();
			
			/* The form has been closed: retrieve the desired device's characteristics */
			/* ----------------------------------------------------------------------- */
			if (dr == DialogResult.OK)
			{
				if (form.device_type == AddDeviceForm.FUNKYGATE)
				{
					/* The user has chosen a FunkyGate TCP reader: create the object, ... */
					SpringCardIWM2_Network_Reader reader = new SpringCardIWM2_Network_Reader(form.ip, form.port, form.com_type, form.key);
					
					/* ... indicate whether the cryptographic detail must be printed, ... */
					reader.SetShowCrypto(ShowCrypto);
					
					/* ... add it in the list, ... */
					devices.Add(reader);
					
					/* ..., the controller, ... */
					SpringCardIWM2_Reader_Controller c = new SpringCardIWM2_Reader_Controller(reader, form.ip.ToString() + ":" + form.port, SpringCardIWM2_Reader_Controller.TYPE_FKG_TCP);
					
					/* ... add the controller on the form, ... */
					flpMiddle.Controls.Add(c);
				
					/* ... and finally scroll to it */
					flpMiddle.ScrollControlIntoView(c);
					
				} else
				{
					/* The user has chosen a Handydrummer: create the object, ... */
					SpringCardIWM2_Network_GPIOs hd = new SpringCardIWM2_Network_GPIOs(form.ip, form.port, form.com_type, form.key);

					/* ... indicate whether the cryptographic detail must be printed, ... */
					hd.SetShowCrypto(ShowCrypto);
					
					/* ... add it in the list, ... */
					devices.Add(hd);
					
					/* ... the controller, ... */
					SpringCardIWM2_GPIOs_Controller c = new SpringCardIWM2_GPIOs_Controller(hd, form.ip.ToString() + ":" + form.port);
					
					/* ... add the controller on the form, ... */
					flpMiddle.Controls.Add(c);
					
					/* ... and finally scroll to it */
					flpMiddle.ScrollControlIntoView(c);
					
				}
			}

		}