android snmp客户端,SNMP4Android/README_EN.md at master · wosika/SNMP4Android · GitHub

SNMP4Android

68747470733a2f2f6a69747061636b2e696f2f762f776f73696b612f534e4d5034416e64726f69642e737667

I have been looking for a long time, but I have not found a suitable SNMP client for android, so I hope to help you

Use:

//Called in a new thread

thread {

SnmpUtils.sendSNMP(

oidCmd = ".1.3.6.1.2.1.25.3.5.1.1"

, ipAddress = "169.254.198.16"

// Optional parameters: snmp version default "2c"

, snmpVersion = SnmpUtils.SNMP_VERSION_2c

//Optional parameters: timeout default "1000ms"

, timeoutMillisecond = 1000

//Optional parameters: retry count default "2 time"

, retryCount = 2

//Optional parameters: snmp community default "public"

, community = "public"

, //Optional parameters: listener ,it can be null

responseListener = { responseState ->

//Determine the success first, and then use value after success

if (responseState.isSuccess) {

setMessage("success:${responseState.value}")

} else {

setMessage("fail:${responseState.exception?.message}")

}

}

)

}

//Don't call the function thread{}.start() , kotlin syntax automatically start

// .start()

To set JDK 1.8, add the code to set JDK version under android in app build:gradle, as follows:

android {

......

//Set JDK version

compileOptions {

sourceCompatibility JavaVersion.VERSION_1_8

targetCompatibility JavaVersion.VERSION_1_8

}

}

uses-permission:

dependency:

1.Add it in your root build.gradle at the end of repositories:

allprojects {

repositories {

...

maven { url 'https://jitpack.io' }

}

}

2.Add the dependency

dependencies {

implementation 'com.github.wosika:SNMP4Android:1.0.1'

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值