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


Java PebbleDictionary.addUint32方法代码示例

本文整理汇总了Java中com.getpebble.android.kit.util.PebbleDictionary.addUint32方法的典型用法代码示例。如果您正苦于以下问题:Java PebbleDictionary.addUint32方法的具体用法?Java PebbleDictionary.addUint32怎么用?Java PebbleDictionary.addUint32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.getpebble.android.kit.util.PebbleDictionary的用法示例。


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

示例1: testGetBytesLeft

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@Test
public void testGetBytesLeft() throws Exception
{
    PebbleCapabilities testCapabilities = new PebbleCapabilities(false, false, false, false, false, 100);

    PebbleDictionary testDictionary = new PebbleDictionary();
    assertEquals(92, PebbleUtil.getBytesLeft(testDictionary, testCapabilities));

    testDictionary.addInt8(1, (byte) 20);
    assertEquals(84, PebbleUtil.getBytesLeft(testDictionary, testCapabilities));

    testDictionary.addInt32(2, 20);
    assertEquals(73, PebbleUtil.getBytesLeft(testDictionary, testCapabilities));

    testDictionary.addBytes(3, new byte[]{1, 2, 3, 4});
    assertEquals(62, PebbleUtil.getBytesLeft(testDictionary, testCapabilities));

    testDictionary.addString(4, "abcde");
    assertEquals(50, PebbleUtil.getBytesLeft(testDictionary, testCapabilities));

    testDictionary.addUint32(1, 20);
    assertEquals(47, PebbleUtil.getBytesLeft(testDictionary, testCapabilities));
}
 
开发者ID:matejdro,项目名称:PebbleAndroidCommons,代码行数:24,代码来源:PebbleUtilTest.java

示例2: addPebbleSettings

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
/**
 * Add user settings to a PebbleDictionary
 * 
 * @param dict
 */
private void addPebbleSettings(PebbleDictionary dict) {
	SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

	// General settings
	int flags = 0;
	flags |= prefs.getBoolean("pref_show_header", true) ? 0x01 : 0; // constants are documented in the watchapp
	flags |= prefs.getBoolean("pref_12h", false) ? 0x02 : 0;
	flags |= prefs.getBoolean("pref_ampm", true) ? 0x04 : 0;
	flags |= Integer.parseInt(prefs.getString("pref_layout_font_size", "0")) % 2 == 1 ? 0x20 : 0;
	flags |= Integer.parseInt(prefs.getString("pref_layout_font_size", "0")) > 1 ? 0x40 : 0;
	flags |= Integer.parseInt(prefs.getString("pref_header_time_size", "1")) % 2 == 1 ? 0x80 : 0;
	flags |= Integer.parseInt(prefs.getString("pref_header_time_size", "1")) > 1 ? 0x100 : 0;
	flags |= prefs.getBoolean("pref_separator_date", false) ? 0x200 : 0;
	flags |= prefs.getBoolean("pref_enable_scroll", true) ? 0x400 : 0;
	flags |= prefs.getBoolean("pref_layout_countdown", false) ? 0x800 : 0;
	flags |= prefs.getBoolean("pref_continuous_scroll", false) ? 0x1000 : 0;
	flags |= prefs.getBoolean("pref_light_while_scrolling", false) ? 0x2000 : 0;
	flags |= prefs.getBoolean("pref_limit_persist", true) ? 0x4000 : 0;
	flags |= prefs.getBoolean("pref_invert_watchface", false) ? 0x8000 : 0;

	dict.addUint32(PEBBLE_KEY_SETTINGS_BOOLFLAGS, flags);
}
 
开发者ID:JanBobolz,项目名称:agendawatchfaceAndroid,代码行数:28,代码来源:AgendaWatchfaceService.java

