예제 #1
0
 public void reencode_message_content(SGIPDeliver deliver) {
   String content = Utility.ucs2_to_gb2312(deliver.message_content);
   if (content == null) return;
   try {
     deliver.message_content = content.getBytes("GB2312");
     deliver.message_coding = 15;
     deliver.message_length = deliver.message_content.length;
   } catch (Exception e) {
     Log.log(e.getMessage(), 0x2000000000000004L);
     Log.log(e);
     Log.log("SGIPExchanger.reencode_message_content : unexpected exit !", 0x2000000000000004L);
   }
 }
예제 #2
0
 public CMPPDeliver unwrapDeliver(SGIPPacket packet) {
   try {
     SGIPDeliver sgip_deliver = new SGIPDeliver(packet);
     sgip_deliver.unwrap();
     SGIPDeliverResponse response = new SGIPDeliverResponse(sgip_deliver.sequence_id);
     response.gateway_name = sgip_deliver.gateway_name;
     response.sequence_id = sgip_deliver.sequence_id;
     response.node_id = sgip_deliver.node_id;
     response.time_stamp = sgip_deliver.time_stamp;
     response.result = (byte) sgip_deliver.checkValid();
     response.session_id = sgip_deliver.session_id;
     response.wrap();
     for (; !m_gateway.send(response); Engine.nap()) ;
     if (sgip_deliver.message_coding == 8) reencode_message_content(sgip_deliver);
     CMPPDeliver deliver = new CMPPDeliver(packet.sequence_id);
     deliver.gateway_name = sgip_deliver.gateway_name;
     deliver.session_id = sgip_deliver.session_id;
     deliver.guid = sgip_deliver.guid;
     long msg_id = (long) sgip_deliver.node_id & 0xfffffffffL;
     msg_id <<= 32;
     msg_id |= (long) sgip_deliver.time_stamp & 0xffffffffL;
     deliver.msg_id = msg_id;
     deliver.registered_delivery = 0;
     deliver.destination_id = sgip_deliver.sp_number;
     deliver.src_terminal_id = sgip_deliver.user_number;
     deliver.tp_pid = sgip_deliver.tp_pid;
     deliver.tp_udhi = sgip_deliver.tp_udhi;
     deliver.msg_fmt = sgip_deliver.message_coding;
     deliver.msg_length = sgip_deliver.message_length;
     deliver.msg_content = sgip_deliver.message_content;
     return deliver;
   } catch (Exception e) {
     Log.log(e);
   }
   Log.log(
       "SGIPExchanger("
           + m_nID
           + ","
           + m_gateway.m_strName
           + ").unwrapDeliver : unexpected exit !",
       0x2000000000000004L);
   return null;
 }