Bluetooth comunication between pc-serer and mobile-client
Hi, I'm trying to program a simple client-server where the server is
running on a PC (win XP) and the client is running on a mobile phone (Nokia 6230). The mobile-client type a string (by cliking its keys) and sends it to the server; upopn resiving the string, the server prints it to the display.
Actually I dont have any idea of how to start, even though it sounds very simple to me.
Can any body PLEAS help me with getting started?
Hi, I'm trying to program a simple client-server where the server is
running on a PC (win XP) and the client is running on a mobile phone (Nokia 6230). The mobile-client type a string (by cliking its keys) and sends it to the server; upopn resiving the string, the server prints it to the display.
Actually I dont have any idea of how to start, even though it sounds very simple to me.
Can any body PLEAS help me with getting started?
Similar Messages
-
Bluetooth simulation between J2SE server and J2ME client
hi there,
I have a working bluetooth client/server application (using BlueCove), with the server on a PC (the PC has bluetooth hardware) and the client on a mobile telephone.
I wish to move the application to a bluetooth simulated environment, however.
To simulate bluetooth between 2 mobiles, I could open 2 instances of the WTK simulator and the mobiles will find each other -- but this doesn't meet my needs. I wish to simulate the bluetooth environment between a J2SE server and a J2ME client.
Can I do this using the wireless toolkit? Does anyone have other ideas?
thanks,
ManojOK - I have the solution.
My PC (server) code used BlueCove to talk to the bluetooth stack. The trick is to use Sun's own KVM packages. This creates a virtual bluetooth device on your machine, shared by the WTK emulator.
Here's the server code:
package com.encube;
import java.awt.BorderLayout;
import java.io.InputStream;
import javax.microedition.io.Connector;
import javax.microedition.io.StreamConnection;
import javax.microedition.io.StreamConnectionNotifier;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import com.sun.kvem.bluetooth.BluetoothStateException;
import com.sun.kvem.bluetooth.DiscoveryAgent;
import com.sun.kvem.bluetooth.LocalDevice;
public class Server {
public static final String UUID_STRING = "A781FDBA229B486A8C21CEBD00000000";
public static final String SERVICE_NAME = "BTCHATSVR";
private StreamConnectionNotifier server;
JFrame jframe;
JTextArea textArea;
public static void main(String[] args) {
Server svr = new Server();
svr.doWork();
public void doWork() {
this.jframe = new JFrame("BT Server");
this.jframe.setLayout(new BorderLayout());
this.textArea = new JTextArea(6, 20);
JScrollPane jsp = new JScrollPane(this.textArea);
this.jframe.add(jsp, BorderLayout.CENTER);
this.jframe.pack();
this.jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.jframe.setVisible(true);
startServer();
public void logMessage(String message) {
this.textArea.setText(this.textArea.getText() + message + "\n");
this.textArea.setCaretPosition(this.textArea.getText().length());
public void startServer() {
LocalDevice local;
try {
local = LocalDevice.getLocalDevice();
local.setDiscoverable(DiscoveryAgent.GIAC);
this.logMessage("max of "
+ LocalDevice
.getProperty("bluetooth.connected.devices.max")
+ " connection(s) supported");
String url = "btspp://localhost:" + UUID_STRING + ";name="
+ SERVICE_NAME;
server = (StreamConnectionNotifier) Connector.open(url);
this.logMessage("waiting for connection...");
StreamConnection conn = server.acceptAndOpen();
this.logMessage("connection opened");
InputStream is = conn.openInputStream();
byte buffer[] = new byte[1000];
while (true) {
int numChars = is.read(buffer);
String s = new String(buffer);
logMessage("received from mobile phone: " + s.substring(0, numChars));
} catch (Exception e) {
this.logMessage(e.getMessage());
}You need to include the location of WTK as the kvem.home define. If its installed in c:\wtk22 (the default), start the server with the parameter -Dkvem.home="c:\wtk22". You also need to include these 3 libraries:
c:\wtk22\wtklib\gcf-op.jar
c:\wtk22\wtklib\kenv.zip
c:\wtk22\wtklib\kvem.jar
That's it for the server. My code of the sample client (the mobile phone, running in the WTK emulator) is messy (sorry about that -- still cleaning it up)!
import java.io.IOException;
import java.io.OutputStream;
import java.util.Enumeration;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;
import javax.bluetooth.BluetoothStateException;
import javax.bluetooth.DeviceClass;
import javax.bluetooth.DiscoveryAgent;
import javax.bluetooth.DiscoveryListener;
import javax.bluetooth.LocalDevice;
import javax.bluetooth.RemoteDevice;
import javax.bluetooth.ServiceRecord;
import javax.bluetooth.UUID;
import javax.microedition.io.Connector;
import javax.microedition.io.StreamConnection;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.StringItem;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class MainMIDlet extends MIDlet {
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
// TODO Auto-generated method stub
protected void pauseApp() {
// TODO Auto-generated method stub
protected void startApp() throws MIDletStateChangeException {
MainForm mainForm = new MainForm();
Display.getDisplay(this).setCurrent(mainForm);
mainForm.initializeDisplay();
class MainForm extends Form {
public static final String UUID_STRING = "A781FDBA229B486A8C21CEBD00000000";
private StringItem log;
private DiscoveryAgent agent;
Object lock = new Object();
static EndPoint currentEndPoint;
static Vector serviceRecords = new Vector();
public MainForm() {
super("BT Client");
public void initializeDisplay() {
this.log = new StringItem("", "");
this.append(this.log);
try {
LocalDevice local = LocalDevice.getLocalDevice();
agent = local.getDiscoveryAgent();
agent.startInquiry(DiscoveryAgent.GIAC, new Listener(this, agent));
} catch (BluetoothStateException e) {
this.logMessage(e.getMessage());
public void logMessage(String message) {
this.log.setText(this.log.getText() + message + "\n");
public void processServiceRecord(ServiceRecord sr) {
try {
String url = sr.getConnectionURL(
ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
logMessage("opening URL " + url);
StreamConnection conn = (StreamConnection) Connector.open(url);
OutputStream os = conn.openOutputStream();
String smessage = "test message from phone emulator";
os.write(smessage.getBytes());
} catch (IOException e) {
logMessage("error while processing service record: "
+ e.getMessage());
class Listener implements DiscoveryListener {
private MainForm mainForm;
private Vector pendingEndPoints;
private DiscoveryAgent agent;
public Listener(MainForm mainForm, DiscoveryAgent agent) {
this.mainForm = mainForm;
this.agent = agent;
this.pendingEndPoints = new Vector();
public void deviceDiscovered(RemoteDevice dev, DeviceClass deviceClass) {
this.mainForm.logMessage("found device");
this.pendingEndPoints.addElement(new EndPoint(dev));
public void inquiryCompleted(int arg0) {
this.mainForm.logMessage("done searching for devices");
for (Enumeration enm = this.pendingEndPoints.elements(); enm
.hasMoreElements();) {
EndPoint ep = (EndPoint) enm.nextElement();
ep.calculateRemoteName();
this.mainForm.logMessage("device name: " + ep.getRemoteName());
new Timer().schedule(new DoServiceDiscovery(), 100);
public void servicesDiscovered(int transID, ServiceRecord[] arg1) {
mainForm.logMessage("found " + arg1.length
+ " service(s) on device "
+ currentEndPoint.getRemoteName());
for (int i = 0; i < arg1.length; i++) {
serviceRecords.addElement(arg1);
public void serviceSearchCompleted(int arg0, int arg1) {
synchronized (lock) {
* unlock to proceed to service search on next device see
* DoServiceDiscovery.run()
lock.notifyAll();
mainForm.logMessage("done searching for services on "
+ currentEndPoint.getRemoteName());
* Inner class. Called a short time after the last device is found.
class DoServiceDiscovery extends TimerTask {
public void run() {
try {
UUID uuids[] = new UUID[2];
* ok, we are interesting in btspp services only and only
* known ones -- check for our UUID
uuids[0] = new UUID(0x1101);
uuids[1] = new UUID(MainForm.UUID_STRING, false);
for (Enumeration enm = pendingEndPoints.elements(); enm
.hasMoreElements();) {
EndPoint ep = (EndPoint) enm.nextElement();
mainForm.logMessage("searching for services on "
+ ep.getRemoteName());
currentEndPoint = ep;
ep.transId = agent.searchServices(null, uuids,
ep.remoteDev, new Listener(mainForm, agent));
synchronized (lock) {
try {
lock.wait();
} catch (InterruptedException e) {
// do nothing
mainForm.logMessage("exception while waiting: "
+ e.getMessage());
mainForm.logMessage("discovered all services; found "
+ serviceRecords.size() + " record(s)");
* assume we have just 1 service record
if (serviceRecords.size() > 0) {
processServiceRecord((ServiceRecord) serviceRecords
.elementAt(0));
} catch (Exception e) {
mainForm.logMessage("error during service discovery: "
+ e.getMessage());
class MiscUtils {
* Get the friendly name for a remote device. On the Nokia 6600, we're able
* to get the friendlyname while doing device discovery, but on the Nokia
* 6230i, an exception is thrown. On the 6230i, we get the friendly name
* only after all devices have been discovered -- when the callback
* inquiryCompleted is called.
* @param dev
* the device to examine
* @return a friendly name for the device, otherwise the IP address as a
* hex-string
public static String getDeviceName(RemoteDevice dev) {
String devName;
try {
devName = dev.getFriendlyName(false);
} catch (IOException e) {
devName = dev.getBluetoothAddress();
return devName;
public static EndPoint findEndPointByTransId(Vector endpoints, int id) {
for (int i = 0; i < endpoints.size(); i++) {
EndPoint endpt = (EndPoint) endpoints.elementAt(i);
if (endpt.getTransId() == id) {
return endpt;
return null; // not found, return null
class EndPoint {
// remote device object
RemoteDevice remoteDev;
// remote device class
DeviceClass remoteClass;
// remote service URL
String remoteUrl;
// service hosted on this device -- populated after searching for devices
ServiceRecord serviceRecord;
// bluetooth discovery transId, obtainsed from searchServices
int transId = -1; // -1 must be used for default. cannot use 0
// local user nick name
String localName;
// remote user nick name
String remoteName;
// vector of ChatPacket pending to be sent to remote service.
// when message is sent, it is removed from the vector.
Vector msgs = new Vector();
public EndPoint(RemoteDevice rdev) {
remoteDev = rdev;
* This functionality isn't called in the constructor because we cannot
* retrieve the friendly name while searching for devices on all phones. On
* some phones we have to wait until after devices have been discovered.
public void calculateRemoteName() {
this.remoteName = MiscUtils.getDeviceName(this.remoteDev);
public RemoteDevice getRemoteDev() {
return remoteDev;
public String getRemoteName() {
return remoteName;
public ServiceRecord getServiceRecord() {
return serviceRecord;
public void setServiceRecord(ServiceRecord serviceRecord) {
this.serviceRecord = serviceRecord;
public int getTransId() {
return transId;
...and that's it. Start the server, then the client (all on the same machine) and you've simulated bluetooth between the 2.
To get the server working with a real mobile, you'll need to use the BlueCove library instead of the 3 WTK jars (and can remove the kvem.home directive as well). The rest of the code should remain the same (haven't quite tested that yet!).
cheers
Manoj
null -
Bluetooth communication between J2SE server and J2ME client
Hi everyone!
I'm new here in this forum...
I try to make a small project to my studies,
My project will include J2SE server and J2ME client.
I'm stuck in the step of finding the server with the wireless toolkit emulator.
I found this issue in old subject: here
I try the solution in reply 6 but I don't understand exactly who to define kvem.home, and I got this error:
" You must define the system property "kvem.home" "
maybe someone can help me and explain how to do that?
thanks!Hello,
I want to find out how this can be done, too. I tried with
System.setProperty("kvem.home", "C:\\WTK2.5.2");but I get an error:
java.lang.UnsatisfiedLinkError: com.sun.kvem.jsr082.impl.bluetooth.BluetoothController.setSystemProperty(Ljava/lang/String;Ljava/lang/String;)I included these files in the build path:
c:\WTK2.5.2\wtklib\gcf-op.jar
c:\WTK2.5.2\wtklib\kenv.zip
c:\WTK2.5.2\wtklib\kvem.jar
and I import com.sun.kvem.bluetooth.*;
I'd appreciate any help. -
TS3274 not able to make Bluetooth connection between my Ipad and Iphone.
I am unable make Bluetooth connection between my Ipad3 and Iphone 4S.
You can't!
Alternativley you can use DropBox to send items over WiFi (free) or sync both with iTunes and drag & drop items in the Apps tab of each device.
<Edited By Host> -
Will Apple ever support Bluetooth transfer between iOS devices and android devices ?
Will Apple ever support Bluetooth transfer between iOS devices and android devices ?
Will the major Religions on earth ever get on together? These are questions that nobody here can help you with until or if it ever happens.
Cheers
Pete -
Difference between system copy and Remote Client copy?
Hi,
Can any body suggest me , What are the major difference between System copy and Remote Client Copy.
As per my knowledge , Both are different
1.In system copy entire data recovered mean copy from Source to target
2.In Remote client copy All Client data can't me import if you choose SAP_ALL profile also
I hope Transaction data and user data can't copied
Anybody share this Question and Give me some idea about this
If anybody give brief explanation that is very gratefull.
regards,
BalaramHi,
System copy will replicate all database from source to target system.
In remote copy only client in which you are performing the copy will get refresh. Also, remote client copy will be done between systems on same patch level. with SAP_ALL profile you can bring all data in target system including your transactional data.
Thanks
Sunny -
Mobile devlopment workstation and Mobile client install on same server
Hi,
Can we install Mobile development workstation and mobile client on same server?
I have already installed mobile development workstation , but when i try to install mobile client on same server it says that add,remove ,modify option install screen. It lis not allowing me to enter new screen.
Any idea.
- tomWhen you install the MD Workstation you are opted to choose among different applications i.e. mobile sales, mobile service, mobile system maintenance or authorization management tool. You can there choose the application to install besides the installation of the MD Workstation.
If you want to add application(s) later, you have to choose 'modify' and choose all parts for the MD Workstation plus the applications. If you omit options chosen before when doing the first installation then these will be removed. So be shure to choose ALL relevant things for the application as well as for the MD Workstation.
You can also generate the application from the installed repository, there are several notes on this subject available ('how to generate an application') which are referred to in about any installation guide or note changing the msa coding.
Regards Kai -
Bluetooth connection between iPhone 4 and MacBook Air
How to enable bluetooth connection between iPhone 4 and MacBook Air?
I used to be able to connect my iPhone 4 with my 3 yr old MacBook Pro using Bluetooth. I used my iPhone's personal hotspot more then once to access the Internet on my laptop when there was no wireless. I don't get why it wouldn't work with my new MacBook Air. That just seems silly. My laptop found my iPhone and was able to add the device, but then my iPhone wouldn't connect. Is there really no way around this??
-
Network bandwidth requirement between MDM server and MDM Clients
The MDM Sizing document for 5.5 states that 'a network connection between MDM Servers and MDM clients should be at least 100 Mbps'. Is this true? This would preclude MDM being offered as a hosted service. I'm interested in MDM Catalogue for SRM, so the catalogue content managers would need the import and data manager clients.
One factor I noticed, in our project...
I would recommend a 4 GB RAM for someone who is working with Import Manager.
As far as the Network connection goes, I am not sure what the requirements are.
We have faced several issues when the end user's laptop are less than 2 GB.
If someone is working with Image Manager, then I would recommend 4GB.
For bulk imports, I would use Import Server. -
What is the difference between E-Series and Commun...
Both E-series and Communicators are business phones,then what is the difference between them?
What is so special that there are two types of smartphones.Communcatiors is just a name that nokia used to describe it's larger fold open business phones.
The last (and still the current) communicator was the E90 which uses the S60 operating system, so it is both an E series and a communicator. It was also the first (and only) communicator to use S60.
The long discontinued communicators of the past used a different operating system, S80. S80 and S60 are not cross compatible with each other.
S80 was dropped in favour of S60 when the E90 launched. This was a cost saving exercise so that nokia only had one smartphone OS to concentrate resources on.
Message Edited by psychomania on 18-Aug-2009 03:12 PM -
7.1 Trial: Error during installation of Mindb and Mobile Client
We are using a barcode scanner running on Windows Mobile 5.0. When I use the SP03 trial to install the mobile client, I get the following information for every application besides the CreMe (the error is shown on the barcode scanner):
The program you have installed may not display properly because it was designed for a previous version of Windows Mobile Software.
How is this possible and what does this mean? These applications state that they are supported on Windows Mobile 5.0.
I continue anyway but when I try to start the Mobile Client I get a pop-up stating Creme is starting, then running, then nothing. I read it can take up to 2 minutes to load the client so I gave it 10 minutes with no result.
I have uninstalled and reinstalled multiple times (everything, Creme, mindb, mobile client) and it doesn't work. I am using Active Sync 4.5.
Any help is greatly appreciated.Thanks for the quick reply. It is a Creme error. I tried the licensed version from SAP first, then tried the 30 day copy and neither works. They both have the same errors.
See the jscpout.txt
NSIcom Ltd., CrEme(tm)
CrE-ME J2ME(tm)
CrE-ME V4.12 B142.190307 19-March-2007
MemoryLimit=64000Kb
EBCI(TM) Interpreter V1.00,
Copyright 1998-2002 by Bytecodes, Inc.
2008-05-15 09:20:11 ... Thread: com.sap.tc.mobile.cfs.startup.pda.Startup Error: Error creating initial tables -->
2008-05-15 09:20:11 ... Thread: com.sap.tc.mobile.cfs.startup.pda.Startup Error: Error dropping initial tables -->
2008-05-15 09:20:14 ... Thread: com.sap.tc.mobile.cfs.startup.pda.Startup Error: Insert sql executation failed -->
2008-05-15 09:20:14 ... Thread: com.sap.tc.mobile.cfs.startup.pda.Startup Error: Error storing model -->
2008-05-15 09:20:15 ... Thread: com.sap.tc.mobile.cfs.startup.pda.Startup Fatal: Cannot initialize framework -->
java.lang.IllegalArgumentException: Error storing model
at com.sap.tc.mobile.cfs.meta.conthandler.MetaDeployTimeUtils.storeModel()
at com.sap.tc.mobile.cfs.meta.conthandler.MetaDeployTimeUtils.deploySystemMBOs()
at com.sap.tc.mobile.cfs.init.FrameworkInitializer.init()
at com.sap.tc.mobile.cfs.startup.pda.Startup.main()
Error starting the framework
java.lang.reflect.InvocationTargetException: java.lang.IllegalStateException: Cannot initialize framework
at com.sap.tc.mobile.cfs.init.FrameworkInitializer.init()
at com.sap.tc.mobile.cfs.startup.pda.Startup.main()
CrEme jsPexit() called with status=1
Sorry for the bad formatting. Any help is appreciated! -
Conncet between form 9i and device client
I want to know about method for conncet between form9i and device client.
Device client example is scanner machine.
Please tell me (If it is example that is good)
thankyou
(my english language is not good ^_^ )Tao,
this is only possible with a signed JavaBean that you run in a Forms Bean container.
Frank -
Difference between L Series and M series T Codes-Warehouse management
Hi all,
Will some body tell me the difference between the T Codes related to stock verification starts with "M" series and "L" series in the warehouse management. Which series codes are better for making physical verification in warehouse management.
In our company we are having warehouse management system and we are following "L" series codes for physical verification.
Thanks & Regards
Prasun jainIf you want to perform physical inventory on a storage location that has a warehouse assigned to it, you will have to use LI* transactions. The system will not allow you to use MI* transactions on those storage locations.
Regards,
Aroop -
Relationship between logical system and a client
Hi,
Our internal notes say that, in order to create a new client, I must do the following:
1. Create a logical system using BD54. The client name must be SID + "CLNT" + number. In my case, this would be NSPCLNT100.
2. Create a client using SCC4.
Questions:
1. What is the relationship between the client and the logical system?
2. How does SAP know that client number 100 must be related to NSPCLNT100? I am not specifying this relationship anywhere.
Thank you in advance for your help.
Regards,
Peteryou assing logical system to a client from SCC4
-
Diff between Java,Window and HTML Clients
Hi can any body clear me
what is the difference between
1. JAVA Client
2. Windows Client
3. HTML Client.
regards
mmukeshThe Windows client requires SAPGUI for Windows loaded on the dekstop (400+ MB of disk), but it works most efficiently.
The HTML client requires an ITS and is not as efficient, but need no specialized software on the desktop.
The Java client is almost never used except by Mac and Unix users!
Cheers
try searching SDN for SAPGUI variants for more details
Maybe you are looking for
-
WICTMS not picking up wip_move_txn_interface records
I am populating the wip_move_txn_interface table with a move record. The WIP Move Transaction Manager (WICTMS) is running every 5 minutes. But my record in the table is not getting processed. 3 days ago it was working, and the WICTMS pgm was recog
-
Hi Everyone, I have tried all the solutions mentioned by apple and still have a white screen with a blinking file folder with a question mark in the center, anyone have any ideas or experienced this?
-
Item Purchase Requisition Block
For cash-relevant sales order line items that are assigned a u201Cdirect from vendoru201D item category and the deposit paid < 100% of the total line item value, then automatically set the purchase requisition block should be applied. For the above
-
Current Flash Version listed Does not Match What gets downloaded
I saw that Adobe Flash 16.0.0.287 is available here: http://www.adobe.com/products/flashplayer/distribution3.html The version I downloaded is still 16.0.0.257 Please fix! Thanks.
-
Creating spool before displaying output
Hi, I want to create spool while executing the program in online ( NOT IN BACKGROUND OR BACTCH JOB) and before displaying out put ( list ). Means before writing or displaying the output from final internal table. I want create a spool for final inter