Commit ac201d4e authored by Martin Cífka's avatar Martin Cífka
Browse files

more logs; fixed param sending

parent e2e8adf6
Loading
Loading
Loading
Loading
Loading
+36 −10
Original line number Diff line number Diff line
@@ -14,6 +14,9 @@ int AMBA_SESSION_TOKEN_INIT = 0;
int AMBA_CAMERA_TIMEOUT = 8000;
/****************************************************************/


MSGID_6156? = 6156

int AMBA_MSGID_RESET_VF = 259;
int AMBA_MSGID_STOP_VF = 260;

@@ -36,7 +39,7 @@ int AMBA_MSGID_GET_CAMERA_ALL_MODE_PARAM = 4365;
int AMBA_MSGID_GET_CAMERA_ALL_PARAM = 4363;
int AMBA_MSGID_GET_CAMERA_ALL_SETTING_PARAM = 4364;

s


/* RVAL */
int AMBA_COMMAND_OK = 0;
@@ -76,16 +79,30 @@ int AMBA_MSGID_STOP_SESSION = 258;


/* WHITEBALANCE */
int AMBA_MSGID_SET_WHITEBALANCE = 5121;
MSGID_SET_PHOTO_WHITEBALANCE = 5168;
MSGID_SET_VIDEO_WHITEBALANCE = 5136;

//int AMBA_MSGID_SET_WHITEBALANCE = 5121; // returns token ({"rval":0,"msg_id":257,"param":1)

int AMBA_PARAM_WHITEBALANCE_AUTO = 0;
int AMBA_PARAM_WHITEBALANCE_OUTDOOR = 1;
int AMBA_PARAM_WHITEBALANCE_SHADOW = 2;
int AMBA_PARAM_WHITEBALANCE_CLOUDY = 3;
int AMBA_PARAM_WHITEBALANCE_NIGHT = 4;
int AMBA_PARAM_WHITEBALANCE_SHADOW = 2; //OVERCAST
int AMBA_PARAM_WHITEBALANCE_CLOUDY = 3; //INCANDESCENT
int AMBA_PARAM_WHITEBALANCE_NIGHT = 4;  //FLUORESCENT



/* PHOTO */
MSGID_SET_PHOTO_COMPENSATION = 5169;
    param -6...6, -3EV...+3EV
    
MSGID_SET_PHOTO_RESOLUTION = 4872;
    0 6912x3456
    1 3456x1728 (stitched)
    2 6912x3456 (stitched)
    3 6912x3456 Raw


int AMBA_MSGID_SAVE_PHOTO_DONE = 8193;
int AMBA_MSGID_TAKE_PHOTO = 769;

@@ -96,19 +113,28 @@ int AMBA_MSGID_SHOOT_PHOTO_TIMING = 4868;
int AMBA_MSGID_SHOOT_PHOTO_INTERVAL = 5025;
int AMBA_MSGID_SHOOT_PHOTO_CONTINUOUS = 5027;

int AMBA_MSGID_SET_SHUTTER = 5127;
int AMBA_MSGID_SET_ISO = 5126;
int AMBA_MSGID_SET_SHUTTER = 5171;
int AMBA_MSGID_SET_ISO = 5172;
    

int AMBA_MSGID_SET_PHOTO_CONTINUOUS_PARAM = 4915;
int AMBA_MSGID_SET_PHOTO_INTERVAL_PARAM = 4929;
int AMBA_MSGID_SET_PHOTO_SURROUNDEXP_PARAM = 4918;
    param seconds (send string, receive int)
    
int AMBA_MSGID_SET_PHOTO_BRACKETING_PARAM = 4918;
    param 0...6 ; 0EV...3EV
    
int AMBA_MSGID_SET_PHOTO_TIMING_PARAM = 4866;
    param seconds (send string, receive int)

int AMBA_MSGID_START_PHOTO_SURROUNDEXP = 5029;
int AMBA_MSGID_START_PHOTO_BRACKETING = 5029;



/* VIDEO */
MSGID_SET_VIDEO_COMPENSATION = 5137;
    param -6...6 ; -3EV...+3EV

int AMBA_MSGID_SAVE_VIDEO_DONE = 8192;

int AMBA_MSGID_START_VIDEO_MICRO = 4620;
@@ -173,7 +199,7 @@ int AMBA_PARAM_CAMERA_STATE_PHOTOING_DELAYED = 7;
int AMBA_PARAM_CAMERA_STATE_PHOTOING_INTERVAL = 12;
int AMBA_PARAM_CAMERA_STATE_CAPTURING_SLOW = 13;
int AMBA_PARAM_CAMERA_STATE_CAPTURING_CONTINUOUS = 14;
int AMBA_PARAM_CAMERA_STATE_CAPTURING_SURROUNDEXP = 15;
int AMBA_PARAM_CAMERA_STATE_CAPTURING_BRACKETING = 15;

    
    
