yy1717
2021-02-07 cea2a94fc97e79897cdfd217be8250c075974a1a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.anyun.exam.lib;
 
import android.content.Context;
import android.util.Log;
 
 
/**
 * MyApplication2
 * Created by lzw on 2019/6/5. 13:15:20
 * 邮箱:632393724@qq.com
 * All Rights Saved! Chongqing AnYun Tech co. LTD
 */
public class AYSdk  implements IAYExamInterface{
 
    private static final String TAG = "AYSDK";
 
 
    //安运驾考系统 sdk 单例模式
    private  volatile static  AYSdk ourInstance = null;
    private Context mContext;
 
 
    public static AYSdk getInstance() {
        if (ourInstance == null){
            synchronized (AYSdk.class){
                if (ourInstance == null){
                    ourInstance = new AYSdk();
                }
            }
        }
        return ourInstance;
    }
 
    /**
     * 初始化SDK
     * @param context
     */
    public void init(Context context){
        this.mContext = context;
        //bind service
    SvrManager.getInstance().bindRemoteService(mContext);
    }
 
 
 
    /**
     * 解绑
     */
    public void uninit(){
        if (mContext != null){
        //UnbinService
            SvrManager.getInstance().unBindRemoteService(mContext);
        }else{
            Log.e(TAG,"mContext == null,please init SDK firstly");
            throw new RuntimeException("mContext == null,please init SDK firstly");
        }
    }
 
    private AYSdk() {
 
    }
 
 
    @Override
    public void checkSignal(int type) {
 
    }
 
    @Override
    public void add() {
        SvrManager.getInstance().add();
    }
 
    @Override
    public void registListener(IAYExamListener iayExamListener) {
        SvrManager.getInstance().registerListener(iayExamListener);
 
    }
 
    @Override
    public void sendCmd(int cmd, String s) {
 
        SvrManager.getInstance().sendCmd(cmd,s);
    }
 
 
 
 
}