Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1004197 // androidGetGateway

JavaX fragment (include)

//import android.net.DhcpInfo;
//import android.net.wifi.WifiManager;

// generified (compiles everywhere)
static S androidGetGateway() {
  O wifii = call(androidContext_gen(), "getSystemService", "wifi");
  O d = call(wifii, "getDhcpInfo");
  int g = (int) get(d, "gateway");
  ret g == 0 ? null : androidGetGateway_intToIP(g);
}

static S androidGetGateway_intToIP(int addr) {
  return  ((addr & 0xFF) + "." + 
          ((addr >>>= 8) & 0xFF) + "." + 
          ((addr >>>= 8) & 0xFF) + "." + 
          ((addr >>>= 8) & 0xFF));
}

Author comment

Began life as a copy of #1004196

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1004197
Snippet name: androidGetGateway
Eternal ID of this version: #1004197/1
Text MD5: f9b7ec64795c00c4fb9e6a15b54bc8ca
Author: stefan
Category: javax / android
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-09 23:26:57
Source code size: 549 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 606 / 614
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)