Changeset 1135 for trunk/MagicSoft


Ignore:
Timestamp:
12/21/01 11:10:51 (23 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/candrv/nodedrv.cc

    r1109 r1135  
    99ClassImp(NodeDrv);
    1010
     11// --------------------------------------------------------------------------
     12//
     13// Constructor for one node. Sets the Node Id (<32) the logging stream
     14// and the node name. The name is a name for debug output.
     15//
    1116NodeDrv::NodeDrv(BYTE_t nodeid, const char *name, MLog &out) : Log(out), fNetwork(NULL), fId(32), fError(0)
    1217{
     
    2025
    2126    if (name)
    22     {
    23         fName = new char[strlen(name)+1];
    24         strcpy(fName, name);
    25     }
     27        fName = name;
    2628    else
    2729    {
    28         fName = new char[9];
    29         sprintf(fName, "Node#%d", nodeid);
     30        fName = "Node#";
     31        fName += nodeid;
    3032    }
    3133}
    3234
     35// --------------------------------------------------------------------------
     36//
     37// Empty destructor
     38//
    3339NodeDrv::~NodeDrv()
    3440{
    35     delete fName;
    36 }
    37 
     41}
     42
     43// --------------------------------------------------------------------------
     44//
     45// Init device, sets the pointer to the whole network and enables
     46// the Can messages to be passed through the interface:
     47//   PDO1 tx
     48//   PDO2 tx
     49//   PDO3 tx
     50//   PDO4 tx
     51//   SDO rx
     52//   SDO tx
     53//
    3854void NodeDrv::InitDevice(Network *net)
    3955{
     
    4864}
    4965
     66// --------------------------------------------------------------------------
     67//
     68// Print an "SDO idx/subidx set." from this device message.
     69// This output is never redirected to the GUI
     70//
    5071void NodeDrv::HandleSDOOK(WORD_t idx, BYTE_t subidx)
    5172{
     
    6384}
    6485
     86// --------------------------------------------------------------------------
     87//
     88// Print an error message with the corresponding data from this device.
     89//
    6590void NodeDrv::HandleSDOError(LWORD_t data)
    6691{
    67     lout << "Nodedrv: SDO Error: Entry not found in deictionary (data=0x";
     92    lout << "Nodedrv: SDO Error: Entry not found in dictionary (data=0x";
    6893    lout << hex << setfill('0') << setw(4) << data << ")";
    6994    lout << endl;
    7095}
    7196
     97// --------------------------------------------------------------------------
     98//
     99// Prints the received SDo from this device
     100//
    72101void NodeDrv::HandleSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, struct timeval *tv)
    73102{
     
    76105}
    77106
     107// --------------------------------------------------------------------------
     108//
     109// Sends the given PDO1 through the network to this device
     110// A PDO is carrying up to eight bytes of information.
     111// PDO messages are broadcasts.
     112//
    78113void NodeDrv::SendPDO1(BYTE_t data[8])
    79114{
     
    81116}
    82117
     118// --------------------------------------------------------------------------
     119//
     120// Sends the given PDO2 through the network to this device
     121// A PDO is carrying up to eight bytes of information.
     122// PDO messages are broadcasts.
     123//
    83124void NodeDrv::SendPDO2(BYTE_t data[8])
    84125{
     
    86127}
    87128
     129// --------------------------------------------------------------------------
     130//
     131// Sends the given PDO1 through the network to this device
     132// A PDO is carrying up to eight bytes of information.
     133// PDO messages are broadcasts.
     134//
    88135void NodeDrv::SendPDO1(BYTE_t m0=0, BYTE_t m1=0, BYTE_t m2=0, BYTE_t m3=0,
    89136                       BYTE_t m4=0, BYTE_t m5=0, BYTE_t m6=0, BYTE_t m7=0)
     
    92139}
    93140
     141// --------------------------------------------------------------------------
     142//
     143// Sends the given PDO2 through the network to this device
     144// A PDO is carrying up to eight bytes of information.
     145// PDO messages are broadcasts.
     146//
    94147void NodeDrv::SendPDO2(BYTE_t m0=0, BYTE_t m1=0, BYTE_t m2=0, BYTE_t m3=0,
    95148                       BYTE_t m4=0, BYTE_t m5=0, BYTE_t m6=0, BYTE_t m7=0)
     
    98151}
    99152
     153// --------------------------------------------------------------------------
     154//
     155// Sends the given SDO through the network to this device
     156// An SDO message contains
     157//  an address (this device)
     158//  an index of the dictionary entry to address
     159//  a subindex of this dictionary entry to access
     160//  and a value to set for this dictionary entry
     161//
    100162void NodeDrv::SendSDO(WORD_t idx, BYTE_t subidx, BYTE_t val, bool store)
    101163{
     
    103165}
    104166
     167// --------------------------------------------------------------------------
     168//
     169// Sends the given SDO through the network to this device
     170// An SDO message contains
     171//  an address (this device)
     172//  an index of the dictionary entry to address
     173//  a subindex of this dictionary entry to access
     174//  and a value to set for this dictionary entry
     175//
    105176void NodeDrv::SendSDO(WORD_t idx, BYTE_t subidx, WORD_t val, bool store)
    106177{
     
    108179}
    109180
     181// --------------------------------------------------------------------------
     182//
     183// Sends the given SDO through the network to this device
     184// An SDO message contains
     185//  an address (this device)
     186//  an index of the dictionary entry to address
     187//  a subindex of this dictionary entry to access
     188//  and a value to set for this dictionary entry
     189//
    110190void NodeDrv::SendSDO(WORD_t idx, BYTE_t subidx, LWORD_t val, bool store)
    111191{
     
    113193}
    114194
     195// --------------------------------------------------------------------------
     196//
     197// Sends the given SDO through the network to this device
     198// An SDO message contains
     199//  an address (this device)
     200//  an index of the dictionary entry to address
     201//  a subindex of this dictionary entry to access
     202//  and a value to set for this dictionary entry
     203//
    115204void NodeDrv::SendSDO(WORD_t idx, BYTE_t val)
    116205{
     
    118207}
    119208
     209// --------------------------------------------------------------------------
     210//
     211// Sends the given SDO through the network to this device
     212// An SDO message contains
     213//  an address (this device)
     214//  an index of the dictionary entry to address
     215//  a subindex of this dictionary entry to access
     216//  and a value to set for this dictionary entry
     217//
    120218void NodeDrv::SendSDO(WORD_t idx, WORD_t val)
    121219{
     
    123221}
    124222
     223// --------------------------------------------------------------------------
     224//
     225// Sends the given SDO through the network to this device
     226// An SDO message contains
     227//  an address (this device)
     228//  an index of the dictionary entry to address
     229//  a subindex of this dictionary entry to access
     230//  and a value to set for this dictionary entry
     231//
    125232void NodeDrv::SendSDO(WORD_t idx, LWORD_t val)
    126233{
     
    128235}
    129236
     237// --------------------------------------------------------------------------
     238//
     239// Request a SDO for a given idx/subidx
     240// An SDO message contains
     241//  an address (this device)
     242//  an index of the dictionary entry to read
     243//  a subindex of this dictionary entry to access
     244//
    130245void NodeDrv::RequestSDO(WORD_t idx, BYTE_t subidx)
    131246{
     
    133248}
    134249
     250// --------------------------------------------------------------------------
     251//
     252// Send an NMT message (command) to this device
     253//
    135254void NodeDrv::SendNMT(BYTE_t cmd)
    136255{
     
    138257}
    139258
     259// --------------------------------------------------------------------------
     260//
     261// Enable passthrough for the given functioncode of this device
     262//
    140263void NodeDrv::EnableCanMsg(BYTE_t fcode)
    141264{
     
    143266}
    144267
     268// --------------------------------------------------------------------------
     269//
     270// Wait a given timeout until the SDO with the given idx/subidx from
     271// this device has been received.
     272// You can stop waiting by StopWaitingForSDO.
     273//
    145274void NodeDrv::WaitForSdo(WORD_t idx, BYTE_t subidx, WORDS_t timeout)
    146275{
     
    156285*/
    157286
     287// --------------------------------------------------------------------------
     288//
     289// Waits until the next Pdo1 from this device has been received
     290//
    158291void NodeDrv::WaitForNextPdo1()
    159292{
     
    161294}
    162295
     296// --------------------------------------------------------------------------
     297//
     298// Waits until the next Pdo2 from this device has been received
     299//
    163300void NodeDrv::WaitForNextPdo2()
    164301{
    165     cout << "WAIT: " << (int)fId << " " << fNetwork << endl;
    166302    fNetwork->WaitForNextPdo2(fId);
    167303}
    168304
     305// --------------------------------------------------------------------------
     306//
     307// Waits until the next Pdo3 from this device has been received
     308//
    169309void NodeDrv::WaitForNextPdo3()
    170310{
     
    172312}
    173313
     314// --------------------------------------------------------------------------
     315//
     316// Waits until the next Pdo4 from this device has been received
     317//
    174318void NodeDrv::WaitForNextPdo4()
    175319{
Note: See TracChangeset for help on using the changeset viewer.