Alexandre Lision | 3c6b710 | 2013-09-16 16:56:46 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004-2013 Savoir-Faire Linux Inc. |
| 3 | * |
| 4 | * Author: Alexandre Lision <alexandre.lision@savoirfairelinux.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 3 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | * |
| 20 | * Additional permission under GNU GPL version 3 section 7: |
| 21 | * |
| 22 | * If you modify this program, or any covered work, by linking or |
| 23 | * combining it with the OpenSSL project's OpenSSL library (or a |
| 24 | * modified version of that library), containing parts covered by the |
| 25 | * terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc. |
| 26 | * grants you additional permission to convey the resulting work. |
| 27 | * Corresponding Source for a non-source form of such a combination |
| 28 | * shall include the source code for the parts of OpenSSL used as well |
| 29 | * as that of the covered work. |
| 30 | */ |
| 31 | |
Alexandre Lision | 6711ab2 | 2013-09-16 15:15:38 -0400 | [diff] [blame] | 32 | package com.savoirfairelinux.sflphone.account; |
| 33 | |
| 34 | import java.util.HashMap; |
| 35 | |
Alexandre Lision | 3c6b710 | 2013-09-16 16:56:46 -0400 | [diff] [blame] | 36 | import android.util.Log; |
| 37 | |
Alexandre Lision | 6711ab2 | 2013-09-16 15:15:38 -0400 | [diff] [blame] | 38 | import com.savoirfairelinux.sflphone.service.ServiceConstants; |
| 39 | import com.savoirfairelinux.sflphone.service.StringMap; |
| 40 | |
| 41 | public class CallDetailsHandler { |
Alexandre Lision | 3c6b710 | 2013-09-16 16:56:46 -0400 | [diff] [blame] | 42 | |
| 43 | private static String TAG = CallDetailsHandler.class.getSimpleName(); |
Alexandre Lision | 6711ab2 | 2013-09-16 15:15:38 -0400 | [diff] [blame] | 44 | |
| 45 | public static HashMap<String, String> convertSwigToNative(StringMap swigmap) { |
| 46 | |
| 47 | HashMap<String, String> entry = new HashMap<String, String>(); |
| 48 | |
Alexandre Lision | fd7a88f | 2013-09-18 10:03:17 -0400 | [diff] [blame] | 49 | Log.i(TAG, "CALL_TYPE: " + tryToGet(swigmap, ServiceConstants.call.CALL_TYPE)); |
| 50 | Log.i(TAG, "PEER_NUMBER: " + tryToGet(swigmap, ServiceConstants.call.PEER_NUMBER)); |
| 51 | Log.i(TAG, "DISPLAY_NAME: " + tryToGet(swigmap, ServiceConstants.call.DISPLAY_NAME)); |
| 52 | Log.i(TAG, "CALL_STATE: " + tryToGet(swigmap, ServiceConstants.call.CALL_STATE)); |
| 53 | Log.i(TAG, "CONF_ID" + tryToGet(swigmap, ServiceConstants.call.CONF_ID)); |
| 54 | Log.i(TAG, "TIMESTAMP_START: " + tryToGet(swigmap, ServiceConstants.call.TIMESTAMP_START)); |
| 55 | Log.i(TAG, "ACCOUNTID: " + tryToGet(swigmap, ServiceConstants.call.ACCOUNTID)); |
Alexandre Lision | 3c6b710 | 2013-09-16 16:56:46 -0400 | [diff] [blame] | 56 | |
Alexandre Lision | fd7a88f | 2013-09-18 10:03:17 -0400 | [diff] [blame] | 57 | entry.put(ServiceConstants.call.CALL_TYPE, tryToGet(swigmap, ServiceConstants.call.CALL_TYPE)); |
| 58 | entry.put(ServiceConstants.call.PEER_NUMBER, tryToGet(swigmap, ServiceConstants.call.PEER_NUMBER)); |
| 59 | entry.put(ServiceConstants.call.DISPLAY_NAME, tryToGet(swigmap, ServiceConstants.call.DISPLAY_NAME)); |
| 60 | entry.put(ServiceConstants.call.CALL_STATE, tryToGet(swigmap, ServiceConstants.call.CALL_STATE)); |
| 61 | entry.put(ServiceConstants.call.CONF_ID, tryToGet(swigmap, ServiceConstants.call.CONF_ID)); |
| 62 | entry.put(ServiceConstants.call.TIMESTAMP_START, tryToGet(swigmap, ServiceConstants.call.TIMESTAMP_START)); |
| 63 | entry.put(ServiceConstants.call.ACCOUNTID, tryToGet(swigmap, ServiceConstants.call.ACCOUNTID)); |
Alexandre Lision | 6711ab2 | 2013-09-16 15:15:38 -0400 | [diff] [blame] | 64 | |
| 65 | return entry; |
| 66 | } |
Alexandre Lision | fd7a88f | 2013-09-18 10:03:17 -0400 | [diff] [blame] | 67 | |
| 68 | private static String tryToGet(StringMap smap, String key) { |
| 69 | if (smap.has_key(key)) { |
| 70 | return smap.get(key); |
| 71 | } else { |
| 72 | return ""; |
| 73 | } |
| 74 | } |
Alexandre Lision | 6711ab2 | 2013-09-16 15:15:38 -0400 | [diff] [blame] | 75 | |
| 76 | } |