Private const MAGIC_EEPROM As Byte = 213
Public Sub GetStoredDataLength As Byte
Dim header() As Byte = eeprom.ReadBytes(0, 2)
' Log("header lu=",header(0),"+",header(1))
If header(0) = MAGIC_EEPROM Then
Return header(1)
End If
Return 0
End Sub
Sub GetStoredData As Byte
Dim length As Byte = GetStoredDataLength
' Log("length wifi=",length)
If length > 0 Then
Dim ObjectsBuffer(18) As Object
Dim Data() As Byte = eeprom.ReadBytes(2, length)
Dim Objects() As Object = sr.ConvertBytesToArray(Data, ObjectsBuffer)
If Objects.Length <> 0 Then
' For Each o As Object In Objects
' Log("obj_wifi",o)
' Next
For i = 0 To 17
GStore1.Put(i,Objects(i))
Next
Return 1
Else
Return 0
End If
Else
Return 0
End If
End Sub
Public Sub SaveNetworkDetails(Data() As Byte)
Log("Saving Network data")
Log("data length: ", Data.Length)
' Log("data to eeprom=",Data)
eeprom.WriteBytes(Array As Byte(MAGIC_EEPROM, Data.Length), 0)
eeprom.WriteBytes(Data, 2)
' ConnectToNetwork
End Sub