Author: derek Date: Mon Sep 25 20:48:16 2006 New Revision: 126 Added: sofaswitch/trunk/callflow/src/senddtmf.cpp sofaswitch/trunk/callflow/src/senddtmf.h Log: Add these files, to indicate the sending of dtmf to a worker node. Added: sofaswitch/trunk/callflow/src/senddtmf.cpp ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/senddtmf.cpp Mon Sep 25 20:48:16 2006 @@ -0,0 +1,123 @@ +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ +#pragma hdrstop +#endif + + +#ifndef WX_PRECOMP +#include "wx/wx.h" +#endif +#include <wx/textfile.h> +#include <wx/tokenzr.h> +#include "shapelist.h" + + +#include "makecall.h" + + +///////////////////////////////////////////////////////////////////////////// +DndShapeMakeCall::DndShapeMakeCall() + : DndShape(MakeCall) +{ + wxSize newSize(50, 50); + SetSize(newSize); + + relInputPoints.Add(25, 0); + relOutputPoints.Add(25, 50); + + displayData[displayData.size()] = + InformationSection(wxT("Worker node to activate (python code)"), wxT("\"voip1\"")); + + displayData[displayData.size()] = + InformationSection(wxT("Call destination (python code)"), wxT("\"h323.voxgratia.org\"")); + + AdjustIoPoints(); +} + +bool DndShapeMakeCall::WriteSystemCode(wxTextFile & file) +{ + file.AddLine(" def Make_Call(self, sTuple): "); + file.AddLine(" a,b,c = sTuple "); + file.AddLine(" rhost = eval(self.data[a][\"worker node\"]) "); + file.AddLine(" rhost += \":CALLNODE \" + self.data[a][\"call destination\"] + \"\\0\" "); + file.AddLine(" self.transport.write(rhost) "); + file.AddLine(" return self.data[a][\"Output\"] "); + file.AddLine(""); + + return true; +} + +bool DndShapeMakeCall::WriteThisShapeInfo(wxTextFile & file) +{ + file.AddLine(wxString::Format(" \"%s\" : { ", GetKey().c_str())); + + wxNode *outputNode = (wxNode *)GetOutputPoints().GetFirst(); + const wxString & outputLabel = ((LabelledPoint *)outputNode->GetData())->GetFullLabel(); + + file.AddLine(wxString::Format(" \"Output\" : ")); + file.AddLine(wxString::Format(" %s, ", outputLabel.c_str())); + + file.AddLine(wxString::Format(" \"worker node\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[1].data.c_str())); + + file.AddLine(wxString::Format(" \"call destination\" : ")); + file.AddLine(wxString::Format(" \"%s\", ", displayData[2].data.c_str())); + + file.AddLine(wxString::Format(" },")); + + return true; +} + + +void DndShapeMakeCall::Draw(wxDC& dc) +{ + DrawCompileError(dc); + dc.SetBrush(wxBrush(*wxBLACK, wxSOLID)); + dc.SetPen(*wxBLACK_PEN); + + wxPoint p1(m_rect.GetPosition()); + wxPoint pA(p1.x + 25, p1.y); + wxPoint pB(p1.x + 25, p1.y + 10); + + wxPoint pY(p1.x + 25, p1.y + 40); + wxPoint pZ(p1.x + 25, p1.y + 50); + + wxPoint pL(p1.x + 3, p1.y+14); + wxPoint pR(p1.x + 47, p1.y + 16); + wxPoint pM(p1.x + 22, p1.y + 12); + wxPoint pL1(pL.x + 0, pL.y+1); + wxPoint pR1(pR.x + 0, pR.y + 1); + dc.DrawLine(pL, pM); + dc.DrawLine(pR, pM); + dc.DrawLine(pL1, pM); + dc.DrawLine(pR1, pM); + + dc.DrawLine(pA, pB); + if (InputPointConnected(0)) + DrawArrow(dc, pB, ArrowDown, Connected); + else + DrawArrow(dc, pB, ArrowDown, Loose); + + dc.DrawLine(pY, pZ); + if (OutputPointConnected(0)) + DrawArrow(dc, pZ, ArrowDown, Connected); + else + DrawArrow(dc, pZ, ArrowDown, Loose); + + wxFont f = wxFont(*wxITALIC_FONT); + f.SetPointSize(7); + dc.SetFont(f); + for (int i = 0; i < 9; i++){ + wxString text = wxString::Format("%d", i+1); + wxCoord w, h; + dc.GetTextExtent(text, &w, &h); + int xPos = m_rect.x + 17 + ((i%3)*9) - (w/2); + int yPos = m_rect.y + 18 + ((i/3)*9) - (h/2); + dc.DrawText(text, xPos, yPos); + } + + + DndShape::Draw(dc); // Draw the selected overlay if required. +} + Added: sofaswitch/trunk/callflow/src/senddtmf.h ============================================================================== --- (empty file) +++ sofaswitch/trunk/callflow/src/senddtmf.h Mon Sep 25 20:48:16 2006 @@ -0,0 +1,34 @@ +#ifndef MAKE_CALL_H +#define MAKE_CALL_H + +#include "dnd.h" + +////////////////////////////////////////////////////////////////////////////////////////////// +/**Define a create a call shape. Store values for size, location, input & output points. + This instance has the ability to draw this shape to a specified location on the canvas */ +class DndShapeMakeCall : public DndShape +{ +public: + /**Construtor, Define this shape in terms of size and points etc */ + DndShapeMakeCall(); + + /**Destroy this shape, and log it */ + virtual ~DndShapeMakeCall() + { + } + + /**Draw this particular shape to the screen..*/ + virtual void Draw(wxDC& dc); + + /**Write the code generic to this Make Call shape */ + virtual bool WriteSystemCode(wxTextFile & file); + + /**Write the dictionary containing relevant points for this shape */ + virtual bool WriteThisShapeInfo(wxTextFile & file); + + /** Used to report the name of this particular class. */ + static wxString GetKindName() { return wxString("Make Call"); } +}; + + +#endif // MAKE_CALL_H
participants (1)
-
SofaSWITCH SVN