示例3: buildDictionary

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
private PebbleDictionary buildDictionary() {
    PebbleDictionary dictionary = new PebbleDictionary();
    TimeZone tz = TimeZone.getDefault();
    Date now = new Date();
    int offsetFromUTC = tz.getOffset(now.getTime());

    final String bgDelta = getBgDelta();
    final String bgReadingS = getBgReading();
    final String slopeOrdinal = getSlopeOrdinal();
    //boolean no_signal;

    if (use_best_glucose) {
        Log.v(TAG, "buildDictionary: slopeOrdinal-" + slopeOrdinal + " bgReading-" + bgReadingS + //
                " now-" + (int) now.getTime() / 1000 + " bgTime-" + (int) (dg.timestamp / 1000) + //
                " phoneTime-" + (int) (new Date().getTime() / 1000) + " getBgDelta-" + getBgDelta());
        //   no_signal = (dg.mssince > Home.stale_data_millis());
    } else {
        Log.v(TAG, "buildDictionary: slopeOrdinal-" + slopeOrdinal + " bgReading-" + bgReadingS + //
                " now-" + (int) now.getTime() / 1000 + " bgTime-" + (int) (this.bgReading.timestamp / 1000) + //
                " phoneTime-" + (int) (new Date().getTime() / 1000) + " getBgDelta-" + getBgDelta());
        //   no_signal = ((new Date().getTime()) - Home.stale_data_millis() - this.bgReading.timestamp > 0);
    }

    dictionary.addString(ICON_KEY, slopeOrdinal);
    dictionary.addString(BG_KEY, bgReadingS);

    if (use_best_glucose) {
        dictionary.addUint32(RECORD_TIME_KEY, (int) (((dg.timestamp + offsetFromUTC) / 1000)));
    } else {
        dictionary.addUint32(RECORD_TIME_KEY, (int) (((this.bgReading.timestamp + offsetFromUTC) / 1000)));
    }

    dictionary.addUint32(PHONE_TIME_KEY, (int) ((new Date().getTime() + offsetFromUTC) / 1000));
    dictionary.addString(BG_DELTA_KEY, bgDelta);

    addBatteryStatusToDictionary(dictionary);

    return dictionary;
}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:40,代码来源:PebbleDisplayStandard.java

示例4: buildDictionary

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
public PebbleDictionary buildDictionary() {
    PebbleDictionary dictionary = new PebbleDictionary();
    TimeZone tz = TimeZone.getDefault();
    Date now = new Date();
    int offsetFromUTC = tz.getOffset(now.getTime());
    Log.v(TAG, "buildDictionary: slopeOrdinal-" + slopeOrdinal() + " bgReading-" + bgReading() + " now-"+ (int) now.getTime()/1000 + " bgTime-" + (int) (mBgReading.datetime / 1000) + " phoneTime-" + (int) (new Date().getTime() / 1000) + " bgDelta-" + bgDelta());
    dictionary.addString(ICON_KEY, slopeOrdinal());
    dictionary.addString(BG_KEY, bgReading());
    dictionary.addUint32(RECORD_TIME_KEY, (int) (((mBgReading.datetime + offsetFromUTC) / 1000)));
    dictionary.addUint32(PHONE_TIME_KEY, (int) ((new Date().getTime() + offsetFromUTC) / 1000));
    dictionary.addString(BG_DELTA_KEY, bgDelta());
    dictionary.addString(UPLOADER_BATTERY_KEY, phoneBattery());
    dictionary.addString(NAME_KEY, "Phone");
    return dictionary;
}
 
开发者ID:StephenBlackWasAlreadyTaken,项目名称:NightWatch,代码行数:16,代码来源:PebbleSync.java

示例5: buildDictionary

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
public PebbleDictionary buildDictionary(TrendArrow trend, String bgValue, int recordTime, int uploaderTimeSec,
                                        String delta, String uploaderBattery, String name) {
    PebbleDictionary dictionary = new PebbleDictionary();
    dictionary.addString(ICON_KEY, String.valueOf(trend.ordinal()));
    dictionary.addString(BG_KEY, bgValue);
    dictionary.addUint32(RECORD_TIME_KEY, recordTime);
    dictionary.addUint32(PHONE_TIME_KEY, uploaderTimeSec);
    dictionary.addString(BG_DELTA_KEY, delta);
    dictionary.addString(UPLOADER_BATTERY_KEY, uploaderBattery);
    // TODO does this need to be set every time?
    dictionary.addString(NAME_KEY, name);
    return dictionary;
}
 
开发者ID:nightscout,项目名称:android-uploader,代码行数:14,代码来源:Pebble.java

示例6: createMockPebbleDictionary

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
private PebbleDictionary createMockPebbleDictionary() {
    PebbleDictionary dict = new PebbleDictionary();
    dict.addString(0, String.valueOf(TrendArrow.FLAT.ordinal()));
    dict.addString(1, "100");
    dict.addUint32(2, 1417990743);
    dict.addUint32(3, 1417990743);
    dict.addString(4, "0");
    dict.addString(5, "100");
    dict.addString(6, "Bob");
    return dict;
}
 
开发者ID:nightscout,项目名称:android-uploader,代码行数:12,代码来源:WearableTest.java

示例7: testReceiveDataWithORUXMAPS_START_RECORD_CONTINUE_PRESSStartsRecord

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@SmallTest
public void testReceiveDataWithORUXMAPS_START_RECORD_CONTINUE_PRESSStartsRecord() {
    PebbleDictionary dic = new PebbleDictionary();
    dic.addUint32(Constants.CMD_BUTTON_PRESS, Constants.ORUXMAPS_START_RECORD_CONTINUE_PRESS);

    _pebbleDataReceiver.receiveData(_mockContext,12345,dic);

    verify(_mockOruxMaps,times(1)).startRecordNewSegment();
}
 
