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


Java PebbleDictionary.addString方法代码示例

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


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

示例1: addBatteryStatusToDictionary

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
public void addBatteryStatusToDictionary(PebbleDictionary dictionary) {
    if (doWeDisplayWixelBatteryStatus()) {

        if (isDexBridgeWixel()) {
            dictionary.addString(UPLOADER_BATTERY_KEY, getBatteryString("bridge_battery"));
            dictionary.addString(NAME_KEY, "Bridge");
        } else {
            dictionary.addString(UPLOADER_BATTERY_KEY, getBatteryString("parakeet_battery"));
            dictionary.addString(NAME_KEY, "Phone");
        }

    } else {
        dictionary.addString(UPLOADER_BATTERY_KEY, getPhoneBatteryStatus());
        dictionary.addString(NAME_KEY, "Phone");
    }

}
 
开发者ID:NightscoutFoundation,项目名称:xDrip,代码行数:18,代码来源:PebbleDisplayAbstract.java

示例2: 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

示例3: sendGroupNames

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
private void sendGroupNames()
{
    if (nextGroupNameToSend >= pickedContactGroups.size())
    {
        nextGroupNameToSend = -1;
        return;
    }

    PebbleDictionary packet = new PebbleDictionary();
    packet.addUint8(0, (byte) 0);
    packet.addUint8(1, (byte) 2);
    packet.addUint8(2, (byte) nextGroupNameToSend);

    int num = Math.min(nextGroupNameToSend + 3, pickedContactGroups.size() - 1) - nextGroupNameToSend;
    for (int i = 0; i <= num; i++)
    {
        packet.addString(3 + i, pickedContactGroups.get(nextGroupNameToSend + i).getName());
    }

    nextGroupNameToSend += 3;

    getService().getPebbleCommunication().sendToPebble(packet);
}
 
开发者ID:matejdro,项目名称:PebbleDialer-Android,代码行数:24,代码来源:SystemModule.java

示例4: sendContacts

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
private void sendContacts(int offset)
{
	PebbleDictionary data = new PebbleDictionary();

	data.addUint8(0, (byte) 3);
       data.addUint8(1, (byte) 0);

       data.addUint16(2, (short) offset);
	data.addUint16(3, (short) names.size());

	for (int i = 0; i < 3; i++)
	{
		int listPos = offset + i;
		if (listPos >= names.size())
			break;

		data.addString(i + 4, names.get(i + offset));
	}

       getService().getPebbleCommunication().sendToPebble(data);
}
 
开发者ID:matejdro,项目名称:PebbleDialer-Android,代码行数:22,代码来源:ContactsModule.java

示例5: initializeSegment

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
/**
 * Sends values like transport mode (line number) and other segment related values
 *  Doesn't send the waypoints, they have to be sent after calling this.
 *  Parameters: line = transport line e.g. 550, hours = hours of day, 
 *  minutes = minutes of hour...
 */
public void initializeSegment(String line, String stopName, String stopCode, int hours, int minutes, int seconds) {
	PebbleDictionary dictionary = new PebbleDictionary();
	dictionary.addUint8(KEY_COMMAND, (byte) COMMAND_INIT_SEGMENT);
	dictionary.addString(KEY_LINE_NUMBER, line);
	dictionary.addString(KEY_FIRST_STOP_NAME, stopName);
	dictionary.addString(KEY_FIRST_STOP_CODE, stopCode);
	dictionary.addUint8(KEY_START_TIME_HOUR, (byte) hours);
	dictionary.addUint8(KEY_START_TIME_MIN, (byte) minutes);
	dictionary.addUint8(KEY_START_TIME_SEC, (byte) seconds); 
	/**
	 * En-queue this message to MessageHandler.
	 */
	System.out.println("PEBBLE_DBG: sending time:" + hours + "." + minutes + "." + seconds);
	
	messageManager.offer(dictionary);
	System.out.println("DBG PebbleCommunication:initializeSegment: " + line);
}
 
开发者ID:apps8os,项目名称:trafficsense,代码行数:24,代码来源:PebbleCommunication.java

示例6: PebbleManager

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
public PebbleManager(Activity act){
    acti = act;
    PebbleKit.PebbleDataReceiver receiver = new PebbleKit.PebbleDataReceiver(PEBBLE_APP_UUID) {
        @SuppressLint("SetTextI18n")
        public void receiveData(final Context context, final int transactionId, final PebbleDictionary data) {
            ArrayList<String> dataToSend = WeekManager.getNextEventsForPebble(weeksList);
            PebbleDictionary msg = new PebbleDictionary();
            msg.addString(0, dataToSend.get(0));
            msg.addString(128, dataToSend.get(1));
            msg.addString(256, dataToSend.get(2));
            PebbleKit.sendDataToPebble(acti.getApplicationContext(), PEBBLE_APP_UUID, msg);
        }
    };
    PebbleKit.registerReceivedDataHandler(act.getApplicationContext(), receiver);
}
 
开发者ID:natinusala,项目名称:openedt,代码行数:16,代码来源:PebbleManager.java

示例7: updateLocation

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
public void updateLocation(double lat, double lon, String name, int distance) {
//        Log.d(TAG, "updateLocation " + lat + " " + lon + " '" + name + "'");
        if (name.isEmpty())
            name = String.format("%.4f,%.4f", lat, lon);
        PebbleDictionary out = new PebbleDictionary();
        out.addInt32(KEY_LAT, (int)Math.round(lat * 1000));
        out.addInt32(KEY_LON, (int)Math.round(lon * 1000));
        out.addString(KEY_LOCATION_NAME, name);
        PebbleKit.sendDataToPebble(m_weatherService, WATCHAPP_UUID, out);
    }
 
