// APRESIA series, 180611.
TELNET
timeout 600						// ^CAEg 600b.
1:
recv 30 exit 51
unless "UserName:" goto 1
sendname						// OC𑗂.
2:
recv 30 exit 52
unless "PassWord:" goto 2
sendpassword					// pX[h𑗂.
5:
recv 30 exit 53
unless "#" goto 5
ifpoesdevcmd goto 20			// ݒ擾(|[gw)̏ꍇ20ɕ.
ifpoeshubcmd goto 30			// ݒ擾(S|[g)̏ꍇ30ɕ.

/--- ON/OFF/REBOOT䏈 ---/
12:
ifpoeoncmd goto 14				// ON14ɕ.
send "config poe ports "		// PoEdR}h𑗂.
sendpoeport						//   - Ώۃ|[g.
send " state disable\r"			//   - d.
ifpoeoffcmd goto 15				// OFF15ɕ.
13:
recv 30 exit 63
unless "#" goto 13
waitpoereboot					// u[g܂ł̃EFCgԂ҂.
14:
send "config poe ports "		// PoE@\R}h𑗂.
sendpoeport						//   - Ώۃ|[g.
send " state enable\r"			//   - dL.
15:
recv 30 exit 64
unless "#" goto 15
goto 40							// I.

//--- ԕ\(|[g) ---/
20:
send "show poe ports "			// |[gݒQƃR}h𑗂.
sendpoeport						//   - Ώۃ|[g.
send "\r"						//   
21:
recv 30 exit 71
save_data						// Mf[^ޔ.
unless "Refresh" goto 21		// "Refresh"󂯂܂ő󂯎.
send "q\r"						// \y[W𔲂.
22:
recv 30 exit 72
unless "#" goto 22				// "#"܂ŌJԂ.
goto 40							// I.

//--- ԕ\(S|[g) ---/
30:								// 
init_poecnt						// 擾y[Wݒ.
send "show poe ports\r"			// |[gݒQƃR}h(S|[g)𑗂.
31:
recv 30 exit 81
save_data						// ŏɎMf[^ޔ.
32:
recv 30 exit 82					// 
if_escstart goto 33				// ESCŎn܂ꍇ̓[hy[WA33֕.
save_data						// y[W̑Af[^ޔ.
goto 32
33:								// [hꂽy[W.
dec_poecnt goto 34				// y[W-1, [ɂȂ36.
send "n\r"						// ̃y[W̎Mw.
goto 31							// 
34:
send "q\r"						// R}h؂グ.
35:
recv 30 exit 83
if "#" goto 40					// "#"܂,
goto 35							// s̉͂JԂ.

//--- Exit ---/
40:
send "logout\r"					// CLI甲.
41:
recv 30 exit 91
unless "Logout" goto 41
exit							// XNvgI.