+18 −3
Original line number Diff line number Diff line
@@ -21,11 +21,26 @@ string Commander::generateJSON(Codes::MsgId msg)
    return str;
}

string Commander::generateJSON(Codes::MsgId msg, int param)
template <typename T>
string Commander::generateJSON(Codes::MsgId msg, T param)
{
    DynamicJsonDocument json(JSON_OBJECT_SIZE(3));
    DynamicJsonDocument json(JSON_OBJECT_SIZE(3)+10);
    json["msg_id"] = (int)msg;
    json["param"] = (int)param;
    json["param"] = to_string(param);
    json["token"] = _token;
    
    string str;
    serializeJson(json, str);
    
    return str;
}

template <>
string Commander::generateJSON(Codes::MsgId msg, string param)
{
    DynamicJsonDocument json(JSON_OBJECT_SIZE(3)+10);
    json["msg_id"] = (int)msg;
    json["param"] = param;
    json["token"] = _token;
    
    string str;
+3 −1
Original line number Diff line number Diff line
@@ -33,7 +33,9 @@ private:
    static bool str2int (const char* s, int& i, int base = 0);
    
    std::string generateJSON(Codes::MsgId msg);
    std::string generateJSON(Codes::MsgId msg, int param);
    
    template <typename T>
    std::string generateJSON(Codes::MsgId msg, T param);
    
};

+55 −8
Original line number Diff line number Diff line
#!/usr/bin/python3

from sys import stdin
from sys import stdin, argv
import json, re

################################################################
{"msg_id":5126,"token":4}
msgid = {
    5168 : "???",
    6156 : "???",
    
    5127 : "!!!SET_SHUTTER!!!",
    5126 : "!!!SET_ISO!!!",
    5168 : "SET_PHOTO_WHITEBALANCE",
    5169 : "SET_PHOTO_COMPENSATION",
    4872 : "SET_PHOTO_RESOLUTION",
    5137 : "SET_VIDEO_COMPENSATION",
    5136 : "SET_VIDEO_WHITEBALANCE",
    
    5171 : "SET_SHUTTER",
    5172 : "SET_ISO",
@@ -37,7 +42,7 @@ msgid = {
    1283 : "CD",
    257 : "START_SESSION",
    258 : "STOP_SESSION",
    5121 : "SET_WHITEBALANCE",
    5121 : "? Returns msg_id:257",
    8193 : "SAVE_PHOTO_DONE",
    769 : "TAKE_PHOTO",
    4357 : "GET_PHOTO_CAPACITY",
@@ -47,9 +52,9 @@ msgid = {
    5027 : "SHOOT_PHOTO_CONTINUOUS",
    4915 : "SET_PHOTO_CONTINUOUS_PARAM",
    4929 : "SET_PHOTO_INTERVAL_PARAM",
    4918 : "SET_PHOTO_SURROUNDEXP_PARAM",
    4918 : "SET_PHOTO_BRACKETING_PARAM",
    4866 : "SET_PHOTO_TIMING_PARAM",
    5029 : "START_PHOTO_SURROUNDEXP",
    5029 : "START_PHOTO_BRACKETING",
    8192 : "SAVE_VIDEO_DONE",
    4620 : "START_VIDEO_MICRO",
    4623 : "START_VIDEO_DELAY",
@@ -70,7 +75,7 @@ msgid = {
    1540 : "WIFI_STOP",
    1541 : "WIFI_START",
    4361 : "GET_BATTERY_VOLUME",
    2307 : "SET_PHOTO_MODE",
    2307 : "SET_PHTO_MODE",
    2308 : "SET_VIDEO_MODE",
    4611 : "SET_CAMERA_MODE",
    4362 : "GET_CAMERA_STATE",
@@ -95,10 +100,50 @@ msgid = {
    5 : "GET_STORAGE_TOTAL_FREE"
}

################################################################

ignore = [
    261,  # SET_CLNT_INFO
    4917, # SET_GPS_INFO
    6147, # RTC_SYNC
    1282, # LS
    1283, # CD

    257,  # START_SESSION
    258,  # STOP_SESSION

    1539, # GET_WIFI_SETTING
    1542, # GET_WIFI_STATUS
    4361, # GET_BATTERY_VOLUME
    4099, # GET_DEVICE_NAME
    4100, # GET_DEVICE_VERSION
    4097, # GET_SN
    4098, # GET_VENDOR
]

################################################################


regex = re.compile(r'"msg_id" *: *(\d+)')

if len(argv) == 2 and argv[1] == '-f':
    filtr = True
else:
    filtr = False
    

for line in stdin:
    
    # filter
    if filtr:
        try:
            if int(regex.search(line).group(1)) in ignore:
                continue
        except:
            pass
    
    
    # print
    print("# ", end='')
    try:    
        print(msgid[int(regex.search(line).group(1))])
@@ -112,3 +157,5 @@ for line in stdin:


  
  
  
+15.9 KiB

File added.

No diff preview for this file type.

Loading