use of com.tvd12.ezyfox.entity.EzyArray in project ezyfox-server-android-client by youngmonkeys.
the class EzyTcpClient method send.
@Override
public void send(EzyRequest request, boolean encrypted) {
Object cmd = request.getCommand();
EzyData data = request.serialize();
send((EzyCommand) cmd, (EzyArray) data, encrypted);
}
use of com.tvd12.ezyfox.entity.EzyArray in project ezyfox-server-android-client by youngmonkeys.
the class EzyAppResponseHandler method handle.
@Override
public void handle(EzyArray data) {
int appId = data.get(0, int.class);
EzyArray commandData = data.get(1, EzyArray.class);
String cmd = commandData.get(0, String.class);
EzyData responseData = commandData.get(1, EzyData.class, null);
EzyApp app = client.getAppById(appId);
if (app == null) {
EzyLogger.info("receive message when has not joined app yet");
return;
}
EzyAppDataHandler dataHandler = app.getDataHandler(cmd);
if (dataHandler != null)
dataHandler.handle(app, responseData);
else
EzyLogger.warn("app: " + app.getName() + " has no handler for command: " + cmd);
}
use of com.tvd12.ezyfox.entity.EzyArray in project ezyfox-server-android-client by youngmonkeys.
the class EzyLoginSuccessHandler method handle.
@Override
public void handle(EzyArray data) {
EzyData responseData = data.get(4, EzyData.class);
EzyUser user = newUser(data);
EzyZone zone = newZone(data);
((EzyMeAware) client).setMe(user);
((EzyZoneAware) client).setZone(zone);
handleLoginSuccess(responseData);
EzyLogger.debug("user: " + user + " logged in successfully");
}
use of com.tvd12.ezyfox.entity.EzyArray in project ezyfox-server-android-client by youngmonkeys.
the class EzyLoginSuccessHandler method newUser.
protected EzyUser newUser(EzyArray data) {
long userId = data.get(2, long.class);
String username = data.get(3, String.class);
EzySimpleUser user = new EzySimpleUser(userId, username);
return user;
}
use of com.tvd12.ezyfox.entity.EzyArray in project ezyfox-server-android-client by youngmonkeys.
the class EzyLoginSuccessHandler method newZone.
protected EzyZone newZone(EzyArray data) {
int zoneId = data.get(0, int.class);
String zoneName = data.get(1, String.class);
EzySimpleZone zone = new EzySimpleZone(client, zoneId, zoneName);
return zone;
}
Aggregations