RFCOMM über serielle Schnittstelle RS 232 MIDLET

Status
Nicht offen für weitere Antworten.

bitfix

Neues Mitglied
Hi Leute,

ich bin momentan ziemlich ralos, bitte um eure Hilfe!!!

Folgendes Projekt:

ich möchte per Handy Daten mit einem Gerät über eine serielle Schnittstelle RS232 austauschen, die Datenmengen sind relativ gering und nicht zeitkritisch ! Ich habe mir einen Adapter Blutooth RS232 besorgt.

Flogende funktionen soll das Midlet auf dem Handy haben:

1. Gerätesuche (funktioniert bereits, mein midlet findet auch den Adapter)

2. Dienstsuche ( funktioniert nicht)

3. Verbindung mit dem Adapter herstellen

4. Daten austauschen

Mein Quellcode:


hat jemand source-Code für die Schritte 2 - 4 ???

Das ganze könnte man mit einem Hyperterminal testen, wenn der Adapter direkt am PC angeschlossen wird.

vielen Dank für eure Bemühungen

gruß Bitfix
Mein Quellcode:

/*
* HelloMidlet.java
*
* Created on 29. November 2006, 21:09
*/

import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import javax.bluetooth.*;


Code:
public class HelloMidlet extends MIDlet implements CommandListener, DiscoveryListener, Runnable
{
 
	private List MainMenu;
        private List ServiceList;
	//remote device found;
        
	private RemoteDevice btDev = null;
	private boolean DeviceSearchRunning = false;
 
 
	private RemoteDevice[] FoundDevices = new RemoteDevice[20];
	private int FoundDevicesNum = 0;
	private DiscoveryAgent agent = LocalDevice.getLocalDevice().getDiscoveryAgent();
 
	public HelloMidlet() throws IOException
	{
		MainMenu = new List("Bluetooth-Test", Choice.IMPLICIT);
		MainMenu.append("Server", null);
		MainMenu.append("Client", null);
		MainMenu.append("Exit", null);
		MainMenu.addCommand(new Command("Exit", Command.EXIT, 1));
		MainMenu.setSelectCommand(new Command("OK", Command.OK, 0));
		MainMenu.setCommandListener(this);
	}
 
	private void BluetoothDeviceSearch() throws IOException
	{
		//Anzeige mit Bluetooth symbol erstellen
		Form Devices = new Form("Device Search");
         	Devices.addCommand(new Command("zurück", Command.BACK, 0));
		Devices.setCommandListener(this);
		Display.getDisplay(this).setCurrent(Devices);
 
		/***Eigene Bluetooth-Gerät sichtbar machen***/
		// retrieve the local Bluetooth device object
		 LocalDevice local = LocalDevice.getLocalDevice();
		// retrieve the Bluetooth address of the local device
		// String address = local.getBluetoothAddress();
		// retrieve the name of the local Bluetooth device
                
		 // local String name = local.getFriendlyName();
                 
                 System.out.println("-->btdevicesearch");
 
		Devices.append("textausgabe");
 
		/***Bluetooth-Gerätesuche starten***/
 
		Devices.append("\nStarting BT Gerätesuche\n");
 
		try { Thread.sleep(500); }
		catch (InterruptedException ex) { ex.printStackTrace(); }
 
		btDev = null;
 
		DeviceSearchRunning = true;
 
		FoundDevicesNum = 0;
           
		agent.startInquiry(DiscoveryAgent.GIAC, this);
		Devices.append("\nSearching...\n");
	}
       
 
	private void BluetoothServiceSearch() throws BluetoothStateException
	{
   
DiscoveryAgent agent = LocalDevice.getLocalDevice().getDiscoveryAgent();
((List)Display.getDisplay(this).getCurrent()).append("Searching Services...", null);
//UUID uuids[] ={ new UUID(0x1101) };
//agent.searchServices(null, uuids, btDev, this);

((List)Display.getDisplay(this).getCurrent()).append("Searching Services...new", null);
UUID[] searchList = new UUID[ 1 ] ;
searchList [ 0 ] = new UUID( "42249B70A08911DAA7460800200C9A66 " ,false ) ;

     agent.searchServices( null , searchList ,  btDev,this ) ;[code]
 
J

jamesmasters1985

Gast
Wenns noch interessiert hardcodiere die Adresse dann sparst du dir Geräte und Dienstsuche.
 
Status
Nicht offen für weitere Antworten.
Ähnliche Java Themen
  Titel Forum Antworten Datum
K Null-Pointer-Exception in ListView - wird über Datenbank gefüllt Android & Cross-Platform Mobile Apps 1
M Einfache Rechenoperation über TCP Server Android & Cross-Platform Mobile Apps 15
H Android Anklickbare Region über RadioButton zentrieren Android & Cross-Platform Mobile Apps 1
B Android TCP-Verbindung zum Server über welche Prozess auslagerung nutzen? Android & Cross-Platform Mobile Apps 1
S Android Absoluter Neuling: EditText zur Laufzeit verändern bzw. über Button Android & Cross-Platform Mobile Apps 2
V Bytes (Wertebereich 0-255) über BLE empfangen,lesen und speichern Android & Cross-Platform Mobile Apps 1
L Android SQLite mit HSQLDB über Android synchronisieren Android & Cross-Platform Mobile Apps 13
Florum Android FTP Upload über Android Android & Cross-Platform Mobile Apps 15
T Musik über Bluetooth streamen Android & Cross-Platform Mobile Apps 2
B Android Mehrer Hexwerte über outputstream senden, und empfangen (Bluetoth) Android & Cross-Platform Mobile Apps 9
R W-Lan Problem über Sockets Android & Cross-Platform Mobile Apps 1
R Android App mit ausgeschaltetem Display über Volume-Tasten steuern Android & Cross-Platform Mobile Apps 0
A Android Login über Serveranbindung Android & Cross-Platform Mobile Apps 3
B Datei downloaden über DialogBox? Android & Cross-Platform Mobile Apps 4
T Android Druckauftrag über Mobiles Internet Android & Cross-Platform Mobile Apps 2
L Android Android über Java Code connecten? Android & Cross-Platform Mobile Apps 2
N Java ME Server-Client Verbindung über Wifi Android & Cross-Platform Mobile Apps 6
D Android JMS über Android Android & Cross-Platform Mobile Apps 4
S DTMF-Töne über MIDlet senden Android & Cross-Platform Mobile Apps 3
Kidao Wie schließt man ein Midlet über Tasten? Android & Cross-Platform Mobile Apps 3
G SMS über Handy SMS Interface versenden Android & Cross-Platform Mobile Apps 5
T Installation über WAP Android & Cross-Platform Mobile Apps 3
J Bücher über Java-Spiele-Programmierung Android & Cross-Platform Mobile Apps 3
B Kann man bei Nokia-Handy's über Java die IR ansteuern? Android & Cross-Platform Mobile Apps 6

Ähnliche Java Themen

Neue Themen


Oben