本文整理汇总了C++中CDevice类的典型用法代码示例。如果您正苦于以下问题:C++ CDevice类的具体用法?C++ CDevice怎么用?C++ CDevice使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDevice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnClientLogin
virtual void OnClientLogin() {
// Associate client with the user/network
CDevice *pDevice = DeviceForClient(*m_pClient);
if (pDevice && m_pNetwork) {
pDevice->AddNetwork(*m_pNetwork);
}
}
示例2: OnClientDisconnect
virtual void OnClientDisconnect() {
CDevice *pDevice = DeviceForClient(*m_pClient);
if (pDevice) {
pDevice->SetInNegotiation(false);
pDevice->RemoveClient(*m_pClient);
}
}
示例3: searchRowFromId
void CRoom::OnAnyButton( UINT nID )
{
CString deviceName;
CString buttonText;
int row = searchRowFromId(nID);
GetDlgItem(nID)->GetWindowTextW(buttonText);
GetDlgItem(2000 + row)->GetWindowTextW(deviceName);
CDevice* tmpDevice = NULL;
if(buttonText == _T("Details"))
{
POSITION pos;
for (pos = phandleData->get_deviceList()->GetHeadPosition(); pos != NULL;)
{
tmpDevice = ((CDevice*)phandleData->get_deviceList()->GetNext(pos));
if(tmpDevice->get_name() == deviceName)
{
CDetailsDIM dlg;
dlg.device = tmpDevice;
dlg.phandleData = phandleData;
dlg.DoModal();
}
}
}
else
{
if(buttonText == _T("An") || buttonText == _T("Auf"))
phandleData->sendCommandtoFhem(deviceName, _T("on"));
else if(buttonText == _T("Aus") || buttonText == _T("Ab"))
phandleData->sendCommandtoFhem(deviceName, _T("off"));
}
//AfxMessageBox(buttonText + _T(" für Gerät ") + deviceName);
}
示例4: new
CDevice* CDevice::NewL()
{
__MSFNSLOG
CDevice* r = new (ELeave) CDevice();
CleanupStack::PushL(r);
r->ConstructL();
CleanupStack::Pop();
return r;
}
示例5: CDevice
void MainChoice::openInfoWindow(){
CDevice *device = new CDevice();
device->setTheshold(0, 100);
device->setTemperature(0, 100);
device->setCurrentMode(3);
infoSystem *is = new infoSystem();
is->setDevice(device);
is->refreshData();
is->show();
close();
}
示例6: Draw
void CPlanet::Draw()
{
CDevice* device = m_engine->GetDevice();
float eyeDirH = m_engine->GetEyeDirH();
float eyeDirV = m_engine->GetEyeDirV();
Math::Vector n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
float dp = 0.5f/256.0f;
for (const auto& planet : m_planets)
{
if (planet.type != m_visibleType)
continue;
m_engine->SetTexture(planet.name);
if (planet.transparent)
m_engine->SetState(ENG_RSTATE_WRAP | ENG_RSTATE_ALPHA);
else
m_engine->SetState(ENG_RSTATE_WRAP | ENG_RSTATE_TTEXTURE_BLACK);
Math::Point p1, p2;
float a = eyeDirH + planet.angle.x;
p1.x = Math::Mod(a, Math::PI*2.0f)-0.5f;
a = eyeDirV + planet.angle.y;
p1.y = 0.4f+(Math::Mod(a+Math::PI, Math::PI*2.0f)-Math::PI)*(2.0f/Math::PI);
p1.x -= planet.dim/2.0f*0.75f;
p1.y -= planet.dim/2.0f;
p2.x = p1.x+planet.dim*0.75f;
p2.y = p1.y+planet.dim;
float u1 = planet.uv1.x + dp;
float v1 = planet.uv1.y + dp;
float u2 = planet.uv2.x - dp;
float v2 = planet.uv2.y - dp;
Vertex quad[4] =
{
Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(u1, v2)),
Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(u1, v1)),
Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(u2, v2)),
Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(u2, v1))
};
device->DrawPrimitive(PRIMITIVE_TRIANGLE_STRIP, quad, 4);
m_engine->AddStatisticTriangle(2);
}
}
示例7: Draw
void CPlanet::Draw()
{
CDevice* device = m_engine->GetDevice();
float eyeDirH = m_engine->GetEyeDirH();
float eyeDirV = m_engine->GetEyeDirV();
Math::Vector n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
float dp = 0.5f/256.0f;
for (int i = 0; i < static_cast<int>( m_planet[m_mode].size() ); i++)
{
m_engine->SetTexture("textures/"+m_planet[m_mode][i].name);
if (m_planet[m_mode][i].transparent)
m_engine->SetState(ENG_RSTATE_WRAP | ENG_RSTATE_ALPHA);
else
m_engine->SetState(ENG_RSTATE_WRAP | ENG_RSTATE_TTEXTURE_BLACK);
Math::Point p1, p2;
float a = eyeDirH + m_planet[m_mode][i].angle.x;
p1.x = Math::Mod(a, Math::PI*2.0f)-0.5f;
a = eyeDirV + m_planet[m_mode][i].angle.y;
p1.y = 0.4f+(Math::Mod(a+Math::PI, Math::PI*2.0f)-Math::PI)*(2.0f/Math::PI);
p1.x -= m_planet[m_mode][i].dim/2.0f*0.75f;
p1.y -= m_planet[m_mode][i].dim/2.0f;
p2.x = p1.x+m_planet[m_mode][i].dim*0.75f;
p2.y = p1.y+m_planet[m_mode][i].dim;
float u1 = m_planet[m_mode][i].uv1.x + dp;
float v1 = m_planet[m_mode][i].uv1.y + dp;
float u2 = m_planet[m_mode][i].uv2.x - dp;
float v2 = m_planet[m_mode][i].uv2.y - dp;
Vertex quad[4] =
{
Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(u1, v2)),
Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(u1, v1)),
Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(u2, v2)),
Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(u2, v1))
};
device->DrawPrimitive(PRIMITIVE_TRIANGLE_STRIP, quad, 4);
m_engine->AddStatisticTriangle(2);
}
}
示例8: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// MainWindow w;
// w.show();
// CDevice *device = new CDevice();
QDir path;
QLibrary lib("libusb-1.0.dll");
if(!lib.load()){
QMessageBox * msg = new QMessageBox();
msg->setText("NO Lib");
msg->show();
}
QTextCodec *utfcodec = QTextCodec::codecForName("cp1251");
QTextCodec::setCodecForTr(utfcodec);
QTextCodec::setCodecForCStrings(utfcodec);
CDevice *device = new CDevice();
device->setTheshold(0, 100);
device->setTemperature(0, 100);
device->setCurrentMode(3);
infoSystem is;
is.setDevice(device);
is.refreshData();
is.show();
// device->setTheshold(0, 100);
// device->setTemperature(0, 100);
// device->setCurrentMode(3);
// infoSystem is;
// is.setDevice(device);
// is.refreshData();
// is.show();
return a.exec();
}
示例9: Deserialize
bool CDeviceXml::Deserialize(const TiXmlElement* pElement, CDevice& record)
{
const char* name = pElement->Attribute(BUTTONMAP_XML_ATTR_DEVICE_NAME);
if (!name)
{
esyslog("<%s> tag has no \"%s\" attribute", DEVICES_XML_ELEM_DEVICE, BUTTONMAP_XML_ATTR_DEVICE_NAME);
return false;
}
record.SetName(name);
const char* provider = pElement->Attribute(BUTTONMAP_XML_ATTR_DEVICE_PROVIDER);
if (!provider)
{
esyslog("<%s> tag has no \"%s\" attribute", DEVICES_XML_ELEM_DEVICE, BUTTONMAP_XML_ATTR_DEVICE_PROVIDER);
return false;
}
record.SetProvider(provider);
const char* vid = pElement->Attribute(BUTTONMAP_XML_ATTR_DEVICE_VID);
if (vid)
record.SetVendorID(CStorageUtils::HexStringToInt(vid));
const char* pid = pElement->Attribute(BUTTONMAP_XML_ATTR_DEVICE_PID);
if (pid)
record.SetProductID(CStorageUtils::HexStringToInt(pid));
const char* buttonCount = pElement->Attribute(BUTTONMAP_XML_ATTR_DEVICE_BUTTONCOUNT);
if (buttonCount)
record.SetButtonCount(std::atoi(buttonCount));
const char* hatCount = pElement->Attribute(BUTTONMAP_XML_ATTR_DEVICE_HATCOUNT);
if (hatCount)
record.SetHatCount(std::atoi(hatCount));
const char* axisCount = pElement->Attribute(BUTTONMAP_XML_ATTR_DEVICE_AXISCOUNT);
if (axisCount)
record.SetAxisCount(std::atoi(axisCount));
const char* index = pElement->Attribute(BUTTONMAP_XML_ATTR_DEVICE_INDEX);
if (index)
record.SetIndex(std::atoi(index));
return true;
}
示例10: vertices
void CCloud::Draw()
{
if (! m_enabled) return;
if (m_level == 0.0f) return;
if (m_lines.empty()) return;
std::vector<VertexTex2> vertices((m_brickCount+2)*2, VertexTex2());
float iDeep = m_engine->GetDeepView();
float deep = (m_brickCount*m_brickSize)/2.0f;
m_engine->SetDeepView(deep);
m_engine->SetFocus(m_engine->GetFocus());
m_engine->UpdateMatProj(); // increases the depth of view
float fogStart = deep*0.15f;
float fogEnd = deep*0.24f;
CDevice* device = m_engine->GetDevice();
// TODO: do this better?
device->SetFogParams(FOG_LINEAR, m_engine->GetFogColor( m_engine->GetRankView() ),
fogStart, fogEnd, 1.0f);
device->SetTransform(TRANSFORM_VIEW, m_engine->GetMatView());
Material material;
material.diffuse = m_diffuse;
material.ambient = m_ambient;
m_engine->SetMaterial(material);
m_engine->SetTexture(m_fileName, 0);
m_engine->SetTexture(m_fileName, 1);
m_engine->SetState(ENG_RSTATE_TTEXTURE_BLACK | ENG_RSTATE_FOG | ENG_RSTATE_WRAP);
Math::Matrix matrix;
matrix.LoadIdentity();
device->SetTransform(TRANSFORM_WORLD, matrix);
float size = m_brickSize/2.0f;
Math::Vector eye = m_engine->GetEyePt();
Math::Vector n = Math::Vector(0.0f, -1.0f, 0.0f);
// Draws all the lines
for (int i = 0; i < static_cast<int>( m_lines.size() ); i++)
{
Math::Vector pos;
pos.y = m_level;
pos.z = m_lines[i].pz;
pos.x = m_lines[i].px1;
int vertexIndex = 0;
Math::Vector p;
Math::Point uv1, uv2;
p.x = pos.x-size;
p.z = pos.z+size;
p.y = pos.y;
AdjustLevel(p, eye, deep, uv1, uv2);
vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2);
p.x = pos.x-size;
p.z = pos.z-size;
p.y = pos.y;
AdjustLevel(p, eye, deep, uv1, uv2);
vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2);
for (int j = 0; j < m_lines[i].len; j++)
{
p.x = pos.x+size;
p.z = pos.z+size;
p.y = pos.y;
AdjustLevel(p, eye, deep, uv1, uv2);
vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2);
p.x = pos.x+size;
p.z = pos.z-size;
p.y = pos.y;
AdjustLevel(p, eye, deep, uv1, uv2);
vertices[vertexIndex++] = VertexTex2(p, n, uv1, uv2);
pos.x += size*2.0f;
}
device->DrawPrimitive(PRIMITIVE_TRIANGLE_STRIP, &vertices[0], vertexIndex);
m_engine->AddStatisticTriangle(vertexIndex - 2);
}
m_engine->SetDeepView(iDeep);
m_engine->SetFocus(m_engine->GetFocus());
m_engine->UpdateMatProj(); // gives depth to initial
}
示例11: Draw
void CLightning::Draw()
{
if (!m_lightningExists) return;
if (m_phase != LP_FLASH) return;
CDevice* device = m_engine->GetDevice();
Math::Matrix mat;
mat.LoadIdentity();
device->SetTransform(TRANSFORM_WORLD, mat);
m_engine->SetTexture("effect00.png");
m_engine->SetState(ENG_RSTATE_TTEXTURE_BLACK);
Math::Point texInf;
texInf.x = 64.5f/256.0f;
texInf.y = 33.0f/256.0f;
Math::Point texSup;
texSup.x = 95.5f/256.0f;
texSup.y = 34.0f/256.0f; // blank
Math::Vector p1 = m_pos;
Math::Vector eye = m_engine->GetEyePt();
float a = Math::RotateAngle(eye.x-p1.x, eye.z-p1.z);
Math::Vector n = Math::Normalize(p1-eye);
Math::Vector corner[4];
Vertex vertex[4];
for (int i = 0; i < FLASH_SEGMENTS-1; i++)
{
Math::Vector p2 = p1;
p2.y += 8.0f+0.2f*i;
Math::Point rot;
Math::Vector p = p1;
p.x += m_width[i];
rot = Math::RotatePoint(Math::Point(p1.x, p1.z), a+Math::PI/2.0f, Math::Point(p.x, p.z));
corner[0].x = rot.x+m_shift[i].x;
corner[0].y = p1.y;
corner[0].z = rot.y+m_shift[i].y;
rot = Math::RotatePoint(Math::Point(p1.x, p1.z), a-Math::PI/2.0f, Math::Point(p.x, p.z));
corner[1].x = rot.x+m_shift[i].x;
corner[1].y = p1.y;
corner[1].z = rot.y+m_shift[i].y;
p = p2;
p.x += m_width[i+1];
rot = Math::RotatePoint(Math::Point(p2.x, p2.z), a+Math::PI/2.0f, Math::Point(p.x, p.z));
corner[2].x = rot.x+m_shift[i+1].x;
corner[2].y = p2.y;
corner[2].z = rot.y+m_shift[i+1].y;
rot = Math::RotatePoint(Math::Point(p2.x, p2.z), a-Math::PI/2.0f, Math::Point(p.x, p.z));
corner[3].x = rot.x+m_shift[i+1].x;
corner[3].y = p2.y;
corner[3].z = rot.y+m_shift[i+1].y;
if (p2.y < p1.y)
{
vertex[0] = Vertex(corner[1], n, Math::Point(texSup.x, texSup.y));
vertex[1] = Vertex(corner[0], n, Math::Point(texInf.x, texSup.y));
vertex[2] = Vertex(corner[3], n, Math::Point(texSup.x, texInf.y));
vertex[3] = Vertex(corner[2], n, Math::Point(texInf.x, texInf.y));
}
else
{
vertex[0] = Vertex(corner[0], n, Math::Point(texSup.x, texSup.y));
vertex[1] = Vertex(corner[1], n, Math::Point(texInf.x, texSup.y));
vertex[2] = Vertex(corner[2], n, Math::Point(texSup.x, texInf.y));
vertex[3] = Vertex(corner[3], n, Math::Point(texInf.x, texInf.y));
}
device->DrawPrimitive(PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2);
p1 = p2;
}
}
示例12: QVariant
QVariant CEnvironmentDetailsModel::data(const QModelIndex & index, int role) const {
if (!m_Environment || (!index.isValid()))
return QVariant();
if ((role == Qt::DecorationRole) && (index.column() == ENVDET_MOD_STATEMENT)) {
CDevice * device = qobject_cast<CDevice *>(m_Environment->parent());
if (m_Environment == device->getActiveEnvironment()) {
if ((qint8)(m_Environment->getSelectResults()[index.internalId()]))
return QIcon(UI_ICON_SELECTED);
}
return QIcon(UI_ICON_UNSELECTED);
}
if (role != Qt::DisplayRole)
return QVariant();
switch (index.column()) {
case ENVDET_MOD_STATEMENT:
if (m_SelectConfig.filters[index.internalId()].invert)
switch (m_SelectConfig.filters[index.internalId()].selType) {
case SelectType::USER:
return tr("not by user");
case SelectType::ARP:
return tr("not by arp");
case SelectType::ESSID:
return tr("not by ssid");
case SelectType::AND_BLOCK:
return tr("at least one not");
case SelectType::OR_BLOCK:
return tr("all not");
default:
break;
}
else
switch (m_SelectConfig.filters[index.internalId()].selType) {
case SelectType::USER:
return tr("by user");
case SelectType::ARP:
return tr("by arp");
case SelectType::ESSID:
return tr("by ssid");
case SelectType::AND_BLOCK:
return tr("all");
case SelectType::OR_BLOCK:
return tr("at least one");
default:
break;
}
case ENVDET_MOD_VALUE:
switch (m_SelectConfig.filters[index.internalId()].selType) {
case SelectType::ARP:
if (m_SelectConfig.filters[index.internalId()].macAddr.valid())
return m_SelectConfig.filters[index.internalId()].ipAddr.toString() + ", "+
m_SelectConfig.filters[index.internalId()].macAddr.toString();
else
return m_SelectConfig.filters[index.internalId()].ipAddr.toString();
case SelectType::ESSID:
return m_SelectConfig.filters[index.internalId()].essid;
default:
break;
}
default:
break;
}
return QVariant();
}
示例13: HandleListCommand
void HandleListCommand(const CString &sLine) {
if (m_pUser->IsAdmin() == false) {
PutModule("Permission denied");
return;
}
CTable Table;
Table.AddColumn("Device");
Table.AddColumn("User");
Table.AddColumn("Network");
Table.AddColumn("Negotiating");
for (std::vector<CDevice*>::const_iterator it = m_vDevices.begin();
it != m_vDevices.end(); ++it)
{
CDevice &device = **it;
const std::map<CString, VCString> msvsNetworks = device.GetNetworks();
std::map<CString, VCString>::const_iterator it2 = msvsNetworks.begin();
for (;it2 != msvsNetworks.end(); ++it2) {
const CString sUsername = it2->first;
const VCString &networks = it2->second;
for (VCString::const_iterator it3 = networks.begin(); it3 != networks.end(); ++it3) {
const CString sNetwork = *it3;
Table.AddRow();
Table.SetCell("Device", device.GetToken());
Table.SetCell("User", sUsername);
Table.SetCell("Network", sNetwork);
Table.SetCell("Negotiating", CString(device.InNegotiation()));
}
if (networks.size() == 0) {
Table.SetCell("Device", device.GetToken());
Table.SetCell("User", sUsername);
Table.SetCell("Network", "");
Table.SetCell("Negotiating", CString(device.InNegotiation()));
}
}
if (msvsNetworks.size() == 0) {
Table.SetCell("Device", device.GetToken());
Table.SetCell("User", "");
Table.SetCell("Network", "");
Table.SetCell("Negotiating", CString(device.InNegotiation()));
}
}
if (PutModule(Table) == 0) {
PutModule("There are no devices registered with this server.");
}
CDevice *pDevice = DeviceForClient(*m_pClient);
if (pDevice) {
PutModule("You are connected from Palaver. (" + pDevice->GetToken() + ")");
} else {
PutModule("You are not connected from a Palaver client.");
}
}
示例14: HandleUserRaw
virtual EModRet HandleUserRaw(CClient* pClient, CString& sLine) {
if (sLine.Token(0).Equals(kPLVCommand)) {
CString sCommand = sLine.Token(1);
if (sCommand.Equals("BACKGROUND")) {
m_pClient->SetAway(true);
} else if (sCommand.Equals("FOREGROUND")) {
m_pClient->SetAway(false);
} else if (sCommand.Equals("IDENTIFY")) {
CDevice *pDevice = DeviceForClient(*pClient);
if (pDevice) {
pDevice->RemoveClient(*pClient);
}
CString sToken = sLine.Token(2);
CString sVersion = sLine.Token(3);
CDevice& device = DeviceWithToken(sToken);
if (device.InNegotiation() == false && device.GetVersion().Equals(sVersion) == false) {
pClient->PutClient("PALAVER REQ *");
device.SetInNegotiation(true);
}
device.AddClient(*pClient);
if (m_pNetwork) {
device.AddNetwork(*m_pNetwork);
}
} else if (sCommand.Equals("BEGIN")) {
CString sToken = sLine.Token(2);
CString sVersion = sLine.Token(3);
CDevice& device = DeviceWithToken(sToken);
device.ResetDevice();
device.SetInNegotiation(true);
device.SetVersion(sVersion);
device.AddClient(*pClient);
} else if (sCommand.Equals("END")) {
CDevice *pDevice = DeviceForClient(*pClient);
if (pDevice) {
pDevice->SetInNegotiation(false);
}
} else if (sCommand.Equals("SET")) {
CString sKey = sLine.Token(2);
CString sValue = sLine.Token(3, true);
CDevice *pDevice = DeviceForClient(*pClient);
if (pDevice) {
if (sKey.Equals("VERSION")) {
pDevice->SetVersion(sValue);
} else if (sKey.Equals(kPLVPushEndpointKey)) {
pDevice->SetPushEndpoint(sValue);
}
}
} else if (sCommand.Equals("ADD")) {
CString sKey = sLine.Token(2);
CString sValue = sLine.Token(3, true);
CDevice *pDevice = DeviceForClient(*pClient);
if (pDevice) {
if (sKey.Equals(kPLVIgnoreKeywordKey)) {
pDevice->AddIgnoreKeyword(sValue);
} else if (sKey.Equals(kPLVIgnoreChannelKey)) {
pDevice->AddIgnoreChannel(sValue);
} else if (sKey.Equals(kPLVIgnoreNickKey)) {
pDevice->AddIgnoreNick(sValue);
} else if (sKey.Equals(kPLVMentionKeywordKey)) {
pDevice->AddMentionKeyword(sValue);
} else if (sKey.Equals(kPLVMentionChannelKey)) {
pDevice->AddMentionChannel(sValue);
} else if (sKey.Equals(kPLVMentionNickKey)) {
pDevice->AddMentionNick(sValue);
}
}
}
return HALT;
}
return CONTINUE;
}
示例15: Serialize
bool CDeviceXml::Serialize(const CDevice& record, TiXmlElement* pElement)
{
pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_NAME, record.Name());
pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_PROVIDER, record.Provider());
if (record.IsVidPidKnown())
{
pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_VID, CStorageUtils::FormatHexString(record.VendorID()));
pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_PID, CStorageUtils::FormatHexString(record.ProductID()));
}
if (record.ButtonCount() != 0)
pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_BUTTONCOUNT, record.ButtonCount());
if (record.HatCount() != 0)
pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_HATCOUNT, record.HatCount());
if (record.AxisCount() != 0)
pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_AXISCOUNT, record.AxisCount());
if (record.Index() != 0)
pElement->SetAttribute(BUTTONMAP_XML_ATTR_DEVICE_INDEX, record.Index());
return true;
}