Di bawah ini merupakan contoh kode yang digunakan untuk mengecek stok SEV Indosat.
Peralatan yang dibutuhkan:
- Modem GSM
- Kartu chip Indosat
Adapun kodenya adalah sebagai berikut:
Option Explicit
'-----------------------------------------------------------------------------
'http://khoiriyyah.blogspot.com
'-----------------------------------------------------------------------------
Dim strBuffer As String
Private Sub cmdSend_Click()
txtResult.Text = ""
txtProcess.Text = ""
strBuffer = ""
If UCase$(Left$(txtATCommand.Text, 2)) <> "AT" Then
MSComm1.Output = txtATCommand.Text & Chr(26)
Else
MSComm1.Output = txtATCommand.Text & vbCrLf
End If
End Sub
Private Sub Form_Load()
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
With MSComm1
.CommPort = 3 'Port disesuaikan
.Settings = "115200,N,8,1"
.Handshaking = comRTS
.RTSEnable = True
.DTREnable = True
.RThreshold = 1
.SThreshold = 1
.InputMode = comInputModeText
.InputLen = 0
.PortOpen = True
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
End Sub
Private Sub MSComm1_OnComm()
Select Case MSComm1.CommEvent
Case comEvReceive
strBuffer = strBuffer & MSComm1.Input
End Select
txtProcess.Text = strBuffer
txtProcess.SelStart = Len(txtProcess.Text)
Do
strBuffer = strBuffer & MSComm1.Input
Loop While MSComm1.InBufferCount
If InStr(1, strBuffer, "+STIN: 99" & vbCrLf) Then
MSComm1.Output = "AT+STGI=99" & vbCrLf
strBuffer = ""
ElseIf InStr(1, strBuffer, "+STIN: 9" & vbCrLf) Then
MSComm1.Output = "AT+STGI=9" & vbCrLf
strBuffer = ""
ElseIf InStr(1, strBuffer, "+STIN: 6" & vbCrLf) Then
MSComm1.Output = "AT+STGI=6" & vbCrLf
strBuffer = ""
ElseIf InStr(1, strBuffer, "+STIN: 3" & vbCrLf) Then
MSComm1.Output = "AT+STGI=3" & vbCrLf
strBuffer = ""
ElseIf InStr(1, strBuffer, "+STIN: 1" & vbCrLf) Then
MSComm1.Output = "AT+STGI=1" & vbCrLf
strBuffer = ""
End If
If InStr(1, strBuffer, "+STGI") Then
If InStr(1, strBuffer, "SEV Menu") Then
MSComm1.Output = "AT+STGR=0,1,3" & vbCrLf
strBuffer = ""
End If
If InStr(1, strBuffer, "Inventory") Then
MSComm1.Output = "AT+STGR=6,1,1" & vbCr
strBuffer = ""
End If
If InStr(1, strBuffer, "Optional") Then
MSComm1.Output = "AT+STGR=6,1,1" & vbCr
strBuffer = ""
End If
If InStr(1, strBuffer, "Enter MPIN") Then
MSComm1.Output = "AT+STGR=3,1" & vbCr
MSComm1.Output = "313131" & Chr(26) 'PIN disesuaikan, hati-hati 3x salah PIN kartu akan diblokir
strBuffer = ""
End If
End If
End Sub
Catatan penting:
- Sebelumnya kita harus mengaktifkan terlebih dahulu menu STK-nya seperti yang telah dijelaskan dalam posting disini.
- Setelah seluruhnya selesai, yang harus kita lakukan adalah mengetikan AT+STGI=0 dan klik tombol Send seperti yang terlihat pada gambar di bawah:
Gambar - Cek STOK SEV Indosat |
Download: Contoh kode VB6 cek stok SEV Indosat
Keywords: contoh, cek, gambar, vb6, code, visual, basic, 6.0, contok, chek, kode, html, contohcek, stk, output, instr, indosat, contoh-contoh, coding, source, mscomm1.output