// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.geocities.com/kpdus/jad.html // Decompiler options: braces fieldsfirst space lnc package com.olio.communication.bluetooth.channel_messages; import com.olio.communication.notifications.NotificationFilters; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.Arrays; import java.util.HashMap; public class ANCSNotificationUpdate { public static final class EventFlags extends Enum { private static final EventFlags $VALUES[]; public static final EventFlags important; public static final EventFlags silent; public static EventFlags valueOf(String s) { return (EventFlags)Enum.valueOf(com/olio/communication/bluetooth/channel_messages/ANCSNotificationUpdate$EventFlags, s); } public static EventFlags[] values() { return (EventFlags[])$VALUES.clone(); } static { silent = new EventFlags("silent", 0); important = new EventFlags("important", 1); $VALUES = (new EventFlags[] { silent, important }); } private EventFlags(String s, int i) { super(s, i); } } public static final class EventType extends Enum { private static final EventType $VALUES[]; public static final EventType added; public static final EventType modified; public static final EventType removed; public static EventType valueOf(String s) { return (EventType)Enum.valueOf(com/olio/communication/bluetooth/channel_messages/ANCSNotificationUpdate$EventType, s); } public static EventType[] values() { return (EventType[])$VALUES.clone(); } static { added = new EventType("added", 0); removed = new EventType("removed", 1); modified = new EventType("modified", 2); $VALUES = (new EventType[] { added, removed, modified }); } private EventType(String s, int i) { super(s, i); } } private static HashMap eventFlags; private static HashMap eventType; private final com.olio.communication.notifications.NotificationFilters.Category mCategory; private final String mCategoryCount; private final String mEventFlags; private final EventType mEventType; private final byte mId[]; private final int mIdInteger; private final String mIdString; private final Integer mLittleEndianIDInteger; public ANCSNotificationUpdate(byte abyte0[]) { mId = Arrays.copyOfRange(abyte0, 4, 8); mIdString = createIdString(mId); mIdInteger = ByteBuffer.wrap(mId).getInt(); mLittleEndianIDInteger = Integer.valueOf(ByteBuffer.wrap(mId).order(ByteOrder.LITTLE_ENDIAN).getInt()); mEventType = (EventType)eventType.get(Byte.valueOf(abyte0[0])); mEventFlags = parseEventFlags(abyte0[1]); mCategory = NotificationFilters.fromANCSValue(abyte0[2]); mCategoryCount = Integer.valueOf(Byte.valueOf(abyte0[3]).intValue()).toString(); } private String createIdString(byte abyte0[]) { StringBuilder stringbuilder = new StringBuilder(10); stringbuilder.append("x"); int j = abyte0.length; for (int i = 0; i < j; i++) { stringbuilder.append(String.format("%02X ", new Object[] { Byte.valueOf(abyte0[i]) })); } return stringbuilder.toString(); } private String parseEventFlags(byte byte0) { boolean flag; if ((((Byte)eventFlags.get(EventFlags.silent)).byteValue() & byte0) != 0) { flag = true; } else { flag = false; } if ((((Byte)eventFlags.get(EventFlags.important)).byteValue() & byte0) != 0) { byte0 = 1; } else { byte0 = 0; } if (flag && byte0 == 0) { return "Silent"; } if (flag && byte0 != 0) { return "Silent and Important"; } if (!flag && byte0 != 0) { return "Important"; } else { return "No Flags"; } } public com.olio.communication.notifications.NotificationFilters.Category getCategory() { return mCategory; } public String getCategoryCount() { return mCategoryCount; } public String getEventFlags() { return mEventFlags; } public EventType getEventType() { return mEventType; } public byte[] getID() { return mId; } public Integer getIDInteger() { return Integer.valueOf(mIdInteger); } public String getIDString() { return mIdString; } public Integer getLittleEndianIDInteger() { return mLittleEndianIDInteger; } public String toString() { return String.format("ANCSNotificationUpdate %s: %s, %s, Category %s, Category Count %s", new Object[] { getIDString(), getEventType(), getEventFlags(), getCategory(), getCategoryCount() }); } static { eventType = new HashMap(); eventFlags = new HashMap(); eventType.put(Byte.decode("0"), EventType.added); eventType.put(Byte.decode("1"), EventType.modified); eventType.put(Byte.decode("2"), EventType.removed); eventFlags.put(EventFlags.silent, Byte.valueOf((byte)1)); eventFlags.put(EventFlags.important, Byte.valueOf((byte)2)); } }