[ СТРАНИЦА В РАЗРАБОТКЕ ]
Для загрузки используется утилита "curl". Скачать с официального сайта проекта
gryphon_run.bat
@echo off
set API_URL=http://192.168.0.92/api
set UPLOAD_DIR=/BK_Uploads
if not exist %1 goto error
set F_SIZE=%~z1
set F_NAME=%~nx1
echo :
echo Uploading...
curl -i -o nul -X POST -H "Content-Type: multipart/form-data" -F "storeas=%UPLOAD_DIR%/%F_NAME%" -F "size=%F_SIZE%" -F "file=@%1" "%API_URL%/upload"
echo :
echo Executing...
curl -i -s -o nul "%API_URL%/run?dev=file&emu10=no&fname=%UPLOAD_DIR%/%F_NAME%"
exit
:error
echo File not found
gryphon_run.sh
#!/bin/bash
API_URL=http://192.168.0.92/api
UPLOAD_DIR=/BK_Uploads
if [ -e "$1" ]; then
F_SIZE=$(stat -c%s "$1")
F_NAME="$(basename $1)"
echo :
echo Uploading...
curl -i -o /dev/null -X POST -H "Content-Type: multipart/form-data" -F "storeas=$UPLOAD_DIR/$F_NAME" -F "size=$F_SIZE" -F "file=@$1" "$API_URL/upload"
echo :
echo Executing...
curl -i -s -o /dev/null "$API_URL/run?dev=file&emu10=no&fname=$UPLOAD_DIR/$F_NAME"
else
echo File not found
fi
черновик
Ответ - json
В ответе всегда содержится либо
"success":1 - в случае успеха операции
"error":"" - в случае ошибки
/api/version
{ "version-mpi": "<строка, версия основного контроллера>",
"version-net": "<строка, версия сетевой карты>",
"serial-mpi" : "<строка, серийник контроллера>"
}
/api/bkinfo
{ "bkinfo": [ BK_Machine_Family,
BK_Machine_Model,
BK_HardwareStatus,
HW_Error_Bits]
}
/api/dir?path=
{ "charset" : "utf8",
"dir" : [
{ "type":"X", "size": 0, "name": ".."},
{ "type":"< D | F >", "size": , "name": ""},
...
]
}
/api/mkdir?path=
/api/delete?path=
/api/rename?from=&to=
/api/status
{ "status": "< MENU.SHARED/UNDEF/PROCESS | HANG | ACTIVE.FREE/NORM/BOOT/STREAM/UNKNOWN >"}
/api/getdrv?drv=< Fx | Hx | T >
{ "drive":"< Fx | Hx | T >",
"path":""
}
/api/setdrv?drv=< Fx | Hx | T >&path=
{ "drive":"< Fx | Hx | T >",
"path":""
}
/api/run?dev=< basic | a16 | smk | mstd | file >[&emu10=< yes | no >][&fname=&pref=<0,1,2,3>]
0 - авто
1 - Basic ROM
2 - A16
3 - SMK512
/api/irps_mode[?mode=< 0,1,2,3,4>]
{ "mode": <0,1,2,3,4>}
0 - выкл
1 - 0177560 / 060
2 - 0176560 / 0360
3 - 0176570 / 0370
4 - 0177560 / 0360
/api/irps_speed?speed=<0..9>
300, 600, 1200, 2400, 4800, 7200, 9600, 12000, 14400, без ограничения
/api/net_cfg?
sta_ssid=
sta_psk=
save=1
/api/client_ctl?
connect
disconnect
POST /api/upload
HTTP Form multipart:
storeas=
size=
file=@file_data