
#define LOG_TAG "BnMyBinder"

/*#include <binder/IPCThreadState.h>
#include <utils/Log.h>

#include <private/android_filesystem_config.h>

#include <sys/time.h>
#include <sys/resource.h>

#include <signal.h>
#include <stdio.h>
#include <unistd.h>*/

#include <BnMyBinder.h>
#include <utils/Debug.h>
#include <utils/Log.h>
#include <binder/Parcel.h>

namespace android {


    status_t BnMyBinder::onTransact(
        uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) {

        switch(code) {
            case LOAD_BOMB_TRANSACTION:
            {
                CHECK_INTERFACE(IMyBinder, data, reply);
                bool err = const_cast<BnMyBinder*>(this)->loadBomb(data.readInt32());
                reply->writeInt32(err);
            }
            return NO_ERROR;
            break;
                
            case CHECK_BOMB_TRANSACTION:                
            {
                CHECK_INTERFACE(IMyBinder, data, reply);
                int restBomb = const_cast<BnMyBinder*>(this)->checkBomb();
                reply->writeInt32(restBomb);
            }
            return NO_ERROR;
            break;

            case FIRE_TRANSACTION:
            {
                CHECK_INTERFACE(IMyBinder, data, reply);
                bool err = const_cast<BnMyBinder*>(this)->fire();
                reply->writeInt32(err);
            }
            return NO_ERROR;
            break;  

            default:
                return BBinder::onTransact(code, data, reply, flags);
        }

    }
}

