Localization, Support Hives without RTC (save to SD Card)
This commit is contained in:
parent
7db2adf562
commit
24cbdc35c2
@ -161,7 +161,8 @@ A_AYS = %00000000_00000000_00000010_00000000
|
||||
a_rtcSetNVSRAM 'Sets the NVSRAM to the selected value (0 - 255) at the index (0 - 55).
|
||||
a_rtcGetNVSRAM 'Gets the selected NVSRAM value at the index (0 - 55).
|
||||
a_rtcPauseForSec 'Pauses execution for a number of seconds. Returns a puesdo random value derived from the current clock frequency and the time when called. Number - Number of seconds to pause for between 0 and 2,147,483,647.
|
||||
a_rtcPauseForMSec '58 'Pauses execution for a number of milliseconds. Returns a puesdo random value derived from the current clock frequency and the time when called. Number - Number of milliseconds to pause for between 0 and 2,147,483,647.
|
||||
a_rtcPauseForMSec 'Pauses execution for a number of milliseconds. Returns a puesdo random value derived from the current clock frequency and the time when called. Number - Number of milliseconds to pause for between 0 and 2,147,483,647.
|
||||
a_rtcTest '59 'Test if RTC Chip is available
|
||||
|
||||
' ---------------------------------------------- LAN-FUNKTIONEN
|
||||
#71, a_lanStart 'Start Network
|
||||
|
@ -1025,6 +1025,13 @@ PUB pauseForMilliseconds(number) 'Pauses execution for a
|
||||
bus_putchar1(gc#a_rtcPauseForMSec)
|
||||
return bus_getlong1
|
||||
|
||||
PUB rtcTest: available 'Test if RTC Chip is available
|
||||
''funktionsgruppe : rtc
|
||||
''busprotokoll : [059][get.avaliable]
|
||||
'' : Returns TRUE if RTC is available, otherwise FALSE
|
||||
bus_putchar1(gc#a_rtcTest)
|
||||
available := bus_getchar1
|
||||
available := ~available
|
||||
|
||||
CON ''------------------------------------------------- LAN_FUNKTIONEN
|
||||
|
||||
|
27
make.sh
27
make.sh
@ -1,6 +1,9 @@
|
||||
#! /bin/sh
|
||||
|
||||
date
|
||||
# Definitionen
|
||||
##D="-D __DEBUG -D __LANG_EN"
|
||||
##D="-D __LANG_EN"
|
||||
D="-D __LANG_DE"
|
||||
|
||||
# Pfade
|
||||
##bin="../Bin"
|
||||
@ -22,18 +25,18 @@ mkdir ${flash}
|
||||
# Flashdateien erzeugen
|
||||
# --> bin/flash
|
||||
|
||||
${BSTC} -L ${libpath} -b -O a flash/administra/admflash.spin
|
||||
${BSTC} -L ${libpath} ${D} -b -O a flash/administra/admflash.spin
|
||||
cp admflash.binary ${flash}
|
||||
mv admflash.binary ${sdsys}/admsys.adm
|
||||
|
||||
${BSTC} -L ${libpath} -D __VGA -b -O a flash/bellatrix/belflash.spin
|
||||
${BSTC} -L ${libpath} ${D} -D __VGA -b -O a flash/bellatrix/belflash.spin
|
||||
cp belflash.binary ${flash}
|
||||
mv belflash.binary ${sdsys}/vga.bel
|
||||
|
||||
${BSTC} -L ${libpath} -D __TV -b -O a flash/bellatrix/belflash.spin
|
||||
${BSTC} -L ${libpath} ${D} -D __TV -b -O a flash/bellatrix/belflash.spin
|
||||
mv belflash.binary ${sdsys}/tv.bel
|
||||
|
||||
${BSTC} -L ${libpath} -b -O a flash/regnatix/regflash.spin
|
||||
${BSTC} -L ${libpath} ${D} -b -O a flash/regnatix/regflash.spin
|
||||
mv regflash.binary ${flash}
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
@ -41,7 +44,7 @@ mv regflash.binary ${flash}
|
||||
# reg.sys (Regime)
|
||||
# --> bin/sdcard\
|
||||
|
||||
${BSTC} -L ${libpath} -b -O a system/regnatix/regime.spin
|
||||
${BSTC} -L ${libpath} ${D} -b -O a system/regnatix/regime.spin
|
||||
mv regime.binary ${sd}/reg.sys
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
@ -49,16 +52,16 @@ mv regime.binary ${sd}/reg.sys
|
||||
# admsid, admay, admnet
|
||||
# htxt, g0key
|
||||
|
||||
${BSTC} -L ${libpath} -b -O a system/administra/admsid/admsid.spin
|
||||
${BSTC} -L ${libpath} ${D} -b -O a system/administra/admsid/admsid.spin
|
||||
mv admsid.binary ${sdsys}/admsid.adm
|
||||
${BSTC} -L ${libpath} -b -O a system/administra/admay/admay.spin
|
||||
${BSTC} -L ${libpath} ${D} -b -O a system/administra/admay/admay.spin
|
||||
mv admay.binary ${sdsys}/admay.adm
|
||||
${BSTC} -L ${libpath} -b -O a system/administra/admnet/admnet.spin
|
||||
${BSTC} -L ${libpath} ${D} -b -O a system/administra/admnet/admnet.spin
|
||||
mv admnet.binary ${sdsys}/admnet.adm
|
||||
|
||||
${BSTC} -L ${libpath} -b -O a system/bellatrix/bel-htext/htext.spin
|
||||
${BSTC} -L ${libpath} ${D} -b -O a system/bellatrix/bel-htext/htext.spin
|
||||
mv htext.binary ${sdsys}/htext.bel
|
||||
${BSTC} -L ${libpath} -b -O a system/bellatrix/bel-g0/g0key.spin
|
||||
${BSTC} -L ${libpath} ${D} -b -O a system/bellatrix/bel-g0/g0key.spin
|
||||
mv g0key.binary ${sdsys}/g0key.bel
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
@ -68,7 +71,7 @@ mv g0key.binary ${sdsys}/g0key.bel
|
||||
# --> bin/sdcard/system/
|
||||
|
||||
for FILE in system/regnatix/*.spin ; do
|
||||
${BSTC} -L ${libpath} -b -O a ${FILE}
|
||||
${BSTC} -L ${libpath} ${D} -b -O a ${FILE}
|
||||
BASE="`basename ${FILE} .spin`"
|
||||
mv "${BASE}.binary" "${sdsys}/${BASE}.bin"
|
||||
done
|
||||
|
@ -204,6 +204,10 @@ OBJ
|
||||
gc : "glob-con" 'globale konstanten
|
||||
num : "glob-numbers" 'Number Engine
|
||||
|
||||
DAT
|
||||
|
||||
strNVRAMFile byte "nvram.sav",0 'contains the 56 bytes of NVRAM, if RTC is not available
|
||||
|
||||
VAR
|
||||
|
||||
long dmarker[6] 'speicher für dir-marker
|
||||
@ -288,6 +292,7 @@ PUB main | cmd,err 'chip: kommandointerpret
|
||||
gc#a_rtcGetNVSRAM: rtc_getNVSRAM 'Gets the selected NVSRAM value at the index (0 - 55).
|
||||
gc#a_rtcPauseForSec: rtc_pauseForSeconds 'Pauses execution for a number of seconds. Returns a puesdo random value derived from the current clock frequency and the time when called. Number - Number of seconds to pause for between 0 and 2,147,483,647.
|
||||
gc#a_rtcPauseForMSec: rtc_pauseForMilliseconds 'Pauses execution for a number of milliseconds. Returns a puesdo random value derived from the current clock frequency and the time when called. Number - Number of milliseconds to pause for between 0 and 2,147,483,647.
|
||||
gc#a_rtcTest: rtc_test 'Test if RTC Chip is available
|
||||
|
||||
' ---------------------------------------------- LAN-FUNKTIONEN
|
||||
gc#a_lanStart: lan_start 'Start Network
|
||||
@ -1109,9 +1114,27 @@ PRI rtc_pauseForMilliseconds 'rtc: Pauses execution f
|
||||
'' : Returns a puesdo random value derived from the current clock frequency and the time when called.
|
||||
sub_putlong(rtc.pauseForMilliseconds(sub_getlong))
|
||||
|
||||
PRI probeRTC | hiveid
|
||||
|
||||
hiveid := rtc.getNVSRAM(NVRAM_HIVE) 'read first byte of hive id
|
||||
|
||||
rtc.setNVSRAM(NVRAM_HIVE, hiveid ^ $F) 'write back to NVRAM with flipped all bits
|
||||
if rtc.getNVSRAM(NVRAM_HIVE) == hiveid ^ $F 'flipped bits are stored?
|
||||
rtc.setNVSRAM(NVRAM_HIVE, hiveid) 'restore first byte of hive id
|
||||
return(TRUE) 'RTC found
|
||||
else
|
||||
rtc.setNVSRAM(NVRAM_HIVE, hiveid) 'still restore first byte of hive id
|
||||
return(FALSE) 'no RTC found
|
||||
|
||||
PRI rtc_test 'rtc: Test if RTC Chip is available
|
||||
''funktionsgruppe : rtc
|
||||
''busprotokoll : [059][put.avaliable]
|
||||
'' : Returns TRUE if RTC is available, otherwise FALSE
|
||||
bus_putchar(probeRTC)
|
||||
|
||||
CON ''------------------------------------------------- LAN-FUNKTIONEN
|
||||
|
||||
PRI lan_start | hiveid, hivestr, strpos, macpos, i
|
||||
PRI lan_start | hiveid, hivestr, strpos, macpos, i, a
|
||||
''funktionsgruppe : lan
|
||||
''funktion : Netzwerk starten
|
||||
''eingabe : -
|
||||
@ -1126,30 +1149,30 @@ PRI lan_start | hiveid, hivestr, strpos, macpos, i
|
||||
bufidx[i++] := $FF '0xFF: nicht zugewiesen
|
||||
|
||||
'IP-Parameter setzen
|
||||
ip_addr := rtc.getNVSRAM(NVRAM_IPADDR)
|
||||
ip_addr[1] := rtc.getNVSRAM(NVRAM_IPADDR+1)
|
||||
ip_addr[2] := rtc.getNVSRAM(NVRAM_IPADDR+2)
|
||||
ip_addr[3] := rtc.getNVSRAM(NVRAM_IPADDR+3)
|
||||
|
||||
ip_subnet := rtc.getNVSRAM(NVRAM_IPMASK)
|
||||
ip_subnet[1] := rtc.getNVSRAM(NVRAM_IPMASK+1)
|
||||
ip_subnet[2] := rtc.getNVSRAM(NVRAM_IPMASK+2)
|
||||
ip_subnet[3] := rtc.getNVSRAM(NVRAM_IPMASK+3)
|
||||
|
||||
ip_gateway := rtc.getNVSRAM(NVRAM_IPGW)
|
||||
ip_gateway[1] := rtc.getNVSRAM(NVRAM_IPGW+1)
|
||||
ip_gateway[2] := rtc.getNVSRAM(NVRAM_IPGW+2)
|
||||
ip_gateway[3] := rtc.getNVSRAM(NVRAM_IPGW+3)
|
||||
|
||||
ip_dns := rtc.getNVSRAM(NVRAM_IPDNS)
|
||||
ip_dns[1] := rtc.getNVSRAM(NVRAM_IPDNS+1)
|
||||
ip_dns[2] := rtc.getNVSRAM(NVRAM_IPDNS+2)
|
||||
ip_dns[3] := rtc.getNVSRAM(NVRAM_IPDNS+3)
|
||||
|
||||
if probeRTC
|
||||
repeat a from 0 to 15
|
||||
ip_addr[a] := rtc.getNVSRAM(NVRAM_IPADDR+a) ' fill addresses
|
||||
hiveid := rtc.getNVSRAM(NVRAM_HIVE)
|
||||
hiveid := hiveid + rtc.getNVSRAM(NVRAM_HIVE+1) << 8
|
||||
hiveid := hiveid + rtc.getNVSRAM(NVRAM_HIVE+2) << 16
|
||||
hiveid := hiveid + rtc.getNVSRAM(NVRAM_HIVE+3) << 24
|
||||
hiveid += rtc.getNVSRAM(NVRAM_HIVE+1) << 8
|
||||
hiveid += rtc.getNVSRAM(NVRAM_HIVE+2) << 16
|
||||
hiveid += rtc.getNVSRAM(NVRAM_HIVE+3) << 24
|
||||
else
|
||||
dmarker[UMARKER] := sdfat.getDirCluster 'u-marker setzen
|
||||
ifnot dmarker[SMARKER] == TRUE 's-marker aktivieren
|
||||
sdfat.setDirCluster(dmarker[SMARKER])
|
||||
ifnot \sdfat.openFile(@strNVRAMFile, "R")
|
||||
\sdfat.setCharacterPosition(NVRAM_IPADDR)
|
||||
repeat a from 0 to 15
|
||||
ip_addr[a] := \sdfat.readCharacter ' fill addresses
|
||||
\sdfat.setCharacterPosition(NVRAM_HIVE)
|
||||
hiveid := \sdfat.readCharacter
|
||||
hiveid += \sdfat.readCharacter << 8
|
||||
hiveid += \sdfat.readCharacter << 16
|
||||
hiveid += \sdfat.readCharacter << 24
|
||||
\sdfat.closeFile
|
||||
ifnot dmarker[UMARKER] == TRUE 'U-marker aktivieren
|
||||
sdfat.setDirCluster(dmarker[UMARKER])
|
||||
|
||||
hivestr := num.ToStr(hiveid, num#DEC)
|
||||
strpos := strsize(hivestr)
|
||||
macpos := 5
|
||||
|
@ -53,6 +53,10 @@ CON 'NVRAM Konstanten ----------------------------------------------------------
|
||||
#20, NVRAM_IPBOOT
|
||||
#24, NVRAM_HIVE ' 4 Bytes
|
||||
|
||||
DAT
|
||||
|
||||
strNVRAMFile byte "nvram.sav",0 'contains the 56 bytes of NVRAM, if RTC is not available
|
||||
|
||||
VAR
|
||||
|
||||
long ip_addr
|
||||
@ -78,7 +82,7 @@ PUB main
|
||||
|
||||
ios.start
|
||||
ifnot (ios.admgetspec & LANMASK)
|
||||
ios.print(string(10,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",10,"Bitte admnet laden.",10))
|
||||
ios.print(@strNoNetwork)
|
||||
ios.stop
|
||||
ios.printnl
|
||||
ios.parastart 'parameterübergabe starten
|
||||
@ -86,10 +90,10 @@ PUB main
|
||||
if byte[@parastr][0] == "/" 'option?
|
||||
case byte[@parastr][1]
|
||||
"?": ios.print(@help)
|
||||
"f": if ios.paranext(@parastr)
|
||||
"h": if ios.paranext(@parastr)
|
||||
setaddr(@parastr)
|
||||
"v": ios.paranext(@remdir)
|
||||
"d": ios.paranext(@filename)
|
||||
"d": ios.paranext(@remdir)
|
||||
"f": ios.paranext(@filename)
|
||||
"u": ios.paranext(@username)
|
||||
"p": ios.paranext(@password)
|
||||
"s": save2card := TRUE
|
||||
@ -98,11 +102,11 @@ PUB main
|
||||
ifnot byte[@filename][0] == 0
|
||||
ifnot ftpconnect
|
||||
ifnot ftplogin
|
||||
ftpcwd
|
||||
ifnot ftpcwd
|
||||
if ftppasv
|
||||
ftpretr
|
||||
else
|
||||
ios.print(string("Keine Datei zum Downloaden angegeben, beende...",10))
|
||||
ios.print(@strNoFile)
|
||||
|
||||
|
||||
ftpclose
|
||||
@ -111,27 +115,43 @@ PUB main
|
||||
PRI ftpconnect
|
||||
|
||||
ifnot (ip_addr) ' Adresse 0.0.0.0
|
||||
ios.print(string("FTP-Server nicht angegeben (Parameter /s)",10))
|
||||
ios.print(@strNoHost)
|
||||
if ios.rtcTest 'RTC chip available?
|
||||
ip_addr := ios.getNVSRAM(NVRAM_IPBOOT) << 24
|
||||
ip_addr += ios.getNVSRAM(NVRAM_IPBOOT+1) << 16
|
||||
ip_addr += ios.getNVSRAM(NVRAM_IPBOOT+2) << 8
|
||||
ip_addr += ios.getNVSRAM(NVRAM_IPBOOT+3)
|
||||
else
|
||||
ios.sddmset(ios#DM_USER) 'u-marker setzen
|
||||
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
|
||||
ifnot ios.sdopen("R",@strNVRAMFile)
|
||||
ios.sdseek(NVRAM_IPBOOT)
|
||||
ip_addr := ios.sdgetc << 24
|
||||
ip_addr += ios.sdgetc << 16
|
||||
ip_addr += ios.sdgetc << 8
|
||||
ip_addr += ios.sdgetc
|
||||
ios.sdclose
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
if (ip_addr)
|
||||
ios.print(string("Verwende Boot-Server (mit ipconfig gesetzt).",10))
|
||||
ios.print(@strUseBoot)
|
||||
else
|
||||
return(-1)
|
||||
ios.print(string("Starte LAN...",10))
|
||||
#ifdef __DEBUG
|
||||
ios.print(@strStartLAN)
|
||||
#endif
|
||||
ios.lanstart
|
||||
ios.print(string("Verbinde mit FTP-Server...",10))
|
||||
ios.print(@strConnect)
|
||||
if (handleidx_control := ios.lan_connect(ip_addr, 21)) == $FF
|
||||
ios.print(string("Kein Socket frei...",10))
|
||||
ios.print(@strErrorNoSock)
|
||||
return(-1)
|
||||
ifnot (ios.lan_waitconntimeout(handleidx_control, 2000))
|
||||
ios.print(string("Verbindung mit FTP-Server konnte nicht aufgebaut werden.",10))
|
||||
ios.print(@strErrorConnect)
|
||||
return(-1)
|
||||
ios.print(string("Verbindung mit FTP-Server hergestellt, warte auf Antwort...",10))
|
||||
#ifdef __DEBUG
|
||||
ios.print(@strConnected)
|
||||
#endif
|
||||
ifnot getResponse(string("220 "))
|
||||
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10))
|
||||
ios.print(@strError220)
|
||||
return(-1)
|
||||
return(0)
|
||||
|
||||
@ -157,9 +177,11 @@ PRI ftplogin | pwreq, respOK, hiveid
|
||||
sendStr(string("anonymous",13,10))
|
||||
|
||||
repeat until readLine == -1
|
||||
#ifdef __DEBUG
|
||||
ios.print(string(" < "))
|
||||
ios.print(@strTemp)
|
||||
ios.printnl
|
||||
#endif
|
||||
strTemp[4] := 0
|
||||
if strcomp(@strTemp, string("230 "))
|
||||
respOk := TRUE
|
||||
@ -169,7 +191,7 @@ PRI ftplogin | pwreq, respOK, hiveid
|
||||
respOk := TRUE
|
||||
quit
|
||||
ifnot respOK
|
||||
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10))
|
||||
ios.print(@strErrorLogin)
|
||||
return(-1)
|
||||
|
||||
ifnot pwreq
|
||||
@ -180,16 +202,28 @@ PRI ftplogin | pwreq, respOK, hiveid
|
||||
sendStr(@password)
|
||||
sendStr(string(13,10))
|
||||
else
|
||||
if ios.rtcTest 'RTC chip available?
|
||||
hiveid := ios.getNVSRAM(NVRAM_HIVE)
|
||||
hiveid += ios.getNVSRAM(NVRAM_HIVE+1) << 8
|
||||
hiveid += ios.getNVSRAM(NVRAM_HIVE+2) << 16
|
||||
hiveid += ios.getNVSRAM(NVRAM_HIVE+3) << 24
|
||||
else
|
||||
ios.sddmset(ios#DM_USER) 'u-marker setzen
|
||||
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
|
||||
ifnot ios.sdopen("R",@strNVRAMFile)
|
||||
ios.sdseek(NVRAM_HIVE)
|
||||
hiveid := ios.sdgetc
|
||||
hiveid += ios.sdgetc << 8
|
||||
hiveid += ios.sdgetc << 16
|
||||
hiveid += ios.sdgetc << 24
|
||||
ios.sdclose
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
sendStr(string("anonymous@hive"))
|
||||
sendStr(str.trimCharacters(num.ToStr(hiveid, num#DEC)))
|
||||
sendStr(string(13,10))
|
||||
|
||||
ifnot getResponse(string("230 "))
|
||||
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10))
|
||||
ios.print(@strErrorPass)
|
||||
return(-1)
|
||||
|
||||
return(0)
|
||||
@ -201,10 +235,13 @@ PRI ftpcwd | i
|
||||
else
|
||||
i := sendStr(string("CWD ")) || sendStr(@remdir) || sendStr(string(13,10))
|
||||
if i
|
||||
ios.print(string("Fehler beim Senden des Verzeichnisses",10))
|
||||
ios.print(@strErrorCWD)
|
||||
return(-1)
|
||||
ifnot getResponse(string("250 "))
|
||||
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10))
|
||||
ios.print(@strError250)
|
||||
ios.printchar("(")
|
||||
ios.print(@strTemp+4)
|
||||
ios.print(string(")",13))
|
||||
return(-1)
|
||||
return(0)
|
||||
|
||||
@ -219,9 +256,11 @@ PRI ftppasv : port | i, k, port256, port1
|
||||
return(0)
|
||||
|
||||
repeat until readLine == -1
|
||||
#ifdef __DEBUG
|
||||
ios.print(string(" < "))
|
||||
ios.print(@strTemp)
|
||||
ios.printnl
|
||||
#endif
|
||||
strTemp[4] := 0
|
||||
if strcomp(@strTemp, string("227 "))
|
||||
repeat i from 5 to 126
|
||||
@ -241,44 +280,53 @@ PRI ftppasv : port | i, k, port256, port1
|
||||
quit
|
||||
|
||||
if (port == 0)
|
||||
ios.print(string("FTP-Server-Fehler beim Öffnen des Passiv-Ports",10))
|
||||
ios.print(@strErrorPasvPort)
|
||||
return(0)
|
||||
ios.print(string("Öffne Verbindung zu Passiv-Port "))
|
||||
#ifdef __DEBUG
|
||||
ios.print(@strOpenPasv)
|
||||
ios.print(num.ToStr(port, num#DEC))
|
||||
ios.printnl
|
||||
#endif
|
||||
if (handleidx_data := ios.lan_connect(ip_addr, port)) == $FF
|
||||
ios.print(string("Kein Socket frei...",10))
|
||||
ios.print(@strErrorSockPasv)
|
||||
return(0)
|
||||
ifnot (ios.lan_waitconntimeout(handleidx_data, 2000))
|
||||
ios.print(string("Verbindung mit FTP-Server konnte nicht aufgebaut werden.",10))
|
||||
ios.print(@strErrorPasvConn)
|
||||
return(0)
|
||||
|
||||
PRI ftpretr | len, respOK
|
||||
|
||||
if sendStr(string("TYPE I",13,10))
|
||||
ios.print(string("Fehler beim Senden des Types",10))
|
||||
ios.print(@strErrorSendType)
|
||||
return(-1)
|
||||
ifnot getResponse(string("200 "))
|
||||
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10))
|
||||
ios.print(@strErrorChType)
|
||||
return(-1)
|
||||
|
||||
if sendStr(string("SIZE ")) || sendStr(@filename) || sendStr(string(13,10))
|
||||
ios.print(string("Fehler beim Senden des SIZE-Kommandos",10))
|
||||
ios.print(@strErrorSendSize)
|
||||
return(-1)
|
||||
ifnot getResponse(string("213"))
|
||||
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10))
|
||||
ios.print(@strErrorSize)
|
||||
ios.printchar("(")
|
||||
ios.print(@strTemp+4)
|
||||
ios.print(string(")",13))
|
||||
return(-1)
|
||||
ifnot(len := num.FromStr(@strTemp+4, num#DEC))
|
||||
ios.print(@strErrorGetSize)
|
||||
return(-1)
|
||||
|
||||
ios.print(@strGetFile)
|
||||
if sendStr(string("RETR ")) || sendStr(@filename) || sendStr(string(13,10))
|
||||
ios.print(string("Fehler beim Senden des Filenamens",10))
|
||||
ios.print(@strErrorSendFN)
|
||||
return -1
|
||||
respOK := FALSE
|
||||
repeat until readLine == -1
|
||||
#ifdef __DEBUG
|
||||
ios.print(string(" < "))
|
||||
ios.print(@strTemp)
|
||||
ios.printnl
|
||||
#endif
|
||||
strTemp[4] := 0
|
||||
if strcomp(@strTemp, string("150 "))
|
||||
respOk := TRUE
|
||||
@ -287,20 +335,23 @@ PRI ftpretr | len, respOK
|
||||
respOk := TRUE
|
||||
quit
|
||||
ifnot respOK
|
||||
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10))
|
||||
ios.print(@strErrorRetr)
|
||||
ios.printchar("(")
|
||||
ios.print(@strTemp+4)
|
||||
ios.print(string(")",13))
|
||||
return(-1)
|
||||
|
||||
if ios.lan_rxdata(handleidx_data, @filename, len)
|
||||
ios.print(string("Fehler beim Empfang der Datei.",10))
|
||||
ios.print(@strErrorRXData)
|
||||
return(-1)
|
||||
|
||||
ifnot getResponse(string("226 "))
|
||||
ios.print(string("Keine oder falsche Antwort vom FTP-Server erhalten.",10))
|
||||
ios.print(@strErrorRetrOK)
|
||||
return(-1)
|
||||
|
||||
if save2card
|
||||
ios.print(@strWrite2SD)
|
||||
writeToSDCard
|
||||
ios.print(string("Speichere auf SD-Card...",10))
|
||||
|
||||
PRI writeToSDCard | fnr, len, i
|
||||
|
||||
@ -311,7 +362,7 @@ PRI writeToSDCard | fnr, len, i
|
||||
ifnot ios.sdnewfile(@filename)
|
||||
ifnot ios.sdopen("W",@filename)
|
||||
i := 0
|
||||
ios.sdxputblk(fnr,len) 'daten als block schreiben
|
||||
ios.sdxputblk(fnr,len) 'Daten als Block schreiben
|
||||
ios.sdclose
|
||||
ios.rd_del(@filename)
|
||||
ios.rd_close(fnr)
|
||||
@ -333,9 +384,11 @@ PRI getResponse (strOk) : respOk | len
|
||||
respOk := FALSE
|
||||
|
||||
repeat until readLine == -1
|
||||
#ifdef __DEBUG
|
||||
ios.print(string(" < "))
|
||||
ios.print(@strTemp)
|
||||
ios.printnl
|
||||
#endif
|
||||
strTemp[strsize(strOk)] := 0
|
||||
if strcomp(@strTemp, strOk)
|
||||
respOk := TRUE
|
||||
@ -359,27 +412,112 @@ PRI readLine | i, ch
|
||||
|
||||
PRI sendStr (strSend) : error
|
||||
|
||||
#ifdef __DEBUG
|
||||
ios.print(string(" > "))
|
||||
ios.print(strSend)
|
||||
ios.printnl
|
||||
#endif
|
||||
error := ios.lan_txdata(handleidx_control, strSend, strsize(strSend))
|
||||
|
||||
DAT
|
||||
DAT ' Locale
|
||||
|
||||
#ifdef __LANG_EN
|
||||
'locale: english
|
||||
|
||||
defdir byte "/hive/sdcard/system",0
|
||||
help byte "/? : Hilfe",10
|
||||
byte "/f <a.b.c.d> : FTP-Server-Adresse",10
|
||||
byte " (default: mit ipconfig gesetzter Boot-Server)",10
|
||||
byte "/v <verzeichnis>: in entferntes Verzeichnis wechseln",10
|
||||
byte " (default: /hive/sdcard/system)",10
|
||||
byte "/d <dateiname> : Download <dateiname>",10
|
||||
byte "/u <username> : Benutzername am FTP-Server",10
|
||||
byte " (default: anonymous)",10
|
||||
byte "/p <password> : Paßwort am FTP-Server",10
|
||||
byte " (default: anonymous@hive<Hive-Id>)",10
|
||||
byte "/s : Datei auf SD-Card speichern",10
|
||||
|
||||
strNoNetwork byte 13,"Administra doesn't provide network functions!",13,"Please load admnet.",13,0
|
||||
strNoFile byte "No file to download specified, exit...",13,0
|
||||
strNoHost byte "No host (ftp server) specified (parameter /h)",13,0
|
||||
strUseBoot byte "Using boot server (set with ipconfig).",13,0
|
||||
strStartLAN byte "Starting LAN...",13,0
|
||||
strConnect byte "Connecting to ftp server...",13,0
|
||||
strErrorNoSock byte "No free socket.",13,0
|
||||
strErrorConnect byte "Couldn't connect to ftp server.",13,0
|
||||
strConnected byte "Connected to ftp server, waiting for answer...",13,0
|
||||
strError220 byte "Ftp server doesn't acknowledge the connection (220).",13,0
|
||||
strErrorLogin byte "Ftp server doesn't acknowledge the login (230/331)",13,0
|
||||
strErrorPass byte "Ftp server doesn't acknowledge the password (230)",13,0
|
||||
strErrorCWD byte "Error sendig remote directory",13,0
|
||||
strError250 byte "Ftp server doesn't acknowledge the directory change (250).",13,0
|
||||
strErrorPasvPort byte "Couldn't get the passive port.",13,0
|
||||
strOpenPasv byte "Open Connection to passive port ",0
|
||||
strErrorSockPasv byte "No free socket fpr passive connection.",13,0
|
||||
strErrorPasvConn byte "Couldn't connect to passive port.",13,0
|
||||
strErrorSendType byte "Error sending file type",13,0
|
||||
strErrorChType byte "Ftp serve couldn't change file type (200).",13,0
|
||||
strErrorSendSize byte "Error sending SIZE command",13,0
|
||||
strErrorSize byte "Ftp server couldn't send file size (213).",13,"File not found? SIZE not supported?",13,0
|
||||
strErrorGetSize byte "Couldn't get file size.",13,0
|
||||
strGetFile byte "Retrieve file, please wait...",13,0
|
||||
strErrorSendFN byte "Error sending file name.",13,0
|
||||
strErrorRetr byte "Ftp server couldn't send file (150/125).",13,0
|
||||
strErrorRXData byte "Error retrieving file.",13,0
|
||||
strErrorRetrOK byte "Ftp server doesn't acknowledge sending of file (226).",13,0
|
||||
strWrite2SD byte "Saving to sd card...",13,0
|
||||
|
||||
help byte "/? : Help",13
|
||||
byte "/h <a.b.c.d> : host ip address (ftp server)",13
|
||||
byte " (default: boot server from ipconfig)",13
|
||||
byte "/d <directory>: change to remote directory",13
|
||||
byte " (default: /hive/sdcard/system)",13
|
||||
byte "/f <filename> : download <filename>",13
|
||||
byte "/u <username> : Username at ftp server",13
|
||||
byte " (default: anonymous)",13
|
||||
byte "/p <password> : password at ftp server",13
|
||||
byte " (default: anonymous@hive<hive id>)",13
|
||||
byte "/s : save file to sd card",13
|
||||
byte 0
|
||||
|
||||
#else
|
||||
'default locale: german
|
||||
|
||||
defdir byte "/hive/sdcard/system",0
|
||||
|
||||
strNoNetwork byte 13,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",13,"Bitte admnet laden.",13,0
|
||||
strNoFile byte "Keine Datei zum Downloaden angegeben, beende...",13,0
|
||||
strNoHost byte "FTP-Server nicht angegeben (Parameter /h)",13,0
|
||||
strUseBoot byte "Verwende Boot-Server (mit ipconfig gesetzt).",13,0
|
||||
strStartLAN byte "Starte LAN...",13,0
|
||||
strConnect byte "Verbinde mit FTP-Server...",13,0
|
||||
strErrorNoSock byte "Kein Socket frei...",13,0
|
||||
strErrorConnect byte "Verbindung mit FTP-Server konnte nicht aufgebaut werden.",13,0
|
||||
strConnected byte "Verbindung mit FTP-Server hergestellt, warte auf Antwort...",13,0
|
||||
strError220 byte "FTP-Server bestätigt den Verbindungsaufbau nicht (220).",13,0
|
||||
strErrorLogin byte "FTP-Server hat Login nicht bestätigt (230/331)",13,0
|
||||
strErrorPass byte "FTP-Server hat das Paßwort nicht bestätigt (230)",13,0
|
||||
strErrorCWD byte "Fehler beim Senden des Verzeichnisses",13,0
|
||||
strError250 byte "FTP-Server hat den Verzeichniswechsel nicht bestätigt (250).",13,0
|
||||
strErrorPasvPort byte "Konnte zu öffnenden Passiv-Port nicht ermitteln.",13,0
|
||||
strOpenPasv byte "Öffne Verbindung zu Passiv-Port ",0
|
||||
strErrorSockPasv byte "Kein Socket für Passiv-Verbindung frei...",13,0
|
||||
strErrorPasvConn byte "Passiv-Verbindung mit FTP-Server konnte nicht aufgebaut werden.",13,0
|
||||
strErrorSendType byte "Fehler beim Senden des Types",13,0
|
||||
strErrorChType byte "FTP-Server konnte Übertragungs-Typ nicht ändern (200).",13,0
|
||||
strErrorSendSize byte "Fehler beim Senden des SIZE-Kommandos",13,0
|
||||
strErrorSize byte "FTP-Server kann die Datei-Größe nicht übermitteln (213).",13,"Datei nicht vorhanden? SIZE nicht unterstützt?",13,0
|
||||
strErrorGetSize byte "Konnte Filegröße nicht ermitteln.",13,0
|
||||
strGetFile byte "Empfange Datei, bitte warten...",13,0
|
||||
strErrorSendFN byte "Fehler beim Senden des Filenamens.",13,0
|
||||
strErrorRetr byte "FTP-Server kann die Datei nicht senden (150/125).",13,0
|
||||
strErrorRXData byte "Fehler beim Empfang der Datei.",13,0
|
||||
strErrorRetrOK byte "FTP-Server hat den Empfang durch den Client nicht bestätigt (226).",13,0
|
||||
strWrite2SD byte "Speichere auf SD-Card...",13,0
|
||||
|
||||
help byte "/? : Hilfe",13
|
||||
byte "/h <a.b.c.d> : FTP-Server-Adresse (Host)",13
|
||||
byte " (default: mit ipconfig gesetzter Boot-Server)",13
|
||||
byte "/d <verzeichnis>: in entferntes Verzeichnis wechseln",13
|
||||
byte " (default: /hive/sdcard/system)",13
|
||||
byte "/f <dateiname> : Download <dateiname>",13
|
||||
byte "/u <username> : Benutzername am FTP-Server",13
|
||||
byte " (default: anonymous)",13
|
||||
byte "/p <password> : Paßwort am FTP-Server",13
|
||||
byte " (default: anonymous@hive<Hive-Id>)",13
|
||||
byte "/s : Datei auf SD-Card speichern",13
|
||||
byte 0
|
||||
#endif
|
||||
|
||||
DAT 'lizenz
|
||||
|
||||
{{
|
||||
|
@ -51,16 +51,43 @@ CON 'NVRAM Konstanten ----------------------------------------------------------
|
||||
#20, NVRAM_IPBOOT
|
||||
#24, NVRAM_HIVE ' 4 Bytes
|
||||
|
||||
DAT
|
||||
|
||||
strNVRAMFile byte "nvram.sav",0 'contains the 56 bytes of NVRAM, if RTC is not available
|
||||
|
||||
VAR
|
||||
|
||||
byte parastr[64]
|
||||
byte rtcAvailable
|
||||
|
||||
PUB main
|
||||
PUB main | i
|
||||
|
||||
ios.start 'ios initialisieren
|
||||
ios.printnl
|
||||
|
||||
ifnot (ios.admgetspec & LANMASK)
|
||||
ios.print(string("WARNUNG!",10,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",10,"Bitte admnet laden.",10,"(ipconfig funktioniert trotzdem)",10))
|
||||
ios.print(@strNoNetwork)
|
||||
ios.stop
|
||||
if ios.rtcTest 'RTC chip available?
|
||||
rtcAvailable := TRUE
|
||||
else 'use configfile
|
||||
rtcAvailable := FALSE
|
||||
ios.print(@strNoRTC)
|
||||
ios.sddmset(ios#DM_USER) 'u-marker setzen
|
||||
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
|
||||
if ios.sdopen("R",@strNVRAMFile) 'config file available
|
||||
ios.sdnewfile(@strNVRAMFile) 'no, create it
|
||||
if ios.sdopen("W",@strNVRAMFile)
|
||||
ios.print(@strErrorOpen)
|
||||
ios.stop
|
||||
else
|
||||
repeat i from 0 to 55 'set default value for pseudo NVRAM Bytes 0 - 55
|
||||
ios.sdputc(0)
|
||||
ios.sdclose
|
||||
else
|
||||
ios.sdclose
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
ios.parastart 'parameterübergabe starten
|
||||
repeat while ios.paranext(@parastr) 'parameter einlesen
|
||||
if byte[@parastr][0] == "/" 'option?
|
||||
@ -84,77 +111,168 @@ PUB main
|
||||
|
||||
PRI cmd_listcfg | hiveid 'nvram: IP-Konfiguration anzeigen
|
||||
|
||||
ios.print(string(" IP-Adresse: "))
|
||||
ifnot rtcAvailable
|
||||
ios.sddmset(ios#DM_USER) 'u-marker setzen
|
||||
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
|
||||
if ios.sdopen("R",@strNVRAMFile)
|
||||
ios.print(@strErrorOpen)
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
return
|
||||
|
||||
ios.print(@strAddr)
|
||||
listaddr(NVRAM_IPADDR)
|
||||
ios.print(string("/"))
|
||||
listaddr(NVRAM_IPMASK)
|
||||
ios.printnl
|
||||
|
||||
ios.print(string(" Gateway: "))
|
||||
ios.print(@strGw)
|
||||
listaddr(NVRAM_IPGW)
|
||||
ios.printnl
|
||||
|
||||
ios.print(string(" DNS-Server: "))
|
||||
ios.print(@strDNS)
|
||||
listaddr(NVRAM_IPDNS)
|
||||
ios.printnl
|
||||
|
||||
ios.print(string(" Boot-Server: "))
|
||||
ios.print(@strBoot)
|
||||
listaddr(NVRAM_IPBOOT)
|
||||
ios.printnl
|
||||
|
||||
ios.print(string(" Hive-Id: "))
|
||||
ios.print(@strHive)
|
||||
if rtcAvailable
|
||||
hiveid := ios.getNVSRAM(NVRAM_HIVE)
|
||||
hiveid += ios.getNVSRAM(NVRAM_HIVE+1) << 8
|
||||
hiveid += ios.getNVSRAM(NVRAM_HIVE+2) << 16
|
||||
hiveid += ios.getNVSRAM(NVRAM_HIVE+3) << 24
|
||||
else
|
||||
ios.sdseek(NVRAM_HIVE)
|
||||
hiveid := ios.sdgetc
|
||||
hiveid += ios.sdgetc << 8
|
||||
hiveid += ios.sdgetc << 16
|
||||
hiveid += ios.sdgetc << 24
|
||||
ios.print(str.trimCharacters(num.ToStr(hiveid, num#DEC)))
|
||||
ios.printnl
|
||||
|
||||
ifnot rtcAvailable
|
||||
ios.sdclose
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
PRI listaddr (nvidx) | count 'IP-Adresse anzeigen
|
||||
|
||||
ifnot rtcAvailable
|
||||
ios.sdseek(nvidx)
|
||||
|
||||
repeat count from 0 to 3
|
||||
if(count)
|
||||
ios.print(string("."))
|
||||
if rtcAvailable
|
||||
ios.print(str.trimCharacters(num.ToStr(ios.getNVSRAM(nvidx+count), num#DEC)))
|
||||
else
|
||||
ios.print(str.trimCharacters(num.ToStr(ios.sdgetc, num#DEC)))
|
||||
|
||||
PRI cmd_setaddr (nvidx, ipaddr) | pos, count 'IP-Adresse setzen
|
||||
|
||||
ifnot rtcAvailable
|
||||
ios.sddmset(ios#DM_USER) 'u-marker setzen
|
||||
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
|
||||
if ios.sdopen("W",@strNVRAMFile)
|
||||
ios.print(@strErrorOpen)
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
return
|
||||
else
|
||||
ios.sdseek(nvidx)
|
||||
|
||||
count := 0
|
||||
repeat while ipaddr
|
||||
pos := str.findCharacter(ipaddr, ".")
|
||||
if(pos)
|
||||
byte[pos++] := 0
|
||||
if rtcAvailable
|
||||
ios.setNVSRAM(nvidx+count++, num.FromStr(ipaddr, num#DEC))
|
||||
else
|
||||
ios.sdputc(num.FromStr(ipaddr, num#DEC))
|
||||
ipaddr := pos
|
||||
if(count == 4)
|
||||
quit
|
||||
|
||||
ifnot rtcAvailable
|
||||
ios.sdclose
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
ios.lanstop
|
||||
ios.lanstart
|
||||
|
||||
PRI cmd_sethive (hiveid) 'Hive-Id setzen
|
||||
|
||||
if rtcAvailable
|
||||
ios.setNVSRAM(NVRAM_HIVE, hiveid & $FF)
|
||||
ios.setNVSRAM(NVRAM_HIVE+1, (hiveid >> 8) & $FF)
|
||||
ios.setNVSRAM(NVRAM_HIVE+2, (hiveid >> 16) & $FF)
|
||||
ios.setNVSRAM(NVRAM_HIVE+3, (hiveid >> 24) & $FF)
|
||||
else
|
||||
ios.sddmset(ios#DM_USER) 'u-marker setzen
|
||||
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
|
||||
if ios.sdopen("W",@strNVRAMFile)
|
||||
ios.print(@strErrorOpen)
|
||||
else
|
||||
ios.sdseek(NVRAM_HIVE)
|
||||
ios.sdputc(hiveid & $FF)
|
||||
ios.sdputc((hiveid >> 8) & $FF)
|
||||
ios.sdputc((hiveid >> 16) & $FF)
|
||||
ios.sdputc((hiveid >> 24) & $FF)
|
||||
ios.sdclose
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
ios.lanstop
|
||||
ios.lanstart
|
||||
|
||||
DAT 'sys: helptext
|
||||
|
||||
#ifdef __LANG_EN
|
||||
'locale: english
|
||||
|
||||
help byte "/? : Hilfe",10
|
||||
byte "/l : Konfiguration anzeigen",10
|
||||
byte "/a <a.b.c.d> : IP-Adresse setzen",10
|
||||
byte "/m <x.x.x.x> : Netzwerk-Maske setzen",10
|
||||
byte "/g <e.f.g.h> : Gateway setzen",10
|
||||
byte "/d <i.j.k.l> : DNS-Server setzen",10
|
||||
byte "/b <m.n.o.p> : Boot-Server setzen",10
|
||||
byte "/i <Id> : Hive-Id setzen",10
|
||||
strNoNetwork byte "Administra doesn't provide network functions!",13,"Please load admnet.",13,0
|
||||
strNoRTC byte "RTC/NVRAM not found",13,"using configuration in /system/nvram.sav",13,0
|
||||
strAddr byte " Ip address: ",0
|
||||
strGw byte " Gateway: ",0
|
||||
strDNS byte " DNS server: ",0
|
||||
strBoot byte " Boot server: ",0
|
||||
strHive byte " Hive ID: ",0
|
||||
strErrorOpen byte "Can't open configuration file",13,0
|
||||
|
||||
help byte "/? : Help",13
|
||||
byte "/l : List configuration",13
|
||||
byte "/a <a.b.c.d> : Set ip address",13
|
||||
byte "/m <x.x.x.x> : Set network mask",13
|
||||
byte "/g <e.f.g.h> : Set default gateway",13
|
||||
byte "/d <i.j.k.l> : Set DNS server",13
|
||||
byte "/b <m.n.o.p> : Set boot server",13
|
||||
byte "/i <Id> : Set Hive ID",13
|
||||
byte 0
|
||||
|
||||
#else
|
||||
'default locale: german
|
||||
|
||||
strNoNetwork byte "Administra stellt keine Netzwerk-Funktionen zur Verfügung!",13,"Bitte admnet laden.",13,0
|
||||
strNoRTC byte "RTC/NVRAM nicht vorhanden",13,"nutze Konfiguration in /system/nvram.sav",13,0
|
||||
strAddr byte " IP-Adresse: ",0
|
||||
strGw byte " Gateway: ",0
|
||||
strDNS byte " DNS-Server: ",0
|
||||
strBoot byte " Boot-Server: ",0
|
||||
strHive byte " Hive-Id: ",0
|
||||
strErrorOpen byte "Kann Konfigurationsdatei nicht öffnen.",13,0
|
||||
|
||||
help byte "/? : Hilfe",13
|
||||
byte "/l : Konfiguration anzeigen",13
|
||||
byte "/a <a.b.c.d> : IP-Adresse setzen",13
|
||||
byte "/m <x.x.x.x> : Netzwerk-Maske setzen",13
|
||||
byte "/g <e.f.g.h> : Gateway setzen",13
|
||||
byte "/d <i.j.k.l> : DNS-Server setzen",13
|
||||
byte "/b <m.n.o.p> : Boot-Server setzen",13
|
||||
byte "/i <Id> : Hive-Id setzen",13
|
||||
byte 0
|
||||
|
||||
#endif
|
||||
|
||||
DAT 'lizenz
|
||||
|
||||
{{
|
||||
|
@ -84,6 +84,10 @@ CON 'NVRAM Konstanten ----------------------------------------------------------
|
||||
#20, NVRAM_IPBOOT
|
||||
#24, NVRAM_HIVE ' 4 Bytes
|
||||
|
||||
DAT
|
||||
|
||||
strNVRAMFile byte "nvram.sav",0 'contains the 56 bytes of NVRAM, if RTC is not available
|
||||
|
||||
VAR
|
||||
|
||||
long t1char 'Empfangs-Zeitpunkt des 1. Zeichen einer Zeile
|
||||
@ -157,14 +161,14 @@ PRI init
|
||||
|
||||
ios.start 'ios initialisieren
|
||||
ifnot (ios.admgetspec & LANMASK)
|
||||
ios.print(string(13,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",13,"Bitte admnet laden.",13))
|
||||
ios.print(@strNoNetwork)
|
||||
ios.stop
|
||||
ios.print(string(13,"Initialisiere, bitte warten...",13))
|
||||
ios.print(@strInitWait)
|
||||
setscreen
|
||||
conf_load
|
||||
if ip_addr == 0
|
||||
ifnot f_setconf
|
||||
handleStatusStr(string("Bitte Konfiguration neu starten (F2)"), 2, FALSE)
|
||||
handleStatusStr(@strRestartConf, 2, FALSE)
|
||||
|
||||
PRI f_focus
|
||||
|
||||
@ -262,7 +266,7 @@ PRI f_connect
|
||||
PRI f_join
|
||||
|
||||
if joined
|
||||
handleStatusStr(string("Kanal bereits betreten, vorher mit F5 (/part) verlassen"), 2, FALSE)
|
||||
handleStatusStr(@strAlreadyJoined, 2, FALSE)
|
||||
else
|
||||
confChannel
|
||||
win_contentRefresh
|
||||
@ -283,13 +287,13 @@ PRI f_user
|
||||
|
||||
confUser
|
||||
win_contentRefresh
|
||||
handleStatusStr(string("User geändert, zum Anwenden neu verbinden"), 2, FALSE)
|
||||
handleStatusStr(@strUserChanged, 2, FALSE)
|
||||
|
||||
PRI f_pass
|
||||
|
||||
confPass
|
||||
win_contentRefresh
|
||||
handleStatusStr(string("Paßwort geändert, zum Anwenden neu verbinden"), 2, FALSE)
|
||||
handleStatusStr(@strPassChanged, 2, FALSE)
|
||||
|
||||
PRI f_close
|
||||
|
||||
@ -329,15 +333,15 @@ PRI confServer
|
||||
temp_str[0] := 0
|
||||
else
|
||||
IpPortToStr(ip_addr, ip_port)
|
||||
input(string("IRC-Server angeben (IP:Port):"),@temp_str ,21)
|
||||
input(@strInputSrv,@temp_str ,21)
|
||||
ifnot strToIpPort(@input_str, @ip_addr, @ip_port)
|
||||
handleStatusStr(string("Fehlerhafte Eingabe von IP-Adresse und Port des Servers."), 2, FALSE)
|
||||
handleStatusStr(@strErrorAddr, 2, FALSE)
|
||||
return (FALSE)
|
||||
return(TRUE)
|
||||
|
||||
PRI confPass | i,n
|
||||
|
||||
input(string("Paßwort eingeben:"),@password,LEN_PASS)
|
||||
input(@strInputPass,@password,LEN_PASS)
|
||||
n := 1
|
||||
repeat i from 0 to LEN_PASS
|
||||
if n == 0
|
||||
@ -348,7 +352,7 @@ PRI confPass | i,n
|
||||
|
||||
PRI confNick | i,n
|
||||
|
||||
input(string("Nickname eingeben:"),@nickname,LEN_NICK)
|
||||
input(@strInputNick,@nickname,LEN_NICK)
|
||||
n := 1
|
||||
repeat i from 0 to LEN_NICK
|
||||
if n == 0
|
||||
@ -359,7 +363,7 @@ PRI confNick | i,n
|
||||
|
||||
PRI confUser | i,n
|
||||
|
||||
input(string("Username eingeben:"),@username,LEN_USER)
|
||||
input(@strInputUser,@username,LEN_USER)
|
||||
n := 1
|
||||
repeat i from 0 to LEN_USER
|
||||
if n == 0
|
||||
@ -370,7 +374,7 @@ PRI confUser | i,n
|
||||
|
||||
PRI confChannel | i,n
|
||||
|
||||
input(string("Channel eingeben:"),@channel,LEN_CHAN)
|
||||
input(@strInputChannel,@channel,LEN_CHAN)
|
||||
n := 1
|
||||
repeat i from 0 to LEN_CHAN
|
||||
if n == 0
|
||||
@ -406,7 +410,7 @@ PRI confSave | i
|
||||
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
handleStatusStr(string("Konfiguration gespeichert."), 2, TRUE)
|
||||
handleStatusStr(@strConfigSaved, 2, TRUE)
|
||||
|
||||
PRI conf_load | i
|
||||
|
||||
@ -434,25 +438,37 @@ PRI conf_load | i
|
||||
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
if ios.rtcTest 'RTC chip available?
|
||||
hiveid := ios.getNVSRAM(NVRAM_HIVE)
|
||||
hiveid += ios.getNVSRAM(NVRAM_HIVE+1) << 8
|
||||
hiveid += ios.getNVSRAM(NVRAM_HIVE+2) << 16
|
||||
hiveid += ios.getNVSRAM(NVRAM_HIVE+3) << 24
|
||||
else
|
||||
ios.sddmset(ios#DM_USER) 'u-marker setzen
|
||||
ios.sddmact(ios#DM_SYSTEM) 's-marker aktivieren
|
||||
ifnot ios.sdopen("R",@strNVRAMFile)
|
||||
ios.sdseek(NVRAM_HIVE)
|
||||
hiveid := ios.sdgetc
|
||||
hiveid += ios.sdgetc << 8
|
||||
hiveid += ios.sdgetc << 16
|
||||
hiveid += ios.sdgetc << 24
|
||||
ios.sdclose
|
||||
ios.sddmact(ios#DM_USER) 'u-marker aktivieren
|
||||
|
||||
PRI ircConnect | t
|
||||
|
||||
joined := FALSE
|
||||
|
||||
handleStatusStr(string("Verbinde mit IRC-Server..."), 2, TRUE)
|
||||
handleStatusStr(@strConnect, 2, TRUE)
|
||||
ios.lanstart
|
||||
if (handleidx := ios.lan_connect(ip_addr, ip_port)) == $FF
|
||||
handleStatusStr(string("Kein Socket frei!"), 2, TRUE)
|
||||
handleStatusStr(@strErrorNoSocket, 2, TRUE)
|
||||
return(-1)
|
||||
ifnot (ios.lan_waitconntimeout(handleidx, 2000))
|
||||
handleStatusStr(string("Verbindung mit IRC-Server konnte nicht aufgebaut werden."), 2, TRUE)
|
||||
handleStatusStr(@@strErrorConnect, 2, TRUE)
|
||||
ircClose
|
||||
return(-1)
|
||||
handleStatusStr(string("Verbunden, warte auf Bereitschaft..."), 2, TRUE)
|
||||
handleStatusStr(@strWaitConnect, 2, TRUE)
|
||||
|
||||
t := cnt
|
||||
repeat until (cnt - t) / clkfreq > 1 '1s lang Meldungen des Servers entgegennehmen
|
||||
@ -463,19 +479,19 @@ PRI ircClose
|
||||
ifnot handleidx == $FF
|
||||
ios.lan_close(handleidx)
|
||||
handleidx := $FF
|
||||
handleStatusStr(string("Verbindung mit IRC-Server getrennt..."), 2, TRUE)
|
||||
handleStatusStr(@strDisconnect, 2, TRUE)
|
||||
|
||||
title_draw
|
||||
|
||||
PRI ircPass
|
||||
|
||||
if handleidx == $FF
|
||||
handleStatusStr(string("Kann Paßwort nicht setzen (keine Verbindung zum Server)"), 2, FALSE)
|
||||
handleStatusStr(@strErrorPassConn, 2, FALSE)
|
||||
return(-1)
|
||||
else
|
||||
handleStatusStr(string("Sende Paßwort..."), 2, TRUE)
|
||||
handleStatusStr(@strSendPass, 2, TRUE)
|
||||
if sendStr(string("PASS ")) or sendStr(@password) or sendStr(string(13,10))
|
||||
handleStatusStr(string("Fehler beim Senden des Paßwortes"), 2, TRUE)
|
||||
handleStatusStr(@strErrorSendPass, 2, TRUE)
|
||||
return(-1)
|
||||
|
||||
PRI ircNick
|
||||
@ -483,21 +499,21 @@ PRI ircNick
|
||||
if handleidx == $FF
|
||||
return(-1)
|
||||
if sendStr(string("NICK ")) or sendStr(@nickname) or sendStr(string(13,10))
|
||||
handleStatusStr(string("Fehler beim Senden des Nicknamens"), 2, TRUE)
|
||||
handleStatusStr(@strErrorSendNick, 2, TRUE)
|
||||
return(-1)
|
||||
|
||||
PRI ircReg | t
|
||||
|
||||
if handleidx == $FF
|
||||
handleStatusStr(string("Anmeldung nicht möglich (keine Verbindung zum Server)"), 2, FALSE)
|
||||
handleStatusStr(@strErrorRegConn, 2, FALSE)
|
||||
return(-1)
|
||||
|
||||
handleStatusStr(string("Sende Nickname und Benutzerinformationen..."), 2, TRUE)
|
||||
handleStatusStr(@strSendNickReg, 2, TRUE)
|
||||
|
||||
ircNick
|
||||
|
||||
if sendStr(string("USER ")) or sendStr(@username) or sendStr(string(" 8 * :Hive #")) or sendStr(str.trimCharacters(num.ToStr(hiveid, num#DEC))) or sendStr(string(13,10))
|
||||
handleStatusStr(string("Fehler beim Senden der Benutzerinformationen"), 2, TRUE)
|
||||
handleStatusStr(@strErrorSendReg, 2, TRUE)
|
||||
return(-1)
|
||||
|
||||
t := cnt
|
||||
@ -508,7 +524,7 @@ PRI ircJoin
|
||||
|
||||
if strsize(@channel) > 0 and handleidx <> $FF
|
||||
if sendStr(string("JOIN ")) or sendStr(@channel) or sendStr(string(13,10))
|
||||
handleStatusStr(string("Fehler beim Verbinden mit Channel"), 2, TRUE)
|
||||
handleStatusStr(@strErrorSendJoin, 2, TRUE)
|
||||
return(-1)
|
||||
|
||||
joined := TRUE
|
||||
@ -567,7 +583,9 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
|
||||
byte[msgstr][i] := byte[x][i]
|
||||
handleChatStr(string("<priv>"), nickstr, msgstr, 2)
|
||||
elseif str.startsWithCharacters(commandstr, string("PING :")) 'PING
|
||||
handleStatusStr(string("PING erhalten, sende PONG"), 2, TRUE)
|
||||
#ifdef __DEBUG
|
||||
handleStatusStr(@strPingPong, 2, TRUE)
|
||||
#endif
|
||||
byte[commandstr][1] := "O"
|
||||
sendStr(commandstr)
|
||||
sendStr(string(13,10))
|
||||
@ -575,7 +593,7 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
|
||||
if (str.replaceCharacter(prefixstr, "!", 0))
|
||||
repeat x from 0 to strsize(prefixstr) - 1
|
||||
temp_str[x] := byte[prefixstr][x]
|
||||
msgstr := string(" hat den Kanal betreten")
|
||||
msgstr := @strJoin
|
||||
repeat i from 0 to strsize(msgstr) - 1
|
||||
temp_str[x++] := byte[msgstr][i]
|
||||
temp_str[x] := 0
|
||||
@ -584,7 +602,7 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
|
||||
if (str.replaceCharacter(prefixstr, "!", 0))
|
||||
repeat x from 0 to strsize(prefixstr) - 1
|
||||
temp_str[x] := byte[prefixstr][x]
|
||||
msgstr := string(" hat den Kanal verlassen")
|
||||
msgstr := @strPart
|
||||
repeat i from 0 to strsize(msgstr) - 1
|
||||
temp_str[x++] := byte[msgstr][i]
|
||||
temp_str[x] := 0
|
||||
@ -593,7 +611,7 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
|
||||
if (str.replaceCharacter(prefixstr, "!", 0))
|
||||
repeat x from 0 to strsize(prefixstr) - 1
|
||||
temp_str[x] := byte[prefixstr][x]
|
||||
msgstr := string(" hat den Server verlassen")
|
||||
msgstr := @strLeaveServer
|
||||
repeat i from 0 to strsize(msgstr) - 1
|
||||
temp_str[x++] := byte[msgstr][i]
|
||||
temp_str[x] := 0
|
||||
@ -604,7 +622,7 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
|
||||
if (str.replaceCharacter(prefixstr, "!", 0))
|
||||
repeat x from 0 to strsize(prefixstr) - 1
|
||||
temp_str[x] := byte[prefixstr][x]
|
||||
msgstr := string(":Nickname geändert in ")
|
||||
msgstr := @strChangeNick
|
||||
repeat i from 0 to strsize(msgstr) - 1
|
||||
temp_str[x++] := byte[msgstr][i]
|
||||
msgstr := commandstr + 5
|
||||
@ -620,7 +638,7 @@ PRI ircGetLine | i, x, prefixstr, nickstr, chanstr, msgstr, commandstr
|
||||
msgstr := str.replaceCharacter(nickstr, " ", 0)
|
||||
case num.FromStr(commandstr, num#DEC)
|
||||
1: if prefixstr
|
||||
msgstr := string("Verbunden mit ")
|
||||
msgstr := @strConnected
|
||||
repeat x from 0 to strsize(msgstr) - 1
|
||||
temp_str[x] := byte[msgstr][x]
|
||||
repeat i from 0 to LEN_IRCSRV
|
||||
@ -658,7 +676,7 @@ PRI ircPutLine | i
|
||||
elseif str.startsWithCharacters(@send_str, string("/srv")) 'mit Server verbinden
|
||||
if send_str[4] == " " and send_str[5] <> " " and send_str[5] <> 0 'Nick als Parameter angegeben
|
||||
ifnot strToIpPort(@send_str[5], @ip_addr, @ip_port)
|
||||
handleStatusStr(string("Fehlerhafte Eingabe von IP-Adresse und Port des IRC-Servers."), 2, TRUE)
|
||||
handleStatusStr(@strErrorAddr, 2, TRUE)
|
||||
return (FALSE)
|
||||
else
|
||||
ifnot confServer 'Eingabefenster
|
||||
@ -675,7 +693,7 @@ PRI ircPutLine | i
|
||||
elseif str.startsWithCharacters(@send_str, string("/pass")) 'Paßwort ändern
|
||||
confPass
|
||||
win_contentRefresh
|
||||
handleStatusStr(string("Paßwort geändert, zum Anwenden neu verbinden"), 2, FALSE)
|
||||
handleStatusStr(@strPassChanged, 2, FALSE)
|
||||
elseif str.startsWithCharacters(@send_str, string("/nick")) 'Nickname ändern
|
||||
if send_str[5] == " " and send_str[6] <> " " and send_str[6] <> 0 'Nick als Parameter angegeben
|
||||
repeat i from 0 to LEN_NICK
|
||||
@ -690,10 +708,10 @@ PRI ircPutLine | i
|
||||
elseif str.startsWithCharacters(@send_str, string("/user")) 'User ändern
|
||||
confUser
|
||||
win_contentRefresh
|
||||
handleStatusStr(string("User geändert, zum Anwenden neu verbinden"), 2, FALSE)
|
||||
handleStatusStr(@strUserChanged, 2, FALSE)
|
||||
elseif str.startsWithCharacters(@send_str, string("/join")) 'mit Channel verbinden
|
||||
if joined
|
||||
handleStatusStr(string("Kanal bereits betreten, vorher mit /part verlassen"), 2, FALSE)
|
||||
handleStatusStr(@strAlreadyJoined, 2, FALSE)
|
||||
else
|
||||
if send_str[5] == " " and send_str[6] == "#" 'Channel als Parameter angegeben
|
||||
repeat i from 0 to LEN_CHAN
|
||||
@ -1266,13 +1284,114 @@ PRI ledTwinkle(rate)
|
||||
repeat brightness from 100 to 0
|
||||
led.LEDBrightness(brightness,gc#HBEAT) 'Adjust LED brightness
|
||||
waitcnt(rate + cnt) 'Wait a moment
|
||||
DAT
|
||||
DAT ' Locale
|
||||
|
||||
#ifdef __LANG_EN
|
||||
'locale: english
|
||||
|
||||
strConfFile byte "irc.cfg",0
|
||||
|
||||
strWin1 byte "Chat",0
|
||||
strWin2 byte "State",0
|
||||
strWin3 byte "Input",0
|
||||
|
||||
strNoNetwork byte 13,"Administra doesn't provide network functions!",13,"Please load admnet.",13,0
|
||||
strInitWait byte 13,"Initialiasing, please wait...",13,0
|
||||
strRestartConf byte "Please restart configuration (F2)",0
|
||||
strAlreadyJoined byte "Already joined, please leave channel before with F5 (/part)",0
|
||||
strUserChanged byte "User changed, please reconnect to use it",0
|
||||
strPassChanged byte "Password changed, please reconnect to use it",0
|
||||
strInputSrv byte "IRC-Server (ip:port):",0
|
||||
strErrorAddr byte "Error in ip address or port of server.",0
|
||||
strInputPass byte "Password:",0
|
||||
strInputNick byte "Nickname:",0
|
||||
strInputUser byte "Username:",0
|
||||
strInputChannel byte "Channel:",0
|
||||
strConfigSaved byte "Configuration saved.",0
|
||||
strConnect byte "Connecting to IRC server...",0
|
||||
strErrorNoSocket byte "No free socket.",0
|
||||
strErrorConnect byte "Error connecting to IRC server.",0
|
||||
strWaitConnect byte "Connected, waiting for readyness...",0
|
||||
strDisconnect byte "Disconnected from IRC server...",0
|
||||
strErrorPassConn byte "Error setting password (no connection)",0
|
||||
strSendPass byte "Sending password...",0
|
||||
strErrorSendPass byte "Error sending password",0
|
||||
strErrorSendNick byte "Error sending nickname",0
|
||||
strErrorRegConn byte "No registration possible (no connection)",0
|
||||
strSendNickReg byte "Sending registration (nick, user, password)...",0
|
||||
strErrorSendReg byte "Error sending user information",0
|
||||
strErrorSendJoin byte "Error joining to channel",0
|
||||
strPingPong byte "PING received, send PONG",0
|
||||
strJoin byte " has joined the channel",0
|
||||
strPart byte " has leaved the channel",0
|
||||
strLeaveServer byte " has leaved the server",0
|
||||
strChangeNick byte " is now known as ",0
|
||||
strConnected byte "Connected to ",0
|
||||
|
||||
' |------------------------------------------------------------|
|
||||
strHelp byte "Internal commands:"
|
||||
byte $0d,"================="
|
||||
byte $0d
|
||||
byte $0d,"F1 This Help"
|
||||
byte $0d,"F2 /set Edit and save all settings"
|
||||
byte $0d,"F3 Connect to server, login and join"
|
||||
byte $0d,"F4 /join Join to channel (/join #<channel>)"
|
||||
byte $0d,"F5 /part Leave current channel (/part <message>)"
|
||||
byte $0d,"F6 /nick Change nickname (/nick <new nickname>)"
|
||||
byte $0d,"F7 /user Change username"
|
||||
byte $0d,"F8 /pass Change password"
|
||||
byte $0d,"F9 /quit Disconnect from server"
|
||||
byte $0d,"F10 Exit irc client"
|
||||
byte $0d," /msg Private Message (/msg <recipient> <text>)"
|
||||
byte $0d," /srv connect to server and login (srv <ip:port>)"
|
||||
byte $0d," /save Save settings"
|
||||
byte $0d,"Tab Switch windows, scroll with cursor up/down"
|
||||
byte $0d
|
||||
byte $0d,"All other input beginning with '/' is a direct command to the"
|
||||
byte $0d,"server. All input that doesn't begin with '/' is a public"
|
||||
byte $0d,"message to the current channel",$0
|
||||
|
||||
#else
|
||||
'default locale: german
|
||||
|
||||
strConfFile byte "irc.cfg",0
|
||||
|
||||
strWin1 byte "Chat",0
|
||||
strWin2 byte "Status",0
|
||||
strWin3 byte "Eingabe",0
|
||||
|
||||
strConfFile byte "irc.cfg",0
|
||||
strNoNetwork byte 13,"Administra stellt keine Netzwerk-Funktionen zur Verfügung!",13,"Bitte admnet laden.",13,0
|
||||
strInitWait byte 13,"Initialisiere, bitte warten...",13,0
|
||||
strRestartConf byte "Bitte Konfiguration neu starten (F2)",0
|
||||
strAlreadyJoined byte "Kanal bereits betreten, vorher mit F5 (/part) verlassen",0
|
||||
strUserChanged byte "User geändert, zum Anwenden neu verbinden",0
|
||||
strPassChanged byte "Paßwort geändert, zum Anwenden neu verbinden",0
|
||||
strInputSrv byte "IRC-Server angeben (IP:Port):",0
|
||||
strErrorAddr byte "Fehlerhafte Eingabe von IP-Adresse und Port des Servers.",0
|
||||
strInputPass byte "Paßwort eingeben:",0
|
||||
strInputNick byte "Nickname eingeben:",0
|
||||
strInputUser byte "Username eingeben:",0
|
||||
strInputChannel byte "Channel eingeben:",0
|
||||
strConfigSaved byte "Konfiguration gespeichert.",0
|
||||
strConnect byte "Verbinde mit IRC-Server...",0
|
||||
strErrorNoSocket byte "Kein Socket frei!",0
|
||||
strErrorConnect byte "Verbindung mit IRC-Server konnte nicht aufgebaut werden.",0
|
||||
strWaitConnect byte "Verbunden, warte auf Bereitschaft...",0
|
||||
strDisconnect byte "Verbindung mit IRC-Server getrennt...",0
|
||||
strErrorPassConn byte "Kann Paßwort nicht setzen (keine Verbindung zum Server)",0
|
||||
strSendPass byte "Sende Paßwort...",0
|
||||
strErrorSendPass byte "Fehler beim Senden des Paßwortes",0
|
||||
strErrorSendNick byte "Fehler beim Senden des Nicknamens",0
|
||||
strErrorRegConn byte "Anmeldung nicht möglich (keine Verbindung zum Server)",0
|
||||
strSendNickReg byte "Sende Nickname und Benutzerinformationen...",0
|
||||
strErrorSendReg byte "Fehler beim Senden der Benutzerinformationen",0
|
||||
strErrorSendJoin byte "Fehler beim Verbinden mit Channel",0
|
||||
strPingPong byte "PING erhalten, sende PONG",0
|
||||
strJoin byte " hat den Kanal betreten",0
|
||||
strPart byte " hat den Kanal verlassen",0
|
||||
strLeaveServer byte " hat den Server verlassen",0
|
||||
strChangeNick byte ":Nickname geändert in ",0
|
||||
strConnected byte "Verbunden mit ",0
|
||||
|
||||
' |------------------------------------------------------------|
|
||||
strHelp byte "Interne Befehle:"
|
||||
@ -1291,11 +1410,12 @@ strHelp byte "Interne Befehle:"
|
||||
byte $0d," /msg Private Mitteilung (/msg <Empfänger> <Text>)"
|
||||
byte $0d," /srv Mit Server verbinden und anmelden (srv <IP:Port>)"
|
||||
byte $0d," /save Einstellungen speichern"
|
||||
byte $0d,"Tab Fenster umschalten, scrollen mit Corsor hoch/runter"
|
||||
byte $0d,"Tab Fenster umschalten, scrollen mit Cursor hoch/runter"
|
||||
byte $0d
|
||||
byte $0d,"Alle anderen mit '/' beginnenden Eingaben sind Befehle an den"
|
||||
byte $0d,"Server. Alle Eingaben, welche nicht mit '/' beginnen, sind"
|
||||
byte $0d,"eine öffentliche Mitteilung an den aktuellen Kanal.",$0
|
||||
#endif
|
||||
|
||||
DAT 'lizenz
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user