fermi-web-socket-bridge.js 3.52 KB
Newer Older
Kim Peace committed
1 2 3 4
var FermiWebSocketBridge = {};

// call from modal_collabo_profile.html
FermiWebSocketBridge.requestHostChange = function (loginID) {
Kim Peace committed
5 6 7
  console.log(
    "peacekim:: FermiWebSocketBridge.requestHostChange loginID: " + loginID
  );
Kim Peace committed
8
  fw.sendToMsg("others", "HOST_CHANGE_REQUEST", {
9
    loginId: loginID,
Kim Peace committed
10 11 12 13
  });
};

FermiWebSocketBridge.shareFileHost = function (collaborationType) {
Kim Peace committed
14 15 16 17
  console.log(
    "peacekim:: FermiWebSocketBridge.shareFileHost collaborationType: " +
      collaborationType
  );
Kim Peace committed
18 19 20 21 22 23
  fw.sendToMsg("others", "SHARE_FILE_HOST", {
    collaborationType: collaborationType,
  });
};

FermiWebSocketBridge.hostChangeResponse = function () {
Kim Peace committed
24
  console.log("peacekim:: FermiWebSocketBridge.hostChangeResponse");
Kim Peace committed
25 26
  fw.sendToMsg("others", "HOST_CHANGE_RESPONSE", {
    isAndroid: deviceInfo.isAndroid(),
27
    isAble: deviceInfo.androidVersion >= ANDROID_SDK_VERSION.O,
28
    loginId: globalUserInfo.loginId,
Kim Peace committed
29 30 31 32 33
  });
};

// PIP_END_REQUEST
FermiWebSocketBridge.pipEndRequest = function (loginID) {
Kim Peace committed
34 35 36
  console.log(
    "peacekim:: FermiWebSocketBridge.pipEndRequest loginID: " + loginID
  );
Kim Peace committed
37
  fw.sendToMsg("others", "PIP_END_REQUEST", {
38
    loginId: loginID,
Kim Peace committed
39 40 41 42 43
  });
};

// HOST_REQUEST_REJECT
FermiWebSocketBridge.hostRequestReject = function (hostID) {
Kim Peace committed
44 45 46
  console.log(
    "peacekim:: FermiWebSocketBridge.hostRequestReject hostID: " + hostID
  );
Kim Peace committed
47 48 49 50 51 52 53
  fw.sendToMsg("others", "HOST_REQUEST_REJECT", {
    hostId: hostID,
  });
};

// HOST_REQUEST_DONE
FermiWebSocketBridge.hostRequestDone = function (hostID) {
Kim Peace committed
54 55 56
  console.log(
    "peacekim:: FermiWebSocketBridge.hostRequestDone hostID: " + hostID
  );
Kim Peace committed
57 58 59 60 61 62 63
  fw.sendToMsg("others", "HOST_REQUEST_DONE", {
    hostId: hostID,
  });
};

// GET_COLLABORATION_TYPE_RESPONSE
FermiWebSocketBridge.getCollaborationTypeResponse = function (loginID) {
64
  let meetingID = globalUserInfo.meetingID ?? 0;
65

Kim Peace committed
66 67 68 69 70 71
  console.log(
    "peacekim:: FermiWebSocketBridge.getCollaborationTypeResponse hostID: " +
      loginID +
      ", meetingID: " +
      meetingID
  );
72
  
Kim Peace committed
73 74
  fw.sendToMsg("others", "GET_COLLABORATION_TYPE_RESPONSE", {
    loginId: loginID,
75
    collaborationType: globalUserInfo.collaborationType,
Kim Peace committed
76 77 78 79 80 81
    newMeetingId: meetingID,
  });
};

// GET_COLLABORATION_TYPE
FermiWebSocketBridge.getCollaborationType = function () {
Kim Peace committed
82 83 84 85
  console.log(
    "peacekim:: FermiWebSocketBridge.getCollaborationType globalUserInfo.loginId: " +
      globalUserInfo.loginId
  );
Kim Peace committed
86 87 88 89 90 91 92
  fw.sendToMsg("others", "GET_COLLABORATION_TYPE", {
    loginId: globalUserInfo.loginId,
  });
};

// CAPTURE_REQUEST
FermiWebSocketBridge.captureRequest = function () {
Kim Peace committed
93 94 95 96 97
  console.log(
    "peacekim:: FermiWebSocketBridge.captureRequest globalUserInfo.loginId: " +
      globalUserInfo.loginId
  );

Kim Peace committed
98
  fw.sendToMsg("others", "CAPTURE_REQUEST", {
99
    name: globalUserInfo.loginId,
Kim Peace committed
100 101 102 103 104 105 106 107
  });
};

// CHANGE_COLLABORATION
FermiWebSocketBridge.changeCollaboration = function (
  collaborationType,
  newMeetingID
) {
Kim Peace committed
108 109 110 111 112 113
  console.log(
    "peacekim:: FermiWebSocketBridge.changeCollaboration collaborationType: " +
      collaborationType +
      ", newMeetingID: " +
      newMeetingID
  );
Kim Peace committed
114 115 116 117 118 119 120 121
  fw.sendToMsg("others", "CHANGE_COLLABORATION", {
    collaborationType: collaborationType,
    newMeetingId: newMeetingID,
  });
};

// CHANGE_HOST_APPLY
FermiWebSocketBridge.changeHostApply = function () {
Kim Peace committed
122 123 124 125
  console.log(
    "peacekim:: FermiWebSocketBridge.changeHostApply globalUserInfo.loginId: " +
      globalUserInfo.loginId
  );
Kim Peace committed
126
  fw.sendToMsg("others", "CHANGE_HOST_APPLY", {
127
    hostId: globalUserInfo.loginId,
Kim Peace committed
128
  });
Kim Peace committed
129
};
130 131 132 133

FermiWebSocketBridge.hostUpdated = function () {
  fw.sendToMsg("others", "HOST_UPDATED", {});
};