当前位置: 首页>>代码示例>>Java>>正文


Java ModDevice类代码示例

本文整理汇总了Java中com.motorola.mod.ModDevice的典型用法代码示例。如果您正苦于以下问题:Java ModDevice类的具体用法?Java ModDevice怎么用?Java ModDevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ModDevice类属于com.motorola.mod包,在下文中一共展示了ModDevice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateModList

import com.motorola.mod.ModDevice; //导入依赖的package包/类
/**
 * Query and update mod device info
 */
protected void updateModList() {
    if (modManager == null) {
        onModDevice(null);
        return;
    }

    try {
        /** Get currently mod device list from ModManager */
        List<ModDevice> l = modManager.getModList(false);
        if (l == null || l.size() == 0) {
            onModDevice(null);
            return;
        }

        // TODO: simply get first mod device from list for this example.
        // You may need consider to check expecting mod base on PID/VID or so on.
        for (ModDevice d : l) {
            if (d != null) {
                onModDevice(d);
            }
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkaudio,代码行数:29,代码来源:Personality.java

示例2: updateModList

import com.motorola.mod.ModDevice; //导入依赖的package包/类
/** Query and update mod device info */
protected void updateModList() {
    if (modManager == null) {
        onModDevice(null);
        return;
    }

    try {
        /** Get currently mod device list from ModManager */
        List<ModDevice> l = modManager.getModList(false);
        if (l == null || l.size() == 0) {
            onModDevice(null);
            return;
        }

        // TODO: simply get first mod device from list for this example.
        // You may need consider to check expecting mod base on PID/VID or so on.
        for (ModDevice d : l) {
            if (d != null) {
                onModDevice(d);
            }
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkbattery,代码行数:27,代码来源:Personality.java

示例3: handleMessage

import com.motorola.mod.ModDevice; //导入依赖的package包/类
public void handleMessage(Message msg) {
    switch (msg.what) {
        case Personality.MSG_MOD_DEVICE:
            /** Mod attach/detach */
            ModDevice device = personality.getModDevice();
            onModDevice(device);
            break;
        case Personality.MSG_MOD_BATTERY:
            /** Battery data updated */
            BatteryPersonality.BatteryStat stat = (BatteryPersonality.BatteryStat) msg.obj;
            onBattery(stat.core, stat.mod, stat.modUsageType, stat.modEfficiency);
            break;
        default:
            Log.i(Constants.TAG, "MainActivity - Un-handle mod events: " + msg.what);
            break;
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkbattery,代码行数:18,代码来源:MainActivity.java

示例4: handleMessage

import com.motorola.mod.ModDevice; //导入依赖的package包/类
public void handleMessage(Message msg) {
    switch (msg.what) {
        case Personality.MSG_RAW_IO_READY:
            /** The RAW I/O of attached mod device is created. */
            onRawInterfaceReady();
            break;
        case Personality.MSG_RAW_DATA:
            // TODO: Does not expect any data from example blinky mod.
            // Handle the data here if you are developing a consumer mod
            // and grant data from the mod.
            break;
        case Personality.MSG_RAW_IO_EXCEPTION:
            /** Got RAW I/O exception. */
            break;
        case Personality.MSG_MOD_DEVICE:
            /** Got mod attach/detach event */
            ModDevice device = rawPersonality.getModDevice();
            if (device == null) {
                notificationManager.cancelAll();
            }
            break;
        default:
            Log.e(Constants.TAG, "RawPersonalityService - Un-handle events: " + msg.what);
            break;
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkutility,代码行数:27,代码来源:RawPersonalityService.java

示例5: handleMessage

import com.motorola.mod.ModDevice; //导入依赖的package包/类
public void handleMessage(Message msg) {
    switch (msg.what) {
        case Personality.MSG_MOD_DEVICE:
            /** Mod attach/detach */
            ModDevice device = personality.getModDevice();
            onModDevice(device);
            break;
        default:
            Log.i(Constants.TAG, "MainActivity - Un-handle mod events: " + msg.what);
            break;
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkaudio,代码行数:13,代码来源:MainActivity.java

示例6: isMDKMod

import com.motorola.mod.ModDevice; //导入依赖的package包/类
/** Check whether attached mod is a MDK based on VID/PID */
private boolean isMDKMod(ModDevice device) {
    if (device == null) {
        // Mod not attached
        return false;
    } else if (device.getVendorId() == Constants.VID_DEVELOPER
            && device.getProductId() == Constants.PID_DEVELOPER) {
        // MDK in developer mode
        return true;
    } else {
        // Check MDK
        return device.getVendorId() == Constants.VID_MDK;
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkaudio,代码行数:15,代码来源:MainActivity.java

示例7: onModDevice

import com.motorola.mod.ModDevice; //导入依赖的package包/类
/** Mod device attach/detach, update modDisplay */
@Override
public void onModDevice(ModDevice d) {
    super.onModDevice(d);

    if (d == null || modManager == null) {
        modDisplay = null;
    } else {
        modDisplay = (ModDisplay) modManager.getClassManager(ModProtocol.Protocol.MODS_DISPLAY);
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkdisplay,代码行数:12,代码来源:DisplayPersonality.java

示例8: handleMessage

import com.motorola.mod.ModDevice; //导入依赖的package包/类
public void handleMessage(Message msg) {
    switch (msg.what) {
        case Personality.MSG_MOD_DEVICE:
            /** Mod attach/detach */
            ModDevice device = personality.getModDevice();
            onModDevice(device);
            break;
        default:
            Log.i(Constants.TAG, "MainActivity - Un-handle events: " + msg.what);
            break;
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkdisplay,代码行数:13,代码来源:MainActivity.java

示例9: isMDKMod

import com.motorola.mod.ModDevice; //导入依赖的package包/类
/** Check current mod whether in developer mode */
private boolean isMDKMod(ModDevice device) {
    if (device == null) {
        /** Mod is not available */
        return false;
    } else if (device.getVendorId() == Constants.VID_DEVELOPER
            && device.getProductId() == Constants.PID_DEVELOPER) {
        // MDK in developer mode
        return true;
    } else {
        // Check MDK
        return device.getVendorId() == Constants.VID_MDK;
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkdisplay,代码行数:15,代码来源:MainActivity.java

示例10: onModDevice

import com.motorola.mod.ModDevice; //导入依赖的package包/类
/** Mod device attach/detach */
@Override
public void onModDevice(ModDevice d) {
    super.onModDevice(d);

    /** Check whether mod device is available and implement BATTERY protocol */
    if (null == modManager || null == modDevice
            || !modDevice.hasDeclaredProtocol(ModProtocol.Protocol.BATTERY)) {
        batteryStat.reset();
    } else {
        queryStatus();
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkbattery,代码行数:14,代码来源:BatteryPersonality.java

示例11: isMDKMod

import com.motorola.mod.ModDevice; //导入依赖的package包/类
/** Check whether attached mod is a MDK based on VID/PID */
private boolean isMDKMod(ModDevice device) {
    if (device == null) {
        // Mod not attached
        return false;
    } else if (device.getVendorId() == Constants.VID_DEVELOPER) {
        // MDK in developer mode
        return true;
    } else {
        // Check MDK
        return device.getVendorId() == Constants.VID_MDK;
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkbattery,代码行数:14,代码来源:MainActivity.java

示例12: handleMessage

import com.motorola.mod.ModDevice; //导入依赖的package包/类
public void handleMessage(Message msg) {
    switch (msg.what) {
        case Personality.MSG_MOD_DEVICE:
            /** Mod attach/detach */
            ModDevice device = personality.getModDevice();
            onModDevice(device);
            break;
        case Personality.MSG_RAW_DATA:
            /** Mod raw data */
            byte[] buff = (byte[]) msg.obj;
            int length = msg.arg1;
            onRawData(buff, length);
            break;
        case Personality.MSG_RAW_IO_READY:
            /** Mod RAW I/O ready to use */
            onRawInterfaceReady();
            break;
        case Personality.MSG_RAW_IO_EXCEPTION:
            /** Mod RAW I/O exception */
            onIOException();
            break;
        case Personality.MSG_RAW_REQUEST_PERMISSION:
            /** Request grant RAW_PROTOCOL permission */
            onRequestRawPermission();
        default:
            Log.i(Constants.TAG, "MainActivity - Un-handle events: " + msg.what);
            break;
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdksensor,代码行数:30,代码来源:MainActivity.java

示例13: onModDevice

import com.motorola.mod.ModDevice; //导入依赖的package包/类
/**  Handle mod device attach/detach events */
@Override
public void onModDevice(ModDevice d) {
    super.onModDevice(d);

    if (modDevice != null) {
        openRawDeviceifAvailable();
    } else {
        closeRawDeviceifAvailable();
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdksensor,代码行数:12,代码来源:RawPersonality.java

示例14: isMDKMod

import com.motorola.mod.ModDevice; //导入依赖的package包/类
/**
 * Check current mod whether in developer mode
 */
private boolean isMDKMod(ModDevice device) {
    if (device == null) {
        /** Mod is not available */
        return false;
    } else if (device.getVendorId() == Constants.VID_DEVELOPER) {
        // MDK in developer mode
        return true;
    } else {
        // Check MDK
        return device.getVendorId() == Constants.VID_MDK;
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkutility,代码行数:16,代码来源:MainActivity.java

示例15: getModMode

import com.motorola.mod.ModDevice; //导入依赖的package包/类
/**
 * Check current mod whether in developer mode
 */
private int getModMode(ModDevice device) {
    if (device == null) {
        return Constants.INVALID_ID;
    }

    if (device.getVendorId() == Constants.VID_DEVELOPER) {
        return Constants.MDK_MOD_DEVELOPER;
    } else if (isMDKMod(device)) {
        return Constants.MDK_MOD_EXAMPLE;
    } else {
        return Constants.INVALID_ID;
    }
}
 
开发者ID:MotorolaMobilityLLC,项目名称:mdkutility,代码行数:17,代码来源:MainActivity.java


注:本文中的com.motorola.mod.ModDevice类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。