[master]expand the interface of socket, add sn
This commit is contained in:
@@ -16,7 +16,7 @@ public interface IMogoCloudSocketManager {
|
||||
*
|
||||
* @param context 上下文
|
||||
*/
|
||||
void init(Context context, double lat, double lon);
|
||||
void init(Context context, String sn, double lat, double lon);
|
||||
|
||||
/**
|
||||
* 重新连接
|
||||
|
||||
@@ -75,9 +75,9 @@ public class SocketManager implements IMogoCloudSocketManager {
|
||||
private int mCurrentIndex = 0;
|
||||
|
||||
@Override
|
||||
public void init(Context context, double lat, double lon) {
|
||||
public void init(Context context, String sn, double lat, double lon) {
|
||||
if (cloudClientConfig.isThirdLogin()) {
|
||||
ThirdSocketManager.getInstance().init(context, lat, lon);
|
||||
ThirdSocketManager.getInstance().init(context, sn, lat, lon);
|
||||
} else {
|
||||
InternalSocketManager.getInstance().init(context);
|
||||
}
|
||||
|
||||
@@ -45,18 +45,22 @@ public class ThirdSocketManager implements Callback, ErrorCallback {
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
public void init(Context context, double lat, double lon) {
|
||||
public void init(Context context, String sn, double lat, double lon) {
|
||||
MLocation mLocation = new MLocation();
|
||||
mLocation.setCoordinate(GCJ02);
|
||||
mLocation.setLatitude(lat);
|
||||
mLocation.setLongitude(lon);
|
||||
String tempSn = cloudClientConfig.getSn();
|
||||
if (tempSn == null || tempSn.isEmpty()) {
|
||||
tempSn = sn;
|
||||
}
|
||||
SocketConfig.instance()
|
||||
.setAppContext(context.getApplicationContext())
|
||||
.setEnvironment(getEnvironment())
|
||||
.setClient(MogoCommon.Client.car)
|
||||
.setChannelId(SocketServicesConstants.SOCKET_CHANNEL_ID)
|
||||
.setOpenAnalytics(true)
|
||||
.setSn(cloudClientConfig.getSn())
|
||||
.setSn(tempSn)
|
||||
.setToken(cloudClientConfig.getToken())
|
||||
.setSecretKey(cloudClientConfig.getSecretKey())
|
||||
.setAuthPubKey(cloudClientConfig.getAuthPubKey())
|
||||
@@ -69,7 +73,7 @@ public class ThirdSocketManager implements Callback, ErrorCallback {
|
||||
SocketClient.getInstance().start(context);
|
||||
}
|
||||
|
||||
public void reConnect(){
|
||||
public void reConnect() {
|
||||
SocketClient.getInstance().stopAndRestart();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user