コード例 #1
0
ファイル: multiClientMain.c プロジェクト: H-H-bin/legato-af
void test1(void)
{
    uint32_t value=10;
    uint32_t data[] = {1, 2, 3, 4};
    size_t length=10;
    uint32_t output[length];
    char response[21];
    char more[21];

    allParameters(COMMON_TWO,
                  &value,
                  data,
                  4,
                  output,
                  &length,
                  "input string",
                  response,
                  sizeof(response),
                  more,
                  sizeof(more));

    LE_PRINT_VALUE("%i", value);
    LE_PRINT_ARRAY("%i", length, output);
    LE_PRINT_VALUE("%s", response);
    LE_PRINT_VALUE("%s", more);
}
コード例 #2
0
ファイル: multiClientMain.c プロジェクト: H-H-bin/legato-af
void test3(void)
{
    uint32_t value=5;
    uint32_t data[] = {3, 9, 4, 1};
    size_t length=14;
    uint32_t output[length];
    char response[21];
    char more[21];

    allParameters(COMMON_THREE,
                  &value,
                  data,
                  4,
                  output,
                  &length,
                  "new thread string",
                  response,
                  sizeof(response),
                  more,
                  sizeof(more));

    LE_PRINT_VALUE("%i", value);
    LE_PRINT_ARRAY("%i", length, output);
    LE_PRINT_VALUE("%s", response);
    LE_PRINT_VALUE("%s", more);
}
コード例 #3
0
ファイル: server.c プロジェクト: mbarazzouq/legato-af
static void Handle_allParameters
(
    le_msg_MessageRef_t _msgRef
)
{
    // Get the message buffer pointer
    __attribute__((unused)) uint8_t* _msgBufPtr = ((_Message_t*)le_msg_GetPayloadPtr(_msgRef))->buffer;

    // Unpack the input parameters from the message
    common_EnumExample_t a;
    _msgBufPtr = UnpackData( _msgBufPtr, &a, sizeof(common_EnumExample_t) );

    size_t dataNumElements;
    _msgBufPtr = UnpackData( _msgBufPtr, &dataNumElements, sizeof(size_t) );

    uint32_t data[dataNumElements];
    _msgBufPtr = UnpackData( _msgBufPtr, data, dataNumElements*sizeof(uint32_t) );

    size_t outputNumElements;
    _msgBufPtr = UnpackData( _msgBufPtr, &outputNumElements, sizeof(size_t) );

    const char* label;
    _msgBufPtr = UnpackString( _msgBufPtr, &label );

    size_t responseNumElements;
    _msgBufPtr = UnpackData( _msgBufPtr, &responseNumElements, sizeof(size_t) );

    size_t moreNumElements;
    _msgBufPtr = UnpackData( _msgBufPtr, &moreNumElements, sizeof(size_t) );

    // Call the function
    allParameters ( (ServerCmdRef_t)_msgRef, a, data, dataNumElements, outputNumElements, label, responseNumElements, moreNumElements );
}
コード例 #4
0
ファイル: fitobject.cpp プロジェクト: ojschumann/clip
FitObject& FitObject::operator=(const FitObject& o) {
  QList<FitParameter*> tP = allParameters();
  QList<FitParameter*> oP = o.allParameters();
  for (int n=0; n<tP.size(); n++) {
    tP.at(n)->setChangeable(oP.at(n)->isChangeable());
    tP.at(n)->setEnabled(oP.at(n)->isEnabled());
  }
  return *this;
}
コード例 #5
0
ファイル: clientMain.c プロジェクト: H-H-bin/legato-af
void test1(void)
{
    uint32_t value=10;
    uint32_t data[] = {1, 2, 3, 4};
    size_t length=10;
    uint32_t output[length];
    char response[21];
    char more[21];

    allParameters(COMMON_TWO,
                  &value,
                  data,
                  4,
                  output,
                  &length,
                  "input string",
                  response,
                  sizeof(response),
                  more,
                  sizeof(more));

    LE_PRINT_VALUE("%i", value);
    LE_PRINT_ARRAY("%i", length, output);
    LE_PRINT_VALUE("%s", response);
    LE_PRINT_VALUE("%s", more);

    // Call again with a special value, so that nothing is returned for the 'output', 'response'
    // and 'more' output parameters. This could happen in a typical function, if an error is 
    // detected.
    
    // Make 'length' larger than actually defined for the 'output' parameter to verify that
    // only the maximum defined value is used on the server.
    length = 20;
    allParameters(COMMON_ZERO,
                  &value,
                  data,
                  4,
                  output,
                  &length,
                  "new string",
                  response,
                  sizeof(response),
                  more,
                  sizeof(more));

    LE_PRINT_VALUE("%i", value);
    LE_PRINT_ARRAY("%i", length, output);
    LE_PRINT_VALUE("%s", response);
    LE_PRINT_VALUE("%s", more);

    // Test file descriptors
    int fdToServer;
    int fdFromServer;

    // Open a file known to exist
    fdToServer = open("/usr/include/stdio.h", O_RDONLY);

    LE_PRINT_VALUE("%i", fdToServer);
    FileTest(fdToServer, &fdFromServer);
    LE_PRINT_VALUE("%i", fdFromServer);

    // Read and print out whatever is read from the server fd
    writeFdToLog(fdFromServer);
}
コード例 #6
0
ファイル: thttprequest.cpp プロジェクト: KOPOJI/treefrog
/*!
  Returns the string value whose name is equal to \a name from the URL or the
  form data.
 */
