Beispiel #1
0
// 12. GET_INFO
static void proc_cmd_get_info(struct mg_connection* conn, const struct mg_request_info* request_info)
{
	logger_remotem("GET_INFO from client: %s, version %s, ID: %s", ip2s(request_info->remote_ip), getVersion(), DVR_ID);
	unsigned long* drive_info = getDriveInfo(DataPath);

	if (DVR_ID == NULL)
	{
		logger_info("No valid ID found wait for next call: %s", DVR_ID);
		mg_printf(conn, "errno=51010\r\n");
		return;
	}

	char tb[40];
	time_t now = time(NULL);
	struct tm tmi;
	strftime(tb, 20, "%Y%m%d_%H%M%S", localtime_r(&now, &tmi));
	mg_printf(conn,
		"HTTP/1.0 200 OK\r\n\n"
		"serial=%s\r\n"
		"version=%s\r\n"
		"dvr_status=%s\r\n"
		"battery_status=%s\r\n"
		"product_code=FBBW1\r\n"
		"filesystem_size=%lu\r\n"
		"free_blocks=%lu\r\n"
		"fg_video=%d\r\n"
		"mac_address=%s\r\n"
		"mainboard=%s\r\n"
		"date_time=%s\r\n"
		"assignable=%s\r\n"
		"dvr_name=%s\r\n"
		"errno=0\r\n",
		DVR_ID, getVersion(), downloading_status, get_battery_level_string(),
		drive_info[0], drive_info[1], getVideoCount(DataPath),
		getMAC(1), get_hw_version(), tb, get_assignable(), get_dvr_name());
}
void test_GetVideoCount() {
	int videoCount = 0;
	TEST_ASSERT_EQUAL(RET_CODE_SUCCESS, getVideoCount(&videoCount));
	TEST_ASSERT_TRUE(videoCount  > 0);
}