Ejemplo n.º 1
0
HRESULT Camera::takePicture(HWND hwndOwner,LPTSTR pszFilename) 
{
    HRESULT         hResult = S_OK;
#if defined(_WIN32_WCE) //&& !defined( OS_PLATFORM_MOTCE )
	if(RHO_IS_WMDEVICE)
	{
		SHCAMERACAPTURE shcc;

		StringW imageDir;
		convertToStringW(rho_rhodesapp_getblobsdirpath(), imageDir);

		StringW strFileName = generate_filename(L".jpg");

		// Set the SHCAMERACAPTURE structure.
		ZeroMemory(&shcc, sizeof(shcc));
		shcc.cbSize             = sizeof(shcc);
		shcc.hwndOwner          = hwndOwner;
		shcc.pszInitialDir      = imageDir.c_str();
		shcc.pszDefaultFileName = strFileName.c_str();
		shcc.pszTitle           = TEXT("Camera");
		shcc.VideoTypes			= CAMERACAPTURE_VIDEOTYPE_MESSAGING;
		shcc.nResolutionWidth   = 176;
		shcc.nResolutionHeight  = 144;
		shcc.StillQuality       = CAMERACAPTURE_STILLQUALITY_LOW;
		shcc.nVideoTimeLimit    = 15;
		shcc.Mode               = CAMERACAPTURE_MODE_STILL;

		// Display the Camera Capture dialog.
		hResult = lpfn_Camera_Capture(&shcc);

		// The next statements will execute only after the user takes
		// a picture or video, or closes the Camera Capture dialog.
		if (S_OK == hResult) 
		{
			LOG(INFO) + "takePicture get file: " + shcc.szFile;

			LPTSTR fname = get_file_name( shcc.szFile, imageDir.c_str() );
			if (fname) {

				StringCchCopy( pszFilename, MAX_PATH, fname );
				free(fname);
			} else {
				LOG(ERROR) + "takePicture error get file: " + shcc.szFile;

				hResult = E_INVALIDARG;
			}
		}else
		{
			LOG(ERROR) + "takePicture failed with code: " + LOGFMT("0x%X") + hResult;
		}
	}
#endif //_WIN32_WCE

    return hResult;
}
Ejemplo n.º 2
0
HRESULT Camera::takePicture(HWND hwndOwner,LPTSTR pszFilename) 
{
    HRESULT         hResult = S_OK;
#if defined(_WIN32_WCE) && !defined( OS_PLATFORM_MOTCE )
    SHCAMERACAPTURE shcc;

    StringW root;
    convertToStringW(rho_rhodesapp_getblobsdirpath(), root);
    wsprintf( pszFilename, L"%s", root.c_str() );

	create_folder(pszFilename);

    //LPCTSTR szExt = wcsrchr(pszFilename, '.');
    TCHAR filename[256];
	generate_filename(filename,L".jpg");

    // Set the SHCAMERACAPTURE structure.
    ZeroMemory(&shcc, sizeof(shcc));
    shcc.cbSize             = sizeof(shcc);
    shcc.hwndOwner          = hwndOwner;
    shcc.pszInitialDir      = pszFilename;
    shcc.pszDefaultFileName = filename;
    shcc.pszTitle           = TEXT("Camera");
    shcc.VideoTypes			= CAMERACAPTURE_VIDEOTYPE_MESSAGING;
    shcc.nResolutionWidth   = 176;
    shcc.nResolutionHeight  = 144;
    shcc.nVideoTimeLimit    = 15;
    shcc.Mode               = CAMERACAPTURE_MODE_STILL;

    // Display the Camera Capture dialog.
    hResult = SHCameraCapture(&shcc);

    // The next statements will execute only after the user takes
    // a picture or video, or closes the Camera Capture dialog.
    if (S_OK == hResult) {
        LPTSTR fname = get_file_name(shcc.szFile,pszFilename);
		if (fname) {
			StringCchCopy(pszFilename, MAX_PATH, fname);
			free(fname);
		} else {
            LOG(ERROR) + "takePicture error get file: " + shcc.szFile;

			hResult = E_INVALIDARG;
		}
    }else
    {
        LOG(ERROR) + "takePicture failed with code: " + LOGFMT("0x%X") + hResult;
    }
#endif //_WIN32_WCE

    return hResult;
}
Ejemplo n.º 3
0
/**
 * @brief Sets the port that was opened for the socket.
 * @param[in] port A #uint_t value that corresponds to an open port.
 * @retval false Returned if the port is outside the limits for a #uint_t variable.
 * @retval true Returned if the port was successfully set.
 */
const bool Socket::sPort( const uint_t& port )
{
    UFLAGS_DE( flags );

    if ( port <= uintmin_t || port >= uintmax_t )
    {
        LOGFMT( flags, "Socket::sPort()-> called with invalid port: %lu", port );
        return false;
    }

    m_port = port;

    return true;
}
Ejemplo n.º 4
0
/**
 * @brief Increment the total count of bytes received by the socket.
 * @param[in] amount A #uint_t value to increase the byte count by.
 * @retval false Returned if the amount is outside the limits for a #uint_t variable or if the existing counter would overflow.
 * @retval true Returned if the byte counter was successfully incremented.
 */
const bool Socket::aBytesRecvd( const uint_t& amount )
{
    UFLAGS_DE( flags );

    if ( amount < uintmin_t || ( ( m_bytes_recvd + amount ) >= uintmax_t ) )
    {
        LOGFMT( flags, "Socket::aBytesRecvd()-> called with m_bytes_recvd overflow: %lu + %lu", m_bytes_recvd, amount );
        return false;
    }

    m_bytes_recvd += amount;

    return true;
}
Ejemplo n.º 5
0
/**
 * @brief Sets the file descriptor that was opened for the socket.
 * @param[in] descriptor A #sint_t value that corresponds to an open file descriptor.
 * @retval false Returned if the descriptor is outside the limits for a #sint_t variable.
 * @retval true Returned if the descriptor was successfully set.
 */
const bool Socket::sDescriptor( const sint_t& descriptor )
{
    UFLAGS_DE( flags );

    if ( descriptor < 0 || descriptor >= sintmax_t )
    {
        LOGFMT( flags, "Socket::sDescriptor()-> called with invalid descriptor: %ld", descriptor );
        return false;
    }

    m_descriptor = descriptor;

    return true;
}