Shop OBEX P1 Docs P2 Docs Learn Events
eb500 and j2me midlet — Parallax Forums

eb500 and j2me midlet

ALAPISCOALAPISCO Posts: 3
edited 2007-10-18 13:58 in General Discussion
Im trying to send a string to the eb500 via a midlet , fist the program searches for available devices and prints on screen details about them, after that it tries to make a connection to a device with service 0x1101which is the one used for the eb500, it is supossed to show the string on the debuger window on the eb500 but nothing happens. Can any1 help me on this pls? am I missing something?



the code I am trying to use is the following :


for he midlet


try{

DiscoveryAgent myDiscoveryAgent = LocalDevice.getLocalDevice().getDiscoveryAgent();
add = LocalDevice.getLocalDevice().getBluetoothAddress();
myDiscoveryAgent.startInquiry(DiscoveryAgent.GIAC,this);
try {

Thread.sleep(10000);
} catch (InterruptedException ex) {
ex.printStackTrace();
}

myDiscoveryAgent.cancelInquiry(this);
RemoteDevice [noparse]/noparse remoteDevices = myDiscoveryAgent.retrieveDevices(DiscoveryListener.INQUIRY_COMPLETED);
DataOutputStream dos = null;

UUID myService = new UUID(0x1101);
servicios = servicios + myDiscoveryAgent.selectService(myService,ServiceRecord.NOAUTHENTICATE_NOENCRYPT,false);


try{
StreamConnection conn = (StreamConnection) Connector.open(servicios);

if (servicios != null) {
conn = (StreamConnection) Connector.open(servicios);
dos = conn.openDataOutputStream();
dos.writeUTF("Hola Oscar");
// dos.writeChars("Hola");
dos.flush();
dos.close();
}
} catch (Exception ex) {
}




for (int i = 0 ;i<remoteDevices.length;i++)

try {
results = results + remoteDevices.toString() + " " + remoteDevices.getFriendlyName(true);

} catch (IOException ex) {
ex.printStackTrace();
}




} catch (BluetoothStateException ex) {

ex.printStackTrace();
}



and the code for the eb500

' {$STAMP BS2px}

serialin VAR Byte
INPUT 5
PAUSE 1000
SEROUT 1,84, [noparse][[/noparse]"con 00:1A[noparse]:D[/noparse]C:8B[noparse]:D[/noparse]E:78",CR]
SERIN 0,84,[noparse][[/noparse]WAIT("ACK",CR)]
WaitForConnection:
IF IN5 = 0 THEN WaitForConnection

main:
serialIn(0) = 0
SERIN 0,84,1000,main,[noparse][[/noparse]STR serialIn\3\"!"]
PAUSE 100
LOOKDOWN serialIn(0),[noparse][[/noparse]100,101],serialIn
BRANCH serialIn,[noparse][[/noparse]test1, test2]
SEROUT 1,84,[noparse][[/noparse]"none", CR]
PAUSE 5
GOTO main
test1:
SEROUT 1,84,[noparse][[/noparse]"a"]
GOTO main
test2:
SEROUT 1,84,[noparse][[/noparse]"b"]
DEBUG STR serialIn,CR
GOTO main

Comments

  • Steve JoblinSteve Joblin Posts: 784
    edited 2007-10-16 16:03
    This forum is usually used to test postings, signatures and the like.... You probably won't get a response as most folks don't read this forum... I suggest you copy and paste your question into either the "BASIC Stamp" or the "Sandbox" forum (but not both forums, just pick one!). Make sure you delete this thread once you have posted your question in the other forum so that you don't have a "double" posting.
  • ALAPISCOALAPISCO Posts: 3
    edited 2007-10-18 04:09
    How do i delete this post ?

    thanks
  • Steve JoblinSteve Joblin Posts: 784
    edited 2007-10-18 13:27
    There should be an icon with an "X" in the top right corner of the post.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-10-18 13:58
    Posts cannot be deleted by members once there has been a reply to them because that would delete other's posts/replies as well. Since it's the Test Forum we won't worry about it. The message was, however, subsequently cross-posted and the duplicate was removed. Please do not cross-post. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.