Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrote services to use new message system #29

Merged
Diff settings

Always

Just for now

@@ -6,8 +6,6 @@ package org.bigbluebutton
import org.bigbluebutton.command.ConnectSignal;
import org.bigbluebutton.command.DisconnectUserCommand;
import org.bigbluebutton.command.DisconnectUserSignal;
import org.bigbluebutton.command.LoadPresentationCommand;
import org.bigbluebutton.command.LoadPresentationSignal;
import org.bigbluebutton.command.LoadSlideCommand;
import org.bigbluebutton.command.LoadSlideSignal;
import org.bigbluebutton.command.ShareCameraCommand;
@@ -16,36 +14,20 @@ package org.bigbluebutton
import org.bigbluebutton.command.ShareMicrophoneSignal;
import org.bigbluebutton.core.BaseConnection;
import org.bigbluebutton.core.BigBlueButtonConnection;
import org.bigbluebutton.core.ChatMessageReceiver;
import org.bigbluebutton.core.ChatMessageSender;
import org.bigbluebutton.core.ChatMessageService;
import org.bigbluebutton.core.DeskshareConnection;
import org.bigbluebutton.core.DeskshareService;
import org.bigbluebutton.core.DeskshareServiceSO;
import org.bigbluebutton.core.IBaseConnection;
import org.bigbluebutton.core.IBigBlueButtonConnection;
import org.bigbluebutton.core.IChatMessageReceiver;
import org.bigbluebutton.core.IChatMessageSender;
import org.bigbluebutton.core.IChatMessageService;
import org.bigbluebutton.core.IDeskshareConnection;
import org.bigbluebutton.core.IDeskshareService;
import org.bigbluebutton.core.IDeskshareServiceSO;
import org.bigbluebutton.core.IListenersServiceSO;
import org.bigbluebutton.core.ILoginService;
import org.bigbluebutton.core.IPresentMessageReceiver;
import org.bigbluebutton.core.IPresentServiceSO;
import org.bigbluebutton.core.IPresentationService;
import org.bigbluebutton.core.IUsersService;
import org.bigbluebutton.core.IUsersServiceSO;
import org.bigbluebutton.core.IVideoConnection;
import org.bigbluebutton.core.UsersService;
import org.bigbluebutton.core.IPresentationService;
import org.bigbluebutton.core.IVoiceConnection;
import org.bigbluebutton.core.ListenersServiceSO;
import org.bigbluebutton.core.IVideoConnection;
import org.bigbluebutton.core.LoginService;
import org.bigbluebutton.core.PresentMessageReceiver;
import org.bigbluebutton.core.PresentServiceSO;
import org.bigbluebutton.core.PresentationService;
import org.bigbluebutton.core.UsersService;
import org.bigbluebutton.core.UsersServiceSO;
import org.bigbluebutton.core.VideoConnection;
import org.bigbluebutton.core.VoiceConnection;
import org.bigbluebutton.model.ConferenceParameters;
@@ -56,6 +38,8 @@ package org.bigbluebutton
import org.bigbluebutton.model.UserUISession;
import org.bigbluebutton.model.chat.ChatMessagesSession;
import org.bigbluebutton.model.chat.IChatMessagesSession;



import robotlegs.bender.extensions.signalCommandMap.api.ISignalCommandMap;
import robotlegs.bender.framework.api.IConfig;
@@ -77,30 +61,21 @@ package org.bigbluebutton
injector.map(IConferenceParameters).toSingleton(ConferenceParameters);
injector.map(IUsersService).toSingleton(UsersService);
injector.map(IChatMessageService).toSingleton(ChatMessageService);
injector.map(IChatMessageReceiver).toSingleton(ChatMessageReceiver);
injector.map(IChatMessageSender).toSingleton(ChatMessageSender);
injector.map(IPresentationService).toSingleton(PresentationService);
injector.map(IPresentMessageReceiver).toSingleton(PresentMessageReceiver);
injector.map(IChatMessagesSession).toSingleton(ChatMessagesSession);
injector.map(IDeskshareConnection).toSingleton(DeskshareConnection);
injector.map(IDeskshareService).toSingleton(DeskshareService);

