android.net.wifi.rtt.WifiRttManager Java Examples
The following examples show how to use
android.net.wifi.rtt.WifiRttManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocationRangingService.java From WiFi-RTT-Trilateration with MIT License | 6 votes |
@Override public void onCreate() { super.onCreate(); mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE); mWifiScanReceiver = new WifiScanReceiver(); mWifiRttManager = (WifiRttManager) getSystemService(Context.WIFI_RTT_RANGING_SERVICE); mRttRangingResultCallback = new RttRangingResultCallback(); configuration = new Configuration(Configuration.CONFIGURATION_TYPE.TESTING_3); //configuration = new Configuration(Configuration.CONFIGURATION_TYPE.TWO_DIMENSIONAL_2); buildingMap = configuration.getConfiguration(); Collections.sort(buildingMap); historicalDistances = new HashMap<String, ArrayList<RangingResult>>(); for (int i = 0; i < buildingMap.size(); i++) { historicalDistances.put(buildingMap.get(i).getBssid().toString(), new ArrayList<RangingResult>()); } }
Example #2
Source File: SystemServiceRegistry.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public RttManager createService(ContextImpl ctx) throws ServiceNotFoundException { IBinder b = ServiceManager.getServiceOrThrow(Context.WIFI_RTT_RANGING_SERVICE); IWifiRttManager service = IWifiRttManager.Stub.asInterface(b); return new RttManager(ctx.getOuterContext(), new WifiRttManager(ctx.getOuterContext(), service)); }
Example #3
Source File: SystemServiceRegistry.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
@Override public WifiRttManager createService(ContextImpl ctx) throws ServiceNotFoundException { IBinder b = ServiceManager.getServiceOrThrow( Context.WIFI_RTT_RANGING_SERVICE); IWifiRttManager service = IWifiRttManager.Stub.asInterface(b); return new WifiRttManager(ctx.getOuterContext(), service); }
Example #4
Source File: MainActivity.java From android-rttmanager-sample with Apache License 2.0 | 5 votes |
@SuppressLint("WrongConstant") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); setSupportActionBar(toolbar); permissionController = new LocationPermissionController(); fab.setOnClickListener(view -> startWifiScan()); wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE); wifiNetworkReceiver = new ScanWifiNetworkReceiver(); rttManager = (WifiRttManager) getSystemService(Context.WIFI_RTT_RANGING_SERVICE); initUI(); }
Example #5
Source File: AccessPointRangingResultsActivity.java From connectivity-samples with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_access_point_ranging_results); // Initializes UI elements. mSsidTextView = findViewById(R.id.ssid); mBssidTextView = findViewById(R.id.bssid); mRangeTextView = findViewById(R.id.range_value); mRangeMeanTextView = findViewById(R.id.range_mean_value); mRangeSDTextView = findViewById(R.id.range_sd_value); mRangeSDMeanTextView = findViewById(R.id.range_sd_mean_value); mRssiTextView = findViewById(R.id.rssi_value); mSuccessesInBurstTextView = findViewById(R.id.successes_in_burst_value); mSuccessRatioTextView = findViewById(R.id.success_ratio_value); mNumberOfRequestsTextView = findViewById(R.id.number_of_requests_value); mSampleSizeEditText = findViewById(R.id.stats_window_size_edit_value); mSampleSizeEditText.setText(SAMPLE_SIZE_DEFAULT + ""); mMillisecondsDelayBeforeNewRangingRequestEditText = findViewById(R.id.ranging_period_edit_value); mMillisecondsDelayBeforeNewRangingRequestEditText.setText( MILLISECONDS_DELAY_BEFORE_NEW_RANGING_REQUEST_DEFAULT + ""); // Retrieve ScanResult from Intent. Intent intent = getIntent(); mScanResult = intent.getParcelableExtra(SCAN_RESULT_EXTRA); if (mScanResult == null) { finish(); } mMAC = mScanResult.BSSID; mSsidTextView.setText(mScanResult.SSID); mBssidTextView.setText(mScanResult.BSSID); mWifiRttManager = (WifiRttManager) getSystemService(Context.WIFI_RTT_RANGING_SERVICE); mRttRangingResultCallback = new RttRangingResultCallback(); // Used to store range (distance) and rangeSd (standard deviation of the measured distance) // history to calculate averages. mStatisticRangeHistory = new ArrayList<>(); mStatisticRangeSDHistory = new ArrayList<>(); resetData(); startRangingRequest(); }
Example #6
Source File: RttRangingManager.java From android-rttmanager-sample with Apache License 2.0 | 4 votes |
@SuppressLint("WrongConstant") RttRangingManager(final Context context) { rttManager = (WifiRttManager) context.getSystemService(Context.WIFI_RTT_RANGING_SERVICE); mainExecutor = context.getMainExecutor(); }
Example #7
Source File: AccessPointRangingResultsActivity.java From android-WifiRttScan with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_access_point_ranging_results); // Initializes UI elements. mSsidTextView = findViewById(R.id.ssid); mBssidTextView = findViewById(R.id.bssid); mRangeTextView = findViewById(R.id.range_value); mRangeMeanTextView = findViewById(R.id.range_mean_value); mRangeSDTextView = findViewById(R.id.range_sd_value); mRangeSDMeanTextView = findViewById(R.id.range_sd_mean_value); mRssiTextView = findViewById(R.id.rssi_value); mSuccessesInBurstTextView = findViewById(R.id.successes_in_burst_value); mSuccessRatioTextView = findViewById(R.id.success_ratio_value); mNumberOfRequestsTextView = findViewById(R.id.number_of_requests_value); mSampleSizeEditText = findViewById(R.id.stats_window_size_edit_value); mSampleSizeEditText.setText(SAMPLE_SIZE_DEFAULT + ""); mMillisecondsDelayBeforeNewRangingRequestEditText = findViewById(R.id.ranging_period_edit_value); mMillisecondsDelayBeforeNewRangingRequestEditText.setText( MILLISECONDS_DELAY_BEFORE_NEW_RANGING_REQUEST_DEFAULT + ""); // Retrieve ScanResult from Intent. Intent intent = getIntent(); mScanResult = intent.getParcelableExtra(SCAN_RESULT_EXTRA); if (mScanResult == null) { finish(); } mMAC = mScanResult.BSSID; mSsidTextView.setText(mScanResult.SSID); mBssidTextView.setText(mScanResult.BSSID); mWifiRttManager = (WifiRttManager) getSystemService(Context.WIFI_RTT_RANGING_SERVICE); mRttRangingResultCallback = new RttRangingResultCallback(); // Used to store range (distance) and rangeSd (standard deviation of the measured distance) // history to calculate averages. mStatisticRangeHistory = new ArrayList<>(); mStatisticRangeSDHistory = new ArrayList<>(); resetData(); startRangingRequest(); }