upload tizen1.0 source
[profile/ivi/wrt-plugins-tizen.git] / src / standards / Tizen / NFC / plugin_initializer.cpp
index 871a19e..a154b65 100755 (executable)
  * 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. 
+ * limitations under the License.
  */
 
 #include <dpl/log/log.h>
 #include <Commons/plugin_initializer_def.h>
+#include <Commons/WrtAccess/WrtAccess.h>
 #include "JSNFCManager.h"
 #include "JSNdefMessage.h"
 #include "JSNdefRecord.h"
 #include "JSNdefRecordURI.h"
 #include "JSNdefRecordMedia.h"
 
-void on_widget_start_callback(int widgetId, JavaScriptContext context, const engine_interface_t *interface)
+using namespace WrtDeviceApis;
+using namespace WrtDeviceApis::Commons;
+
+void on_widget_start_callback(int widgetId)
 {
     LogDebug("[TIZEN1.0\\NFC ] on_widget_start_callback (" << widgetId << ")");
+    Try
+    {
+        WrtAccessSingleton::Instance().initialize(widgetId);
+    }
+    Catch(Commons::Exception)
+    {
+        LogError("WrtAccess initialization failed");
+    }
 }
 
 void on_widget_stop_callback(int widgetId)
 {
     LogDebug("[TIZEN1.0\\NFC ] on_widget_stop_callback (" << widgetId << ")");
+    Try
+    {
+        WrtAccessSingleton::Instance().deinitialize(widgetId);
+    }
+    Catch(Commons::Exception)
+    {
+        LogError("WrtAccess deinitialization failed");
+    }
 }
 
 PLUGIN_ON_WIDGET_START(on_widget_start_callback)