00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <stdlib.h>
00027
00028 #include "extpin.h"
00029 #include "net.h"
00030
00031 #include <sstream>
00032 using namespace std;
00033
00034 ExtPin::ExtPin(T_Pinstate ps,
00035 UserInterface *_ui,
00036 const char *_extName,
00037 const char *baseWindow):
00038 Pin(ps),
00039 ui(_ui),
00040 extName(_extName)
00041 {
00042 ostringstream os;
00043 outState=ps;
00044 os << "create Net " << _extName << " " << baseWindow << " " << endl;
00045 ui->Write(os.str());
00046
00047 ui->AddExternalType(extName, this);
00048 }
00049
00050 void ExtPin::SetInState(const Pin &p) {
00051 ui->SendUiNewState(extName, p);
00052 }
00053
00054 void ExtPin::SetNewValueFromUi(const string& s) {
00055 Pin tmp;
00056 tmp= s[0];
00057
00058 outState= tmp.outState;
00059
00060 connectedTo->CalcNet();
00061 }
00062
00063 void ExtAnalogPin::SetNewValueFromUi(const string& s) {
00064 outState= ANALOG;
00065 analogValue=atol(s.c_str());
00066
00067 connectedTo->CalcNet();
00068 }
00069
00070
00071 ExtAnalogPin::ExtAnalogPin(unsigned int value,
00072 UserInterface *_ui,
00073 const char *_extName,
00074 const char* baseWindow):
00075 Pin(Pin::TRISTATE),
00076 ui(_ui),
00077 extName(_extName)
00078 {
00079 ostringstream os;
00080 os << "create AnalogNet " << _extName << " " << baseWindow << " " << endl;
00081 ui->Write(os.str());
00082
00083 ui->AddExternalType(extName, this);
00084 }
00085
00086 void ExtAnalogPin::SetInState(const Pin &p) {
00087 ui->SendUiNewState(extName, p);
00088 }
00089