1: 2015-02-18 (水) 20:51:00 nao-pon With "attach" plugin. (Created empty) |
現: 2015-02-18 (水) 20:53:02 nao-pon |
| + | #navi |
| + | RIGHT:&rsslink(../); |
| + | #boxdate |
| | | |
| + | * Android Tasker で指定秒間のネットワーク通信量(Kbps)計るタスクを作った [#hcff32cf] |
| + | RIGHT:&tag(Android,Tasker); |
| + | |
| + | Android アプリの Tasker でスリープ中で非通信時に、エアプレーンモードにしようと思い、ネットワーク通信量を計りたかったので、そんなタスクをつくってみた。 |
| + | |
| + | - 要 busybox |
| + | -- busybox ifconfig 使用 |
| + | -- wlan0 (Wi-Fi 専用) |
| + | |
| + | getNetKbps (3) |
| + | A1: If [ %par1 Set ] |
| + | A2: Variable Set [ Name:%sec To:%par1 Do Maths:Off Append:Off ] |
| + | A3: Else |
| + | A4: Variable Set [ Name:%sec To:10 Do Maths:Off Append:Off ] |
| + | A5: End If |
| + | A6: Variable Set [ Name:%tx1 To:0 Do Maths:Off Append:Off ] |
| + | A7: Variable Set [ Name:%rx1 To:0 Do Maths:Off Append:Off ] |
| + | <check> |
| + | A8: Run Shell [ Command:busybox ifconfig wlan0 Timeout (Seconds):0 Use Root:Off Store Output In:%res Store Errors In: Store Result In: ] |
| + | A9: Variable Search Replace [ Variable:%res Search:(Rx bytes:)(\d+)(.*Tx bytes:)(\d+) Ignore Case:On Multi-Line:Off One Match Only:On Store Matches In: Replace Matches:On Replace With:|$2|$4| ] |
| + | A10: [X] Flash [ Text:%res Long:Off ] |
| + | A11: Variable Split [ Name:%res Splitter:| Delete Base:On ] |
| + | A12: If [ %rx1 eq 0 ] |
| + | A13: Variable Set [ Name:%rx1 To:%res2 Do Maths:Off Append:Off ] |
| + | A14: Variable Set [ Name:%tx1 To:%res3 Do Maths:Off Append:Off ] |
| + | A15: Wait [ MS:0 Seconds:%sec Minutes:0 Hours:0 Days:0 ] |
| + | A16: Goto [ Type:Action Label Number:1 Label:check ] |
| + | A17: Else |
| + | A18: Variable Set [ Name:%bps To:((%res2-%rx1)+(%res3-%tx1))/%sec/1024 Do Maths:On Append:Off ] |
| + | A19: [X] Flash [ Text:((%res2-%rx1)+(%res3-%tx1))/%sec Long:On ] |
| + | A20: [X] Flash [ Text:%bps Long:Off ] |
| + | A21: End If |
| + | A22: Return [ Value:%bps Stop:On ] |
| + | |
| + | デバグ用に Flash 入れて無効にしてあります。 |
| + | |
| + | - XML: &ref(getNetKbps.tsk.xml); |
| + | |
| + | RIGHT:&font(90%){&page_comments;}; |
| + | #navi |
Counter: 515,
today: 1,
yesterday: 0