00001 // Filename: dialNode.cxx 00002 // Created by: drose (12Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "dialNode.h" 00020 #include "config_device.h" 00021 #include "dataNodeTransmit.h" 00022 #include "dcast.h" 00023 00024 TypeHandle DialNode::_type_handle; 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Function: DialNode::Constructor 00028 // Access: Public 00029 // Description: 00030 //////////////////////////////////////////////////////////////////// 00031 DialNode:: 00032 DialNode(ClientBase *client, const string &device_name) : 00033 DataNode(device_name) 00034 { 00035 nassertv(client != (ClientBase *)NULL); 00036 PT(ClientDevice) device = 00037 client->get_device(ClientDialDevice::get_class_type(), device_name); 00038 00039 if (device == (ClientDevice *)NULL) { 00040 device_cat.warning() 00041 << "Unable to open dial device " << device_name << "\n"; 00042 return; 00043 } 00044 00045 if (!device->is_of_type(ClientDialDevice::get_class_type())) { 00046 device_cat.error() 00047 << "Inappropriate device type " << device->get_type() 00048 << " created; expected a ClientDialDevice.\n"; 00049 return; 00050 } 00051 00052 _dial = DCAST(ClientDialDevice, device); 00053 } 00054 00055 //////////////////////////////////////////////////////////////////// 00056 // Function: DialNode::Destructor 00057 // Access: Public, Virtual 00058 // Description: 00059 //////////////////////////////////////////////////////////////////// 00060 DialNode:: 00061 ~DialNode() { 00062 // When the _dial pointer destructs, the ClientDialDevice 00063 // disconnects itself from the ClientBase, and everything that needs 00064 // to get turned off does. Magic. 00065 } 00066 00067 //////////////////////////////////////////////////////////////////// 00068 // Function: DialNode::do_transmit_data 00069 // Access: Protected, Virtual 00070 // Description: The virtual implementation of transmit_data(). This 00071 // function receives an array of input parameters and 00072 // should generate an array of output parameters. The 00073 // input parameters may be accessed with the index 00074 // numbers returned by the define_input() calls that 00075 // were made earlier (presumably in the constructor); 00076 // likewise, the output parameters should be set with 00077 // the index numbers returned by the define_output() 00078 // calls. 00079 //////////////////////////////////////////////////////////////////// 00080 void DialNode:: 00081 do_transmit_data(const DataNodeTransmit &, DataNodeTransmit &output) { 00082 if (is_valid()) { 00083 _dial->poll(); 00084 00085 // Not clear yet what we should be transmitting. 00086 } 00087 }