Methods Summary |
---|
static android.bluetooth.client.map.BluetoothMapEventReport | fromStream(java.io.DataInputStream in)
BluetoothMapEventReport ev = null;
try {
XmlPullParser xpp = XmlPullParserFactory.newInstance().newPullParser();
xpp.setInput(in, "utf-8");
int event = xpp.getEventType();
while (event != XmlPullParser.END_DOCUMENT) {
switch (event) {
case XmlPullParser.START_TAG:
if (xpp.getName().equals("event")) {
HashMap<String, String> attrs = new HashMap<String, String>();
for (int i = 0; i < xpp.getAttributeCount(); i++) {
attrs.put(xpp.getAttributeName(i), xpp.getAttributeValue(i));
}
ev = new BluetoothMapEventReport(attrs);
// return immediately, only one event should be here
return ev;
}
break;
}
event = xpp.next();
}
} catch (XmlPullParserException e) {
Log.e(TAG, "XML parser error when parsing XML", e);
} catch (IOException e) {
Log.e(TAG, "I/O error when parsing XML", e);
} catch (IllegalArgumentException e) {
Log.e(TAG, "Invalid event received", e);
}
return ev;
|
public java.lang.String | getFolder()
return mFolder;
|
public java.lang.String | getHandle()
return mHandle;
|
public BluetoothMapBmessage.Type | getMsgType()
return mMsgType;
|
public java.lang.String | getOldFolder()
return mOldFolder;
|
public android.bluetooth.client.map.BluetoothMapEventReport$Type | getType()
return mType;
|
private BluetoothMapBmessage.Type | parseMsgType(java.lang.String msgType)
for (BluetoothMapBmessage.Type t : BluetoothMapBmessage.Type.values()) {
if (t.name().equals(msgType)) {
return t;
}
}
throw new IllegalArgumentException("Invalid value for msg_type: " + msgType);
|
private android.bluetooth.client.map.BluetoothMapEventReport$Type | parseType(java.lang.String type)
for (Type t : Type.values()) {
if (t.toString().equals(type)) {
return t;
}
}
throw new IllegalArgumentException("Invalid value for type: " + type);
|
public java.lang.String | toString()
JSONObject json = new JSONObject();
try {
json.put("type", mType);
json.put("handle", mHandle);
json.put("folder", mFolder);
json.put("old_folder", mOldFolder);
json.put("msg_type", mMsgType);
} catch (JSONException e) {
// do nothing
}
return json.toString();
|