platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java in rhodes-3.1.0.beta.3 vs platform/android/Rhodes/src/com/rhomobile/rhodes/bluetooth/RhoBluetoothManagerNew.java in rhodes-3.1.0.beta.4
- old
+ new
@@ -212,21 +212,21 @@
RhoBluetoothManager.logi(TAG, "onSessionConnectedOK()");
//mInput.setLength(0);
mInputBufferSize = 0;
PerformOnUiThread.exec( new Runnable() {
public void run() {
- fireCreateSessionCallback(RhoBluetoothManager.BTC_OK, mConnectedDeviceName);
+ fireCreateSessionCallback(RhoBluetoothManager.BTC_OK_STRING, mConnectedDeviceName);
}
});
}
public void onSessionDisconnected() {
RhoBluetoothManager.logi(TAG, "onSessionDisconnected()");
PerformOnUiThread.exec( new Runnable() {
public void run() {
if (sharedInstance().getSession().getCallbackURL() == null) {
- fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR, "");
+ fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
}
else {
fireSessionCallback(mConnectedDeviceName, RhoBluetoothSession.BT_SESSION_DISCONNECT);
}
}
@@ -308,11 +308,11 @@
RhoBluetoothManager.logi(TAG, "BT not enabled");
//Toast.makeText(this, R.string.bt_not_enabled_leaving, Toast.LENGTH_SHORT).show();
//finish();
PerformOnUiThread.exec( new Runnable() {
public void run() {
- fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR, "");
+ fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
}
});
}
}
}
@@ -339,11 +339,11 @@
//mActivity.startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE);
RhodesService.getInstance().startActivity(serverIntent);
}
else {
RhoBluetoothManager.logi(TAG, " mBluetoothAdapter == null");
- sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR, "");
+ sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
}
}
});
}
@@ -366,11 +366,11 @@
RhoBluetoothManager.logi(TAG, " mBluetoothAdapter.getScanMode() == BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE");
}
}
else {
RhoBluetoothManager.logi(TAG, " mBluetoothAdapter == null");
- sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR, "");
+ sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
}
}
});
}
@@ -398,16 +398,16 @@
if (!mBluetoothIsEnabled) return "bluetooth is not worked";
RhoBluetoothManager.logi(TAG, "get_device_name() : "+sharedInstance().mDeviceName);
return sharedInstance().mDeviceName;
}
- public String get_last_error() {
+ public int get_last_error() {
if (!mBluetoothIsEnabled) return RhoBluetoothManager.BTC_ERROR;
return RhoBluetoothManager.BTC_OK;
}
- public String create_session(String role, String callback_url) {
+ public int create_session(String role, String callback_url) {
if (!mBluetoothIsEnabled) return RhoBluetoothManager.BTC_ERROR;
RhoBluetoothManager.logi(TAG, "create_session("+role+", "+callback_url+");");
sharedInstance().mCreateSessionCallback = callback_url;
//sharedInstance().mRole = role;
@@ -467,11 +467,11 @@
//if (sharedInstance().mInputStringsArrayAdapter.isEmpty()) {
return sharedInstance().mInputBufferSize;//mInput.length();
}
public String session_read_string(String connected_device_name) {
- if (!mBluetoothIsEnabled) return RhoBluetoothManager.BTC_ERROR;
+ if (!mBluetoothIsEnabled) return RhoBluetoothManager.BTC_ERROR_STRING;
RhoBluetoothManager.logi(TAG, "session_read_string");
//String t = sharedInstance().mInput.toString();
//sharedInstance().mInput.setLength(0);
String t = null;
synchronized (mInputBuffer) {
@@ -574,10 +574,10 @@
return;
}
}
}
}
- sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR, "");
+ sharedInstance().fireCreateSessionCallback(RhoBluetoothManager.BTC_ERROR_STRING, "");
}
});
}
public void stop_current_connection_process() {