tsknetwork.c

来自「ICETEK-DM642-EDUlabv1.3.rar」· C语言 代码 · 共 79 行

C
79
字号
#include <std.h>
#include <tsk.h>
#include <stdio.h>
#include <csl.h>
#include <csl_cache.h>
#include <csl_dat.h>
#include <chan.h>
#include <scom.h>
#include <utl.h>
#include <ialg.h>

#include "appmain.h"
#include "appThreads.h"
#include "appBiosObjects.h"

#include "c:\ti\c6000\ndk\inc\netmain.h"

void tskNetworkTx()
{
    int      jpg_size,channel;
    UINT8    *jpg_buf;
    UINT8    *pFileBuffer;

    ScomMessage *pMsgBuf;
    SCOM_Handle hs_Enc2JPG,hs_JPG2Enc;

    hs_Enc2JPG = SCOM_open("ENC2NET");
    hs_JPG2Enc = SCOM_open("NET2ENC");

    if( !hs_Enc2JPG || !hs_JPG2Enc )
    {
        for(;;);
    }

    for(;;)
    {
        // Get a JPEG file
        pMsgBuf = SCOM_getMsg( hs_Enc2JPG, SYS_FOREVER );

        channel  = pMsgBuf->channel;
        jpg_size = pMsgBuf->sizeLinear;
        jpg_buf  = pMsgBuf->bufLinear;


        // Convert the JPG to a file so NETCAM still works
        if( jpg_size > 0 && jpg_size < 256000 )
        {
            pFileBuffer = mmBulkAlloc( jpg_size );
            if( pFileBuffer )
            {
                mmCopy( pFileBuffer, jpg_buf, jpg_size );

                if( channel == 1 )
                {
                    efs_destroyfile( "image1.jpg" );
                    efs_createfilecb( "image1.jpg", jpg_size, pFileBuffer,
                                    (EFSFUN)mmBulkFree, (UINT32)pFileBuffer );
                }
                else if( channel == 2 )
                {
                    efs_destroyfile( "image2.jpg" );
                    efs_createfilecb( "image2.jpg", jpg_size, pFileBuffer,
                                    (EFSFUN)mmBulkFree, (UINT32)pFileBuffer );
                }
            }
        }

        // We pulled the JPEG file into cache, so clean it out
        OEMCacheClean( jpg_buf, jpg_size );

        // Synch the cache
        OEMCacheCleanSynch();

        // Tell the encode that we're done with the JPEG file
        SCOM_putMsg( hs_JPG2Enc, pMsgBuf );
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?