/*
 FPLUGDeviceService.java
 Copyright (c) 2015 NTT DOCOMO,INC.
 Released under the MIT license
 http://opensource.org/licenses/mit-license.php
 */
package org.deviceconnect.android.deviceplugin.fplug;

import org.deviceconnect.android.deviceplugin.fplug.fplug.FPLUGController;
import org.deviceconnect.android.deviceplugin.fplug.profile.FPLUGSystemProfile;
import org.deviceconnect.android.deviceplugin.fplug.service.FPLUGService;
import org.deviceconnect.android.event.EventManager;
import org.deviceconnect.android.event.cache.MemoryCacheController;
import org.deviceconnect.android.message.DConnectMessageService;
import org.deviceconnect.android.profile.SystemProfile;
import org.deviceconnect.android.service.DConnectService;

/**
 * F-PLUG device plug-in.
 *
 * @author NTT DOCOMO, INC.
 */
public class FPLUGDeviceService extends DConnectMessageService
    implements FPLUGApplication.ControllerListener {

    @Override
    public void onCreate() {
        super.onCreate();
        EventManager.INSTANCE.setController(new MemoryCacheController());

        FPLUGApplication app = (FPLUGApplication) getApplication();
        app.setControllerListener(this);
    }

    @Override
    protected void onManagerUninstalled() {
        // Managerアンインストール検知時の処理
    }

    @Override
    protected void onManagerTerminated() {
        // Manager正常終了通知受信時の処理
    }

    @Override
    protected void onDevicePluginReset() {
        // Device Plug-inへのReset要求受信時の処理
    }

    @Override
    protected SystemProfile getSystemProfile() {
        return new FPLUGSystemProfile();
    }

    @Override
    public void onAdded(final FPLUGController controller) {
        getServiceProvider().addService(new FPLUGService(controller.getAddress()));
    }

    @Override
    public void onConnected(final FPLUGController controller) {
        DConnectService service = getServiceProvider().getService(controller.getAddress());
        if (service != null) {
            service.setOnline(true);
        }
    }

    @Override
    public void onDisconnected(final FPLUGController controller) {
        DConnectService service = getServiceProvider().getService(controller.getAddress());
        if (service != null) {
            service.setOnline(false);
        }
    }
}

@@ -726,16 +726,42 @@
 rvice;%0A%0A
+import android.util.Log;%0A%0A
 /**%0A * F
@@ -1293,203 +1293,540 @@
     
-%7D%0A%0A    @Override%0A    protected void onManagerTerminated() %7B%0A        // Manager%E6%AD%A3%E5%B8%B8%E7%B5%82%E4%BA%86%E9%80%9A%E7%9F%A5%E5%8F%97%E4%BF%A1%E6%99%82%E3%81%AE%E5%87%A6%E7%90%86%0A    %7D%0A%0A    @Override%0A    protected void onDevicePluginReset() %7B%0A        // Device Plug-in%E3%81%B8%E3%81%AEReset%E8%A6%81%E6%B1%82%E5%8F%97%E4%BF%A1%E6%99%82%E3%81%AE%E5%87%A6%E7%90%86
+    if (BuildConfig.DEBUG) %7B%0A            Log.i(%22fplug.dplugin%22, %22Plug-in : onManagerUninstalled%22);%0A        %7D%0A    %7D%0A%0A    @Override%0A    protected void onManagerTerminated() %7B%0A        // Manager%E6%AD%A3%E5%B8%B8%E7%B5%82%E4%BA%86%E9%80%9A%E7%9F%A5%E5%8F%97%E4%BF%A1%E6%99%82%E3%81%AE%E5%87%A6%E7%90%86%0A        if (BuildConfig.DEBUG) %7B%0A            Log.i(%22fplug.dplugin%22, %22Plug-in : onManagerTerminated%22);%0A        %7D%0A    %7D%0A%0A    @Override%0A    protected void onDevicePluginReset() %7B%0A        // Device Plug-in%E3%81%B8%E3%81%AEReset%E8%A6%81%E6%B1%82%E5%8F%97%E4%BF%A1%E6%99%82%E3%81%AE%E5%87%A6%E7%90%86%0A        if (BuildConfig.DEBUG) %7B%0A            Log.i(%22fplug.dplugin%22, %22Plug-in : onDevicePluginReset%22);%0A        %7D
 %0A   

デバッグ用ログ追加。