// Type mapping
injector.map(IBaseConnection).toType(BaseConnection);
injector.map(IVoiceConnection).toType(VoiceConnection);
injector.map(ILoginService).toType(LoginService);
injector.map(IUsersServiceSO).toType(UsersServiceSO);
injector.map(IListenersServiceSO).toType(ListenersServiceSO);
injector.map(IPresentServiceSO).toType(PresentServiceSO);
injector.map(IDeskshareServiceSO).toType(DeskshareServiceSO);
injector.map(IBigBlueButtonConnection).toType(BigBlueButtonConnection);
injector.map(IVideoConnection).toType(VideoConnection);

// Signal to Command mapping
signalCommandMap.map(ConnectSignal).toCommand(ConnectCommand);
signalCommandMap.map(ShareMicrophoneSignal).toCommand(ShareMicrophoneCommand);
signalCommandMap.map(ShareCameraSignal).toCommand(ShareCameraCommand);
signalCommandMap.map(LoadPresentationSignal).toCommand(LoadPresentationCommand);
signalCommandMap.map(LoadSlideSignal).toCommand(LoadSlideCommand);
signalCommandMap.map(CameraQualitySignal).toCommand(CameraQualityCommand);
signalCommandMap.map(DisconnectUserSignal).toCommand(DisconnectUserCommand);
@@ -8,7 +8,6 @@ package org.bigbluebutton.command
import org.bigbluebutton.core.IBigBlueButtonConnection;
import org.bigbluebutton.core.IChatMessageService;
import org.bigbluebutton.core.IDeskshareConnection;
import org.bigbluebutton.core.IDeskshareService;
import org.bigbluebutton.core.IPresentationService;
import org.bigbluebutton.core.IUsersService;
import org.bigbluebutton.core.IVideoConnection;
@@ -56,9 +55,6 @@ package org.bigbluebutton.command
[Inject]
public var presentationService: IPresentationService;

[Inject]
public var deskshareService: IDeskshareService;

override public function execute():void {
connection.uri = uri;

@@ -68,51 +64,73 @@ package org.bigbluebutton.command
connection.connect(conferenceParameters);
}

