From: TrillGates Date: Tue, 13 Apr 2021 12:52:47 +0000 (+0800) Subject: update interface with friend info. X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=3d02778baa5f16bcc20903b66f50ff611510d296;p=protocol_srv.git update interface with friend info. --- diff --git a/app/src/main/aidl/com/enqualcomm/support/IFZDCallback.aidl b/app/src/main/aidl/com/enqualcomm/support/IFZDCallback.aidl index 619dd8a6..4bcaaef3 100644 --- a/app/src/main/aidl/com/enqualcomm/support/IFZDCallback.aidl +++ b/app/src/main/aidl/com/enqualcomm/support/IFZDCallback.aidl @@ -4,11 +4,10 @@ package com.enqualcomm.support; interface IFZDCallback { void onContractsLoaded(); void onBRIdLoaded(in String brId); - void onFriendsAddResult(in boolean isSuccess); void onCallRequestResult(int result); void onBRIdEmpty(); void onRemoteReject(in String remoteUserId,in int type); - void onFriendsMakeResult(in int result); + void onFriendsMakeResult(in int result,String friendName,String id,String phoneNum); void onFriendsUnbindResult(); void onFriendsListLoaded(); } \ No newline at end of file diff --git a/app/src/main/java/com/enqualcomm/support/CoreService.java b/app/src/main/java/com/enqualcomm/support/CoreService.java index fd46a347..d1225899 100644 --- a/app/src/main/java/com/enqualcomm/support/CoreService.java +++ b/app/src/main/java/com/enqualcomm/support/CoreService.java @@ -1710,12 +1710,14 @@ public class CoreService extends Service { private final IFZDService.Stub mFZDService = new IFZDService.Stub() { @Override public void registerCallback(IFZDCallback callback) { + ICLogger.d("registerCallback..."); //接口注册 runtime.setFZDRemoteCallback(callback); } @Override public void unregisterCallback(IFZDCallback callback) { + ICLogger.d("unregisterCallback..."); //取消接口注册 runtime.removeFZDRemoteCallback(callback); } @@ -1775,7 +1777,7 @@ public class CoreService extends Service { //交朋友的话是根据配置去走蓝牙交友 //还是位置交友 //目前先实现位置交友的功能 - protocol_fzd.makeFriendsByPosition(connection,runtime); + protocol_fzd.makeFriendsByPosition(connection, runtime); } @Override diff --git a/app/src/main/java/com/ic/protocols/protocol_fzd.java b/app/src/main/java/com/ic/protocols/protocol_fzd.java index 5f6d596a..8fe0b65f 100644 --- a/app/src/main/java/com/ic/protocols/protocol_fzd.java +++ b/app/src/main/java/com/ic/protocols/protocol_fzd.java @@ -1579,7 +1579,6 @@ public class protocol_fzd { ICLogger.i("收到服务器时间 LGZONE " + data); handleLGZONE(mRuntime, data); break; - case CENTER: ICLogger.d("收到中心号码设置--> " + data); handleCENTER(cmd, data, mRuntime); @@ -1720,7 +1719,7 @@ public class protocol_fzd { case PPR: //这个结果有可能是平台主动解除的 //也有可能是客户端自己解除的 - handleFriendUnbindResult(mRuntime, data); + handleFriendUnbindResult(mRuntime); ICLogger.d("解除好友的指令..." + data); break; case PP: @@ -1734,7 +1733,6 @@ public class protocol_fzd { break; } return ret; - } /** @@ -1784,10 +1782,12 @@ public class protocol_fzd { } try { int i = fzdCallback.beginBroadcast(); + ICLogger.d("call back count == > " + i); while (i > 0) { i--; IFZDCallback broadcastItem = fzdCallback.getBroadcastItem(i); broadcastItem.onFriendsListLoaded(); + ICLogger.d("onFriendsListLoaded..."); } } catch (Exception e) { e.printStackTrace(); @@ -1821,13 +1821,15 @@ public class protocol_fzd { // boolean contains = data.contains(CMDSPLIT); int result = 0; + String friendName = ""; + String friendId = ""; + String phoneNum = ""; if (contains) { result = 0; //成功的结果 String[] split = data.split(CMDSPLIT); - String friendId = split[0]; - String friendName = Util.decodeUnicode2Utf8(split[1]); - String phoneNum = ""; + friendId = split[0]; + friendName = Util.decodeUnicode2Utf8(split[1]); if (split.length == 3) { phoneNum = split[2]; } @@ -1853,7 +1855,7 @@ public class protocol_fzd { while (i > 0) { i--; IFZDCallback broadcastItem = fzdCallback.getBroadcastItem(i); - broadcastItem.onFriendsMakeResult(result); + broadcastItem.onFriendsMakeResult(result, friendName, friendId, phoneNum); } } catch (Exception e) { e.printStackTrace(); @@ -1862,7 +1864,7 @@ public class protocol_fzd { } } - private void handleFriendUnbindResult(Runtime mRuntime, String data) { + private void handleFriendUnbindResult(Runtime mRuntime) { //解除有结果了,然去拉取一下新的用户列表吧 RemoteCallbackList fzdCallback = mRuntime.getFZDCallback(); if (fzdCallback == null) {