正在显示
6 个修改的文件
包含
198 行增加
和
67 行删除
| @@ -116,6 +116,7 @@ export default class MessageEntrance extends Emiter { | @@ -116,6 +116,7 @@ export default class MessageEntrance extends Emiter { | ||
| 116 | this.sendDocumentUpload= this._sendDocumentUpload;//上传文档 | 116 | this.sendDocumentUpload= this._sendDocumentUpload;//上传文档 |
| 117 | this.sendDocumentSwitch= this._sendDocumentSwitch; //切换文档 | 117 | this.sendDocumentSwitch= this._sendDocumentSwitch; //切换文档 |
| 118 | this.sendDocumentDelete= this. _sendDocumentDelete;//删除文档 | 118 | this.sendDocumentDelete= this. _sendDocumentDelete;//删除文档 |
| 119 | + this.sendDocumentDeleteAll= this._documentDeleteAll;//删除所有文档 | ||
| 119 | this.sendDocumentCommand= this._sendDocumentCommand;//操作文档(翻页、缩放、滚动...) | 120 | this.sendDocumentCommand= this._sendDocumentCommand;//操作文档(翻页、缩放、滚动...) |
| 120 | 121 | ||
| 121 | //debug | 122 | //debug |
| @@ -371,6 +372,13 @@ export default class MessageEntrance extends Emiter { | @@ -371,6 +372,13 @@ export default class MessageEntrance extends Emiter { | ||
| 371 | _doc_ape.documentDelete(_param); | 372 | _doc_ape.documentDelete(_param); |
| 372 | } | 373 | } |
| 373 | } | 374 | } |
| 375 | + //删除所有文档 | ||
| 376 | + _documentDeleteAll(_param){ | ||
| 377 | + if(_doc_ape){ | ||
| 378 | + _doc_ape.documentDeleteAll(_param); | ||
| 379 | + } | ||
| 380 | + } | ||
| 381 | + | ||
| 374 | //操作文档(翻页、缩放、滚动...) | 382 | //操作文档(翻页、缩放、滚动...) |
| 375 | _sendDocumentCommand(_param){ | 383 | _sendDocumentCommand(_param){ |
| 376 | if(_doc_ape){ | 384 | if(_doc_ape){ |
| @@ -62,7 +62,7 @@ export default class Ape extends Emiter { | @@ -62,7 +62,7 @@ export default class Ape extends Emiter { | ||
| 62 | 62 | ||
| 63 | // 消息处理 | 63 | // 消息处理 |
| 64 | _pduMessageHandler(regBuffer) { | 64 | _pduMessageHandler(regBuffer) { |
| 65 | - console.log("RCPDU_REG_ADAPTER=========================================="); | 65 | + console.log("RCPDU_REG_ADAPTER==========================================this._apeDelayed",this._apeDelayed,this._confInfo['mcuDelay']); |
| 66 | if (this._apeDelayed) { | 66 | if (this._apeDelayed) { |
| 67 | // this._apeDelayedMsgs.push(regBuffer); | 67 | // this._apeDelayedMsgs.push(regBuffer); |
| 68 | // this._apeDelayedStart(); | 68 | // this._apeDelayedStart(); |
| @@ -98,7 +98,7 @@ export default class Ape extends Emiter { | @@ -98,7 +98,7 @@ export default class Ape extends Emiter { | ||
| 98 | let regPdu = pdu['RCAdapterPdu'].decode(regBuffer); | 98 | let regPdu = pdu['RCAdapterPdu'].decode(regBuffer); |
| 99 | let regItems = regPdu.item; | 99 | let regItems = regPdu.item; |
| 100 | let regItemSize = regItems.length; | 100 | let regItemSize = regItems.length; |
| 101 | - loger.log(this._session_name + '数据同步消息'); | 101 | + //loger.log(this._session_name + '数据同步消息'); |
| 102 | loger.log(this._session_name + '数据同步消息.同步条数', regItemSize); | 102 | loger.log(this._session_name + '数据同步消息.同步条数', regItemSize); |
| 103 | //console.log(regPdu); | 103 | //console.log(regPdu); |
| 104 | 104 | ||
| @@ -124,7 +124,7 @@ export default class Ape extends Emiter { | @@ -124,7 +124,7 @@ export default class Ape extends Emiter { | ||
| 124 | let object_id = regUpdatedItem.objId; | 124 | let object_id = regUpdatedItem.objId; |
| 125 | let user_data = regUpdatedItem.userData; | 125 | let user_data = regUpdatedItem.userData; |
| 126 | 126 | ||
| 127 | - loger.log('REG OBJECT EVENT ->', pdu.id2type(sub_type),regUpdatedItem); | 127 | + loger.log('REG OBJECT EVENT ->', pdu.id2type(sub_type)); |
| 128 | switch (sub_type) { | 128 | switch (sub_type) { |
| 129 | case pdu.RCPDU_REG_ROSTER_INSERT_PDU: | 129 | case pdu.RCPDU_REG_ROSTER_INSERT_PDU: |
| 130 | let rosterInsertData = pdu['RCRegstryRosterInsertItemPdu'].decode(user_data); | 130 | let rosterInsertData = pdu['RCRegstryRosterInsertItemPdu'].decode(user_data); |
| @@ -33,10 +33,18 @@ class ConferApe extends Ape { | @@ -33,10 +33,18 @@ class ConferApe extends Ape { | ||
| 33 | ); | 33 | ); |
| 34 | 34 | ||
| 35 | // Attribures | 35 | // Attribures |
| 36 | - this.hostNodeId = -1; | ||
| 37 | - this.hostUserId = ''; | ||
| 38 | - this.rosters = {}; | ||
| 39 | - this.activeDocId = ''; | 36 | + this.hostNodeId = -1;//主持人的nodeId |
| 37 | + // 用户的身份,5种类型: | ||
| 38 | + // host(主持人/老师) | ||
| 39 | + // presenter(主讲人) | ||
| 40 | + // assistant(助教) | ||
| 41 | + // normal(普通角色/学生) | ||
| 42 | + // record(暂时没用. | ||
| 43 | + // 默认值: normal | ||
| 44 | + this.hostUserId = '';//主持人的 第三方userId | ||
| 45 | + this.rosters = {};//用户列表 | ||
| 46 | + this.activeDocId =0;//当前激活的文档ID | ||
| 47 | + this.activeDocCurPage=1;//当前激活的文档的当前页 | ||
| 40 | 48 | ||
| 41 | // Ape Models | 49 | // Ape Models |
| 42 | this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); | 50 | this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); |
| @@ -136,7 +144,7 @@ class ConferApe extends Ape { | @@ -136,7 +144,7 @@ class ConferApe extends Ape { | ||
| 136 | const uncompressedBytes = new Zlib.Inflate(tabUpdatePdu.action.compact().view).decompress(); | 144 | const uncompressedBytes = new Zlib.Inflate(tabUpdatePdu.action.compact().view).decompress(); |
| 137 | let tabInfo = UTF8.getStringFromBytes(uncompressedBytes); | 145 | let tabInfo = UTF8.getStringFromBytes(uncompressedBytes); |
| 138 | let tabTypeMatches = tabInfo.match(/<TabType>(.+)<\/TabType>/); | 146 | let tabTypeMatches = tabInfo.match(/<TabType>(.+)<\/TabType>/); |
| 139 | - loger.log("更新列表数据 tableUpdateHandler",tabInfo); | 147 | + loger.log("更新列表数据 tableUpdateHandler","owner:"+owner, "itemIdx:"+itemIdx,"tabInfo:",tabInfo); |
| 140 | if (tabTypeMatches.length > 1 && tabTypeMatches[1] == 'show.docsharing') { | 148 | if (tabTypeMatches.length > 1 && tabTypeMatches[1] == 'show.docsharing') { |
| 141 | if (tabInfo.match(/<visible>(.+)<\/visible>/)[1] == 'true') { | 149 | if (tabInfo.match(/<visible>(.+)<\/visible>/)[1] == 'true') { |
| 142 | this.activeDocId = tabInfo.match(/<TabID>(.+)<\/TabID>/)[1]; | 150 | this.activeDocId = tabInfo.match(/<TabID>(.+)<\/TabID>/)[1]; |
| @@ -30,12 +30,13 @@ class DocApe extends Ape { | @@ -30,12 +30,13 @@ class DocApe extends Ape { | ||
| 30 | ApeConsts.DOCSHARING_SESSION_NAME, | 30 | ApeConsts.DOCSHARING_SESSION_NAME, |
| 31 | ApeConsts.DOCSHARING_SESSION_TAG | 31 | ApeConsts.DOCSHARING_SESSION_TAG |
| 32 | ); | 32 | ); |
| 33 | - this.docList = {}; | 33 | + this.docList = {};//记录文档的数组this.docList[itemIdx]=itemIdx的数据 |
| 34 | 34 | ||
| 35 | 35 | ||
| 36 | // Ape Models | 36 | // Ape Models |
| 37 | this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); | 37 | this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); |
| 38 | - this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5, ApeConsts.DOCSHARING_OBJ_TABLE_NAME_H5, ApeConsts.DOCSHARING_OBJ_TABLE_TAG_H5, 0, new ArrayBuffer); | 38 | + this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.DOCSHARING_OBJ_TABLE_ID, ApeConsts.DOCSHARING_OBJ_TABLE_NAME, ApeConsts.DOCSHARING_OBJ_TABLE_TAG, 0, new ArrayBuffer); |
| 39 | + //this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5, ApeConsts.DOCSHARING_OBJ_TABLE_NAME_H5, ApeConsts.DOCSHARING_OBJ_TABLE_TAG_H5, 0, new ArrayBuffer); | ||
| 39 | 40 | ||
| 40 | // 延迟 | 41 | // 延迟 |
| 41 | this._apeDelayed = true; | 42 | this._apeDelayed = true; |
| @@ -56,11 +57,11 @@ class DocApe extends Ape { | @@ -56,11 +57,11 @@ class DocApe extends Ape { | ||
| 56 | this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | 57 | this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); |
| 57 | return ; | 58 | return ; |
| 58 | } | 59 | } |
| 59 | - console.log(docDataModelPdu); | 60 | + //console.log(docDataModelPdu); |
| 60 | 61 | ||
| 61 | let tableItemPdu = new pdu['RCRegistryTableItemPdu']; | 62 | let tableItemPdu = new pdu['RCRegistryTableItemPdu']; |
| 62 | tableItemPdu.itemIdx=itemIdx;//直接用时间戳作为id | 63 | tableItemPdu.itemIdx=itemIdx;//直接用时间戳作为id |
| 63 | - tableItemPdu.registerObjId=ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5; | 64 | + tableItemPdu.registerObjId=ApeConsts.DOCSHARING_OBJ_TABLE_ID;// tableItemPdu.registerObjId=ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5; |
| 64 | tableItemPdu.owner = 0;//收到flash的是这个值,不清楚先写固定 | 65 | tableItemPdu.owner = 0;//收到flash的是这个值,不清楚先写固定 |
| 65 | tableItemPdu.itemData =docDataModelPdu.toArrayBuffer(); | 66 | tableItemPdu.itemData =docDataModelPdu.toArrayBuffer(); |
| 66 | 67 | ||
| @@ -72,7 +73,7 @@ class DocApe extends Ape { | @@ -72,7 +73,7 @@ class DocApe extends Ape { | ||
| 72 | tableInsertItemPdu.items.push(tableItemPdu); | 73 | tableInsertItemPdu.items.push(tableItemPdu); |
| 73 | 74 | ||
| 74 | let updateObjPdu = new pdu['RCRegistryUpdateObjPdu']; | 75 | let updateObjPdu = new pdu['RCRegistryUpdateObjPdu']; |
| 75 | - updateObjPdu.objId = ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5; | 76 | + updateObjPdu.objId = ApeConsts.DOCSHARING_OBJ_TABLE_ID;// updateObjPdu.objId = ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5; |
| 76 | updateObjPdu.subType = tableInsertItemPdu.type; | 77 | updateObjPdu.subType = tableInsertItemPdu.type; |
| 77 | updateObjPdu.userData = tableInsertItemPdu.toArrayBuffer(); | 78 | updateObjPdu.userData = tableInsertItemPdu.toArrayBuffer(); |
| 78 | 79 | ||
| @@ -85,17 +86,89 @@ class DocApe extends Ape { | @@ -85,17 +86,89 @@ class DocApe extends Ape { | ||
| 85 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | 86 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; |
| 86 | adapterPdu.item.push(adapterItemPdu); | 87 | adapterPdu.item.push(adapterItemPdu); |
| 87 | 88 | ||
| 88 | - console.log("文档upload tableItemPdu.itemIdx="+tableItemPdu.itemIdx); | 89 | + loger.log("文档upload tableItemPdu.itemIdx="+tableItemPdu.itemIdx); |
| 90 | + this.sendUniform(adapterPdu,true); | ||
| 91 | + } | ||
| 92 | + updaterDoc(_docDataModel,_itemIdx){ | ||
| 93 | + loger.log("文档===updaterDoc ",_itemIdx); | ||
| 94 | + //验证坐标点集合数组是否合法 | ||
| 95 | + if(_docDataModel==null||_itemIdx==null){ | ||
| 96 | + this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 97 | + return null; | ||
| 98 | + } | ||
| 99 | + loger.log("文档===updaterDoc ",_docDataModel); | ||
| 100 | + | ||
| 101 | + let docDataModelPdu=this.packPdu(_docDataModel,_itemIdx); | ||
| 102 | + let tableItemPdu = new pdu['RCRegistryTableItemPdu']; | ||
| 103 | + tableItemPdu.itemIdx=_itemIdx;//直接用时间戳作为id | ||
| 104 | + tableItemPdu.registerObjId=ApeConsts.DOCSHARING_OBJ_TABLE_ID;// tableItemPdu.registerObjId=ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5; | ||
| 105 | + tableItemPdu.owner = 0;//收到flash的是这个值,不清楚先写固定 | ||
| 106 | + tableItemPdu.itemData =docDataModelPdu.toArrayBuffer(); | ||
| 107 | + | ||
| 108 | + //insert | ||
| 109 | + let tableInsertItemPdu = new pdu['RCRegistryTableUpdateItemPdu']; | ||
| 110 | + //optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_UPDATE_PDU]; | ||
| 111 | + //repeated RCRegistryTableItemPdu items = 2; | ||
| 112 | + tableInsertItemPdu.type = pdu.RCPDU_REG_TABLE_UPDATE_PDU;// | ||
| 113 | + tableInsertItemPdu.items.push(tableItemPdu); | ||
| 114 | + | ||
| 115 | + let updateObjPdu = new pdu['RCRegistryUpdateObjPdu']; | ||
| 116 | + updateObjPdu.objId = ApeConsts.DOCSHARING_OBJ_TABLE_ID;// updateObjPdu.objId = ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5; | ||
| 117 | + updateObjPdu.subType = tableInsertItemPdu.type; | ||
| 118 | + updateObjPdu.userData = tableInsertItemPdu.toArrayBuffer(); | ||
| 119 | + | ||
| 120 | + //同步 | ||
| 121 | + let adapterItemPdu = new pdu['RCAdapterItemPdu']; | ||
| 122 | + adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ; | ||
| 123 | + adapterItemPdu.itemData = updateObjPdu.toArrayBuffer(); | ||
| 124 | + | ||
| 125 | + let adapterPdu = new pdu['RCAdapterPdu']; | ||
| 126 | + adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | ||
| 127 | + adapterPdu.item.push(adapterItemPdu); | ||
| 128 | + | ||
| 129 | + loger.log("发送更新文档.itemIdx="+tableItemPdu.itemIdx); | ||
| 89 | this.sendUniform(adapterPdu,true); | 130 | this.sendUniform(adapterPdu,true); |
| 90 | } | 131 | } |
| 91 | //切换文档 | 132 | //切换文档 |
| 92 | documentSwitch(paramInfo){ | 133 | documentSwitch(paramInfo){ |
| 93 | - | 134 | + console.log(this.docList); |
| 135 | + //获取已经存在的数据 | ||
| 136 | + let docDataModel= this.docList[paramInfo.itemIdx]; | ||
| 137 | + if(docDataModel==null){ | ||
| 138 | + loger.log('documentSwitch失败,文档不存在',paramInfo); | ||
| 139 | + this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 140 | + return; | ||
| 141 | + } | ||
| 142 | + //更新数据的字段 | ||
| 143 | + docDataModel.visible=!docDataModel.visible; | ||
| 144 | + this.updaterDoc(docDataModel,docDataModel.itemIdx); | ||
| 94 | } | 145 | } |
| 95 | 146 | ||
| 96 | //操作文档(翻页、缩放、滚动...) | 147 | //操作文档(翻页、缩放、滚动...) |
| 97 | documentCommand(paramInfo){ | 148 | documentCommand(paramInfo){ |
| 149 | + console.log(this.docList); | ||
| 150 | + //获取已经存在的数据 | ||
| 151 | + let docDataModel= this.docList[paramInfo.itemIdx]; | ||
| 152 | + //console.log(docDataModelPdu); | ||
| 153 | + //console.log(docDataModel); | ||
| 154 | + if(docDataModel==null){ | ||
| 155 | + loger.log('documentCommand失败,文档不存在',paramInfo); | ||
| 156 | + this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 157 | + return; | ||
| 158 | + } | ||
| 159 | + //更新数据的字段 | ||
| 160 | + docDataModel.curPageNo=docDataModel.curPageNo+1; | ||
| 161 | + this.updaterDoc(docDataModel,docDataModel.itemIdx); | ||
| 162 | + } | ||
| 98 | 163 | ||
| 164 | + //删除所有文档 | ||
| 165 | + documentDeleteAll(_param){ | ||
| 166 | + let len=0; | ||
| 167 | + for (let key in this.docList){ | ||
| 168 | + //console.log("key:"+key); | ||
| 169 | + loger.log("删除文档数据,itemIdx:"+key); | ||
| 170 | + this.documentDelete({"itemIdx":key}); | ||
| 171 | + } | ||
| 99 | } | 172 | } |
| 100 | 173 | ||
| 101 | //删除文档 | 174 | //删除文档 |
| @@ -108,7 +181,7 @@ class DocApe extends Ape { | @@ -108,7 +181,7 @@ class DocApe extends Ape { | ||
| 108 | tableDeleteItemPdu.itemIdx=parseInt(paramInfo.itemIdx);//这里需要设置要删除的数据的itemIdx,每条数据的这个id都不一样 | 181 | tableDeleteItemPdu.itemIdx=parseInt(paramInfo.itemIdx);//这里需要设置要删除的数据的itemIdx,每条数据的这个id都不一样 |
| 109 | 182 | ||
| 110 | let updateObjPdu = new pdu['RCRegistryUpdateObjPdu']; | 183 | let updateObjPdu = new pdu['RCRegistryUpdateObjPdu']; |
| 111 | - updateObjPdu.objId = ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5; | 184 | + updateObjPdu.objId = ApeConsts.DOCSHARING_OBJ_TABLE_ID;// updateObjPdu.objId = ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5; |
| 112 | updateObjPdu.subType = tableDeleteItemPdu.type; | 185 | updateObjPdu.subType = tableDeleteItemPdu.type; |
| 113 | updateObjPdu.userData = tableDeleteItemPdu.toArrayBuffer(); | 186 | updateObjPdu.userData = tableDeleteItemPdu.toArrayBuffer(); |
| 114 | 187 | ||
| @@ -121,63 +194,73 @@ class DocApe extends Ape { | @@ -121,63 +194,73 @@ class DocApe extends Ape { | ||
| 121 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | 194 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; |
| 122 | adapterPdu.item.push(adapterItemPdu); | 195 | adapterPdu.item.push(adapterItemPdu); |
| 123 | 196 | ||
| 124 | - console.log("文档发送删除数据============="+tableDeleteItemPdu.itemIdx); | 197 | + loger.log("文档发送删除数据============="+tableDeleteItemPdu.itemIdx); |
| 125 | this.sendUniform(adapterPdu,true); | 198 | this.sendUniform(adapterPdu,true); |
| 126 | } | 199 | } |
| 127 | 200 | ||
| 128 | ///////白板数据的封包和解包///////////////////////////////////////// | 201 | ///////白板数据的封包和解包///////////////////////////////////////// |
| 129 | packPdu(_param,_itemIdx){ | 202 | packPdu(_param,_itemIdx){ |
| 203 | + loger.log("文档===packPdu "); | ||
| 130 | //验证坐标点集合数组是否合法 | 204 | //验证坐标点集合数组是否合法 |
| 131 | - if(_param.pointGroup==null||_param.pointGroup.length<1){ | 205 | + if(_param==null||_itemIdx==null){ |
| 132 | this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | 206 | this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); |
| 133 | return null; | 207 | return null; |
| 134 | } | 208 | } |
| 135 | - /* required uint32 item_idx=1;//唯一标识 | ||
| 136 | - required uint32 owner=2; | ||
| 137 | - optional uint32 from=3; | ||
| 138 | - optional uint32 cur_page_no=4; | ||
| 139 | - optional uint32 page_num =5; | ||
| 140 | - required string filetype=6; | ||
| 141 | - required string doc_type=7; | ||
| 142 | - required string relative_url=8;//文档相对地址 | ||
| 143 | - optional string url =9;//文档地址 | ||
| 144 | - optional uint32 cur_V=10; | ||
| 145 | - optional uint32 cur_H=11; | ||
| 146 | - optional uint32 scale=12; | ||
| 147 | - optional bool visible=13; | ||
| 148 | - optional uint32 action=14;//0,无操作, 1翻页、2.显示/隐藏 | ||
| 149 | - optional string id=15;//文档在服务器数据库中的唯一id*/ | 209 | + |
| 210 | + /* message RCDocSendDataModelPdu { | ||
| 211 | + required uint32 item_idx=1;//唯一标识 | ||
| 212 | + required uint32 owner=2; | ||
| 213 | + optional uint32 from=3; | ||
| 214 | + optional uint32 cur_page_no=4; | ||
| 215 | + optional uint32 page_num =5; | ||
| 216 | + optional string file_type=6; | ||
| 217 | + optional string doc_type=7; | ||
| 218 | + optional string relative_url=8;//文档相对地址 | ||
| 219 | + optional string url =9;//文档地址 | ||
| 220 | + optional uint32 cur_V=10; | ||
| 221 | + optional uint32 cur_H=11; | ||
| 222 | + optional uint32 scale=12; | ||
| 223 | + optional bool visible=13; | ||
| 224 | + optional uint32 action=14;//0,无操作, 1翻页、2.显示/隐藏 | ||
| 225 | + optional string db_id=15;//文档在服务器数据库中的唯一id | ||
| 226 | + }*/ | ||
| 150 | 227 | ||
| 151 | //判断type类型,根据type设置不同的参数 | 228 | //判断type类型,根据type设置不同的参数 |
| 152 | - let docModelPdu =new pdu['RCDocSendDataModel']; | 229 | + let docModelPdu =new pdu['RCDocSendDataModelPdu']; |
| 153 | docModelPdu.itemIdx=_itemIdx; | 230 | docModelPdu.itemIdx=_itemIdx; |
| 154 | docModelPdu.owner=GlobalConfig.nodeId; | 231 | docModelPdu.owner=GlobalConfig.nodeId; |
| 155 | docModelPdu.from=GlobalConfig.nodeId; | 232 | docModelPdu.from=GlobalConfig.nodeId; |
| 156 | - docModelPdu.curPageNo = 1; | ||
| 157 | - docModelPdu.pageNum =10; | 233 | + docModelPdu.curPageNo = _param.curPageNo||1; |
| 234 | + docModelPdu.pageNum = _param.pageNum||1; | ||
| 158 | docModelPdu.fileType=_param.fileType||""; | 235 | docModelPdu.fileType=_param.fileType||""; |
| 159 | - docModelPdu.docType="pdf2swf"; | ||
| 160 | - docModelPdu.url = "http://101.200.150.192/DocSharing/data/h5test/20170206-171100025/7e9c4178cac1133e0dd9d5b583439122.jpg"; | ||
| 161 | - docModelPdu.relativeUrl="/DocSharing/data/h5test/20170206-171100025/7e9c4178cac1133e0dd9d5b583439122.jpg"; | ||
| 162 | - docModelPdu.curV=0; | ||
| 163 | - docModelPdu.curH=0; | ||
| 164 | - docModelPdu.scale=1; | ||
| 165 | - docModelPdu.visible=false; | ||
| 166 | - docModelPdu.action=0;//0,无操作, 1翻页、2.显示/隐藏 | ||
| 167 | - docModelPdu.id=_param.id||"";//文档在服务器数据库中的唯一id | 236 | + docModelPdu.docType=_param.docType||"pdf2swf"; |
| 237 | + docModelPdu.url =_param.url||"";//"http://101.200.150.192/DocSharing/data/h5test/20170206-171100025/7e9c4178cac1133e0dd9d5b583439122.jpg"; | ||
| 238 | + docModelPdu.relativeUrl=_param.relativeUrl||"";//"/DocSharing/data/h5test/20170206-171100025/7e9c4178cac1133e0dd9d5b583439122.jpg"; | ||
| 239 | + docModelPdu.curV=_param.curV||0; | ||
| 240 | + docModelPdu.curH=_param.curH||0; | ||
| 241 | + docModelPdu.scale=_param.scale||1; | ||
| 242 | + docModelPdu.visible= _param.visible||false; | ||
| 243 | + docModelPdu.action=_param.action||0;//0,无操作, 1翻页、2.显示/隐藏 | ||
| 244 | + docModelPdu.dbId=_param.dbId||"";//文档在服务器数据库中的唯一id | ||
| 245 | + | ||
| 246 | + console.log(docModelPdu); | ||
| 168 | return docModelPdu; | 247 | return docModelPdu; |
| 169 | } | 248 | } |
| 170 | 249 | ||
| 171 | unPackPdu(owner, itemIdx,itemData){ | 250 | unPackPdu(owner, itemIdx,itemData){ |
| 172 | - this.docList[itemIdx] = itemData; | 251 | + loger.log("文档===unPackPdu "); |
| 252 | + if(owner==null||itemIdx==null||itemData==null){ | ||
| 253 | + this._emit(MessageTypes.MCU_ERROR,MessageTypes.ERR_APE_INTERFACE_PARAM_WRONG); | ||
| 254 | + return null; | ||
| 255 | + } | ||
| 256 | + | ||
| 173 | try{ | 257 | try{ |
| 174 | - console.log("文档收到数据===unPackPdu "); | ||
| 175 | - let docModelPdu= pdu['RCDocSendDataModel'].decode(itemData); | 258 | + let docModelPdu= pdu['RCDocSendDataModelPdu'].decode(itemData); |
| 176 | //console.log(whiteBoardModelPdu); | 259 | //console.log(whiteBoardModelPdu); |
| 177 | - loger.log(docModelPdu); | 260 | + //loger.log(docModelPdu); |
| 178 | return docModelPdu; | 261 | return docModelPdu; |
| 179 | }catch (err){ | 262 | }catch (err){ |
| 180 | - console.log("unPackPdu Pdu解析错误,itemIdx="+itemIdx+" err:"+err.message); | 263 | + loger.log("文档收到数据 unPackPdu Pdu解析错误,itemIdx="+itemIdx+" err:"+err.message); |
| 181 | } | 264 | } |
| 182 | return null; | 265 | return null; |
| 183 | } | 266 | } |
| @@ -187,6 +270,7 @@ class DocApe extends Ape { | @@ -187,6 +270,7 @@ class DocApe extends Ape { | ||
| 187 | //this.tableUpdateHandler(owner, tableId, itemData); | 270 | //this.tableUpdateHandler(owner, tableId, itemData); |
| 188 | //loger.log('tableInsertHandler---',itemData); | 271 | //loger.log('tableInsertHandler---',itemData); |
| 189 | let itemDataInfo = this.unPackPdu(owner, itemIdx, itemData); | 272 | let itemDataInfo = this.unPackPdu(owner, itemIdx, itemData); |
| 273 | + this.docList[itemIdx] = itemDataInfo; | ||
| 190 | loger.log('tableInsertHandler',itemDataInfo); | 274 | loger.log('tableInsertHandler',itemDataInfo); |
| 191 | } | 275 | } |
| 192 | 276 | ||
| @@ -201,8 +285,8 @@ class DocApe extends Ape { | @@ -201,8 +285,8 @@ class DocApe extends Ape { | ||
| 201 | let itemIdxs=tableDeleteData.itemIdx; | 285 | let itemIdxs=tableDeleteData.itemIdx; |
| 202 | for (let i=0;i<len;i++){ | 286 | for (let i=0;i<len;i++){ |
| 203 | if(this.docList[itemIdxs[i]]){ | 287 | if(this.docList[itemIdxs[i]]){ |
| 288 | + loger.log("删除文档数据:",itemIdxs[i]); | ||
| 204 | delete this.docList[itemIdxs[i]]; | 289 | delete this.docList[itemIdxs[i]]; |
| 205 | - loger.log("删除文档数据:",itemIdxs[i],"当前剩余的文档数据",this.docList); | ||
| 206 | } | 290 | } |
| 207 | } | 291 | } |
| 208 | } | 292 | } |
| @@ -210,6 +294,31 @@ class DocApe extends Ape { | @@ -210,6 +294,31 @@ class DocApe extends Ape { | ||
| 210 | tableUpdateHandler(owner, itemIdx, itemData) { | 294 | tableUpdateHandler(owner, itemIdx, itemData) { |
| 211 | //let itemDataInfo = pdu['RCDocSendDataRequestPdu'].decode(itemData); | 295 | //let itemDataInfo = pdu['RCDocSendDataRequestPdu'].decode(itemData); |
| 212 | let itemDataInfo = this.unPackPdu(owner, itemIdx, itemData); | 296 | let itemDataInfo = this.unPackPdu(owner, itemIdx, itemData); |
| 297 | + this.docList[itemIdx] = itemDataInfo; | ||
| 298 | + if(itemDataInfo==null){ | ||
| 299 | + try { | ||
| 300 | + let recordInfo = pdu['RCDocSendDataRequestPdu'].decode(itemData); | ||
| 301 | + recordInfo.type = ApeConsts.DOCUMENT_LOAD; | ||
| 302 | + | ||
| 303 | + recordInfo.ext = recordInfo.name.substr(recordInfo.name.indexOf('.') + 1); | ||
| 304 | + recordInfo.wbid = (recordInfo.id << 10) + recordInfo.curPageNo; | ||
| 305 | + recordInfo.isPicture = ~['bmp', 'png', 'gif', 'jpg', 'jpeg'].indexOf(recordInfo.ext); | ||
| 306 | + | ||
| 307 | + if (recordInfo.isPicture) { | ||
| 308 | + recordInfo.namePath = recordInfo.uri.substring(0, recordInfo.uri.lastIndexOf('.')); | ||
| 309 | + recordInfo.loadURL = recordInfo.namePath + '.' + recordInfo.ext; | ||
| 310 | + } else { | ||
| 311 | + recordInfo.namePath = recordInfo.uri.substring(0, recordInfo.uri.lastIndexOf('/')); | ||
| 312 | + recordInfo.loadURL = `${recordInfo.namePath}/${recordInfo.curPageNo}.jpg`; | ||
| 313 | + } | ||
| 314 | + this.docList[itemIdx] = recordInfo; | ||
| 315 | + // this.emit(MessageTypes.DOC_UPDATE, recordInfo); | ||
| 316 | + loger.log('Doc update ->' + itemIdx,recordInfo); | ||
| 317 | + } catch (e) { | ||
| 318 | + loger.warn('Doc Table Update Decode包异常'); | ||
| 319 | + } | ||
| 320 | + return; | ||
| 321 | + } | ||
| 213 | loger.log('tableUpdateHandler',itemDataInfo); | 322 | loger.log('tableUpdateHandler',itemDataInfo); |
| 214 | /*try { | 323 | /*try { |
| 215 | const recordInfo = pdu['RCDocSendDataRequestPdu'].decode(itemData); | 324 | const recordInfo = pdu['RCDocSendDataRequestPdu'].decode(itemData); |
| @@ -48,10 +48,12 @@ class WhiteBoardApe extends Ape { | @@ -48,10 +48,12 @@ class WhiteBoardApe extends Ape { | ||
| 48 | ApeConsts.WHITEBOARD_OBJ_TABLE_NAME, ApeConsts.WHITEBOARD_OBJ_TABLE_TAG, 0, new ArrayBuffer); | 48 | ApeConsts.WHITEBOARD_OBJ_TABLE_NAME, ApeConsts.WHITEBOARD_OBJ_TABLE_TAG, 0, new ArrayBuffer); |
| 49 | 49 | ||
| 50 | // ape listeners | 50 | // ape listeners |
| 51 | - this.on(pdu.RCPDU_CONFERENCE_SEND_DATA_REQUEST, this.whiteboardMsgComingHandler.bind(this)); | ||
| 52 | this.on(pdu.RCPDU_SESSION_JOIN_RESPONSE, this._joinSessionHandler.bind(this)); | 51 | this.on(pdu.RCPDU_SESSION_JOIN_RESPONSE, this._joinSessionHandler.bind(this)); |
| 53 | - // 白板延迟 | ||
| 54 | - this._apeDelayed = true; | 52 | + |
| 53 | + //this.on(pdu.RCPDU_CONFERENCE_SEND_DATA_REQUEST, this.whiteboardMsgComingHandler.bind(this));//这个是会议消息类型,flash里在使用这里不再使用,各个模块的消息由模块自己来处理 | ||
| 54 | + | ||
| 55 | + // 白板延迟 | ||
| 56 | + //this._apeDelayed = true; | ||
| 55 | } | 57 | } |
| 56 | 58 | ||
| 57 | _joinSessionHandler(confInfo) { | 59 | _joinSessionHandler(confInfo) { |
| @@ -83,7 +85,7 @@ class WhiteBoardApe extends Ape { | @@ -83,7 +85,7 @@ class WhiteBoardApe extends Ape { | ||
| 83 | return ; | 85 | return ; |
| 84 | } | 86 | } |
| 85 | 87 | ||
| 86 | - itemIdx=parseInt(Date.now()/1000); | 88 | + itemIdx=EngineUtils.generateNodeID(); |
| 87 | let whiteBoardModelPdu = this.packPdu(_param,itemIdx); | 89 | let whiteBoardModelPdu = this.packPdu(_param,itemIdx); |
| 88 | if(whiteBoardModelPdu==null){ | 90 | if(whiteBoardModelPdu==null){ |
| 89 | loger.log('sendInsetAnnotaion失败,参数错误'); | 91 | loger.log('sendInsetAnnotaion失败,参数错误'); |
| @@ -119,15 +121,15 @@ class WhiteBoardApe extends Ape { | @@ -119,15 +121,15 @@ class WhiteBoardApe extends Ape { | ||
| 119 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | 121 | adapterPdu.type = pdu.RCPDU_REG_ADAPTER; |
| 120 | adapterPdu.item.push(adapterItemPdu); | 122 | adapterPdu.item.push(adapterItemPdu); |
| 121 | 123 | ||
| 122 | - console.log("白板insert数据======111111111111=tableItemPdu.itemIdx="+tableItemPdu.itemIdx); | 124 | + console.log("添加白板数据=====itemIdx="+tableItemPdu.itemIdx); |
| 123 | this.sendUniform(adapterPdu,true); | 125 | this.sendUniform(adapterPdu,true); |
| 124 | } | 126 | } |
| 125 | //删除所有标注 | 127 | //删除所有标注 |
| 126 | sendDeleteAllAnnotation(_param){ | 128 | sendDeleteAllAnnotation(_param){ |
| 127 | let len=0; | 129 | let len=0; |
| 128 | for (let key in this.annoInfos){ | 130 | for (let key in this.annoInfos){ |
| 129 | - console.log("key:"+key); | ||
| 130 | - console.log("删除白板数据,itemIdx:"+this.annoInfos[key]); | 131 | + //console.log("key:"+key); |
| 132 | + console.log("删除白板数据,itemIdx:"+key); | ||
| 131 | this.sendDeleteAnnotaion({"itemIdx":key}); | 133 | this.sendDeleteAnnotaion({"itemIdx":key}); |
| 132 | } | 134 | } |
| 133 | } | 135 | } |
| @@ -285,10 +287,14 @@ class WhiteBoardApe extends Ape { | @@ -285,10 +287,14 @@ class WhiteBoardApe extends Ape { | ||
| 285 | } | 287 | } |
| 286 | 288 | ||
| 287 | /////收到消息处理///////////////////////////////////////////////////////////////////////////////// | 289 | /////收到消息处理///////////////////////////////////////////////////////////////////////////////// |
| 288 | - whiteboardMsgComingHandler(pdu) { | ||
| 289 | - loger.warn('whiteboardMsgComingHandler needs to be handled.'); | ||
| 290 | - const recordInfo = pdu['RCWhiteboardDataRequestPdu'].decode(pdu); | ||
| 291 | - loger.log("whiteboardMsgComingHandler",recordInfo); | 290 | + whiteboardMsgComingHandler(_data) { |
| 291 | + //flash RCConferenceSendDataRequestPdu | ||
| 292 | + //loger.warn('whiteboardMsgComingHandler needs to be handled.'); | ||
| 293 | + //const recordInfo = pdu['RCWhiteboardDataRequestPdu'].decode(pdu); | ||
| 294 | + //loger.log("whiteboardMsgComingHandler",recordInfo); | ||
| 295 | + | ||
| 296 | + let receiveInfo = pdu['RCConferenceSendDataRequestPdu'].decode(_data); | ||
| 297 | + loger.log("whiteboardMsgComingHandler",receiveInfo); | ||
| 292 | } | 298 | } |
| 293 | 299 | ||
| 294 | tableInsertHandler(owner, itemIdx,itemData) { | 300 | tableInsertHandler(owner, itemIdx,itemData) { |
| @@ -713,22 +713,22 @@ message RCDocSendDataRequestPdu { | @@ -713,22 +713,22 @@ message RCDocSendDataRequestPdu { | ||
| 713 | optional uint32 scale = 10; | 713 | optional uint32 scale = 10; |
| 714 | optional uint32 page_num = 11; | 714 | optional uint32 page_num = 11; |
| 715 | } | 715 | } |
| 716 | -message RCDocSendDataModel { | 716 | +message RCDocSendDataModelPdu { |
| 717 | required uint32 item_idx=1;//唯一标识 | 717 | required uint32 item_idx=1;//唯一标识 |
| 718 | required uint32 owner=2; | 718 | required uint32 owner=2; |
| 719 | optional uint32 from=3; | 719 | optional uint32 from=3; |
| 720 | optional uint32 cur_page_no=4; | 720 | optional uint32 cur_page_no=4; |
| 721 | optional uint32 page_num =5; | 721 | optional uint32 page_num =5; |
| 722 | - required string file_type=6; | ||
| 723 | - required string doc_type=7; | ||
| 724 | - required string relative_url=8;//文档相对地址 | 722 | + optional string file_type=6; |
| 723 | + optional string doc_type=7; | ||
| 724 | + optional string relative_url=8;//文档相对地址 | ||
| 725 | optional string url =9;//文档地址 | 725 | optional string url =9;//文档地址 |
| 726 | optional uint32 cur_V=10; | 726 | optional uint32 cur_V=10; |
| 727 | optional uint32 cur_H=11; | 727 | optional uint32 cur_H=11; |
| 728 | optional uint32 scale=12; | 728 | optional uint32 scale=12; |
| 729 | optional bool visible=13; | 729 | optional bool visible=13; |
| 730 | optional uint32 action=14;//0,无操作, 1翻页、2.显示/隐藏 | 730 | optional uint32 action=14;//0,无操作, 1翻页、2.显示/隐藏 |
| 731 | - optional string id=15;//文档在服务器数据库中的唯一id | 731 | + optional string db_id=15;//文档在服务器数据库中的唯一id |
| 732 | } | 732 | } |
| 733 | message RCGiftSendDataRequestPdu { | 733 | message RCGiftSendDataRequestPdu { |
| 734 | optional uint32 initiator = 1; | 734 | optional uint32 initiator = 1; |
-
请 注册 或 登录 后发表评论