private function successConnected():void {
private function successConnected():void {
Log.getLogger("org.bigbluebutton").info(String(this) + ":successConnected()");

userSession.mainConnection = connection;
userSession.userId = connection.userId;

usersService.connectUsers(uri);
// Set up users message sender in order to send the "joinMeeting" message:
usersService.setupMessageSenderReceiver();

// Send the join meeting message, then wait for the reponse
userSession.successJoiningMeetingSignal.add(successJoiningMeeting);
userSession.unsuccessJoiningMeetingSignal.add(unsuccessJoiningMeeting);

usersService.sendJoinMeetingMessage();

connection.successConnected.remove(successConnected);
connection.unsuccessConnected.remove(unsuccessConnected);
}

private function successJoiningMeeting():void {

// Set up remaining message sender and receivers:
chatService.setupMessageSenderReceiver();
presentationService.setupMessageSenderReceiver();

// set up and connect the remaining connections
videoConnection.uri = userSession.config.getConfigFor("VideoConfModule").@uri + "/" + conferenceParameters.room;

//TODO use proper callbacks
//TODO see if videoConnection.successConnected is dispatched when it's connected properly
videoConnection.successConnected.add(successVideoConnected);
videoConnection.unsuccessConnected.add(unsuccessVideoConnected);

videoConnection.connect();

userSession.videoConnection = videoConnection;

voiceConnection.uri = userSession.config.getConfigFor("PhoneModule").@uri;
userSession.voiceConnection = voiceConnection;

usersService.connectListeners(uri);

deskshareConnection.applicationURI = userSession.config.getConfigFor("DeskShareModule").@uri;
deskshareConnection.room = conferenceParameters.room;
deskshareConnection.connect();

userSession.deskshareConnection = deskshareConnection;
deskshareService.connectDeskshareSO();
deskshareService.checkIfStreamIsPublishing(conferenceParameters.room);

userSession.deskshareConnection = deskshareConnection;

// Query the server for chat, users, and presentation info
chatService.sendWelcomeMessage();
chatService.getPublicChatMessages();

presentationService.getPresentationInfo();

userSession.userList.allUsersAddedSignal.add(successUsersAdded);
usersService.queryForParticipants();
usersService.queryForRecordingStatus();

presentationService.connectPresent(uri);
userSession.successJoiningMeetingSignal.remove(successJoiningMeeting);
userSession.unsuccessJoiningMeetingSignal.remove(unsuccessJoiningMeeting);
usersService.getRoomLockState();
}

private function unsuccessJoiningMeeting():void {
trace("ConnectCommand::unsuccessJoiningMeeting() -- Failed to join the meeting!!!");

connection.successConnected.remove(successConnected);
connection.unsuccessConnected.remove(unsuccessConnected);
userSession.successJoiningMeetingSignal.remove(successJoiningMeeting);
userSession.unsuccessJoiningMeetingSignal.remove(unsuccessJoiningMeeting);
}

/**
* Raised when we receive signal from UserServiceSO.as that all participants were added.
* Now we can switch from loading screen to participants screen
*/
private function successUsersAdded():void
{
userUISession.loading = false;

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -1,11 +1,15 @@
package org.bigbluebutton.command
{
import org.bigbluebutton.core.IUsersService;
import org.bigbluebutton.model.IUserSession;

import robotlegs.bender.bundles.mvcs.Command;

public class RaiseHandCommand extends Command
{
[Inject]
public var userSession: IUserSession;

[Inject]
public var userService: IUsersService;

@@ -17,8 +21,15 @@ package org.bigbluebutton.command

override public function execute():void
{
trace("RaiseHandCommand.execute() - handRaised = " + raised);
userService.raiseHand(userId, raised);
if(raised) {
trace("RaiseHandCommand.execute() - handRaised");
userService.raiseHand();
}
else {
trace("RaiseHandCommand.execute() - hand lowered for user " + userId + " by user " + userId);
userService.lowerHand(userId, userSession.userId);
}

}
}
}
@@ -20,7 +20,7 @@ package org.bigbluebutton.core
{
[Inject]
public var disconnectUserSignal:DisconnectUserSignal;

public static const NAME:String = "BaseConnection";

protected var _successConnected:ISignal = new Signal();
@@ -29,7 +29,7 @@ package org.bigbluebutton.core
protected var _netConnection:NetConnection;
protected var _uri:String;
protected var _onUserCommand:Boolean;

public function BaseConnection() {
Log.getLogger("org.bigbluebutton").info(String(this));
}
@@ -60,8 +60,16 @@ package org.bigbluebutton.core

public function connect(uri:String, ...parameters):void {
_uri = uri;

// The connect call needs to be done properly. At the moment lock settings
// are not implemented in the mobile client, so parameters[7] and parameters[8]
// are "faked" in order to connect (without them, I couldn't get the connect
// call to work...) - Adam
parameters[7] = false;
parameters[8] = false;

try {
trace("Connecting to " + uri + "[" + parameters + "]");
trace("Trying to connect to [" + uri + "] ...");
// passing an array to a method that expects a variable number of parameters
// http://stackoverflow.com/a/3852920
_netConnection.connect.apply(null, new Array(uri).concat(parameters));
@@ -130,7 +138,7 @@ package org.bigbluebutton.core
break;
}
}

protected function sendConnectionSuccessEvent():void
{
successConnected.dispatch();
@@ -161,15 +169,15 @@ package org.bigbluebutton.core
}

public function sendMessage(service:String, onSuccess:Function, onFailure:Function, message:Object=null):void {
trace("SENDING [" + service + "]");
trace("SENDING MESSAGE: [" + service + "]");
var responder:Responder = new Responder(
function(result:Object):void { // On successful result
onSuccess("Successfully sent [" + service + "].");
onSuccess("SUCCESSFULLY SENT: [" + service + "].");
},
function(status:Object):void { // status - On error occurred
var errorReason:String = "Failed to send [" + service + "]:\n";
var errorReason:String = "FAILED TO SEND: [" + service + "]:";
for (var x:Object in status) {
errorReason += "\t" + x + " : " + status[x];
errorReason += "\n - " + x + " : " + status[x];
}
onFailure(errorReason);
}
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.