QString THttpRequest::parameter(const QString &name) const
{
    return allParameters()[name].toString();
}
コード例 #7
0
ファイル: server.c プロジェクト: ekral85/legato-af
static void Handle_allParameters
(
    le_msg_MessageRef_t _msgRef

)
{
    // Get the message buffer pointer
    uint8_t* _msgBufPtr = ((_Message_t*)le_msg_GetPayloadPtr(_msgRef))->buffer;

    // Needed if we are returning a result or output values
    uint8_t* _msgBufStartPtr = _msgBufPtr;

    // Unpack the input parameters from the message
    common_EnumExample_t a;
    _msgBufPtr = UnpackData( _msgBufPtr, &a, sizeof(common_EnumExample_t) );

    size_t dataNumElements;
    _msgBufPtr = UnpackData( _msgBufPtr, &dataNumElements, sizeof(size_t) );

    uint32_t data[dataNumElements];
    _msgBufPtr = UnpackData( _msgBufPtr, data, dataNumElements*sizeof(uint32_t) );

    size_t outputNumElements;
    _msgBufPtr = UnpackData( _msgBufPtr, &outputNumElements, sizeof(size_t) );
    if ( outputNumElements > 10 )
    {
        LE_DEBUG("Adjusting outputNumElements from %zd to 10", outputNumElements);
        outputNumElements = 10;
    }

    char label[21];
    _msgBufPtr = UnpackString( _msgBufPtr, label, 21 );

    size_t responseNumElements;
    _msgBufPtr = UnpackData( _msgBufPtr, &responseNumElements, sizeof(size_t) );

    size_t moreNumElements;
    _msgBufPtr = UnpackData( _msgBufPtr, &moreNumElements, sizeof(size_t) );


    // Define storage for output parameters
    uint32_t b;

    uint32_t output[outputNumElements];
    char response[responseNumElements]; response[0]=0;
    char more[moreNumElements]; more[0]=0;

    // Call the function
    allParameters ( a, &b, data, dataNumElements, output, &outputNumElements, label, response, responseNumElements, more, moreNumElements );


    // Re-use the message buffer for the response
    _msgBufPtr = _msgBufStartPtr;


    // Pack any "out" parameters
    _msgBufPtr = PackData( _msgBufPtr, &b, sizeof(uint32_t) );
    _msgBufPtr = PackData( _msgBufPtr, &outputNumElements, sizeof(size_t) );
    _msgBufPtr = PackData( _msgBufPtr, output, outputNumElements*sizeof(uint32_t) );
    _msgBufPtr = PackString( _msgBufPtr, response );
    _msgBufPtr = PackString( _msgBufPtr, more );

    // Return the response
    LE_DEBUG("Sending response to client session %p : %ti bytes sent",
             le_msg_GetSession(_msgRef),
             _msgBufPtr-_msgBufStartPtr);
    le_msg_Respond(_msgRef);
}