OpenECHO
 All Classes Namespaces Files Functions Variables
DefaultNodeProfile.java
Go to the documentation of this file.
1 package com.sonycsl.echo.processing.defaults;
2 
3 import java.io.IOException;
4 
6 
7 public class DefaultNodeProfile extends NodeProfile {
8 
9  byte[] mManufactureCode = {0,0,0};
10  byte[] mStatus = {0x30};
11  byte[] mIdNumber = {(byte)0xFE,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
12  byte[] mUniqueId = {0,1};
13 
14  public DefaultNodeProfile() {
15  super();
16  // TODO Auto-generated constructor stub
17  }
18 
19  @Override
20  protected byte[] getManufacturerCode() {return mManufactureCode;}
21 
22  @Override
23  protected byte[] getOperatingStatus() { return mStatus; }
24 
25  public void changeOperatingStatus(boolean status) {
26  byte b = (status?(byte)0x30:(byte)0x31) ;
27 
28  if(mStatus[0] == b) return ;
29  mStatus[0] = b;
30  try {
31  inform().reqInformOperatingStatus().send();
32  } catch (IOException e) {e.printStackTrace();}
33  }
34 
35  @Override
36  protected byte[] getIdentificationNumber() {return mIdNumber;}
37 
38  @Override
39  protected boolean setUniqueIdentifierData(byte[] edt) {
40  if((edt[0] & 0x40) != 0)
41  return false;
42 
43  mUniqueId[0] = (byte)(((edt[0] & (byte)0x3F) | (mUniqueId[0] & 0x80)) | (byte)0x40);
44  mUniqueId[1] = edt[1];
45  return true;
46  }
47 
48  @Override
49  protected byte[] getUniqueIdentifierData() {return mUniqueId;}
50 
51 }