Jump to content
View in the app

A better way to browse. Learn more.

Tinkerunity

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Geschrieben

Hallo

 

ich habe ein Listener in meinem Programm integriert. Doch der funktioniert nur einmal wenn das erste mal das Programm durchgelesen wird und wenn das Chip auf dem Bricklet ist. Wenn ich das Chip später auf dem Bricklet ist wird er nicht gelesen. Weiss jemand warum? :-\

 

Danke für Eure Hilfe

 

Nel

Geschrieben

Welches Programm und mit welcher Sprache?

Sonst kann keiner dir helfen.

Geschrieben
  • Autor

Programmiersprache: Java

public static void analyse() {



	nr.addStateChangedListener(new BrickletNFCRFID.StateChangedListener() {
		public void stateChanged(short state, boolean idle) {
			try {
				nr.requestPage(5);
			} catch (TimeoutException | NotConnectedException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			if (state == BrickletNFCRFID.STATE_REQUEST_PAGE_READY) {
				// Get and print pages
				short[] data;
				try {
					data = nr.getPage();

					bochPos = data[0];
					jusPos = data[1];
					cerealesPos = data[2];
					painPos = data[3];
					co1Pos = data[4];
					co2Pos = data[5];
				} catch (TimeoutException | NotConnectedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

				System.out.println(bochTableau[bochPos].getDescription() + " " + jusTableau[jusPos].getDescription()
						+ " " + cerealesTableau[cerealesPos].getDescription() + " "
						+ painTableau[painPos].getDescription() + " " + confitureTableau[co1Pos].getDescription()
						+ " " + confitureTableau[co2Pos].getDescription());

				WindowController.getInstance().nextNFC(bochTableau[bochPos], jusTableau[jusPos],
						cerealesTableau[cerealesPos], painTableau[painPos], confitureTableau[co1Pos],
						confitureTableau[co2Pos]);

				try {
					ipcon.disconnect();
				} catch (NotConnectedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			System.out.println("State " + state);
		}
	});

	try {
		nr.requestTagID(BrickletNFCRFID.TAG_TYPE_TYPE2);
	} catch (TimeoutException | NotConnectedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	// Select NFC Forum Type 2 tag

}

 

und das ist mein Programm

  • 2 weeks later...
Geschrieben

Du rufst nur einmal "nr.requestTagID(BrickletNFCRFID.TAG_TYPE_TYPE2);" auf. Du musst innerhalb deiner stateChanged Methode am Ende wieder "nr.requestTagID(BrickletNFCRFID.TAG_TYPE_TYPE2);" aufrufen, wenn du mit dem Auslesen des Tags fertig bist. Das stößt dann die Suche nach dem nächsten Tag an.

 

Schau dir auch mal das "Scan for Tags" Beispiel an:

 

https://www.tinkerforge.com/de/doc/Software/Bricklets/NFCRFID_Bricklet_Java.html#scan-for-tags

Geschrieben
  • Autor

	nr.addStateChangedListener(new BrickletNFCRFID.StateChangedListener() {
		public void stateChanged(short state, boolean idle) {
			try {
				nr.requestPage(5);
			} catch (TimeoutException | NotConnectedException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
			if (state == BrickletNFCRFID.STATE_REQUEST_PAGE_READY) {
				// Get and print pages
				short[] data;
				try {
					data = nr.getPage();

					bochPos = data[0];
					jusPos = data[1];
					cerealesPos = data[2];
					painPos = data[3];
					co1Pos = data[4];
					co2Pos = data[5];
					vidangePos = data[6];
				} catch (TimeoutException | NotConnectedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

				try {
					ipcon.disconnect();
				} catch (NotConnectedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}

				System.out.println(bochTableau[bochPos].getDescription() + " " + jusTableau[jusPos].getDescription()
						+ " " + cerealesTableau[cerealesPos].getDescription() + " "
						+ painTableau[painPos].getDescription() + " " + confitureTableau[co1Pos].getDescription()
						+ " " + confitureTableau[co2Pos].getDescription() + " vidange: "
						+ vidangeTableau[vidangePos].getDescription());

				WindowController.getInstance().nextNFC(bochTableau[bochPos], jusTableau[jusPos],
						cerealesTableau[cerealesPos], painTableau[painPos], confitureTableau[co1Pos],
						confitureTableau[co2Pos], vidangeTableau[vidangePos]);

			}
			else if((state & (1 << 6)) == (1 << 6)) {
			System.out.println("State " + state);


			}
			try {
				nr.requestTagID(BrickletNFCRFID.TAG_TYPE_TYPE2);
			} catch (TimeoutException | NotConnectedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}


	});

	try {
		nr.requestTagID(BrickletNFCRFID.TAG_TYPE_TYPE2);
	} catch (TimeoutException | NotConnectedException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

 

So klappt es immer noch nicht :-\

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gast
Reply to this topic...

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.