OpenECHO
 All Classes Namespaces Files Functions Variables
DefaultController.java
Go to the documentation of this file.
1 package com.sonycsl.echo.processing.defaults;
2 
3 import java.io.IOException;
5 
6 public class DefaultController extends Controller {
7 
8  byte[] mStatus = {0x30};
9  byte[] mLocation = {0x00};
10  byte[] mFaultStatus = {0x42};
11  byte[] mManufacturerCode = {0,0,0};
12 
13  @Override
14  protected byte[] getOperationStatus() { return mStatus; }
15 
16  public void changeOperationStatus(boolean status) {
17  byte b = (status ? (byte)0x30 : (byte)0x31) ;
18 
19  if(mStatus[0] == b) return ;
20 
21  mStatus[0] = b;
22  try {
23  inform().reqInformOperationStatus().send();
24  } catch (IOException e) { e.printStackTrace(); }
25  }
26 
27  @Override
28  protected boolean setInstallationLocation(byte[] edt) {
30  return true;
31  }
32 
33  @Override
34  protected byte[] getInstallationLocation() {return mLocation;}
35 
36  public void changeInstallationLocation(byte location) {
37  if(mLocation[0] == location) return ;
38  mLocation[0] = location;
39  try {
40  inform().reqInformInstallationLocation().send();
41  } catch (IOException e) { e.printStackTrace(); }
42  }
43  @Override
44  protected byte[] getFaultStatus() { return mFaultStatus;}
45 
46  public void changeFaultStatus(boolean status) {
47  byte b = (status?(byte)0x41:(byte)0x42) ;
48 
49  if(mFaultStatus[0] == b) return ;
50  mFaultStatus[0] = b;
51  try {
52  inform().reqInformFaultStatus().send();
53  } catch (IOException e) { e.printStackTrace();}
54  }
55 
56  @Override
57  protected byte[] getManufacturerCode() {return mManufacturerCode;}
58 
59  @Override
60  protected boolean setOperationStatus(byte[] edt) {
61  mStatus = edt;
62  return true;
63  }
64 }
65