updated api for download binary
This commit is contained in:
@@ -41,7 +41,8 @@ public class WebAPIs {
|
||||
private static final String SERVICE_LIST_CITIES = "/indexing/list_cities";
|
||||
private static final String SERVICE_LIST_OPERATORS = "/indexing/list_operators";
|
||||
private static final String SERVICE_LIST_INDEXES = "/indexing/list_indexes";
|
||||
private static final String SERVICE_DOWNLOAD_BIN = "/indexing/download_bin";
|
||||
private static final String SERVICE_DOWNLOAD_BIN = "/operation/download_bin";
|
||||
private static final String SERVICE_ONLINE_DECODE = "/operation/decode";
|
||||
|
||||
private int adminId;
|
||||
private String token;
|
||||
@@ -274,4 +275,30 @@ public class WebAPIs {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public int[] decodeIR(int indexId) {
|
||||
String decodeURL = URL_PREFIX + SERVICE_ONLINE_DECODE;
|
||||
DecodeRequest decodeRequest = new DecodeRequest();
|
||||
decodeRequest.setAdminId(adminId);
|
||||
decodeRequest.setToken(token);
|
||||
decodeRequest.setIndexId(indexId);
|
||||
|
||||
String bodyJson = decodeRequest.toJson();
|
||||
|
||||
if (null != bodyJson) {
|
||||
try {
|
||||
String response = postToServer(decodeURL, bodyJson);
|
||||
|
||||
DecodeResponse decodeResponse = new Gson().fromJson(response, DecodeResponse.class);
|
||||
|
||||
if (decodeResponse.getStatus().getCode() == Constants.ERROR_CODE_SUCCESS) {
|
||||
return decodeResponse.getEntity();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
104
src/net/irext/webapi/bean/ACStatus.java
Normal file
104
src/net/irext/webapi/bean/ACStatus.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package net.irext.webapi.bean;
|
||||
|
||||
/**
|
||||
* Filename: ACStatus.java
|
||||
* Revised: Date: 2017-03-28
|
||||
* Revision: Revision: 1.0
|
||||
* <p>
|
||||
* Description: Status descriptor for air-conditioner
|
||||
* <p>
|
||||
* Revision log:
|
||||
* 2017-03-28: created by strawmanbobi
|
||||
*/
|
||||
public class ACStatus {
|
||||
|
||||
private static final String TAG = ACStatus.class.getSimpleName();
|
||||
|
||||
private int acPower;
|
||||
private int acTemp;
|
||||
private int acMode;
|
||||
private int acWindDir;
|
||||
private int acWindSpeed;
|
||||
private int acDisplay;
|
||||
private int acSleep;
|
||||
private int acTimer;
|
||||
|
||||
public ACStatus() {
|
||||
}
|
||||
|
||||
public ACStatus(int acPower, int acMode, int acTemp, int acWindSpeed, int acWindDir,
|
||||
int acDisplay, int acSleep, int acTimer) {
|
||||
this.acPower = acPower;
|
||||
this.acTemp = acTemp;
|
||||
this.acMode = acMode;
|
||||
this.acWindDir = acWindDir;
|
||||
this.acWindSpeed = acWindSpeed;
|
||||
this.acDisplay = acDisplay;
|
||||
this.acSleep = acSleep;
|
||||
this.acTimer = acTimer;
|
||||
}
|
||||
|
||||
public int getAcPower() {
|
||||
return acPower;
|
||||
}
|
||||
|
||||
public void setAcPower(int acPower) {
|
||||
this.acPower = acPower;
|
||||
}
|
||||
|
||||
public int getAcTemp() {
|
||||
return acTemp;
|
||||
}
|
||||
|
||||
public void setAcTemp(int acTemp) {
|
||||
this.acTemp = acTemp;
|
||||
}
|
||||
|
||||
public int getAcMode() {
|
||||
return acMode;
|
||||
}
|
||||
|
||||
public void setAcMode(int acMode) {
|
||||
this.acMode = acMode;
|
||||
}
|
||||
|
||||
public int getAcWindDir() {
|
||||
return acWindDir;
|
||||
}
|
||||
|
||||
public void setAcWindDir(int acWindDir) {
|
||||
this.acWindDir = acWindDir;
|
||||
}
|
||||
|
||||
public int getAcWindSpeed() {
|
||||
return acWindSpeed;
|
||||
}
|
||||
|
||||
public void setAcWindSpeed(int acWindSpeed) {
|
||||
this.acWindSpeed = acWindSpeed;
|
||||
}
|
||||
|
||||
public int getAcDisplay() {
|
||||
return acDisplay;
|
||||
}
|
||||
|
||||
public void setAcDisplay(int acDisplay) {
|
||||
this.acDisplay = acDisplay;
|
||||
}
|
||||
|
||||
public int getAcSleep() {
|
||||
return acSleep;
|
||||
}
|
||||
|
||||
public void setAcSleep(int acSleep) {
|
||||
this.acSleep = acSleep;
|
||||
}
|
||||
|
||||
public int getAcTimer() {
|
||||
return acTimer;
|
||||
}
|
||||
|
||||
public void setAcTimer(int acTimer) {
|
||||
this.acTimer = acTimer;
|
||||
}
|
||||
}
|
||||
43
src/net/irext/webapi/bean/TemperatureRange.java
Normal file
43
src/net/irext/webapi/bean/TemperatureRange.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package net.irext.webapi.bean;
|
||||
|
||||
/**
|
||||
* Filename: TemperatureRange.java
|
||||
* Revised: Date: 2017-03-28
|
||||
* Revision: Revision: 1.0
|
||||
* <p>
|
||||
* Description: Temperature range for air-conditioner
|
||||
* <p>
|
||||
* Revision log:
|
||||
* 2017-03-28: created by strawmanbobi
|
||||
*/
|
||||
public class TemperatureRange {
|
||||
|
||||
private static final String TAG = TemperatureRange.class.getSimpleName();
|
||||
|
||||
private int tempMin;
|
||||
private int tempMax;
|
||||
|
||||
public TemperatureRange() {
|
||||
}
|
||||
|
||||
public TemperatureRange(int tempMin, int tempMax) {
|
||||
this.tempMin = tempMin;
|
||||
this.tempMax = tempMax;
|
||||
}
|
||||
|
||||
public int getTempMin() {
|
||||
return tempMin;
|
||||
}
|
||||
|
||||
public void setTempMin(int tempMin) {
|
||||
this.tempMin = tempMin;
|
||||
}
|
||||
|
||||
public int getTempMax() {
|
||||
return tempMax;
|
||||
}
|
||||
|
||||
public void setTempMax(int tempMax) {
|
||||
this.tempMax = tempMax;
|
||||
}
|
||||
}
|
||||
64
src/net/irext/webapi/request/DecodeRequest.java
Normal file
64
src/net/irext/webapi/request/DecodeRequest.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package net.irext.webapi.request;
|
||||
|
||||
import net.irext.webapi.bean.ACStatus;
|
||||
|
||||
/**
|
||||
* Filename: DecodeRequest.java
|
||||
* Revised: Date: 2017-05-16
|
||||
* Revision: Revision: 1.0
|
||||
* <p>
|
||||
* Description: HTTP decode online
|
||||
* <p>
|
||||
* Revision log:
|
||||
* 2017-05-16: created by strawmanbobi
|
||||
*/
|
||||
public class DecodeRequest extends BaseRequest {
|
||||
|
||||
private int indexId;
|
||||
private ACStatus acStatus;
|
||||
private int keyCode;
|
||||
private int changeWindDir;
|
||||
|
||||
public DecodeRequest(int indexId, ACStatus acStatus, int keyCode, int changeWindDir) {
|
||||
this.indexId = indexId;
|
||||
this.acStatus = acStatus;
|
||||
this.keyCode = keyCode;
|
||||
this.changeWindDir = changeWindDir;
|
||||
}
|
||||
|
||||
public DecodeRequest() {
|
||||
|
||||
}
|
||||
|
||||
public int getIndexId() {
|
||||
return indexId;
|
||||
}
|
||||
|
||||
public void setIndexId(int indexId) {
|
||||
this.indexId = indexId;
|
||||
}
|
||||
|
||||
public ACStatus getAcStatus() {
|
||||
return acStatus;
|
||||
}
|
||||
|
||||
public void setAcStatus(ACStatus acStatus) {
|
||||
this.acStatus = acStatus;
|
||||
}
|
||||
|
||||
public int getKeyCode() {
|
||||
return keyCode;
|
||||
}
|
||||
|
||||
public void setKeyCode(int keyCode) {
|
||||
this.keyCode = keyCode;
|
||||
}
|
||||
|
||||
public int getChangeWindDir() {
|
||||
return changeWindDir;
|
||||
}
|
||||
|
||||
public void setChangeWindDir(int changeWindDir) {
|
||||
this.changeWindDir = changeWindDir;
|
||||
}
|
||||
}
|
||||
33
src/net/irext/webapi/response/DecodeResponse.java
Normal file
33
src/net/irext/webapi/response/DecodeResponse.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package net.irext.webapi.response;
|
||||
|
||||
/**
|
||||
* Filename: DecodeResponse.java
|
||||
* Revised: Date: 2017-05-16
|
||||
* Revision: Revision: 1.0
|
||||
* <p>
|
||||
* Description: Online decode response
|
||||
* <p>
|
||||
* Revision log:
|
||||
* 2017-05-16: created by strawmanbobi
|
||||
*/
|
||||
public class DecodeResponse extends ServiceResponse {
|
||||
|
||||
private int[] entity;
|
||||
|
||||
public DecodeResponse(Status status, int[] entity) {
|
||||
super(status);
|
||||
this.entity = entity;
|
||||
}
|
||||
|
||||
public DecodeResponse() {
|
||||
|
||||
}
|
||||
|
||||
public int[] getEntity() {
|
||||
return entity;
|
||||
}
|
||||
|
||||
public void setEntity(int[] entity) {
|
||||
this.entity = entity;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user