This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Trying to take picture and stored inside of IPNetCam DM355

We are trying to take a picture using IPNetcam DM355 and stored inside of the camera.

 

This is the application program to take picture.

 

#include "ApproDrvMsg.h"
#include "Appro_interface.h"
#include "cmem.h"
#include "Msg_Def.h"
#include <stdio.h>
int i;
 
void Init_Interface(int Msg_id)
{
    int qid;
    if(ApproDrvInit(Msg_id))
    exit(1);
 
    if(func_get_mem(&qid))
    {
    ApproDrvExit();
    exit(1);
    }
}
 
int SaveAudioFile( char *pFileName )
{
        FILE *pfd = NULL;
        int error_code = 0;
        int     SerialBook = -1;
        int     SerialLock = -1;
        int     ret = 0;
        int     save_cnt = 1;
        AV_DATA av_data;
        
        pfd = fopen(pFileName,"wb");
        if( pfd == NULL )
        {
               // ERR("open file error!!");
                error_code = -1;
                goto RECORD_QUIT;
        }
 
 
        if( fseek( pfd, 0, SEEK_SET ) < 0)
        {
               // ERR("seek file error!!");
                error_code = -1;
                goto RECORD_QUIT;
        }
        
        do
        {
                GetAVData(AV_OP_GET_MJPEG_SERIAL, -1, &av_data );
        } while (av_data.serial < 0);
        
        SerialBook = av_data.serial;
        
        while( save_cnt > 0)
        {
                ret = GetAVData(AV_OP_LOCK_MJPEG, SerialBook, &av_data );
                if (ret == RET_SUCCESS)
                {
                        if( fwrite( av_data.ptr,av_data.size,1, pfd )  <= 0)
                        {
                               // ERR("save file error!!");
                                error_code = -1;
                                goto RECORD_QUIT;
                        }
                        if (SerialLock >= 0)
                        {
                                GetAVData(AV_OP_UNLOCK_MJPEG, SerialLock, &av_data);
                        }
                        SerialLock = SerialBook;
                        save_cnt--;
                        SerialBook++;
                }
                else
                {
                        GetAVData(AV_OP_GET_MJPEG_SERIAL, -1, &av_data );                               
                        if( SerialBook > av_data.serial )
                        {
                                // delay for waiting next frame 
                               // usleep(5);
                                 // sleep();
                for(i=0;i<1000;i++);
 
                        }else{
                                SerialBook = av_data.serial;
                        }
                }
        }
        GetAVData(AV_OP_UNLOCK_MJPEG, SerialLock, &av_data);
RECORD_QUIT:
        if( pfd )
        {
                fclose(pfd);
        }
        return error_code;
}
 
int main()
{
    int result = 0;
    char *pFileName = "snap_test.jpg";
    Init_Interface(0x01);
    result = SaveAudioFile(pFileName );
     
    return 0;
}
 
 
 
And this the make file

 

 

# Makefile
#
ROOTDIR = ../../..
include $(ROOTDIR)/Rules.make

#TARGET = system_server
TARGET = take_snap

C_FLAGS += -Wall -g

CPP_FLAGS += -I$(PUBLIC_INCLUDE_DIR) \
                -I. \
        -D_GNU_SOURCE \
        -D_LARGEFILE64_SOURCE \
        -D_FILE_OFFSET_BITS=64 \
                $(XDC_FLAGS)

LD_FLAGS += -lfreetype -lpthread

COMPILE.c = $(MVTOOL_PREFIX)gcc $(C_FLAGS) $(CPP_FLAGS) -c
LINK.c = $(MVTOOL_PREFIX)gcc $(LD_FLAGS)

RELTARGET = release/$(TARGET)

RELCFLAGS = -O3 -fno-strict-aliasing

SOURCES = $(wildcard *.c)
HEADERS = $(wildcard *.h) $(PUBLIC_INCLUDE_DIR)/*.h

RELOBJFILES = $(SOURCES:%.c=release/%.o)

RELLDFLAGS =



.PHONY: clean release install

all:    release

install: release
    install -d $(EXEC_DIR)
    install $(RELTARGET) $(EXEC_DIR)

release:    $(RELTARGET)

$(RELTARGET):   $(RELOBJFILES) $(LIB_DIR)/file_msg_drv.a $(LIB_DIR)/Appro_interface.a $(LIB_DIR)/alarm_msg_drv.a $(LIB_DIR)/cmem.a $(LIB_DIR)/dm355_gio_util.a
    $(LINK.c) -o $@ $^ $(RELLDFLAGS)


$(RELOBJFILES): release/%.o: %.c $(HEADERS)
    @mkdir -p release
    $(COMPILE.c) $(RELCFLAGS) -o $@ $<

clean:
    -$(RM) -rf release  *.d

 

When we make this file its is creating exe (takesnap) and put the exe inside of the IPNetcam and tried to run but it showing error.

./takesnap

 

It showing error

 

modprobe:FATAL: Could not load /lib/modules/2.6.10_mvl401_

IPNC-2.1.0/modules.dy

modprobe:FATAL: Could not load /lib/modules/2.6.10_mvl401_IPNC-2.1.0/modules.dy



If any one knows the solution for this problem please let me know it will be very useful for us.