MapContact.java revision c4fbd756e2645147470c486ae96f2253f5e13a52
1/*
2* Copyright (C) 2015 Samsung System LSI
3* Licensed under the Apache License, Version 2.0 (the "License");
4* you may not use this file except in compliance with the License.
5* You may obtain a copy of the License at
6*
7*      http://www.apache.org/licenses/LICENSE-2.0
8*
9* Unless required by applicable law or agreed to in writing, software
10* distributed under the License is distributed on an "AS IS" BASIS,
11* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12* See the License for the specific language governing permissions and
13* limitations under the License.
14*/
15package com.android.bluetooth.map;
16
17import com.android.bluetooth.SignedLongLong;
18
19
20/**
21 * Local representation of an Android contact
22 */
23public class MapContact {
24    private final String mName;
25    private final long mId;
26
27    private MapContact(long id, String name) {
28        mId = id;
29        mName = name;
30    }
31
32    public static MapContact create(long id, String name) {
33        return new MapContact(id, name);
34    }
35
36    public String getName() {
37        return mName;
38    }
39
40    public long getId() {
41        return mId;
42    }
43
44    public String getXBtUidString() {
45        if (mId > 0) {
46            return BluetoothMapUtils.getLongLongAsString(mId, 0);
47        }
48        return null;
49    }
50
51    public SignedLongLong getXBtUid() {
52        if (mId > 0) {
53            return new SignedLongLong(mId, 0);
54        }
55        return null;
56    }
57
58    @Override
59    public String toString() {
60        return mName;
61    }
62}
63