开发者ID:ec1oud,项目名称:sologyr,代码行数:11,代码来源:PebbleUtil.java

示例8: updateCurrentWeather

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
public void updateCurrentWeather(double temperature, double cloudCover, WeatherIcon icon,
                                     double windSpeed, double windBearing, double humidity, double dewPoint,
                                     double pressure, double ozone, double precipIntensity) {
        m_updatedSinceConnected = true;
        // TODO send more to the pebble
        String tempStr = Math.round(temperature) + "°";
        if (icon == null)
            return;
//        Log.d(TAG, "updateCurrentWeather " + tempStr + " " + cloudCover + "% " + icon.getValue());
        PebbleDictionary out = new PebbleDictionary();
        out.addString(KEY_TEMPERATURE, tempStr);
        out.addUint8(KEY_CLOUD_COVER, (byte)Math.round(cloudCover * 100)); // from fraction (e.g. 0.25) to int percent, so it fits in a byte
        out.addUint8(KEY_WEATHER_ICON, icon.getValue());
        PebbleKit.sendDataToPebble(m_weatherService, WATCHAPP_UUID, out);
    }
 
开发者ID:ec1oud,项目名称:sologyr,代码行数:16,代码来源:PebbleUtil.java

示例9: 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

示例10: 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

示例11: doMessageUpdate

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
/**
 * Sends a new word and definition to the watch and updates the textview
 * within the main activity.
 */
private void doMessageUpdate()
{
    // Make sure the watch is connected
    if ( PebbleKit.isWatchConnected( getApplicationContext() ) )
    {
        // Make sure the current index is valid first
        if ( currentIndex < 0 || currentIndex > wordsList.size() )
        {
            setRandomIndex();
        }

        PebbleDictionary dict = new PebbleDictionary();
        dict.addString(
                KEY_WORD, wordsList.get( currentIndex ) );
        dict.addString( KEY_DEFINITION, definitionsList.get( currentIndex ) );
        PebbleKit.sendDataToPebble( getApplicationContext(), MSG_UUID,
                dict
                );
        txtview.setText( wordsList.get( currentIndex ) + " - "
                + definitionsList.get( currentIndex ) );
    }
    else
    {
        Toast.makeText(
                getApplicationContext(),
                "Warning, a pebble is not connected!",
                Toast.LENGTH_LONG ).show();
    }
}
 
开发者ID:carlb15,项目名称:FunnyWordsWithPebble,代码行数:34,代码来源:MainActivity.java

示例12: 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

示例13: 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

示例14: noNetworkFound

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
public void noNetworkFound () {
	if (PebbleKit.areAppMessagesSupported(getApplicationContext())) {
		PebbleDictionary networkFail = new PebbleDictionary();
		networkFail.addUint8(0, (byte) 0);
		networkFail.addUint8(1, (byte) 0); // Filler value
		networkFail.addString(2, "LIFX Network not found.");
		Log.i("Dictionary", networkFail.toJsonString());
		PebbleKit.sendDataToPebble(getApplicationContext(), PEBBLE_APP_UUID, networkFail);
		Log.i("", "Data sent.");
	}
	PebbleKit.closeAppOnPebble(getApplicationContext(), PEBBLE_APP_UUID);
}
 
开发者ID:jadengore,项目名称:PebbLIFX,代码行数:13,代码来源:PebbLIFXService.java

示例15: discover

import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
public void discover() {
	localNetworkContext = LFXClient.getSharedInstance(getApplicationContext()).getLocalNetworkContext();
    localNetworkContext.connect();
    bulbList = localNetworkContext.getAllLightsCollection().getLights();
    Log.i("PebbLIFXService", "Bulb List: " + bulbList.toString());
	if (bulbList == null) {
		Log.e("PebbLIFXService","Nothing returned. No network found.");
		sendMessage(0);
	} else {
		Log.i("PebbLIFXService", "Search has completed.");
		int numberOfBulbs = bulbList.size();
		Log.i("PebbLIFXService", "Bulb List Size:" + numberOfBulbs);
		if (PebbleKit.areAppMessagesSupported(getApplicationContext())) {
			PebbleDictionary bulbData = new PebbleDictionary();
			bulbData.addUint8(0, (byte) 1);
			bulbData.addUint8(1, (byte) numberOfBulbs); // Will only allow 255 bulbs to be passed.
			int j = 2;
			for (int i = 0; i < numberOfBulbs; i++) {
				// First get the bulb name.
				bulbData.addString(j++, bulbList.get(i).getLabel());
				// Find out whether bulbs are on or off.
				LFXPowerState a = bulbList.get(i).getPowerState();
				if (a == LFXPowerState.ON) {
					bulbData.addUint8(j++, (byte)1);
				} else {
					bulbData.addUint8(j++, (byte)0);
				}
				//	TODO Fix brightness and hue getting. Returning nothing.
				bulbData.addUint16(j++, (short)getUnsignedInt(bulbList.get(i).getColor().getBrightness()));
				bulbData.addUint16(j++, (short)getUnsignedInt(bulbList.get(i).getColor().getHue()));
			}
			Log.i("PebbLIFXService", "Dictionary -> " + bulbData.toJsonString());
			Log.i("PebbLIFXService", "Dictionary Size = " + bulbData.size());
			PebbleKit.sendDataToPebble(getApplicationContext(), PEBBLE_APP_UUID, bulbData);
			Log.i("PebbLIFXService", "Data sent.");
		}
	}
}
 
开发者ID:jadengore,项目名称:PebbLIFX,代码行数:39,代码来源:PebbLIFXService.java


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