本文整理匯總了Java中com.integreight.onesheeld.sdk.ShieldFrame.addArgument方法的典型用法代碼示例。如果您正苦於以下問題:Java ShieldFrame.addArgument方法的具體用法?Java ShieldFrame.addArgument怎麽用?Java ShieldFrame.addArgument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.integreight.onesheeld.sdk.ShieldFrame
的用法示例。
在下文中一共展示了ShieldFrame.addArgument方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onSensorChanged
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
@Override
public void onSensorChanged(SensorEvent event) {
if (flag && (oldInput != event.values[0] || isFirstTime)) {
isFirstTime = false;
frame = new ShieldFrame(UIShield.TEMPERATURE_SHIELD.getId(),
TEMPERATURE_VALUE);
oldInput = event.values[0];
frame.addArgument((byte) Math.round(event.values[0]));
sendShieldFrame(frame);
Log.d("Sensor Data of X", event.values[0] + "");
if (eventHandler != null)
eventHandler.onSensorValueChangedFloat(event.values[0] + "");
//
flag = false;
}
}
示例2: run
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
@Override
public void run() {
// Do work
ShieldFrame frame = new ShieldFrame(UIShield.CLOCK_SHIELD.getId(), CLOCK_VALUE);
calendar = Calendar.getInstance();
if (frame != null && calendar != null) {
if (isClockBegin) {
frame.addArgument((byte) calendar.get(Calendar.SECOND));
sendShieldFrame(frame);
}
String hour = calendar.get(Calendar.HOUR_OF_DAY) + "";
String min = calendar.get(Calendar.MINUTE) + "";
String sec = calendar.get(Calendar.SECOND) + "";
if (eventHandler != null)
eventHandler.onTimeChanged(""
+ (hour.length() == 1 ? "0" + hour : hour) + ":"
+ (min.length() == 1 ? "0" + min : min) + ":"
+ (sec.length() == 1 ? "0" + sec : sec) + "",
calendar.get(Calendar.AM_PM) == Calendar.AM);
}
if (handler != null)
handler.postDelayed(this, PERIOD);
}
示例3: onSensorChanged
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
@Override
public void onSensorChanged(SensorEvent event) {
if (flag && (oldInput != event.values[0] || isFirstTime)) {
isFirstTime = false;
frame = new ShieldFrame(UIShield.PRESSURE_SHIELD.getId(),
PRESSURE_VALUE);
oldInput = event.values[0];
// frame.addByteArgument((byte) Math.round(event.values[0]));
frame.addArgument(2, Math.round(event.values[0]));
sendShieldFrame(frame);
Log.d("Sensor Data of X", event.values[0] + "");
if (eventHandler != null)
eventHandler.onSensorValueChangedFloat(event.values[0] + "");
//
flag = false;
}
}
示例4: setRowAndColumn
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
public void setRowAndColumn(int row, int column) {
ArduinoPin columnPin = matchedShieldPins.get(activity.getString(R.string.keypad_column)+" " + column);
if (columnPin != null) {
digitalWrite(columnPin.microHardwarePin, true);
}
columnByte = BitsUtils.setBit(columnByte, column);
ArduinoPin rowPin = matchedShieldPins.get(activity.getString(R.string.keypad_row)+" " + row);
if (rowPin != null) {
digitalWrite(rowPin.microHardwarePin, true);
}
rowByte = BitsUtils.setBit(rowByte, row);
sf = new ShieldFrame(UIShield.KEYPAD_SHIELD.getId(), DATA_IN);
sf.addArgument(rowByte);
sf.addArgument(columnByte);
sendShieldFrame(sf);
}
示例5: run
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
@Override
public void run() {
// Do work with the MIC values.
double amplitude = MicSoundMeter.getInstance().getAmplitudeEMA();
if (!Double.isInfinite(amplitude) && amplitude != 0) {
initialRequest = false;
ampl = amplitude;
// Log.d("MIC", "Amp = " + ampl);
frame = new ShieldFrame(UIShield.MIC_SHIELD.getId(), MIC_VALUE);
frame.addArgument((byte) Math.round(ampl));
sendShieldFrame(frame);
if (isResumed)
if (eventHandler != null)
eventHandler.getAmplitude(ampl);
}
// The Runnable is posted to run again here:
if (handler != null)
handler.postDelayed(this, PERIOD);
}
示例6: onResult
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
@Override
public void onResult(List<String> result) {
if (result != null && result.size() > 0) {
isWorking = false;
if (eventHandler != null)
eventHandler.onResult(result);
sf = new ShieldFrame(UIShield.SPEECH_RECOGNIZER_SHIELD.getId(),
SEND_RESULT);
recognized = result.get(0);
sf.addArgument(recognized.toLowerCase());
Log.d("Frame", sf.toString());
sendShieldFrame(sf, true);
} else {
onError(activity.getString(R.string.voice_recognizer_no_matching_result), SpeechRecognizer.ERROR_NO_MATCH);
}
}
示例7: resetRowAndColumn
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
public void resetRowAndColumn(int row, int column) {
ArduinoPin columnPin = matchedShieldPins.get(activity.getString(R.string.keypad_column)+" " + column);
if (columnPin != null) {
digitalWrite(columnPin.microHardwarePin, false);
}
columnByte = BitsUtils.resetBit(columnByte, column);
ArduinoPin rowPin = matchedShieldPins.get(activity.getString(R.string.keypad_row)+" " + row);
if (rowPin != null) {
digitalWrite(rowPin.microHardwarePin, false);
}
rowByte = BitsUtils.resetBit(rowByte, row);
sf = new ShieldFrame(UIShield.KEYPAD_SHIELD.getId(), DATA_IN);
sf.addArgument(rowByte);
sf.addArgument(columnByte);
sendShieldFrame(sf);
}
示例8: sendNewEmptyTagFrame
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
private void sendNewEmptyTagFrame() {
if (currentTag != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
DataReply tagId = getTagId();
DataReply maxSize = getNdefMaxSize();
if (!tagId.hasError() && !maxSize.hasError()) {
ShieldFrame sf = new ShieldFrame(SHIELD_ID, NEW_TAG_FRAME);
sf.addArgument(tagId.getBytesData());
sf.addArgument(2, maxSize.getIntegerData());
sf.addArgument(1, 0);
sf.addArgument(2, 0);
sendShieldFrame(sf, true);
}else {
sendError(TAG_READING_ERROR);
return;
}
}
}
}
示例9: sendIncomingNumber
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
@Override
public void sendIncomingNumber(String phoneNumber) {
// send frame contain Incoming Number..
Log.d("Phone::Controller::SendIncomingNum", phoneNumber);
frame = new ShieldFrame(UIShield.PHONE_SHIELD.getId(), (byte) 0x02);
frame.addArgument(phoneNumber);
sendShieldFrame(frame,true);
if (eventHandler != null)
eventHandler.onReceiveACall(phoneNumber);
}
示例10: onResult
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
@Override
public void onResult(List<String> result) {
if (result != null && result.size() > 0) {
if (eventHandler != null)
eventHandler.onResult(result);
sf = new ShieldFrame(UIShield.SPEECH_RECOGNIZER_SHIELD.getId(),
SEND_RESULT);
String recognized = result.get(0);
sf.addArgument(recognized.toLowerCase());
Log.d("Frame", sf.toString());
sendShieldFrame(sf, true);
} else {
onError(activity.getString(R.string.voice_recognizer_no_matching_result), SpeechRecognizer.ERROR_NO_MATCH);
}
}
示例11: onPatternDetected
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
public void onPatternDetected(List<LockPatternViewEx.Cell> pattern) {
frame=new ShieldFrame(UIShield.PATTERN_SHIELD.getId(),SEND_PATTERN);
patternPath=new byte[pattern.size()];
for (int i=0;i<pattern.size();i++)
{
patternPath[i]=(byte)((pattern.get(i).getRow())|((pattern.get(i).getColumn())<<4));
}
frame.addArgument(patternPath);
sendShieldFrame(frame,true);
}
示例12: onSmsReceiveSuccess
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
@Override
public void onSmsReceiveSuccess(String mobile_num, String sms_body) {
// send frame contain SMS body..
Log.d("SMS::Controller::onSmsReceiveSuccess", sms_body);
frame = new ShieldFrame(UIShield.SMS_SHIELD.getId(), (byte) 0x01);
frame.addArgument(mobile_num);
frame.addArgument(sms_body);
Log.d("Fram", frame.getArgumentAsString(1));
sendShieldFrame(frame,true);
}
示例13: onSensorChanged
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
@Override
public void onSensorChanged(SensorEvent event) {
if (flag && (oldInput != event.values[0] || isFirstTime)) {
Log.d("Sensor Data of X", event.values[0] + "");
if (eventHandler != null)
eventHandler.onSensorValueChangedFloat(event.values[0] + "");
isFirstTime = false;
frame = new ShieldFrame(UIShield.LIGHT_SHIELD.getId(), LIGHT_VALUE);
oldInput = event.values[0];
frame.addArgument(3, Math.round(event.values[0]));
sendShieldFrame(frame);
flag = false;
}
}
示例14: sendFrame
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
private void sendFrame(Location myLocation) {
// TODO Auto-generated method stub
frame = new ShieldFrame(UIShield.GPS_SHIELD.getId(), GPS_VALUE);
float lat = (float) myLocation.getLatitude();
float lang = (float) myLocation.getLongitude();
frame.addArgument(lat);
frame.addArgument(lang);
sendShieldFrame(frame);
}
示例15: onSensorChanged
import com.integreight.onesheeld.sdk.ShieldFrame; //導入方法依賴的package包/類
@Override
public void onSensorChanged(SensorEvent event) {
if (flag
&& (oldInput_x != event.values[0]
|| oldInput_y != event.values[1]
|| oldInput_z != event.values[2] || isFirstTime)) {
// TODO Auto-generated method stub
frame = new ShieldFrame(UIShield.MAGNETOMETER_SHIELD.getId(),
MAGNETOMETER_VALUE);
isFirstTime = false;
oldInput_x = event.values[0];
oldInput_y = event.values[1];
oldInput_z = event.values[2];
// frame.addByteArgument((byte) Math.round(event.values[0]));
frame.addArgument(event.values[0]);
frame.addArgument(event.values[1]);
frame.addArgument(event.values[2]);
sendShieldFrame(frame);
if (eventHandler != null)
eventHandler.onSensorValueChangedFloat(event.values);
Log.d("Sensor Data of X", event.values[0] + "");
Log.d("Sensor Data of Y", event.values[1] + "");
Log.d("Sensor Data of Z", event.values[2] + "");
// calculate magnetic field value
float magnetic_field = (float) Math
.sqrt((event.values[0] * event.values[0])
+ (event.values[1] * event.values[1])
+ (event.values[2] * event.values[2]));
Log.d("Magnetic field value = ", magnetic_field + "");
//
flag = false;
}
}