CON '-> [ENUM] Constants ERRORTITLELENGTH = 32 ERRORDESCRIPTIONLENGTH = 64 '-> [ENUM] Errors eGBL_UNFORSEENERROR = 65535 VAR '-> ErrorInfo Buffer/Variables '* Persisted in DATA section below ' ErrorInfo[100] ' Word _ErrSrcObjId 'Error source object Id ' Word _ErrId 'Error Id ' Byte _ErrTitle[32] 'Error title (32 chars) ' Byte _ErrDesc[64] 'Error description (64 chars) '-> [Start] Start PUB Start ' '-> Init Error Info buffers ClearErrors ' 'End Pub '-> [Pub] Clear Errors PUB ClearErrors ' ByteFill(@_wErrSrcObjId, 0 , 100) ' 'END PUB '-> [Pub] ErrTitleAddr PUB ErrTitleAddr ' Return (@_baErrTitle) ' 'END PUB '-> [Pub] ErrDescAddr PUB ErrDescAddr ' Return (@_baErrDesc) ' 'END PUB '-> [Pub] MoveGenericString PUB MoveGenericString(plStrSrcAddr, plStrDestAddr, pbMaxLen) | tmpLen ' tmpLen := StrSize(plStrSrcAddr) If (tmpLen > pbMaxLen) tmpLen := pbMaxLen 'End If ByteMove(plStrDestAddr, plStrSrcAddr, tmpLen) ' 'END PUB '-> [Pub] GetSrcObjId PUB GetSrcObjId : rtnERRSRCOBJID | tmpValue ' ByteMove(@tmpValue, @_wErrSrcObjId, 2) rtnERRSRCOBJID := tmpValue ' 'End Pub '-> [Pub] SetSrcObjId PUB SetSrcObjId(pwNewErrSrcObjId) ' ByteMove(@_wErrSrcObjId, @pwNewErrSrcObjId, 2) ' 'End Pub '-> [Pub] GetErrId PUB GetErrId : rtnERRID | tmpValue ' ByteMove(@tmpValue, @_wErrId, 2) rtnERRID := tmpValue ' 'End Pub '-> [Pub] SetErrId PUB SetErrId(pwNewErrId) ' ByteMove(@_wErrId, @pwNewErrId, 2) ' 'End Pub '-> [Pub] GetErrTitle PUB GetErrTitle(plDestAddr) ' 'MoveGenericString(SrcAddr, DestAddr, MaxLen) MoveGenericString(@_baErrTitle, plDestAddr, 32) ' 'End Pub '-> [Pub] SetErrTitle PUB SetErrTitle(plSrcAddr) | tmpLen ' 'MoveGenericString(SrcAddr, DestAddr, MaxLen) MoveGenericString(plSrcAddr, @_baErrTitle, 32) ' 'End Pub '-> [Pub] GetErrDesc PUB GetErrDesc(plDestAddr) | tmpLen ' 'MoveGenericString(SrcAddr, DestAddr, MaxLen) MoveGenericString(@_baErrDesc, plDestAddr, 64) ' 'End Pub '-> [Pub] SetErrDesc PUB SetErrDesc(plSrcAddr) | tmpLen ' 'MoveGenericString(SrcAddr, DestAddr, MaxLen) MoveGenericString(plSrcAddr, @_baErrDesc, 64) ' 'End Pub '-> [Pub] Set Error Info PUB SetErrorInfo(pwSrcObjId, pwErrId, plErrTitlePtr, plErrDescPtr) | tmpPtr1, tmpPtr2, tmpLen ' '-> Info ' This method raises an error by populatng the error object fields with valid data and thus officiating the error ' The user must call the PRINTERROR method directly after calling this method to PRINT the ERROR to the SCREEN ' '-> Process request If (pwErrId > 0) ' '-> Clear old info ClearErrors ' '-> Set error source object id ByteMove(@_wErrSrcObjId, @pwSrcObjId, 2) ' '-> Set error id ByteMove(@_wErrId, @pwErrId, 2) ' '-> If unforseen error If (pwErrId == eGBL_UNFORSEENERROR) ' '-> Store user friendly error title in error title ByteMove(@_baErrTitle, @et_Unforeseen, 16) ' '-> Store user friendly error message in error description ByteMove(@_baErrTitle, @ed_Unforeseen, 60) ' Else ' '-> Store user friendly error title in error title tmpLen := StrSize(plErrTitlePtr) If (tmpLen > ERRORTITLELENGTH) tmpLen := ERRORTITLELENGTH 'End If ByteMove(@_baErrTitle, plErrTitlePtr, tmpLen) ' '-> Store user friendly error message in error description tmpLen := StrSize(plErrDescPtr) If (tmpLen > ERRORDESCRIPTIONLENGTH) tmpLen := ERRORDESCRIPTIONLENGTH 'End If ByteMove(@_baErrDesc, plErrDescPtr, tmpLen) 'End If 'End If ' 'END PUB DAT '-> ErrorInfo[100] _wErrSrcObjId Byte Word $0 'Error source object Id _wErrId Byte Word $0 'Error Id _baErrTitle Byte Byte $0[32], 0 'Error title (32 chars) _baErrDesc Byte Byte $0[64], 0 'Error description (64 chars) '-> clsErrorsManager Error Data et_Unforeseen Byte "Unforseen Error!", 0 'Len=16 ed_Unforeseen Byte "An unforeseen error has occurred, please restart your device", 0 'Len=60