Permalink
Browse files

updating bbb-java to use the api return codes, and some modifications…

… on bbb-android related to that
  • Loading branch information...
1 parent d781d0f commit 4fe7eda4996e8152c1c199de80db72536400f8c4 @alexandrekreis alexandrekreis committed Mar 29, 2012
@@ -47,6 +47,7 @@
import org.mconf.bbb.BigBlueButtonClient.OnParticipantStatusChangeListener;
import org.mconf.bbb.BigBlueButtonClient.OnPrivateChatMessageListener;
import org.mconf.bbb.BigBlueButtonClient.OnPublicChatMessageListener;
+import org.mconf.bbb.api.JoinServiceBase;
import org.mconf.bbb.chat.ChatMessage;
import org.mconf.bbb.listeners.IListener;
import org.mconf.bbb.listeners.Listener;
@@ -354,7 +355,7 @@ private boolean joinAndConnect() {
return false;
}
- if (!getBigBlueButton().getJoinService().join(meetingId, username, moderator)) {
+ if (getBigBlueButton().getJoinService().join(meetingId, username, moderator) != JoinServiceBase.E_OK) { //.
if (getBigBlueButton().getJoinService().getJoinedMeeting() != null) {
String error = getBigBlueButton().getJoinService().getJoinedMeeting().getMessage();
log.debug("Joining error message: " + error);
@@ -18,4 +18,11 @@
<string name="choose_a_server_to_login">Escolha um servidor para conectar</string>
<string name="server_password">Digite a senha do servidor</string>
<string name="change_password">Mude a senha do servidor</string>
+
+ <string name="failed_to_connect">Falha ao conectar</string>
+
+ <string name="checksum_error">Senha inválida para esse servidor</string>
+ <string name="empty_security_key">Contate o administrador - O suporte ao mobile está temporiariamente desabilitado</string>
+ <string name="mobile_not_supported">O servidor não dá suporte ao serviço mobile</string>
+ <string name="server_unreachable">Não foi possível conectar ao servidor</string>
</resources>
@@ -18,4 +18,11 @@
<string name="choose_a_server_to_login">Choose a server to login</string>
<string name="server_password">Type the server password</string>
<string name="change_password">Change the server password</string>
+
+ <string name="failed_to_connect">Failed to connect</string>
+
+ <string name="checksum_error">Invalid password for this server</string>
+ <string name="empty_security_key">Contact the administrator - The mobile support is temporary disabled</string>
+ <string name="mobile_not_supported">The server does not support mobile service</string>
+ <string name="server_unreachable">Could not connect the server</string>
</resources>
@@ -66,21 +66,33 @@
import android.widget.RadioGroup.OnCheckedChangeListener;
//page where the user chooses the room, the name, and connects to a conference
public class LoginPage extends BigBlueButtonActivity {
+
+ private final int E_OK = 0;
+ //private final int E_CHECKSUM_NOT_INFORMED = 1;
+ private final int E_INVALID_CHECKSUM = 2;
+ //private final int E_INVALID_TIMESTAMP = 3;
+ private final int E_EMPTY_SECURITY_KEY = 4;
+ //private final int E_MISSING_PARAM_MEETINGID = 5;
+ //private final int E_MISSING_PARAM_FULLNAME = 6;
+ //private final int E_MISSING_PARAM_PASSWORD = 7;
+ //private final int E_MISSING_PARAM_TIMESTAMP = 8;
+ //private final int E_INVALID_URL = 9;
+ //private final int E_SERVER_UNREACHABLE = 10;
+ private final int E_MOBILE_NOT_SUPPORTED = 11;
+ //public static final int E_UNKNOWN_ERROR = 12;
private static final Logger log = LoggerFactory.getLogger(LoginPage.class);
public static final String SERVER_CHOSED ="org.mconf.bbb.android.Client.SERVER_CHOSED";
public static final int MENU_QR_CODE = Menu.FIRST;
public static final int MENU_ABOUT = Menu.FIRST + 1;
-
- private static final int TIMESTAMP_FAILED = -1;
private ArrayAdapter<String> spinnerAdapter;
private boolean moderator;
private String username = "Android";
private String serverUrl = "";
private String serverPassword = "";
- private String createdMeeting = "";
+ private String createdMeeting = "";
BroadcastReceiver serverChosed = new BroadcastReceiver(){
public void onReceive(Context context, Intent intent)
@@ -160,7 +172,7 @@ public void onItemSelected(AdapterView<?> parent, View view,
public void onClick(DialogInterface dialog, int which) {
createdMeeting = input.getText().toString().trim();
- if (!getBigBlueButton().getJoinService().createMeeting(createdMeeting)) {
+ if (getBigBlueButton().getJoinService().createMeeting(createdMeeting) != E_OK) { //.
AlertDialog.Builder builder = new AlertDialog.Builder(LoginPage.this);
builder.setCancelable(false)
.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() {
@@ -296,19 +308,63 @@ private void updateMeetingsList() {
final Handler h = new Handler() {
- @Override
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case TIMESTAMP_FAILED:
- showTimestampFailedDialog();
-
- }
+ @Override
+ public void handleMessage(Message msg) {
+ showTimestampFailedDialog(setCorrectMsg(msg.what));
}
+
+ private String setCorrectMsg(int errorCode)
+ {
+ String message= getString(R.string.server_unreachable);
+ switch(errorCode)
+ {
+ case E_INVALID_CHECKSUM:
+ message = getString(R.string.checksum_error);
+ break;
+
+ case E_EMPTY_SECURITY_KEY:
+ message = getString(R.string.empty_security_key);
+ break;
+
+ case E_MOBILE_NOT_SUPPORTED:
+ message = getString(R.string.mobile_not_supported);
+ break;
+
+// case E_CHECKSUM_NOT_INFORMED:
+// //message =
+// break;
+//
+// case E_INVALID_TIMESTAMP:
+// //message =
+// break;
+//
+// case E_MISSING_PARAM_MEETINGID:
+// //message =
+// break;
+//
+// case E_MISSING_PARAM_FULLNAME:
+// //message =
+// break;
+//
+// case E_MISSING_PARAM_PASSWORD:
+// //message =
+// break;
+//
+// case E_MISSING_PARAM_TIMESTAMP:
+// //message =
+// break;
+//
+// case E_INVALID_URL:
+// //message =
+// break;
+ }
+ return message;
+ }
};
final Thread updateThread = new Thread(new Runnable() {
@Override
- public void run() {
+ public void run() { //.
getBigBlueButton().createJoinService(serverUrl, serverPassword);
@@ -318,13 +374,16 @@ public void run() {
return;
}
- if(!getBigBlueButton().getJoinService().load())
+ int returnCode = getBigBlueButton().getJoinService().load();
+
+ if(returnCode != E_OK)
{
log.debug("timestamp failed on android");
if (progressDialog.isShowing())
progressDialog.dismiss();
- h.sendEmptyMessage(TIMESTAMP_FAILED);
+
+ h.sendEmptyMessage(returnCode);
return;
}
@@ -426,11 +485,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent intent)
}
}
- private void showTimestampFailedDialog()
+ private void showTimestampFailedDialog(String message)
{
AlertDialog.Builder timestampFailed = new AlertDialog.Builder(LoginPage.this);
- timestampFailed.setTitle("Failed to connect");
- timestampFailed.setMessage("Failed to connect - Did you enter the correct password for this server?");
+ timestampFailed.setTitle(R.string.failed_to_connect);
+ timestampFailed.setMessage(message);
timestampFailed.setNeutralButton(R.string.ok, null);
timestampFailed.show();
}

0 comments on commit 4fe7eda

Please sign in to comment.