开发者ID:team-mount-ventoux,项目名称:JayPS-AndroidApp,代码行数:10,代码来源:PebbleDataReceiverTest.java

示例8: testReceiveDataWithORUXMAPS_STOP_RECORD_PRESSStartsRecord

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@SmallTest
public void testReceiveDataWithORUXMAPS_STOP_RECORD_PRESSStartsRecord() {
    PebbleDictionary dic = new PebbleDictionary();
    dic.addUint32(Constants.CMD_BUTTON_PRESS, Constants.ORUXMAPS_STOP_RECORD_PRESS);

    _pebbleDataReceiver.receiveData(_mockContext,12345,dic);

    verify(_mockOruxMaps,times(1)).stopRecord();
}
 
开发者ID:team-mount-ventoux,项目名称:JayPS-AndroidApp,代码行数:10,代码来源:PebbleDataReceiverTest.java

示例9: testReceiveDataWithORUXMAPS_NEW_WAYPOINT_PRESSAddsNewWaypoint

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@SmallTest
public void testReceiveDataWithORUXMAPS_NEW_WAYPOINT_PRESSAddsNewWaypoint() {
    PebbleDictionary dic = new PebbleDictionary();
    dic.addUint32(Constants.CMD_BUTTON_PRESS, Constants.ORUXMAPS_NEW_WAYPOINT_PRESS);

    _pebbleDataReceiver.receiveData(_mockContext,12345,dic);

    verify(_mockOruxMaps,times(1)).newWaypoint();
}
 
开发者ID:team-mount-ventoux,项目名称:JayPS-AndroidApp,代码行数:10,代码来源:PebbleDataReceiverTest.java

示例10: testReceiveDataWithSTOP_PRESSStopsLocationServices

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@SmallTest
public void testReceiveDataWithSTOP_PRESSStopsLocationServices() {
    PebbleDictionary dic = new PebbleDictionary();
    dic.addUint32(Constants.CMD_BUTTON_PRESS, Constants.STOP_PRESS);

    _pebbleDataReceiver.receiveData(_mockContext,12345,dic);

    verify(_mockServiceStarter,times(1)).stopLocationServices();
}
 
开发者ID:team-mount-ventoux,项目名称:JayPS-AndroidApp,代码行数:10,代码来源:PebbleDataReceiverTest.java

示例11: testReceiveDataWithPLAY_PRESSStartsLocationServices

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@SmallTest
public void testReceiveDataWithPLAY_PRESSStartsLocationServices() {
    PebbleDictionary dic = new PebbleDictionary();
    dic.addUint32(Constants.CMD_BUTTON_PRESS, Constants.PLAY_PRESS);

    _pebbleDataReceiver.receiveData(_mockContext,12345,dic);

    verify(_mockServiceStarter,times(1)).startLocationServices();
}
 
开发者ID:team-mount-ventoux,项目名称:JayPS-AndroidApp,代码行数:10,代码来源:PebbleDataReceiverTest.java

示例12: testReceiveDataWithREFRESH_PRESSRefreshLocationServices

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@SmallTest
public void testReceiveDataWithREFRESH_PRESSRefreshLocationServices() throws InterruptedException {
    PebbleDictionary dic = new PebbleDictionary();
    dic.addUint32(Constants.CMD_BUTTON_PRESS, Constants.REFRESH_PRESS);

    _pebbleDataReceiver.receiveData(_mockContext,12345,dic);

    _stateLatch.await(1000, TimeUnit.MILLISECONDS);
    assertNotNull(_refreshEvent);
}
 
开发者ID:team-mount-ventoux,项目名称:JayPS-AndroidApp,代码行数:11,代码来源:PebbleDataReceiverTest.java

示例13: testReceiveDataWithREFRESH_PRESSResetsSavedData

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@SmallTest
public void testReceiveDataWithREFRESH_PRESSResetsSavedData() throws InterruptedException {
    PebbleDictionary dic = new PebbleDictionary();
    dic.addUint32(Constants.CMD_BUTTON_PRESS, Constants.REFRESH_PRESS);

    _pebbleDataReceiver.receiveData(_mockContext,12345,dic);

    _stateLatch.await(1000, TimeUnit.MILLISECONDS);
    verify(_mockDataStore,times(1)).resetAllValues();
    verify(_mockDataStore,times(1)).commit();
}
 
开发者ID:team-mount-ventoux,项目名称:JayPS-AndroidApp,代码行数:12,代码来源:PebbleDataReceiverTest.java


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