本文整理汇总了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();
}
}
示例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();
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}
}
示例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;
}
}
示例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;
}
}
示例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();
}
}
示例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;
}
}
示例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;
}
}
示例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();
}
}
示例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;
}
}
示例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;
}
}