--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>plugin.gear.noti</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.pde.ManifestBuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.pde.SchemaBuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.pde.PluginNature</nature>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ </natures>\r
+</projectDescription>\r
"device.notify", "oc.mi.def", entitycb,
EnumSet.of(ResourceProperty.DISCOVERABLE));
}
+ else{
+ Log.w(TAG, "Something Happened");
+ }
}
@Override
package oic.plugin.gear.noti;
+import java.util.EnumSet;
import java.util.UUID;
import oic.plugin.gear.noti.Activator.TemplateTypes;
.getRequestHandle());
response.setResourceHandle(resourcerequest
.getResourceHandle());
- Log.d("JUDO",
- "/******************************************************************************/");
- Log.d("JUDO", "Name: "
- + resourcerequest.getResourceRepresentation()
- .getValueString("name"));
- Log.d("JUDO", "Name: "
- + resourcerequest.getResourceRepresentation()
- .getValueString("power"));
- Log.d("JUDO", "Name: "
- + resourcerequest.getResourceRepresentation()
- .getValueInt("brigthness"));
- Log.d("JUDO", "Name: "
- + resourcerequest.getResourceRepresentation()
- .getValueInt("color"));
- Log.d("JUDO",
- "/******************************************************************************/");
switch (requestType) {
case GET:
break;
case PUT:
+ try {
textNoti = resourcerequest
.getResourceRepresentation()
- .getValueString("power");
+ .getValue("power");
+ } catch (OcException e) {
+ // TODO Auto-generated catch block
+ Log.e(TAG, e.getMessage());
+ }
perform(0);
break;
case POST:
}
response.setErrorCode(200);
// representation.setUri("/a/galaxy/gear");
- representation.setValueString("name",
- Activator.myNotify.m_name);
- representation.setValueString("power",
- Activator.myNotify.m_power);
- representation.setValueInt("brightness", 0);
- representation.setValueInt("color", 0);
- response.setResourceRepresentation(representation);
+ try {
+ representation.setValue("name",
+ Activator.myNotify.m_name);
+ representation.setValue("power",
+ Activator.myNotify.m_power);
+ representation.setValue("brightness", 0);
+ representation.setValue("color", 0);
+ response.setResourceRepresentation(representation);
+ } catch (OcException e) {
+ // TODO Auto-generated catch block
+ Log.e(TAG, e.getMessage());
+ }
+
try {
OcPlatform.sendResponse(response);
} catch (OcException e) {
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>plugin.hue</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.pde.ManifestBuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.pde.SchemaBuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.pde.PluginNature</nature>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ </natures>\r
+</projectDescription>\r
System.currentTimeMillis());
PlatformConfig cfg = new PlatformConfig(
- this,
+ getApplicationContext(),
ServiceType.IN_PROC,
ModeType.CLIENT_SERVER,
"0.0.0.0", 0,
package oic.plugin.hue;
+import java.util.EnumSet;
import java.util.List;
import org.iotivity.base.EntityHandlerResult;
.getResourceCache().getAllLights();
for (PHLight light : mmyLights) {
PHLightState lightState = new PHLightState();
- String str = resourcerequest
- .getResourceRepresentation()
- .getValueString("power");
- if (str.equals("on")) {
- lightState.setOn(true);
- Activator.myLight.m_power = "on";
- } else if (str.equals("off")) {
- lightState.setOn(false);
- Activator.myLight.m_power = "off";
+ try {
+ String str = resourcerequest
+ .getResourceRepresentation()
+ .getValue("power");
+ if (str.equals("on")) {
+ lightState.setOn(true);
+ Activator.myLight.m_power = "on";
+ } else if (str.equals("off")) {
+ lightState.setOn(false);
+ Activator.myLight.m_power = "off";
+ }
+ int setHueValue = resourcerequest
+ .getResourceRepresentation()
+ .getValue("color");
+ lightState.setHue(setHueValue);
+ Activator.myLight.m_color = resourcerequest
+ .getResourceRepresentation()
+ .getValue("color");
+ } catch (OcException e) {
+ // TODO Auto-generated catch block
+ Log.e(TAG, e.getMessage());
}
- lightState.setHue(resourcerequest
- .getResourceRepresentation()
- .getValueInt("color"));
- Activator.myLight.m_color = resourcerequest
- .getResourceRepresentation()
- .getValueInt("color");
mbridge.updateLightState(light, lightState);
}
break;
}
response.setErrorCode(200);
// representation.setUri("/a/huebulb");
- representation.setValueString("name",
- Activator.myLight.m_name);
- representation.setValueString("power",
- Activator.myLight.m_power);
- representation.setValueInt("brightness",
- Activator.myLight.m_brightness);
- representation.setValueInt("color",
- Activator.myLight.m_color);
+ try {
+ representation.setValue("name",
+ Activator.myLight.m_name);
+ representation.setValue("power",
+ Activator.myLight.m_power);
+ representation.setValue("brightness",
+ Activator.myLight.m_brightness);
+ representation.setValue("color",
+ Activator.myLight.m_color);
+ } catch (OcException e) {
+ // TODO Auto-generated catch block
+ Log.e(TAG, e.getMessage());
+ }
response.setResourceRepresentation(representation);
try {
OcPlatform.sendResponse(response);
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>plugin.wemo</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.pde.ManifestBuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.eclipse.pde.SchemaBuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.pde.PluginNature</nature>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ </natures>\r
+</projectDescription>\r
.getWeMoDeviceByUDN(udn);
if ((listDevice != null) && (listDevice.isAvailable())) {
PlatformConfig cfg = new PlatformConfig(
- this,
+ getApplicationContext(),
ServiceType.IN_PROC,
ModeType.CLIENT_SERVER, "0.0.0.0", 0,
QualityOfService.LOW);
package oic.plugin.wemo;
import java.util.ArrayList;
+import java.util.EnumSet;
import org.iotivity.base.EntityHandlerResult;
import org.iotivity.base.OcException;
String type = wemoDevice.getType();
if (type.equals(WeMoDevice.SWITCH)) {
String newState = "";
- if (resourcerequest
- .getResourceRepresentation()
- .getValueString("power")
- .equals("on")) {
- Activator.mySmartPlug.m_power = "on";
- newState = WeMoDevice.WEMO_DEVICE_ON;
- } else if (resourcerequest
- .getResourceRepresentation()
- .getValueString("power")
- .equals("off")) {
- Activator.mySmartPlug.m_power = "off";
- newState = WeMoDevice.WEMO_DEVICE_OFF;
- }
+ try {
+ if (resourcerequest
+ .getResourceRepresentation()
+ .getValue("power")
+ .equals("on")) {
+ Activator.mySmartPlug.m_power = "on";
+ newState = WeMoDevice.WEMO_DEVICE_ON;
+ } else if (resourcerequest
+ .getResourceRepresentation()
+ .getValue("power")
+ .equals("off")) {
+ Activator.mySmartPlug.m_power = "off";
+ newState = WeMoDevice.WEMO_DEVICE_OFF;
+ }
+ } catch (OcException e) {
+ // TODO Auto-generated catch block
+ Log.e(TAG, e.getMessage());
+ }
+
Activator.mWeMoSDKContext.setDeviceState(
newState, wemoDevice.getUDN());
}
}
response.setErrorCode(200);
// representation.setUri("/a/wemo");
- representation.setValueString("name",
- Activator.mySmartPlug.m_name);
- representation.setValueString("power",
- Activator.mySmartPlug.m_power);
- representation.setValueInt("brightness", 0);
- representation.setValueInt("color", 0);
+ try {
+ representation.setValue("name",
+ Activator.mySmartPlug.m_name);
+ representation.setValue("power",
+ Activator.mySmartPlug.m_power);
+ representation.setValue("brightness", 0);
+ representation.setValue("color", 0);
+ } catch (OcException e) {
+ // TODO Auto-generated catch block
+ Log.e(TAG, e.getMessage());
+ }
+
response.setResourceRepresentation(representation);
try {
OcPlatform.sendResponse(response);