السلام عليكم جميعا ..............
اعمل على برنامج للتحكم بالكمبيوتر وقمت بكتابة الكود الذى يرسل قيم عن طريق البلوتوث من الموبايل , ولكن المشكلة هى انه فى الكمبيوتر يعمل بصورة جيدة ولكن عند نقله الى جهاز الموبايل (6600) فانه وبمجرد الوصول الى الكود الذى يتعامل مع البلوتوث فان البرنامج يدخل فى حالة عدم استجابة , ولا اعرف السبب , على كل الكود الذى تحدث عنده الاشكالية هو كالاتى : __
try {
LocalDevice local = LocalDevice.getLocalDevice();
DiscoveryAgent agent = local.getDiscoveryAgent();
String address = local.getBluetoothAddress();
String name = local.getFriendlyName();
String connString = agent.selectService(
new UUID("86b4d249fb8844d6a756ec265dd1f6a3", false),
ServiceRecord.NOAUTHENTICATE_NOENCRYPT, false);
if (connString != null) {
try {
StreamConnection conn = (StreamConnection)
Connector.open(connString);
OutputStream out = conn.openOutputStream();
if (x==1) out.write("log on".getBytes());
else
if (x== 2) out.write("log off".getBytes());
else
if (x== 3) out.write("restart".getBytes());
else
if (x == 4) out.write("shutdown".getBytes());
else
if (x == 5) out.write("mediaplayer".getBytes());
out.close();
conn.close();
form2.append("Massege sent correctly");
} catch (IOException e) {
form2.append("IO Exception ");
form2.append(e.getMessage());
}
} else {
// Unable to locate a service so just print an error
// message on the screen
form2.append("Unable to locate a service");
}
} catch (BluetoothStateException e) {
form2.append("BluetoothStateException: ");
form2.append(e.getMessage());
}بالمناسبة هل توجد طريقة لتجربة برامج البلوتوث على الكمبيوتر قبل انزالها الى الموبايل ؟