예제 #1
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  rtsys = getrtsys() ; // Get pointer to rtsys 

  if (rtsys==NULL) {
    return;
  }

  // Check number and type of arguments. 
  if (nrhs != 2) {
    MEX_ERROR("ttCreateMonitor: Wrong number of input arguments!\nUsage: ttCreateMonitor(monitorname, display)");
    return;
  }

  if (mxIsChar(prhs[0]) != 1) {
    MEX_ERROR("ttCreateMonitor: monitorname must be a string");
    return;
  }
  if (!mxIsDoubleScalar(prhs[1])) {
    MEX_ERROR("ttCreateMonitor: display must be an integer scalar");
    return;
  }

  char monitorname[100];
  mxGetString(prhs[0], monitorname, 100);
  
  int display = (int) *mxGetPr(prhs[1]);
  if (display == 0) {
    ttCreateMonitor(monitorname, false);
  } else {
    ttCreateMonitor(monitorname, true);
  }
}
예제 #2
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  rtsys = getrtsys() ; // Get pointer to rtsys 

  if (rtsys==NULL) {
    return;
  }

  // Check number and type of arguments. 
  if (nrhs != 1) {
    MEX_ERROR("ttGive: Wrong number of input arguments!\nUsage: ttGive(sempahorename)");
    return;
  }
  
  if (mxIsChar(prhs[0]) != 1 || mxGetM(prhs[0]) != 1) {
    MEX_ERROR("ttGive: sempahorename must be a non-empty string");
    return;
  }

  char sempahorename[100];
  mxGetString(prhs[0], sempahorename, 100);
  
  ttGive(sempahorename);

}
예제 #3
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  rtsys = getrtsys() ; // Get pointer to rtsys 

  if (rtsys==NULL) {
    return;
  }

  // Check number and type of arguments. 
  if (nrhs != 1) {
    MEX_ERROR("ttLogStop: Wrong number of input arguments!\nUsage: ttLogStop(logID)");
    return;
  }

  int ID = 0;
  if (mxIsDoubleScalar(prhs[0])) {
    ID = (int)*mxGetPr(prhs[0]);
  }
  if (ID <= 0) {
    MEX_ERROR("ttLogStop: logID must be a positive number");
    return;
  }

  ttLogStop(ID);
}
예제 #4
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  rtsys = getrtsys() ; // Get pointer to rtsys 
 
  if (rtsys==NULL) {
    return;
  }

  // Check number and type of arguments. 
  if (nrhs != 1) {
    MEX_ERROR("ttNotify: Wrong number of input arguments!\nUsage: ttNotify(eventname)");
    return;
  }

  if (mxIsChar(prhs[0]) != 1) {
    MEX_ERROR("ttNotify: eventname must be a string");
    return;
  }
  
  char eventname[100];
  mxGetString(prhs[0], eventname, 100);
  
  ttNotify(eventname);

}
예제 #5
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  rtsys = getrtsys() ; // Get pointer to rtsys 

  if (rtsys==NULL) {
    return;
  }

  // Check number and type of arguments. 
  if (nrhs != 2) {
    MEX_ERROR("ttAttachDLHandler: Wrong number of input arguments!\nUsage: ttAttachDLHandler(taskname, handlername)");
    return;
  }

  if (mxIsChar(prhs[0]) != 1 || mxGetM(prhs[0]) != 1) {
    MEX_ERROR("ttAttachDLHandler: taskname must be a non-empty string");
    return;
  }
  if (mxIsChar(prhs[1]) != 1 || mxGetM(prhs[1]) != 1) {
    MEX_ERROR("ttAttachDLHandler: handlername must be a non-empty string");
    return;
  }

  char taskname[100];
  char handlername[100];

  mxGetString(prhs[0], taskname, 100);
  mxGetString(prhs[1], handlername, 100);

  ttAttachDLHandler(taskname, handlername);
}
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
    double value;
    char parametername[100];

    rtsys = getrtsys(); // Get pointer to rtsys

    if (rtsys==NULL) {
        return;
    }
    // Check number and type of arguments.
    if (nrhs < 2 || nrhs > 2) {
        MEX_ERROR("ttSetKernelParameter: Wrong number of input arguments!\nUsage: ttSetKernelParameter(parameter, value)");
        return;
    }
    if (mxIsChar(prhs[0]) != 1) {
        MEX_ERROR("ttSetKernelParameter: parameter name must be a string");
        return;
    }
    mxGetString(prhs[0], parametername, 100);

    if (!mxIsDouble(prhs[1])) {
        MEX_ERROR("ttSetKernelParameter: value must be a double");
        return;
    }
    value = (double)*mxGetPr(prhs[1]);
    //printf("%s, %f\n", parametername, value);
    ttSetKernelParameter(parametername, value);
    //printf("%s:%d\n", __FILE__,__LINE__);
}
예제 #7
0
void ttNoSchedule(char* name) {

  DataNode* dn1, *dn2;
  UserTask* task;
  InterruptHandler* handler;

  // can only be called during initialization phase
  if (!rtsys->init_phase) {
    MEX_ERROR("ttNoSchedule: Can only be called from the init-function!");
    return;
  }

  dn1 = getNode(name, rtsys->taskList);
  dn2 = getNode(name, rtsys->handlerList);
  
  if (dn1 == NULL && dn2 == NULL) {
    char buf[200];
    sprintf(buf, "ttNoSchedule: Non-existent task or handler '%s'\n", name);
    MEX_ERROR(buf);
  }
  
  if (dn1 != NULL) {
    task = (UserTask*) dn1->data; 
    task->display = false;
    rtsys->nbrOfSchedTasks--;
  }
  
  if (dn2 != NULL) {
    handler = (InterruptHandler*) dn2->data; 
    handler->display = false;
    rtsys->nbrOfSchedHandlers--;
  }
}
// Matlab gateway function
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
  //mexPrintf("I'm Running!\n");

  // Get the command string
  char cmd[64];
  if (nrhs < 1 || mxGetString(prhs[0], cmd, sizeof(cmd)))
  {
    MEX_ERROR("First input should be a command string less than 64 characters long.");
  }

  //--- Standard Functions ---//

  // Command: New
  if (!strcmp("new", cmd))
  {
    return CommandNew(nlhs, plhs, nrhs, prhs);
  }

  // All Other Comamnds:
  //  2nd input must be class instance handle
  if (nrhs < 2)
  {
    MEX_ERROR("ERROR: Second input should be a class instance handle.");
  }

  // Command: Delete
  if (!strcmp("delete", cmd))
  {
    return CommandDelete(nlhs, plhs, nrhs, prhs);
  }


  //--- ICP Methods ---//

  // Command: Initialize 
  if (!strcmp("Initialize", cmd))
  {
    return CommandInitialize(nlhs, plhs, nrhs, prhs);
  }

  // Command: Match
  if (!strcmp("ComputeMatches", cmd))
  {
    return CommandComputeMatches(nlhs, plhs, nrhs, prhs);
  }

  MEX_ERROR("ERROR: Command not recognized.");


  //// Command: Template 
  //if (!strcmp("template", cmd))
  //{
  //  return CommandInitialize(  nlhs, plhs, nrhs, prhs );
  //}
}
예제 #9
0
bool ttCreateTask(char *name, double deadline, double priority, double (*codeFcn)(int, void*)) {

  UserTask* task;

  if (strcmp(name,"") == 0) {
    MEX_ERROR("ttCreate(Periodic)Task: Name should be a non-empty string!");
    return false;
  }
  if (rtsys->prioFcn == NULL) {
    MEX_ERROR("ttCreate(Periodic)Task: Kernel must be initialized before creation of tasks!");
    return false;
  }
  DataNode* dn = getNode(name, rtsys->taskList);
  if (dn != NULL) { 
    MEX_ERROR("ttCreate(Periodic)Task: Name of task not unique! Task not created!");
    return false;
  }
  if (priority < EPS) {
    MEX_ERROR("ttCreate(Periodic)Task: Priorities are supposed to be positive real numbers!");
    return false;
  }
  
  task = new UserTask(name);
  task->codeFcn = codeFcn;

  task->priority = priority;
  task->wcExecTime = deadline;
  task->deadline = deadline;
  
  task->state = IDLE;
  task->taskID = rtsys->nbrOfTasks + 1;
  task->isPreemptable = true;
  task->display = true;

  task->lastStart = 0.0;
  task->absDeadline = deadline;
  task->release = 0.0;
  task->budget = deadline;
  
  task->arrival_hook  = rtsys->default_arrival;
  task->release_hook  = rtsys->default_release;
  task->start_hook    = rtsys->default_start;
  task->suspend_hook  = rtsys->default_suspend;
  task->resume_hook   = rtsys->default_resume;
  task->finish_hook   = rtsys->default_finish;
      
  rtsys->taskList->appendNode(new DataNode(task, task->name));

  rtsys->nbrOfSchedTasks++;
  rtsys->nbrOfTasks++;

  return true;
}
예제 #10
0
void ttTake(char *nameOfSemaphore) {
  
  Semaphore* sem;
  UserTask* task;
  
  DataNode* dn = getNode(nameOfSemaphore, rtsys->semaphoreList);
  if (dn == NULL) {
    // Semaphore does not exist 
    char buf[200];
    sprintf(buf, "ttTake: Non-existent semaphore '%s'!", nameOfSemaphore);
    MEX_ERROR(buf);
    return;
  }

  task = (UserTask*) rtsys->running;
  sem = (Semaphore*) dn->data;

  sem->value--;

  if (sem->value < 0) { // Not free 
    task->moveToList(sem->waitingQ);
    task->state = WAITING;
    // Execute suspend hook
    task->suspend_hook(task);

  }

}
예제 #11
0
static void
mex_telepathy_channel_on_contact_fetched (TpConnection     *connection,
                                          guint             n_contacts,
                                          TpContact *const *contacts,
                                          guint             n_failed,
                                          const TpHandle   *failed,
                                          const GError     *fetched_error,
                                          gpointer          user_data,
                                          GObject          *weak_object)
{
  MexTelepathyChannel *self = MEX_TELEPATHY_CHANNEL (user_data);

  int i = 0;

  if (self->priv->channel)
    {
      for (i = 0; i < n_contacts; ++i)
        {
          gchar *text;
          const gchar *alias;
          TpContact *current;
          GFile *file;

          // Get the contacts.
          current = contacts[i];

          // Connect to alias change signal.
          // Add the alias to the label.
          alias = tp_contact_get_alias (current);
          mx_label_set_text (MX_LABEL (self->priv->title_label),
                             alias);

          if (tp_channel_get_requested(self->priv->channel))
            text = g_strdup_printf ("Calling %s", alias);
          else
            text = g_strdup_printf ("Setting up call with %s", alias);
          mx_label_set_text (MX_LABEL (self->priv->busy_label), text);
          g_free (text);

          file = tp_contact_get_avatar_file (current);
          if (file)
            {
              gchar *filename = g_file_get_path (file);
              GError *error = NULL;
              MEX_DEBUG ("setting new avatar filename to %s", filename);
              mx_image_set_from_file (MX_IMAGE(self->priv->avatar_image),
                                      filename,
                                      &error);
              if (error)
                {
                  MEX_ERROR ("ERROR %s loading avatar from file %s\n",
                             error->message, filename);
                  g_clear_error (&error);
                }
              if (filename)
                g_free (filename);
            }
        }
    }
}
예제 #12
0
void ttAnalogOut(int outputChan, double value) {
  
  if (outputChan < 1 || outputChan > rtsys->nbrOfOutputs) {
    MEX_ERROR("ttAnalogOut: outpChan out of bounds");
    return;
  }

  rtsys->outputs[outputChan-1] = value;
}
예제 #13
0
double ttAnalogIn(int inputNbr) {

  if (inputNbr < 1 || inputNbr > rtsys->nbrOfInputs) {
    MEX_ERROR("ttAnalogIn: inpChan out of bounds");
    return 0.0;
  }

  return rtsys->inputs[inputNbr-1];
}
예제 #14
0
void ttExitMonitor(char *nameOfMonitor) {

  Monitor* mon;
  UserTask* task;

  DataNode* dn = getNode(nameOfMonitor, rtsys->monitorList);
  if (dn == NULL) {
    // Monitor does not exist 
    char buf[200];
    sprintf(buf, "ttExitMonitor: Non-existent monitor '%s'!", nameOfMonitor);
    MEX_ERROR(buf);
    return;
  }

  task = (UserTask*) rtsys->running;
  mon = (Monitor*) dn->data;
  
  if (mon->heldBy != task) {
    char buf[200];
    sprintf(buf, "ttExitMonitor: Task '%s' not holding monitor '%s'!", task->name, nameOfMonitor);
    MEX_ERROR(buf);
    return;
  }

  // Priority Inheritance, reset
  task->tempPrio = 0.0;
  task->prioRaised = false;
  // Reshuffle readyQ
  if (task->myList == rtsys->readyQ) {
    task->moveToList(rtsys->readyQ);
  }

  mon->heldBy = NULL;

  // Move first waiting task to readyQ
  task = (UserTask*) mon->waitingQ->getFirst();
  if (task != NULL) {
    task->moveToList(rtsys->readyQ);
    task->state = READY;
    mon->heldBy = task;
  }

}
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  int network;
  double value;
  char parametername[100];

  rtsys = getrtsys(); // Get pointer to rtsys 

  if (rtsys==NULL) {
    return;
  }
  // Check number and type of arguments. 
  if (nrhs < 2 || nrhs > 3) {
    MEX_ERROR("ttSetNetworkParameter: Wrong number of input arguments!\nUsage: ttSetNetworkParameter(parameter, value) or\n       ttSetNetworkParameter(network, parameter, value)");
    return;
  }
  if (mxIsChar(prhs[nrhs-2]) != 1) {
    MEX_ERROR("ttSetNetworkParameter: parameter name must be a string");
    return;
  }

  mxGetString(prhs[nrhs-2], parametername, 100);
  if (nrhs == 2){ // no network specified
    if (!mxIsDouble(prhs[1])){
      MEX_ERROR("ttSetNetworkParameter: value must be a double");
      return;
    }
    network = 1;
    value = (double)*mxGetPr(prhs[1]);
  } else { // the network is specified
    if (!mxIsDouble(prhs[0]) || !mxIsDouble(prhs[2])){
      MEX_ERROR("ttSetNetworkParameter: network must be a double\n                       value must be a double");
      return;
    }
    network = (int)*mxGetPr(prhs[0]);
    value = (double)*mxGetPr(prhs[2]);
  }
  //printf("%d, %s, %f\n", network, parametername, value);
  ttSetNetworkParameter(network, parametername, value);
  //printf("%s:%d\n", __FILE__,__LINE__);
}
예제 #16
0
// get priority of calling task
double ttGetPriority() {

  if (!rtsys->running->isUserTask()) {
    MEX_ERROR("ttGetPriority: Can not be called by interrupt handler!");
    return 0.0;
  }

  UserTask* task = (UserTask*) (rtsys->running); 
  
  return task->priority;
}
예제 #17
0
// get absolute deadline of specific task
double ttGetAbsDeadline(char *nameOfTask) {

  DataNode* dn = getNode(nameOfTask, rtsys->taskList);
  if (dn == NULL) {
    char buf[200];
    sprintf(buf, "ttGetAbsDeadline: Non-existent task '%s'!", nameOfTask);
    MEX_ERROR(buf);
    return 0.0;
  }

  UserTask* task = (UserTask*) dn->data; 
  if (task->nbrJobs == 0) {
    char buf[200];
    sprintf(buf, "ttGetAbsDeadline: No running job of task '%s'!", nameOfTask);
    MEX_ERROR(buf);
    return 0.0;
  }

  return task->absDeadline;
}  
예제 #18
0
// get absolute deadline of calling task
double ttGetAbsDeadline() {

  if (!rtsys->running->isUserTask()) {
    MEX_ERROR("ttGetAbsDeadline: Can not be called by interrupt handler!");
    return 0.0;
  }

  UserTask* task = (UserTask*) (rtsys->running); 

  return task->absDeadline;
}
void ttSetNetworkParameter(int networkNbr, char* parameter, double value)
{
  Network* net = getNetwork(networkNbr);
  if (net == NULL) {
    char buf[200];
    sprintf(buf, "ttSendMsg: Network #%d not present!", networkNbr);
    MEX_ERROR(buf);
    return;
  }
  //printf("%d\n",(int)net);
  nwSetNetworkParameter(net, parameter, value);
}
예제 #20
0
void ttCreateLog(char* taskname, int logtype, char* variable, int size) {

  DataNode* dn;
  UserTask* task;
  char buf[100];
  
  // can only be called during initialization phase
  if (!rtsys->init_phase) {
    MEX_ERROR("ttCreateLog: Can only be called from the init-function!");
    return;
  }
  if (logtype > USERLOG || logtype < RESPONSETIMELOG) {
    sprintf(buf,"ttCreateLog: unknown log type %d", logtype);
    MEX_ERROR(buf);
    return;
  }

  dn = getNode(taskname, rtsys->taskList);
  if (dn == NULL) {
    sprintf(buf, "ttCreateLog: Non-existent task '%s'", taskname);
    MEX_ERROR(buf);
    return;
  }
  task = (UserTask*) dn->data;
  if (logtype != USERLOG) {
    if (task->logs[logtype-1] != NULL) {
      MEX_ERROR("ttCreateLog: log already assigned");
      return;
    }
    task->logs[logtype-1] = new Log(variable, size);
  } else {
    if (task->nbrOfUserLogs == NBRUSERLOGS) {
      sprintf(buf, "ttCreateLog: Maximum number of user logs exceeded! Can not create log variable %s for task %s", variable, taskname);
      MEX_ERROR(buf);
      return;
    }
    task->logs[task->nbrOfUserLogs+5] = new Log(variable, size);
    task->nbrOfUserLogs++;
  }
}
예제 #21
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  rtsys = getrtsys() ; // Get pointer to rtsys 

  if (rtsys==NULL) {
    return;
  }

  // Check number and type of arguments. 
  if (nrhs < 2 || nrhs > 3 ) {
    MEX_ERROR("ttCreateSemaphore: Wrong number of input arguments!\nUsage: ttCreateSemaphore(semaphorename, initval [, maxval])");
    return;
  }
  if (mxIsChar(prhs[0]) != 1) {
    MEX_ERROR("ttCreateSemaphore: semaphorename must be a string");
    return;
  }
  if (!mxIsDoubleScalar(prhs[1])) {
    MEX_ERROR("ttCreateSemaphore: initval must be an integer scalar");
    return;
  }

  if (nrhs == 3) {
    if (!mxIsDoubleScalar(prhs[2])) {
      MEX_ERROR("ttCreateSemaphore: maxval must be an integer scalar");
      return;
    }
  }

  char semaphorename[100];
  mxGetString(prhs[0], semaphorename, 100);
  int initval = (int) *mxGetPr(prhs[1]);
  if (nrhs == 2) {
    ttCreateSemaphore(semaphorename, initval);
  } else {
    int maxval = (int) *mxGetPr(prhs[2]);
    ttCreateSemaphore(semaphorename, initval, maxval);
  }
}
예제 #22
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
    mxArray* data;
    int network;

    rtsys = getrtsys(); // Get pointer to rtsys

    if (rtsys==NULL) {
        return;
    }

    // Check number and type of arguments.
    if (nrhs > 1) {
        MEX_ERROR("ttGetMsg: Wrong number of input arguments!\nUsage: ttGetMsg or\n       ttGetMsg(network)");
        return;
    }

    if (nrhs == 1) {
        if (!mxIsDoubleScalar(prhs[0])) {
            MEX_ERROR("ttGetMsg: network must be an integer scalar");
            return;
        }
        network = (int) *mxGetPr(prhs[0]);
    } else {
        network = 1;
    }

    double signalPower;
    data = ttGetMsgMATLAB(network, &signalPower);

    if ( data==NULL ) {
        data = mxCreateDoubleMatrix(0,0,mxREAL); // Return empty matrix
    }

    plhs[0] = data;
    if ( nlhs>=2 ) {
        plhs[1] = mxCreateDoubleScalar(signalPower);
    }
}
예제 #23
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  double value; 
  
  rtsys = getrtsys() ; // Get pointer to rtsys 

  if (rtsys==NULL) {
    return;
  }

  // Check number and type of arguments. 
  if (nrhs == 0 || nrhs > 2) {
    MEX_ERROR("ttSetDeadline: Wrong number of input arguments!\nUsage: ttSetDeadline(value) or ttSetDeadline(value, taskname)");
    return;
  }

  if (!mxIsDoubleScalar(prhs[0])) {
    MEX_ERROR("ttSetDeadline: value must be a number");
    return;
  }
  
  if (nrhs == 1) {
    value = *mxGetPr(prhs[0]);
    ttSetDeadline(value);
    
  } else {
    if (mxIsChar(prhs[1]) != 1 || mxGetM(prhs[1]) != 1) {
      MEX_ERROR("ttSetDeadline: taskname must be a string");
      return;
    }
    
    value = *mxGetPr(prhs[0]);
    char taskname[100];
    mxGetString(prhs[1], taskname, 100);
    
    ttSetDeadline(value, taskname);
  }

}
예제 #24
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  rtsys = getrtsys() ; // Get pointer to rtsys 

  if (rtsys==NULL) {
    return;
  }

  // Check number and type of arguments. 
  if (nrhs < 1 || nrhs > 2) {
    MEX_ERROR("ttCreateEvent: Wrong number of input arguments!\nUsage: ttCreateEvent(eventname) or ttCreateEvent(eventname, monitorname)");
    return;
  }

  if (mxIsChar(prhs[0]) != 1) {
    MEX_ERROR("ttCreateEvent: eventname must be a string");
    return;
  }
  
  if (nrhs == 2) {
    if (mxIsChar(prhs[1]) != 1) {
      MEX_ERROR("ttCreateEvent: monitorname must be a string");
      return;
    }  
  }

  char eventname[100];
  mxGetString(prhs[0], eventname, 100);

  if (nrhs == 1) {
    ttCreateEvent(eventname);
  } else {
    char monitorname[100];
    mxGetString(prhs[1], monitorname, 100);
    
    ttCreateEvent(eventname, monitorname);
  }
}
예제 #25
0
// get priority of specific task
double ttGetPriority(char *nameOfTask) {

  DataNode* dn = getNode(nameOfTask, rtsys->taskList);
  if (dn == NULL) {
    char buf[200];
    sprintf(buf, "ttGetPriority: Non-existent task '%s'!", nameOfTask);
    MEX_ERROR(buf);
    return 0.0;
  }
  
  UserTask* task = (UserTask*) dn->data; 
  return task->priority;
}
예제 #26
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  double retval; 
   
  rtsys = getrtsys() ; // Get pointer to rtsys 

  if (rtsys==NULL) {
    return;
  }

  // Check number and type of arguments. 
  if (nrhs > 1) {
    MEX_ERROR("ttGetWCET: Wrong number of input arguments!\nUsage: ttGetWCET or ttGetWCET(taskname)");
    return;
  }

  if (nrhs == 0) {
    retval = ttGetWCET(); 
    
    plhs[0] = mxCreateDoubleScalar(retval);

  } else {
    if (mxIsChar(prhs[0]) != 1 || mxGetM(prhs[0]) != 1) {
      MEX_ERROR("ttGetWCET: taskname must be a string");
      return;
    }
    
    char taskname[100];
    mxGetString(prhs[0], taskname, 100);
    retval = ttGetWCET(taskname); 
    
    plhs[0] = mxCreateDoubleScalar(retval);
    
  }

}
void CommandNew(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{ // create new class instance

  // Expected Input:
  //  cmd

  // Check parameters
  if (nlhs != 1 || nrhs != 1)
  {
    MEX_ERROR("New: requires 1 outputs, 1 inputs.");
  }
  // Return a handle to a new C++ instance
  plhs[0] = convertPtr2Mat < mexInterface_AlgPDTree_MLP_Mesh >
    (new mexInterface_AlgPDTree_MLP_Mesh);
}
예제 #28
0
static gboolean
mex_telepathy_channel_on_bus_watch (GstBus     *bus,
                                    GstMessage *message,
                                    gpointer    user_data)
{
  MexTelepathyChannel *self = MEX_TELEPATHY_CHANNEL (user_data);
  MexTelepathyChannelPrivate *priv = self->priv;

  if (priv->tf_channel != NULL)
    tf_channel_bus_message (priv->tf_channel, message);

  if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_ERROR)
    {
      GError *error = NULL;
      gchar *debug = NULL;
      gst_message_parse_error (message, &error, &debug);
      MEX_ERROR ("ERROR from element %s: %s\n",
                 GST_OBJECT_NAME (message->src), error->message);
      MEX_ERROR ("Debugging info: %s\n", (debug) ? debug : "none");
      g_error_free (error);
      g_free (debug);
    }
  return TRUE;
}
예제 #29
0
void ttLogStart(int logID) {
  UserTask* usertask;

  if (logID < 1 || logID > NBRUSERLOGS) {
    MEX_ERROR("ttLogStart: Log ID out of bounds!");
    return;
  }
  if (rtsys->running->isUserTask()) {
    usertask = (UserTask*) rtsys->running;
    logstart(usertask, logID+5);     // 5 pre-defined log types
  } else {
    printf("ttLogStart: Call from interrupt handler ignored!\n");
    return;
  }
}
예제 #30
0
void mexFunction( int nlhs, mxArray *plhs[],
                  int nrhs, const mxArray *prhs[] )
{
  rtsys = getrtsys() ; // Get pointer to rtsys 

  if (rtsys==NULL) {
    return;
  }

  // Check number and type of arguments. 
  if (nrhs != 1) {
    MEX_ERROR("ttSleepUntil: Wrong number of input arguments!\nUsage: ttSleepUntil(time)");
    return;
  }

  if (!mxIsDoubleScalar(prhs[0])) {
    MEX_ERROR("ttSleepUntil: time must be a number");
    return;
  }

  double time = *mxGetPr(prhs[0]);

  ttSleepUntil(time);
}