extern "C" bool WINAPI EXPORT vscp_writeVscpEventToString( vscpEvent *pEvent, 
                                                                char *p )
{
    bool rv;

    wxString str = wxString::FromAscii( p );
    if ( ( rv =  writeVscpEventToString( pEvent, str ) ) ) {
        strcpy( p, str.ToAscii() );
    }
    return rv;
}
示例#2
0
bool CVSCPVariable::writeVariableToString( wxString& strVariable )
{
    wxString str = wxT("");
    switch ( m_type ) { 

        case VSCP_DAEMON_VARIABLE_CODE_STRING:
            strVariable = m_strValue;
            break;

        case VSCP_DAEMON_VARIABLE_CODE_BOOLEAN:
            if ( m_boolValue ) {
                strVariable.Printf(_("true"));
            }
            else {
                strVariable.Printf(_("false"));
            }
            break;

        case VSCP_DAEMON_VARIABLE_CODE_INTEGER:
            strVariable.Printf(_("%d"), m_longValue );
            break;

        case VSCP_DAEMON_VARIABLE_CODE_LONG:
            strVariable.Printf(_("%ld"), m_longValue );
            break;

        case VSCP_DAEMON_VARIABLE_CODE_DOUBLE:
            strVariable.Printf(_("%f"), m_floatValue );
            break;

        case VSCP_DAEMON_VARIABLE_CODE_VSCP_MEASUREMENT:
            writeVscpDataWithSizeToString( m_normIntSize, m_normInteger, strVariable );
            break;

        case VSCP_DAEMON_VARIABLE_CODE_VSCP_EVENT:
            writeVscpEventToString( &m_event, strVariable );
            break;

        case VSCP_DAEMON_VARIABLE_CODE_VSCP_EVENT_GUID:
            writeGuidToString( &m_event, strVariable );
            break;

        case VSCP_DAEMON_VARIABLE_CODE_VSCP_EVENT_DATA:
            writeVscpDataToString( &m_event, strVariable );
            break;

        case VSCP_DAEMON_VARIABLE_CODE_VSCP_EVENT_CLASS:
            strVariable.Printf(_("%d"), m_event.vscp_class );
            break;

        case VSCP_DAEMON_VARIABLE_CODE_VSCP_EVENT_TYPE:
            strVariable.Printf(_("%d"), m_event.vscp_type );
            break;

        case VSCP_DAEMON_VARIABLE_CODE_VSCP_EVENT_TIMESTAMP:
            strVariable.Printf(_("%d"), m_event.timestamp );
            break;

        case VSCP_DAEMON_VARIABLE_CODE_DATETIME:
            strVariable = m_timestamp.FormatISODate();
            strVariable += wxT(" ");
            strVariable += m_timestamp.FormatISOTime();
            break;

        case VSCP_DAEMON_VARIABLE_CODE_UNASSIGNED:

            // Fall through

        default:
            strVariable.Printf(_("UNKNOWN"));
            break;
    }

    return true;

}