Hello,
In part of software, user enters account data i.e. account id, card number and user name one step after another in separate subs, each sub should copy entered value to public array, this array then will be written to SD card file. everything goes fine, but I get only first step OK, other failed to copy data to public array. I tried byte converter and random access file, both gave me same result. for example if user entered account data as follows:
01234567891
ABC02001
Mostez
Desc 1
Desc 2
entered value tested OK, but I get only first copied value '01234567891' in public array, any ideas how to solve this problem.
Thanks
In part of software, user enters account data i.e. account id, card number and user name one step after another in separate subs, each sub should copy entered value to public array, this array then will be written to SD card file. everything goes fine, but I get only first step OK, other failed to copy data to public array. I tried byte converter and random access file, both gave me same result. for example if user entered account data as follows:
01234567891
ABC02001
Mostez
Desc 1
Desc 2
entered value tested OK, but I get only first copied value '01234567891' in public array, any ideas how to solve this problem.
Thanks
B4X:
private Sub AddUserAccount(KeyFromMenuHandler As String)
MenuIndex = MENU_ADD_USER_ACCOUNT
RFIDmode = RFID_MODE_ENTRY
If KeyFromMenuHandler = KEY_NONE Then
For m = 0 To UserAccountSettingsArray.Length -1 'reset user account settings array
UserAccountSettingsArray(m) = Asc(" ") 'fill array with spaces
Next
NewEntry("Card Number:",10) 'title and max allowed char
Return
End If
Dim Result As Byte = NumericEntry(KeyFromMenuHandler,False)
If Result = KEY_ENTER Then
Dim Cid(10) As Byte 'tmp array
BC.ArrayCopy2(EntryBuffer,0,Cid,0,10) 'copy entry buffer to local tmp array
BC.ArrayCopy2(Cid,0,UserAccountSettingsArray,0,10) 'copy tmp array to public user account array
UserAccountSettingsArray(10) = TAB
' Dim raf As RandomAccessFile
' raf.Initialize(UserAccountSettingsArray,False)
' raf.CurrentPosition = 0
' raf.WriteBytes(Cid,0,10,raf.CurrentPosition)
' raf.WriteByte(TAB,raf.CurrentPosition) 'TAB delimeter
' Log(BC.StringFromBytes(Cid))
EnterUserAccountID(KEY_NONE) 'goto next step
Else if Result = KEY_CANCEL Then
RFIDmode = RFID_MODE_NONE
LCD.Clear
MenuUserAccount(KEY_NONE)
End If
End Sub
private Sub EnterUserAccountID(KeyFromMenuHandler As String)
MenuIndex = MENU_ENTER_USER_ACCOUNT_ID
RFIDmode = RFID_MODE_NONE
If KeyFromMenuHandler = KEY_NONE Then
NewEntry("Account ID:",8)
Return
End If
Dim Result As Byte = AlphaNumericEntry(KeyFromMenuHandler,False,ENTRY_ID_TYPE)
If Result = KEY_ENTER Then
Dim Cid(8) As Byte
BC.ArrayCopy2(EntryBuffer,0,Cid,0,8)
BC.ArrayCopy2(Cid,0,UserAccountSettingsArray,11,8)
UserAccountSettingsArray(27) = TAB
' Dim raf As RandomAccessFile
' raf.Initialize(UserAccountSettingsArray,False)
' raf.CurrentPosition = 11
' raf.WriteBytes(Cid,0,8,raf.CurrentPosition)
' raf.WriteByte(TAB,raf.CurrentPosition) 'TAB delimeter
' Log(BC.StringFromBytes(Cid))
EnterUserAccountDescription1(KEY_NONE) 'goto next step
Else if Result = KEY_CANCEL Then
RFIDmode = RFID_MODE_NONE
LCD.Clear
MenuUserAccount(KEY_NONE)
End If
End Sub
private Sub EnterUserAccountDescription1(KeyFromMenuHandler As String)
MenuIndex = MENU_ADD_USER_ACCOUNT_DESCRIPTION_1
RFIDmode = RFID_MODE_NONE
If KeyFromMenuHandler = KEY_NONE Then
NewEntry("User Name",16)
Return
End If
Dim Result As Byte = AlphaNumericEntry(KeyFromMenuHandler,False,ENTRY_ALPHANUMERIC)
If Result = KEY_ENTER Then
Dim Cid(16) As Byte
BC.ArrayCopy2(EntryBuffer,0,Cid,0,16)
BC.ArrayCopy2(Cid,0,UserAccountSettingsArray,28,16)
UserAccountSettingsArray(48) = TAB
' Dim raf As RandomAccessFile
' raf.Initialize(UserAccountSettingsArray,False)
' raf.CurrentPosition = 28
' raf.WriteBytes(Cid,0,16,raf.CurrentPosition)
' raf.WriteByte(TAB,raf.CurrentPosition) 'TAB delimeter
' Log(BC.StringFromBytes(Cid))
EnterUserAccountDescription2(KEY_NONE)
Else if Result = KEY_CANCEL Then
RFIDmode = RFID_MODE_NONE
LCD.Clear
MenuUserAccount(KEY_NONE)
End If
End Sub
private Sub EnterUserAccountDescription2(KeyFromMenuHandler As String)
MenuIndex = MENU_ADD_USER_ACCOUNT_DESCRIPTION_2
RFIDmode = RFID_MODE_NONE
If KeyFromMenuHandler = KEY_NONE Then
NewEntry("Profession:",16)
Return
End If
Dim Result As Byte = AlphaNumericEntry(KeyFromMenuHandler,False,ENTRY_ALPHANUMERIC)
If Result = KEY_ENTER Then
Dim Cid(16) As Byte
BC.ArrayCopy2(EntryBuffer,0,Cid,0,16)
BC.ArrayCopy2(Cid,0,UserAccountSettingsArray,49,16)
UserAccountSettingsArray(69) = TAB
' Dim raf As RandomAccessFile
' raf.Initialize(UserAccountSettingsArray,False)
' raf.CurrentPosition = 49
' raf.WriteBytes(Cid,0,16,raf.CurrentPosition)
' raf.WriteByte(TAB,raf.CurrentPosition) 'TAB delimeter
' MsgBox("Account Created","","",MSGBOX_INF,1000)
' Log(BC.StringFromBytes(Cid))
Log(BC.StringFromBytes(UserAccountSettingsArray))
MenuUserAccount(KEY_NONE)
Else if Result = KEY_CANCEL Then
RFIDmode = RFID_MODE_NONE
LCD.Clear
MenuUserAccount(KEY_NONE)
End If
End Sub