kolibrios/programs/cmm/examples/netcheck.c
Kirill Lipatov (Leency) 2eda7fed5c tinypad: no optim_save by default
eolite: fix crash on put image h<1
cmm: rename colors to the short one "sc"

git-svn-id: svn://kolibrios.org@7806 a494cfbc-eb01-0410-851d-a64ba20cac60
2020-04-17 23:52:24 +00:00

102 lines
2.5 KiB
C

/*
* Network testing utility
* Leency 2018
*/
#define MEMSIZE 4096*10
#include "../lib/fs.h"
#include "../lib/gui.h"
#include "../lib/events.h"
//===================================================//
// //
// DATA //
// //
//===================================================//
char download_file[] = "-d http://kolibri-n.org/files/KolibriN9.zip";
EVENTS button;
EVENTS key;
//===================================================//
// //
// CODE //
// //
//===================================================//
void main()
{
loop() switch(WaitEvent())
{
case evButton:
button.press( GetButtonID() );
break;
case evKey:
GetKeys();
key.press( key_scancode );
break;
case evReDraw:
draw_window();
break;
}
}
void draw_window()
{
sc.get();
DefineAndDrawWindow(215, 100, 350, 300, 0x34, sc.work, "Network testing utility",0);
button.init(10);
key.init(10);
WriteText(10,10, 0x90, sc.work_text, "Download via:");
AddEvent(10, 30, #EventRunAsmDownloader, SCAN_CODE_F1, "ASM Downloader [F1]");
AddEvent(10, 60, #EventRunCmmDownloader, SCAN_CODE_F2, "C-- Downloader [F2]");
AddEvent(10, 120, #EventRunNetStat, SCAN_CODE_F3, "NetStat [F3]");
AddEvent(10, 150, #EventRunNetCfg, SCAN_CODE_F4, "NetCfg [F4]");
AddEvent(10, 180, #EventRunBoard, SCAN_CODE_F5, "Board [F5]");
button.add_n(1, #ExitProcess);
key.add_n(SCAN_CODE_ESC, #ExitProcess);
}
void AddEvent(dword bx, by, event, hotkey, text)
{
DrawStandartCaptButton(bx, by, button.add(event), text);
key.add_n(hotkey, event);
}
//===================================================//
// //
// EVENTS //
// //
//===================================================//
void EventRunAsmDownloader()
{
RunProgram("/sys/network/downloader", #download_file+3);
}
void EventRunCmmDownloader()
{
RunProgram("/sys/network/webview", #download_file);
}
void EventRunNetStat()
{
RunProgram("/sys/network/netstat", NULL);
}
void EventRunNetCfg()
{
RunProgram("/sys/network/netcfg", NULL);
}
void EventRunBoard()
{
RunProgram("/sys/develop/board", NULL);
}