125 lines
2.4 KiB
C++
125 lines
2.4 KiB
C++
// RobotDll.cpp : ¶¨Òå DLL µÄ³õʼ»¯Àý³Ì¡£
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "RobotDll.h"
|
|
//#include "Melfaxm.h"
|
|
#include "resource.h"
|
|
#include "Robot_conect.h"
|
|
#include "melfarxmctrl1.h"
|
|
//#include "Robot_Position.h"
|
|
extern Robot_conect *m_Robot;
|
|
//extern Robot_Position *m_RobotPosition;
|
|
extern "C" EXP_IMP void OnStart()
|
|
{
|
|
|
|
/*Robot_conect* Robot1 = new Robot_conect();
|
|
Robot1->Create(Robot_conect::IDD,NULL);
|
|
Robot1->ShowWindow(SW_SHOW);
|
|
Robot1->OnStart();
|
|
*/
|
|
//Robot_conect *Robot = new Robot_conect();
|
|
// Robot->OnStart();
|
|
|
|
|
|
//Robot_conect *dlg = new Robot_conect();
|
|
//dlg.OnInitDialog();
|
|
//dlg.DoModal();
|
|
//dlg->Create(Robot_conect::IDD,NULL);
|
|
//dlg->ShowWindow(SW_SHOW);
|
|
// dlg->OnBnClickedButton1();
|
|
m_Robot->OnStart();
|
|
|
|
|
|
}
|
|
extern "C" EXP_IMP long SetPosition(char* Position,char* ProgName,char* ProgNumber)
|
|
{
|
|
long rid;
|
|
CString sn("\n");
|
|
CString sdata1,sdata2,sdata3,sdata;
|
|
sdata1 = ProgName;
|
|
sdata2 = ProgNumber;
|
|
sdata3 = Position;
|
|
sdata = sdata1 + sn;
|
|
sdata = sdata + sdata2 + sn;
|
|
sdata = sdata + sdata3;
|
|
|
|
rid = m_Robot->Write_position_data(sdata);
|
|
return rid;
|
|
}
|
|
|
|
extern "C" EXP_IMP long Execute_Program(char* ProgName,int Method)
|
|
{
|
|
long rid;
|
|
CString sdata,sdata2;
|
|
CString s0("0");
|
|
CString s1("1");
|
|
CString sn("\n");
|
|
sdata2 = ProgName;
|
|
sdata = s1 + sn;
|
|
sdata = sdata +sdata2 + sn;
|
|
if(Method>=1)
|
|
{
|
|
sdata = sdata + s0;
|
|
}
|
|
else
|
|
{
|
|
sdata = sdata + s1;
|
|
}
|
|
|
|
rid = m_Robot->Execute_Program(sdata);
|
|
return rid;
|
|
}
|
|
|
|
extern "C" EXP_IMP long Stop_Program()
|
|
{
|
|
long rid;
|
|
rid = m_Robot->Stop_Program();
|
|
return rid;
|
|
}
|
|
|
|
extern "C" EXP_IMP void OnEnd()
|
|
{
|
|
m_Robot->OnEnd();
|
|
}
|
|
|
|
extern "C" EXP_IMP char* GetPosition()
|
|
{
|
|
// char* sdata;
|
|
// sdata = (LPSTR)(LPCTSTR)m_Robot->GetCurrentPosition();
|
|
/*
|
|
memset(m_Robot->Position,0,sizeof(m_Robot->Position));
|
|
for(int i=0; i<m_Robot->m_position.GetLength();i++)
|
|
{
|
|
if(i>=255)
|
|
{
|
|
break;;
|
|
}
|
|
m_Robot->Position[i] = m_Robot->m_position.GetAt(i);
|
|
}
|
|
*/
|
|
m_Robot->m_position="66.23,23.15,35.24,33.23,28.71,12.96,22.05,12.11";
|
|
static CStringA strbuf;
|
|
strbuf = CT2A(m_Robot->m_position);
|
|
m_Robot->Position = strbuf.GetBuffer();
|
|
return m_Robot->Position;
|
|
// m_RobotPosition->GetCurrentPosition(position);
|
|
}
|
|
|
|
extern "C" EXP_IMP long Server_ON()
|
|
{
|
|
return m_Robot->Server_ON();
|
|
}
|
|
|
|
extern "C" EXP_IMP long Server_OFF()
|
|
{
|
|
return m_Robot->Server_OFF();
|
|
}
|
|
|
|
extern "C" EXP_IMP long SetSpeed(char* Speed)
|
|
{
|
|
CString sdata;
|
|
sdata= Speed;
|
|
return m_Robot->SetSpeed(sdata);
|
|
}
|