/* * The order of the data in the buffer is: * Word1 : NotificationSize (2 bytes) , PathSize (2 bytes) * Word2 : NewNameSize (2 bytes) , NotificationType (2 bytes) * Word3 : UID - NOT YET SUPPORTED * Word(s) : Path (TText8) , [Any sub-class members] * * The new name size should be located at: *this + sizeof(NotificationSize) + sizeof(PathSize) */ TInt TFsNotification::NewNameSize() const { //The only notifications containing a new name are ERename, EVolumeName and EDriveName __ASSERT_DEBUG((NotificationType() == ERename || NotificationType() == EVolumeName || NotificationType() == EDriveName),Panic(ENotificationPanic)); TInt* word2 = PtrAdd((TInt*)this, sizeof(TInt)); return ((*word2) >> 16); }
/* * The order of the data in the buffer is: * Word1 : NotificationSize (2 bytes) , PathSize (2 bytes) * Word2 : NewNameSize (2 bytes) , NotificationType (2 bytes) * Word3 : UID - NOT YET SUPPORTED * Word(s) : Path (TText8) , [Any sub-class members] * * The path size should be located at *this + sizeof(NotificationSize) */ TInt TFsNotification::PathSize() const { //Notification of type EOverflow does not have a path associated with it __ASSERT_DEBUG(NotificationType() != EOverflow,Panic(ENotificationPanic)); TUint ret = (*(TUint*)this & 0x0000FFFF); //Returns the lower 2 bytes of Word1 return (TInt)ret; }
/* * The order of the data in the buffer is: * Word1 : NotificationSize (2 bytes) , PathSize (2 bytes) * Word2 : NewNameSize (2 bytes) , NotificationType (2 bytes) * Word3 : UID - NOT YET SUPPORTED * Word(s) : Path (TText8) , [Any sub-class members] * * The size should be located at: *this + KNotificationHeaderSize + Align4(PathSize) */ EXPORT_C TInt TFsNotification::FileSize(TInt64& aSize) const { if(NotificationType() != EFileChange) return KErrNotSupported; aSize = *PtrAdd((TInt64*)this, KNotificationHeaderSize + Align4(PathSize())); return KErrNone; }
/* * The order of the data in the buffer is: * Word1 : NotificationSize (2 bytes) , PathSize (2 bytes) * Word2 : NewNameSize (2 bytes) , NotificationType (2 bytes) * Word3 : UID - NOT YET SUPPORTED * Word(s) : Path (TText8) , [Any sub-class members] * * The path should be located at: *this + KNotificationHeaderSize */ EXPORT_C TInt TFsNotification::Path(TPtrC& aPath) const { //Notification of type EOverflow does not have a path associated with it if(NotificationType() == EOverflow) return KErrNotSupported; TUint16* pathPtr = PtrAdd((TUint16*)this, KNotificationHeaderSize); aPath.Set(pathPtr,PathSize()/2); return KErrNone; }
/* * The order of the data in the buffer is: * Word1 : NotificationSize (2 bytes) , PathSize (2 bytes) * Word2 : NewNameSize (2 bytes) , NotificationType (2 bytes) * Word3 : UID - NOT YET SUPPORTED * Word(s) : Path (TText8) , [Any sub-class members] * * The attribute should be located at: *this + KNotificationHeaderSize + Align4(PathSize) */ EXPORT_C TInt TFsNotification::Attributes(TUint& aSetAtt, TUint& aClearAtt) const { if(NotificationType() != EAttribute) return KErrNotSupported; TUint* clearAttptr = PtrAdd((TUint*)this, KNotificationHeaderSize + Align4(PathSize())); aClearAtt = *clearAttptr; aSetAtt = *PtrAdd((TUint*)clearAttptr, sizeof(TUint)); return KErrNone; }
/* * The order of the data in the buffer is: * Word1 : NotificationSize (2 bytes) , PathSize (2 bytes) * Word2 : NewNameSize (2 bytes) , NotificationType (2 bytes) * Word3 : UID - NOT YET SUPPORTED * Word(s) : Path (TText8) , [Any sub-class members] * * The new name should be located at: *this + KNotificationHeaderSize + Align4(PathSize) */ EXPORT_C TInt TFsNotification::NewName(TPtrC& aNewName) const { //Only ERename, EVolumeName and EDriveName have second paths //Notification of type EOverflow does not have a path associated with it TFsNotificationType notificationType = NotificationType(); if((notificationType != ERename && notificationType != EVolumeName && notificationType != EDriveName) || notificationType == EOverflow) { return KErrNotSupported; } TUint16* pathPtr = PtrAdd((TUint16*)this, KNotificationHeaderSize + Align4(PathSize())); aNewName.Set(pathPtr,NewNameSize()/2); return KErrNone; }
//============================================================================== MainContentComponent::MainContentComponent(AudioDeviceManager* manager) : deviceManager(manager), synth(keyboardState) { Rectangle<int> desktopDimens = Desktop::getInstance().getDisplays().getMainDisplay().totalArea; setSize (desktopDimens.getWidth(), desktopDimens.getHeight()); // initialize the MidiKeyboardComponent keyboard = new MidiKeyboardComponent(keyboardState, MidiKeyboardComponent::horizontalKeyboard); // define the size of the keyboard keyboard->setBounds(16, 50, getWidth() - 32, 64); addAndMakeVisible(keyboard); deviceManager->initialise(0, 2, 0, true); AudioDeviceManager::AudioDeviceSetup newSettings; deviceManager->getAudioDeviceSetup(newSettings); //newSettings.bufferSize = 4096; // larger buffer //deviceManager->setAudioDeviceSetup(newSettings, true); // connect the keyboard to the audio input audioSourcePlayer.setSource(&synth); deviceManager->addAudioCallback(&audioSourcePlayer); deviceManager->setMidiInputEnabled("MPK mini", true); deviceManager->addMidiInputCallback(String::empty, &(synth.midiCollector)); // set the actual displayed text in the labels String filterStr1 = "Filter 1"; String filterStr2 = "Filter 2"; String mixerStr = "Mixer"; String reverbStr = "Reverb"; String delayStr = "Delay"; String envelopeStr1 = "Envelope 1"; String envelopeStr2 = "Envelope 2"; String LFOStr1 = "LFO 1"; String LFOStr2 = "LFO 2"; NotificationType DontSendNotification = NotificationType(0); // set up the first row of labels and rotary encoders // set labels on the screen filterLabel1.setText(filterStr1, DontSendNotification); filterLabel2.setText(filterStr2, DontSendNotification); mixerLabel.setText(mixerStr, DontSendNotification); reverbLabel.setText(reverbStr, DontSendNotification); // sound the dimensions and placement of the labels filterLabel1.setBounds( 15, 125, 80, 25 ); filterLabel2.setBounds( 140, 125, 80, 25 ); mixerLabel.setBounds( 275, 125, 80, 25 ); reverbLabel.setBounds( 410, 125, 80, 25 ); // make the labels visible addAndMakeVisible(filterLabel1); addAndMakeVisible(filterLabel2); addAndMakeVisible(mixerLabel); addAndMakeVisible(reverbLabel); // now set the style of the rotary encoders filterSlider1.setSliderStyle(Slider::SliderStyle::Rotary); filterSlider2.setSliderStyle(Slider::SliderStyle::Rotary); mixerSlider.setSliderStyle(Slider::SliderStyle::Rotary); reverbSlider.setSliderStyle(Slider::SliderStyle::Rotary); // set the dimensions and placement of the rotary encoders filterSlider1.setBounds( 10, 155, 80, 50 ); filterSlider2.setBounds( 135, 155, 80, 50 ); mixerSlider.setBounds( 270, 155, 80, 50 ); reverbSlider.setBounds( 405, 155, 80, 50 ); // make the rotary encoders visible addAndMakeVisible(filterSlider1); addAndMakeVisible(filterSlider2); addAndMakeVisible(mixerSlider); addAndMakeVisible(reverbSlider); // start up the second row // set labels on the screen envelopeLabel1.setText(envelopeStr1, DontSendNotification); envelopeLabel2.setText(envelopeStr2, DontSendNotification); LFOLabel1.setText(LFOStr1, DontSendNotification); LFOLabel2.setText(LFOStr2, DontSendNotification); // sound the dimensions and placements of the labels envelopeLabel1.setBounds( 10, 205, 80, 25 ); envelopeLabel2.setBounds( 135, 205, 80, 25 ); LFOLabel1.setBounds( 275, 205, 80, 25 ); LFOLabel2.setBounds( 410, 205, 80, 25 ); // make the labels visible // addAndMakeVisible(envelopeLabel1); // addAndMakeVisible(envelopeLabel2); // addAndMakeVisible(LFOLabel1); // addAndMakeVisible(LFOLabel2); // now set the style of the rotary encoders envelopeSlider1.setSliderStyle(Slider::SliderStyle::Rotary); envelopeSlider2.setSliderStyle(Slider::SliderStyle::Rotary); LFOSlider1.setSliderStyle(Slider::SliderStyle::Rotary); LFOSlider2.setSliderStyle(Slider::SliderStyle::Rotary); // set the dimensions and placement of the rotary encoders envelopeSlider1.setBounds( 10, 205, 80, 50 ); envelopeSlider2.setBounds( 135, 205, 80, 50 ); LFOSlider1.setBounds( 270, 205, 80, 50 ); LFOSlider2.setBounds( 405, 205, 80, 50 ); // make the rotary encoders visible //addAndMakeVisible(envelopeSlider1); //addAndMakeVisible(envelopeSlider2); //addAndMakeVisible(LFOSlider1); //addAndMakeVisible(LFOSlider2); }
CreationFailed::CreationFailed(Twainet::Module module, CreationFailed::CreationType type) : NotificationMessage(module, NotificationType(MODULE_CREATION_FAILED + type)) , m_type(type) { }
void CLogitechMediaServer::UpdateNodeStatus(const LogitechMediaServerNode &Node, const _eMediaStatus nStatus, const std::string sStatus, bool bPingOK) { //Find out node, and update it's status std::vector<LogitechMediaServerNode>::iterator itt; for (itt = m_nodes.begin(); itt != m_nodes.end(); ++itt) { if (itt->ID == Node.ID) { //Found it //Retrieve devicename instead of playername in case it was renamed... std::string sDevName = itt->Name; std::vector<std::vector<std::string> > result; result = m_sql.safe_query("SELECT Name FROM DeviceStatus WHERE DeviceID=='%q'", itt->szDevID); if (result.size() == 1) { std::vector<std::string> sd = result[0]; sDevName = sd[0]; } bool bUseOnOff = false; if (((nStatus == MSTAT_OFF) && bPingOK) || ((nStatus != MSTAT_OFF) && !bPingOK)) bUseOnOff = true; time_t atime = mytime(NULL); itt->LastOK = atime; if ((itt->nStatus != nStatus) || (itt->sStatus != sStatus)) { // 1: Update the DeviceStatus if ((nStatus == MSTAT_PLAYING) || (nStatus == MSTAT_PAUSED) || (nStatus == MSTAT_STOPPED)) _log.Log(LOG_NORM, "Logitech Media Server: (%s) %s - '%s'", Node.Name.c_str(), Media_Player_States(nStatus), sStatus.c_str()); else _log.Log(LOG_NORM, "Logitech Media Server: (%s) %s", Node.Name.c_str(), Media_Player_States(nStatus)); struct tm ltime; localtime_r(&atime, <ime); char szLastUpdate[40]; sprintf(szLastUpdate, "%04d-%02d-%02d %02d:%02d:%02d", ltime.tm_year + 1900, ltime.tm_mon + 1, ltime.tm_mday, ltime.tm_hour, ltime.tm_min, ltime.tm_sec); std::vector<std::vector<std::string> > result; result = m_sql.safe_query("UPDATE DeviceStatus SET nValue=%d, sValue='%q', LastUpdate='%q' WHERE (HardwareID == %d) AND (DeviceID == '%q') AND (Unit == 1) AND (SwitchType == %d)", int(nStatus), sStatus.c_str(), szLastUpdate, m_HwdID, itt->szDevID, STYPE_Media); // 2: Log the event if the actual status has changed std::string sShortStatus = sStatus; if ((itt->nStatus != nStatus) || (itt->sShortStatus != sShortStatus)) { std::string sLongStatus = Media_Player_States(nStatus); if ((nStatus == MSTAT_PLAYING) || (nStatus == MSTAT_PAUSED) || (nStatus == MSTAT_STOPPED)) if (sShortStatus.length()) sLongStatus += " - " + sShortStatus; result = m_sql.safe_query("INSERT INTO LightingLog (DeviceRowID, nValue, sValue) VALUES (%d, %d, '%q')", itt->ID, int(nStatus), sLongStatus.c_str()); } // 3: Trigger On/Off actions if (bUseOnOff) { result = m_sql.safe_query("SELECT StrParam1,StrParam2 FROM DeviceStatus WHERE (HardwareID==%d) AND (ID = '%q') AND (Unit == 1)", m_HwdID, itt->szDevID); if (result.size() > 0) { m_sql.HandleOnOffAction(bPingOK, result[0][0], result[0][1]); } } // 4: Trigger Notifications & events on status change if (itt->nStatus != nStatus) { m_notifications.CheckAndHandleNotification(itt->ID, sDevName, NotificationType(nStatus), sStatus.c_str()); m_mainworker.m_eventsystem.ProcessDevice(m_HwdID, itt->ID, 1, int(pTypeLighting2), int(sTypeAC), 12, 100, int(nStatus), sStatus.c_str(), sDevName, 0); } itt->nStatus = nStatus; itt->sStatus = sStatus; itt->sShortStatus = sShortStatus; } break; } } }