Android Question Problem creating my own class

cds-soft

Member
Licensed User
Longtime User
Well I'm trying to create my own class for FTP conections and I can't complete it correctly.

This is my basic code of my class called "MyOwnFTP"

B4X:
Sub Class_Globals
    Private oFTP As FTP
    Private sServ As String
    Private iPort As Int
    Private sUser As String
    Private sPass As String
End Sub

'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize (vsServ As String, viPort As Int, vsUser As String, vsPass As String)
    sServ = vsServ
    iPort = viPort
    sUser = vsUser
    sPass = vsPass
End Sub

Public Sub fbIsInitialized As Boolean
    Return oFTP.IsInitialized
End Sub

Public Sub pConectFTP
    oFTP.Initialize("FTP", sServ, iPort, sUser, sPass)
End Sub

Public Sub pQuitFTP
    oFTP.Close
End Sub

Public Sub pExecuteCommand(vCommand As String, vParameters As String)
    oFTP.SendCommand(vCommand,vParameters)
End Sub

And in the main activity I place a button like this
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim MOFTP As MyOwnFTP
End Sub

Sub Globals
    Private btnSend As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Transfer")
    MOFTP.Initialize("www.FTP.com",21,"USER","PASS")
End Sub

Sub btnSend_Click
    MOFTP.pConectFTP
    If MOFTP.fbIsInitialized Then
        Log("A...................")
        MOFTP.pExecuteCommand("MKD","/directory")
    End If
    MOFTP.pQuitFTP
End Sub

Sub FTP_CommandCompleted (Command As String, Success As Boolean, ReplyCode As Int, ReplyString As String)
    Log(Command)
    Log(ReplyCode)
    Log(ReplyString)
End Sub

All works correctly unless the FTP_CommandCompleted procedure. I don't now why. What I'm doing bad or not doing?

Thanks for your help.
 
Top