Wish Ethernet IP in B4A-Bridge

Discussion in 'Bugs & wishlist' started by TheMightySwe, May 26, 2015.

  1. TheMightySwe

    TheMightySwe Active Member Licensed User

    Hi,

    Do you think it's possible to display the ethernet IP in the B4A-Bridge.
     
  2. tigrot

    tigrot Well-Known Member Licensed User

    Why this? There is already a display for local address. To know the public address you have to ask a remote server, since it can know your public address.

    If you want I have a little piece of code to do that.

    Mauro
     
    Peter Simpson likes this.
  3. TheMightySwe

    TheMightySwe Active Member Licensed User


    IT DOES NOT Display the local adress if you are connected via a ethernet cable. Only if you are connected via WIFI!
     
  4. Peter Simpson

    Peter Simpson Expert Licensed User

    @TheMightySwe below is the link to the latest source code for the B4A-Bridge, you can download the source code and modify it for your own personal use. How are you connecting your device to an Ethernet cable, I presume that you are using one of these?
    [​IMG]

    Anyway you can use the code below and modify B4A-Bridge to do what you need it to do. Actually thinking about, the B4A-Bridge becomes redundant if you are connecting an Ethernet cable to your device, that means your device is no longer wireless. Why don't you just use USB debugging instead.

    B4A-Bridge source code: http://www.b4x.com/android/forum/threads/b4a-bridge-source-code.8153/page-2#post-299234
     
  5. TheMightySwe

    TheMightySwe Active Member Licensed User

    The device does not have USB, its a old POS system. And B4A-Bridge works but I have to see the IP in a other program. The FTP server. Just annoying. But I will check out the B4A Code.
    [​IMG]
     
  6. TheMightySwe

    TheMightySwe Active Member Licensed User

    If @Erel want to put the code in the real version it would be great.

    Put an extra label named lblLanIp in the designer

    Add the label in Globals

    Dim lblLanIp As Label


    Code:
    Sub UpdateIp

        
    Dim ip As String
        ip = 
    server.GetMyWifiIP
        
    If ip = "127.0.0.1" OR ip.Contains(":"Then
            ip = 
    "Not connected to wireless network."  
        
    End If
        lblIp.Text = 
    "My IP: " & ip
      
        
    Dim ip As String
        ip = 
    server.GetMyIP
      
        
    If ip = "127.0.0.1" OR ip.Contains(":"Then
            ip = 
    "Not connected to LAN network."  
        
    End If
      
        lblLanIp.Text = 
    "My LAN IP: " & ip
      
    End Sub

    In service1.bas

    Code:
    Sub PE_ConnectivityChanged (NetworkType As String, State As StringIntent As Intent)
        
    If NetworkType = "WIFI" Then CallSub(Main, "UpdateIp")
        
    If NetworkType = "ETH" Then CallSub(Main, "UpdateIp")
    End Sub
     
    Last edited: May 29, 2015
    Troberg likes this.
  7. Peter Simpson

    Peter Simpson Expert Licensed User

    It will not be added to the main app.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice