aboutsummaryrefslogtreecommitdiff
path: root/xbmc/android/jni/WifiInfo.cpp
blob: 4aab7001b5eb3f44541f017fabd1335505be178d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
 *      Copyright (C) 2013 Team XBMC
 *      http://xbmc.org
 *
 *  This Program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2, or (at your option)
 *  any later version.
 *
 *  This Program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with XBMC; see the file COPYING.  If not, see
 *  <http://www.gnu.org/licenses/>.
 *
 */

#include "WifiInfo.h"
#include "jutils/jutils-details.hpp"

using namespace jni;

std::string CJNIWifiInfo::getSSID() const
{
  return jcast<std::string>(call_method<jhstring>(m_object,
    "getSSID", "()Ljava/lang/String;"));
}

std::string CJNIWifiInfo::getBSSID() const
{
  return jcast<std::string>(call_method<jhstring>(m_object,
    "getBSSID", "()Ljava/lang/String;"));
}

int CJNIWifiInfo::getRssi() const
{
  return call_method<jint>(m_object,
    "getRssi", "()I");
}

int CJNIWifiInfo::getLinkSpeed() const
{
  return call_method<jint>(m_object,
    "getLinkSpeed", "()I");
}

std::string CJNIWifiInfo::getMacAddress() const
{
  return jcast<std::string>(call_method<jhstring>(m_object,
    "getMacAddress", "()Ljava/lang/String;"));
}

int CJNIWifiInfo::getNetworkId() const
{
  return call_method<jint>(m_object,
    "getNetworkId", "()I");
}

int CJNIWifiInfo::getIpAddress() const
{
  return call_method<jint>(m_object,
    "getIpAddress" , "()I");
}

bool CJNIWifiInfo::getHiddenSSID() const
{
  return call_method<jboolean>(m_object,
    "getHiddenSSID" , "()Z");
}

std::string CJNIWifiInfo::toString() const
{
  return jcast<std::string>(call_method<jhstring>(m_object,
    "toString", "()Ljava/lang/String;"));
}

int CJNIWifiInfo::describeContents() const
{
  return call_method<jint>(m_object,
    "describeContents" , "()I");
}

CJNISupplicantState CJNIWifiInfo::getSupplicantState() const
{
  return call_method<jhobject>(m_object,
    "getSupplicantState", "()Landroid/net/wifi/SupplicantState;");
}

CJNINetworkInfoDetailedState CJNIWifiInfo::getDetailedStateOf(const CJNISupplicantState &suppState)
{
  return call_static_method<jhobject>("android/net/wifi/WifiInfo",
    "getDetailedStateOf", "(Landroid/net/wifi/SupplicantState;)Landroid/net/NetworkInfo$DetailedState;",
    suppState.get_raw());
}