~ubuntu-branches/debian/jessie/rtai/jessie

« back to all changes in this revision

Viewing changes to rtai-lab/scicoslab/macros/RTAI/rtai4_mbx_ovrwr_send.sci

  • Committer: Bazaar Package Importer
  • Author(s): Roland Stigge
  • Date: 2009-07-04 11:47:08 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090704114708-0ivbkccfaawz2pby
Tags: 3.7.1-1
* New upstream release
* debian/control: Standards-Version: 3.8.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
function [x,y,typ] = rtai4_mbx_ovrwr_send(job,arg1,arg2)
 
2
  x=[];y=[];typ=[];
 
3
  select job
 
4
  case 'plot' then
 
5
    exprs=arg1.graphics.exprs;
 
6
    name=exprs(2)
 
7
    standard_draw(arg1)
 
8
  case 'getinputs' then
 
9
    [x,y,typ]=standard_inputs(arg1)
 
10
  case 'getoutputs' then
 
11
    [x,y,typ]=standard_outputs(arg1)
 
12
  case 'getorigin' then
 
13
    [x,y]=standard_origin(arg1)
 
14
  case 'set' then
 
15
    x=arg1
 
16
    model=arg1.model;graphics=arg1.graphics;
 
17
    exprs=graphics.exprs;
 
18
    while %t do
 
19
      [ok,inport,name,ipaddr,exprs]=..
 
20
      getvalue('Set RTAI mbx_ovrwr_send block parameters',..
 
21
      ['Input ports:';
 
22
       'MBX Name:';
 
23
       'IP address:'],..
 
24
      list('vec',-1,'str',1,'str',1),exprs)
 
25
      if ~ok then break,end
 
26
      if exists('inport') then in=ones(inport,1), out=[], else in=1, out=[], end
 
27
      [model,graphics,ok]=check_io(model,graphics,in,out,1,[])
 
28
      if ok then
 
29
        graphics.exprs=exprs;
 
30
        model.rpar=[];
 
31
        model.ipar=[length(name);
 
32
                    length(ipaddr);
 
33
                    ascii(name)';
 
34
                    ascii(ipaddr)'];
 
35
        model.dstate=[];
 
36
        x.graphics=graphics;x.model=model
 
37
        break
 
38
      end
 
39
    end
 
40
  case 'define' then
 
41
    inport=1
 
42
    name='MBX1'
 
43
    ipaddr='127.0.0.1'
 
44
    model=scicos_model()
 
45
    model.sim=list('rtai_mbx_ovrwr_send',4)
 
46
    if exists('inport') then model.in=ones(inport,1), model.out=[], else model.in=1, model.out=[], end
 
47
    model.evtin=1
 
48
    model.rpar=[]
 
49
    model.ipar=[length(name);
 
50
                length(ipaddr);
 
51
                ascii(name)';
 
52
                ascii(ipaddr)']
 
53
    model.dstate=[];
 
54
    model.blocktype='d'
 
55
    model.dep_ut=[%t %f]
 
56
    exprs=[sci2exp(inport),name,ipaddr]
 
57
    gr_i=['xstringb(orig(1),orig(2),[''Mbx Send Ovw'';name],sz(1),sz(2),''fill'');']
 
58
    x=standard_define([3 2],model,exprs,gr_i)
 
59
  end
 
60
endfunction