+//******************************************************************
+//
+// Copyright 2015 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+
package org.iotivity.service.resourcecontainer;
import java.util.HashMap;
-/******************************************************************
- *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
+//******************************************************************
+//
+// Copyright 2015 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
/**
* @file
-/******************************************************************
- *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
+//******************************************************************
+//
+// Copyright 2015 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
package org.iotivity.service.resourcecontainer;
-/******************************************************************
- *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
+//******************************************************************
+//
+// Copyright 2015 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
/**
* @file
}
}
catch(Exception e){
- Log.e(TAG, e.getMessage());
+ Log.e(TAG, e.getMessage(), e);
}
Log.d(TAG, "Have to register android bundle");
}
}
public void registerResource(String bundleId, AndroidBundleResource resource){
+ Log.d(TAG, "register Resource");
// bundleResources.add(resource);
nativeRegisterAndroidResource(resource, resource.getAttributeKeys(), bundleId,
resource.getURI(), resource.getResourceType(),
}
public List<ResourceConfig> getConfiguredBundleResources(String bundleId) {
+ Log.d(TAG, "getConfiguredBundleResource " + bundleId);
int configuredResources = getNumberOfConfiguredResources(bundleId);
+ Log.d(TAG, "configured resources " + configuredResources);
Vector<ResourceConfig> configs = new Vector<ResourceConfig>();
public void unregisterResource(AndroidBundleResource resource){
+ Log.d(TAG, "unregister Resource");
nativeUnregisterAndroidResource(resource, resource.getURI());
}
public int getNumberOfConfiguredResources(String bundleId){
+ Log.d(TAG, "getNumberOfConfiguredResources");
return nativeGetNumberOfConfiguredResources(bundleId);
}
public String[] getConfiguredResourceParams(String bundleId, int resId){
+ Log.d(TAG, "getConfiguredResourceParams");
return nativeGetConfiguredResourceParams(bundleId, resId);
}
}
-/******************************************************************
- *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
+//******************************************************************
+//
+// Copyright 2015 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
/**
* @file
import java.util.Map;
import java.util.Vector;
-// TODO null check for parameters
/**
* This class provides APIs for managing the container and bundles in the
* container.
-/******************************************************************
- *
- * Copyright 2015 Samsung Electronics All Rights Reserved.
- *
- *
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- ******************************************************************/
+//******************************************************************
+//
+// Copyright 2015 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
package org.iotivity.service.resourcecontainer;
"handleGetAttributesRequest", "()Lorg/iotivity/service/resourcecontainer/RcsResourceAttributes;");
//LOGD("Looking for softSensorResource class.");
//jclass androidBundleSoftSensorResourceClass = m_env->FindClass("org/iotivity/service/resourcecontainer/AndroidBundleSoftSensorResource");
- LOGD("Looking for onUpdatedInputResource2.");
+ LOGD("Looking for onUpdatedInputResource.");
jclass superclass = m_env->GetSuperclass(m_bundleResourceClass);
jclass classClass = m_env->FindClass("java/lang/Class");
(JNIEnv *env, jobject obj, jobject bundleResource, jobjectArray attributes, jstring bundleId,
jstring uri, jstring resourceType, jstring res_name)
{
+ JNIEnvWrapper envWrapper(env);
LOGD("nativeRegisterAndroidResource");
- const char *str_bundleId = env->GetStringUTFChars(bundleId, 0);
- LOGD("retrieved bundle id.");
- const char *str_uri = env->GetStringUTFChars(uri, 0);
- LOGD("retrieved uri.");
- const char *str_resourceType = env->GetStringUTFChars(resourceType, 0);
- LOGD("retrieved resource type");
- const char *str_res_name = env->GetStringUTFChars(res_name, 0);
+ auto str_bundle_id = toStdString(&envWrapper, bundleId);
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer", "retrieved bundle id: %s.", str_bundle_id.c_str());
+ auto str_uri = toStdString(&envWrapper, uri);
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer", "retrieved uri: %s.", str_uri.c_str());
+ auto str_resourceType = toStdString(&envWrapper, resourceType);
+ __android_log_print(ANDROID_LOG_DEBUG, "JNI-RCSResourceContainer", "retrieved resource type: %s.", str_resourceType.c_str());
+ auto str_res_name = toStdString(&envWrapper, res_name);
LOGD("retrieved res name.");
AndroidResource res;
BundleResource::Ptr androidResource = std::make_shared< AndroidResource >
- (env, obj, bundleResource, str_bundleId, attributes);
+ (env, obj, bundleResource, str_bundle_id, attributes);
ResourceContainerImpl *container = ResourceContainerImpl::getImplInstance();
- androidResource->m_uri = string(str_uri, strlen(str_uri));
- androidResource->m_resourceType = string(str_resourceType, strlen(str_resourceType));
- androidResource->m_name = string(str_res_name, strlen(str_res_name));
+ androidResource->m_uri = str_uri;
+ androidResource->m_resourceType = str_resourceType;
+ androidResource->m_name = str_res_name;
+ androidResource->m_bundleId = str_bundle_id;
// link java resource instance to c++ resource instance
env->SetLongField(bundleResource, g_field_mNativeHandle, reinterpret_cast< jlong >(androidResource.get()));
JNIEnv *env, jobject obj, jstring bundleId)
{
(void)obj;
+ LOGD("nativeGetNumberOfConfiguredResources");
const char *str_bundleId = env->GetStringUTFChars(bundleId, 0);
-
+ LOGD("retrieved bundle id");
+ __android_log_print(ANDROID_LOG_DEBUG, "CONTAINER", "getNumberOfConfiguredResources %s",str_bundleId);
ResourceContainerImpl *container = ResourceContainerImpl::getImplInstance();
vector< resourceInfo > resourceConfig;
container->getResourceConfiguration(str_bundleId, &resourceConfig);
(JNIEnv *, jobject, jobject, jobjectArray, jstring, jstring, jstring, jstring);
JNIEXPORT void JNICALL Java_org_iotivity_service_resourcecontainer_RcsResourceContainer_nativeUnregisterAndroidResource
- (JNIEnv *, jobject, jstring, jobject, jstring);
+ (JNIEnv *, jobject, jobject, jstring);
JNIEXPORT jint JNICALL Java_org_iotivity_service_resourcecontainer_RcsResourceContainer_nativeGetNumberOfConfiguredResources
(JNIEnv *, jobject, jstring);
-JNIEXPORT jobjectArray JNICALL Java_org_iotivity_service_resourcecontainer_RcsResourceContainer_nativeBaseActivator_getConfiguredResourceParams
+JNIEXPORT jobjectArray JNICALL Java_org_iotivity_service_resourcecontainer_RcsResourceContainer_nativeGetConfiguredResourceParams
(JNIEnv *, jobject, jstring, jint);
#define MAX_PATH 2048
-/* Annother way to create a context: */
-auto info_logger = []() -> boost::iostreams::stream<OC::oc_log_stream> &
-{
- static OC::oc_log_stream ols(oc_make_ostream_logger);
- static boost::iostreams::stream<OC::oc_log_stream> os(ols);
-
- return os;
-};
void getCurrentPath(std::string *pPath)
{
int main()
{
- info_logger()->set_module("ContainerTest");
- info_logger()->set_level(OC_LOG_INFO);
- info_logger() << "Starting container test." << std::flush;
+ cout << "Starting container test." << endl;
std::string strConfigPath;
getCurrentPath(&strConfigPath);
--- /dev/null
+//******************************************************************
+//
+// Copyright 2015 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+package org.iotivity.service.sample.androidbundle.resources;
+
+import android.content.Context;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.util.Log;
+
+import org.iotivity.service.resourcecontainer.AndroidBundleResource;
+import org.iotivity.service.resourcecontainer.RcsResourceAttributes;
+import org.iotivity.service.resourcecontainer.RcsValue;
+
+public class GyroscopeResource extends AndroidBundleResource implements SensorEventListener {
+ private static final String LOG_TAG = GyroscopeResource.class.getSimpleName();
+ private final SensorManager mSensorManager;
+ private final Sensor humiditySensor;
+
+ public GyroscopeResource(Context context){
+ super(context);
+ this.setResourceType("oic.r.gyroscope");
+ this.setName("gyroscopeSensor");
+ mSensorManager = (SensorManager) context.getApplicationContext().getSystemService(Context.SENSOR_SERVICE);
+ humiditySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
+ mSensorManager.registerListener(this, humiditySensor, SensorManager.SENSOR_DELAY_NORMAL);
+ Log.d(LOG_TAG, "Created new gyroscope instance");
+ }
+
+ @Override
+ protected void initAttributes() {
+ this.m_attributes.put("x", 0d);
+ this.m_attributes.put("y", 0d);
+ this.m_attributes.put("z", 0d);
+ }
+
+ @Override
+ public void handleSetAttributesRequest(RcsResourceAttributes attrs) {
+ Log.i(LOG_TAG, "Set Attributes called with ");
+ for(String key: attrs.keySet()){
+ Log.i(LOG_TAG, " " + key + ": " + attrs.get(key));
+ }
+ }
+
+ @Override
+ public RcsResourceAttributes handleGetAttributesRequest() {
+ Log.i(LOG_TAG, "Get Attributes called");
+ Log.i(LOG_TAG, "Returning: ");
+ for(String key: m_attributes.keySet()){
+ Log.i(LOG_TAG, " " + key + ": " + m_attributes.get(key));
+ }
+ return this.m_attributes;
+ }
+
+ @Override
+ public void onSensorChanged(SensorEvent sensorEvent) {
+ Log.i(LOG_TAG, "Sensor event " + sensorEvent.values[0] + ", " + sensorEvent.values[1]
+ + ", " + sensorEvent.values[2]);
+ setAttribute("x", new RcsValue( (int) (sensorEvent.values[0])), true);
+ setAttribute("y", new RcsValue( (int) (sensorEvent.values[1]) ) , true);
+ setAttribute("z", new RcsValue( (int) (sensorEvent.values[2]) ) , true);
+ }
+
+ @Override
+ public void onAccuracyChanged(Sensor sensor, int i) {
+
+ }
+}
</resources>
</bundle>
<bundle>
- <id>oic.bundle.android.light</id>
+ <id>oic.android.sample</id>
<path>org.iotivity.service.sample.androidbundle.apk</path>
<activator>org.iotivity.service.sample.androidbundle.SampleActivator</activator>
<version>1.0.0</version>
<resourceUri>/android/light/1</resourceUri>
</resourceInfo>
<resourceInfo>
- <name>LightIntensity1</name>
- <resourceType>oic.r.lightintensity</resourceType>
- <resourceUri>/android/lightintensity/1</resourceUri>
+ <name>LightIntensity1</name>
+ <resourceType>oic.r.lightintensity</resourceType>
+ <resourceUri>/android/lightintensity/1</resourceUri>
+ </resourceInfo>
+ <resourceInfo>
+ <name>Humidity1</name>
+ <resourceType>oic.r.humidity</resourceType>
+ <resourceUri>/android/humidity/1</resourceUri>
+ </resourceInfo>
+ <resourceInfo>
+ <name>Tepmerature1</name>
+ <resourceType>oic.r.temperature</resourceType>
+ <resourceUri>/android/temperature/1</resourceUri>
+ </resourceInfo>
+ <resourceInfo>
+ <name>Gyroscope1</name>
+ <resourceType>oic.r.gyroscope</resourceType>
+ <resourceUri>/android/gyroscope/1</resourceUri>
</resourceInfo>
<resourceInfo>
<name>DiscomfortIndexSensor1</name>
bool Configuration::isHasInput(std::string &bundleId) const
{
+
try
{
+ OC_LOG_V(INFO, CONTAINER_TAG, "isHasInput: (%d) %s",m_mapisHasInput.at(bundleId), bundleId.c_str() );
return m_mapisHasInput.at(bundleId);
}
catch (std::out_of_range &e)
{
+ OC_LOG_V(INFO, CONTAINER_TAG, "isHasInput out of range %s.", bundleId.c_str());
return false;
}
}
string strBundleId;
string strKey, strValue;
+ OC_LOG(INFO, CONTAINER_TAG, "Loading resource configuration!");
if (m_loaded)
{
// <id>
strBundleId = bundle->first_node(BUNDLE_ID)->value();
+ OC_LOG_V(INFO, CONTAINER_TAG, "Comparing bundle ids %s - %s !", strBundleId.c_str(), bundleId.c_str());
+
if (!strBundleId.compare(bundleId))
{
+ OC_LOG_V(INFO, CONTAINER_TAG, "Inspecting");
// <resourceInfo>
for (resource = bundle->first_node(OUTPUT_RESOURCES_TAG)->first_node(OUTPUT_RESOURCE_INFO);
resource; resource = resource->next_sibling())
if (strKey.compare(INPUT_RESOURCE))
{
m_mapisHasInput[strBundleId] = true;
+ OC_LOG_V(INFO, CONTAINER_TAG, "Bundle has input (%s)", strBundleId.c_str());
}
for (subItem2 = subItem->first_node(); subItem2;
OC_LOG_V(ERROR, CONTAINER_TAG, "Exception (%s)", e.what());
}
}
+ else{
+ OC_LOG(INFO, CONTAINER_TAG, "config is not loaded yet !!");
+ }
}
void Configuration::getConfigDocument(std::string pathConfigFile)
}
}
}
-}
\ No newline at end of file
+}
((BundleInfoInternal *) bundleInfo)->setJavaBundle(false);
registerSoBundle(bundleInfo);
}
+ // other cases might be for example .apk for android, which are loaded in the wrapper
else{
((BundleInfoInternal *) bundleInfo)->setSoBundle(false);
((BundleInfoInternal *) bundleInfo)->setJavaBundle(false);
registerExtBundle(bundleInfo);
}
- // other cases might be for example .apk for android, which are loaded in the wrapper
}
void ResourceContainerImpl::unregisterBundle(RCSBundleInfo *bundleInfo)
string strResourceType = resource->m_resourceType;
RCSResourceObject::Ptr server = nullptr;
- OC_LOG_V(INFO, CONTAINER_TAG, "Registration 2 of resource (%s)" ,
- std::string(strUri + ", " + strResourceType).c_str());
+ OC_LOG_V(INFO, CONTAINER_TAG, "Registration of resource (%s)" ,
+ std::string(strUri + ", " + strResourceType + "," + resource->m_bundleId).c_str());
registrationLock.lock();
if (m_mapResources.find(strUri) == m_mapResources.end())
std::bind(&ResourceContainerImpl::setRequestHandler, this,
std::placeholders::_1, std::placeholders::_2));
- OC_LOG_V(INFO, CONTAINER_TAG, "Registration finished (%s)",
- std::string(strUri + ", " +
- strResourceType).c_str());
+
if (m_config->isHasInput(resource->m_bundleId))
{
+ OC_LOG_V(INFO, CONTAINER_TAG, "Resource has input (%s)",
+ std::string(strUri + ", " +
+ strResourceType).c_str());
discoverInputResource(strUri);
}
+ else{
+ OC_LOG_V(INFO, CONTAINER_TAG, "Resource has no input (%s)",
+ std::string(strUri + ", " +
+ strResourceType).c_str());
+ }
+ OC_LOG_V(INFO, CONTAINER_TAG, "Registration finished (%s)",
+ std::string(strUri + ", " +
+ strResourceType).c_str());
// to get notified if bundle resource attributes are updated
resource->registerObserver((NotificationReceiver *) this);
{
m_config->getResourceConfiguration(bundleId, configOutput);
}
+ else{
+ OC_LOG_V(DEBUG, CONTAINER_TAG, "no config present ");
+ }
}
RCSGetResponse ResourceContainerImpl::getRequestHandler(const RCSRequest &request,
void ResourceContainerImpl::startBundle(const std::string &bundleId)
{
+ OC_LOG_V(INFO, CONTAINER_TAG, "startBundle %s",bundleId.c_str());
if (m_bundles.find(bundleId) != m_bundles.end())
{
if (!m_bundles[bundleId]->isActivated())
void ResourceContainerImpl::stopBundle(const std::string &bundleId)
{
+ OC_LOG_V(INFO, CONTAINER_TAG, "stopBundle %s",bundleId.c_str());
if (m_bundles.find(bundleId) != m_bundles.end())
{
if (m_bundles[bundleId]->isActivated())
void ResourceContainerImpl::removeBundle(const std::string &bundleId)
{
+ OC_LOG_V(INFO, CONTAINER_TAG, "removeBundle %s",bundleId.c_str());
if (m_bundles.find(bundleId) != m_bundles.end())
{
BundleInfoInternal *bundleInfo = m_bundles[bundleId];
void ResourceContainerImpl::removeResourceConfig(const std::string &bundleId,
const std::string &resourceUri)
{
+ OC_LOG_V(INFO, CONTAINER_TAG, "removeResourceConfig %s, %s",bundleId.c_str(), resourceUri.c_str());
if (m_bundles.find(bundleId) != m_bundles.end())
{
if (m_bundles[bundleId]->getSoBundle())
std::list< string > ResourceContainerImpl::listBundleResources(const std::string &bundleId)
{
+ OC_LOG_V(INFO, CONTAINER_TAG, "listBundleResources %s",bundleId.c_str());
std::list < string > ret;
if (m_mapBundleResources.find(bundleId) != m_mapBundleResources.end())
std::string(bundleInfo->getActivatorName()).c_str());
m_bundles[bundleInfo->getID()] = ((BundleInfoInternal *)bundleInfo);
+ // in this case at least the resource configuration needs to be loaded
+ // in order to mark potential input resources for soft sensors
+ std::vector< resourceInfo > temp;
+ OC_LOG_V(INFO, CONTAINER_TAG, "Loading resource config(%s)",
+ std::string(bundleInfo->getID()).c_str());
+ getResourceConfiguration(bundleInfo->getID(),
+ &temp);
OC_LOG(INFO, CONTAINER_TAG, "Bundle registered");
}