Android Open Source - OHC-android Device






From Project

Back to project page OHC-android.

License

The source code is released under:

MIT License

If you think the Android project OHC-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package io.openhc.ohc.basestation.device;
/*from  w  w  w  .j  av a  2  s.com*/
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;

import io.openhc.ohc.OHC;

public class Device
{
  private String name;
  private String id;

  private HashMap<Integer, Field> fields = new HashMap<>();
  private int field_num;

  public Device(String name, String id)
  {
    this.name = name;
    this.id = id;
  }

  public void set_name(String name)
  {
    this.name = name;
  }

  public void add_field(int id, Field f)
  {
    this.fields.put(id, f);
  }

  public void rm_field(int id)
  {
    this.fields.remove(id);
  }

  public void set_field(int id, Field field)
  {
    this.fields.put(id, field);
  }

  public int get_field_num()
  {
    return this.field_num;
  }

  public void set_field_num(int num)
  {
    this.field_num = num;
  }

  public String get_name()
  {
    return this.name;
  }

  public String get_id()
  {
    return this.id;
  }

  public List<Field> get_fields()
  {
    List<Field> fields = new ArrayList<>();
    Iterator it = this.fields.entrySet().iterator();
    while(it.hasNext())
    {
      Field field = (Field)((Map.Entry)it.next()).getValue();
      if(field.is_accessible())
        fields.add(field);
    }
    return fields;
  }

  @Override
  public String toString()
  {
    return this.name;
  }
}




Java Source Code List

io.openhc.ohc.ApplicationTest.java
io.openhc.ohc.OHC.java
io.openhc.ohc.OHC_ui.java
io.openhc.ohc.basestation.Basestation.java
io.openhc.ohc.basestation.device.Device.java
io.openhc.ohc.basestation.device.Field.java
io.openhc.ohc.basestation.rpc.Base_rpc.java
io.openhc.ohc.logging.OHC_Logger.java
io.openhc.ohc.skynet.Broadcaster.java
io.openhc.ohc.skynet.Network.java
io.openhc.ohc.skynet.Receiver.java
io.openhc.ohc.skynet.Sender.java
io.openhc.ohc.skynet.Socket_timeout.java
io.openhc.ohc.skynet.transaction.Transaction_generator.java
io.openhc.ohc.ui.Field_adapter.java
io.openhc.ohc.ui.input.filter.Input_filter_float.java
io.openhc.ohc.ui.input.filter.Input_filter_int.java
io.openhc.ohc.ui.input.filter.Input_filter_string.java