NIMSDK-AOS  9.16.3
StatusCode.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk;
2 
6 public enum StatusCode {
7 
11  INVALID(0, ""),
12 
16  UNLOGIN(1, ""),
17 
21  NET_BROKEN(2, ""),
22 
26  CONNECTING(3, ""),
27 
31  LOGINING(4, ""),
32 
36  SYNCING(5, ""),
37 
41  LOGINED(6, ""),
42 
46  KICKOUT(7, ""),
47 
52 
56  FORBIDDEN(9, ""),
57 
61  VER_ERROR(10, ""),
62 
66  PWD_ERROR(11, ""),
67 
71  DATA_UPGRADE(12, ""),
72 
76  NEED_RECONNECT(13, ""),
77 
81  NEED_CHANGE_LBS(14, ""),
82 
86  LOGOUT(15,"")
87 
88  ;
89 
95  public boolean wontAutoLogin() {
96  return this == KICKOUT || this == KICK_BY_OTHER_CLIENT || this == FORBIDDEN || this == PWD_ERROR || this == DATA_UPGRADE;
97  }
98 
105  public boolean wontAutoLoginForever() {
106  return this == KICKOUT || this == KICK_BY_OTHER_CLIENT;
107  }
108 
109  public boolean shouldReLogin() {
110  return this == UNLOGIN || this == NET_BROKEN || this == StatusCode.NEED_RECONNECT || this == StatusCode.NEED_CHANGE_LBS;
111  }
112 
113  private int value;
114 
116  private String desc;
117 
118  StatusCode(int value, String desc) {
119  this.value = value;
120  this.desc = desc;
121  }
122 
123  public int getValue() {
124  return value;
125  }
126 
127  public String getDesc() {
128  return desc;
129  }
130 
131  public void setDesc(String desc) {
132  this.desc = desc;
133  }
134 
135  public static StatusCode typeOfValue(int value) {
136  for (StatusCode c : values()) {
137  if (c.getValue() == value) {
138  return c;
139  }
140  }
141 
142  return INVALID;
143  }
144 
145  public static StatusCode statusOfResCode(int resCode) {
146  switch (resCode) {
148  return StatusCode.LOGINED;
151  return StatusCode.FORBIDDEN;
153  return StatusCode.VER_ERROR;
157  return StatusCode.PWD_ERROR;
159  return StatusCode.KICKOUT;
161  return StatusCode.NEED_RECONNECT;
165  default:
166  return StatusCode.UNLOGIN;
167  }
168  }
169 }
static final short RES_DEVICE_NOT_TRUST
设备不在信任设备表里
CONNECTING
正在连接服务器
Definition: StatusCode.java:26
static final short RES_EUIDPASS
密码不正确
static StatusCode typeOfValue(int value)
PWD_ERROR
用户名或密码错误
Definition: StatusCode.java:66
用户当前状态码定义
Definition: StatusCode.java:6
云信服务器主要响应码定义
NET_BROKEN
网络连接已断开
Definition: StatusCode.java:21
KICK_BY_OTHER_CLIENT
被同时在线的其他端主动踢掉
Definition: StatusCode.java:51
static final short RES_ACCOUNT_BLOCK
帐号被禁用
static final short RES_EEXIST
对象已经存在
boolean wontAutoLoginForever()
判断处于当前状态码时,SDK还会不会继续自动重连登录,即使进程杀掉重启,也不会再做自动登录。 FORBIDDEN可...
static final short RES_NEED_CHANGE_LBS
需要切换LBS 不在ResponseDispatcherPush::makeResponse中传给主进程,在其他地方直接通过RemoteAgent::resp...
FORBIDDEN
被服务器禁止登录
Definition: StatusCode.java:56
static final short RES_ENONEXIST
目标(对象或用户)不存在
static final short RES_NEED_RECONNECT
需要重连 不在ResponseDispatcherPush::makeResponse中传给主进程,在其他地方直接通过RemoteAgent::respons...
VER_ERROR
客户端版本错误
Definition: StatusCode.java:61
static final short RES_SUCCESS
操作成功
static final short RES_FORBIDDEN
应用被封禁
boolean wontAutoLogin()
判断处于当前状态码时,SDK还会不会继续自动重连登录。
Definition: StatusCode.java:95
static StatusCode statusOfResCode(int resCode)
StatusCode(int value, String desc)
static final short RES_VERSION_EXPIRED
版本号太旧,需要升级
UNLOGIN
未登录/登录失败
Definition: StatusCode.java:16
KICKOUT
被其他端的登录踢掉
Definition: StatusCode.java:46
static final short RES_EPARAM
参数错误