本文整理汇总了C++中UpdateStatus函数的典型用法代码示例。如果您正苦于以下问题:C++ UpdateStatus函数的具体用法?C++ UpdateStatus怎么用?C++ UpdateStatus使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UpdateStatus函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
int SerialPort::Initialize()
{
if (initialized_)
return DEVICE_OK;
// do not initialize if this port has been blacklisted
std::vector<std::string>::iterator it = g_BlackListedPorts.begin();
while (it < g_BlackListedPorts.end()) {
if( portName_ == (*it))
return ERR_PORT_BLACKLISTED;
it++;
}
long sb;
int ret = GetPropertyData(MM::g_Keyword_StopBits, stopBits_.c_str(), sb);
assert(ret == DEVICE_OK);
long parity;
ret = GetPropertyData(MM::g_Keyword_Parity, parity_.c_str(), parity);
long baud;
ret = GetCurrentPropertyData(MM::g_Keyword_BaudRate, baud);
assert(ret == DEVICE_OK);
long handshake;
ret = GetCurrentPropertyData(MM::g_Keyword_Handshaking, handshake);
assert(ret == DEVICE_OK);
pService_ = new boost::asio::io_service();
try
{
pPort_ = new AsioClient (*pService_, boost::lexical_cast<unsigned int>(baud), this->portName_,
boost::asio::serial_port_base::flow_control::type(handshake),
boost::asio::serial_port_base::parity::type(parity),
boost::asio::serial_port_base::stop_bits::type(sb),
this
);
}
catch( std::exception& what)
{
LogMessage(what.what(),false);
return DEVICE_ERR;
}
try
{
pThread_ = new boost::thread(boost::bind(&boost::asio::io_service::run, pService_));
}
catch(std::exception& what)
{
LogMessage(what.what(), false);
return DEVICE_ERR;
}
ret = UpdateStatus();
if (ret != DEVICE_OK)
return ret;
initialized_ = true;
return DEVICE_OK;
}
示例2: USBHCDEvents
//*****************************************************************************
//
// This is the generic callback from host stack.
//
// pvData is actually a pointer to a tEventInfo structure.
//
// This function will be called to inform the application when a USB event has
// occurred that is outside those related to the keyboard device. At this
// point this is used to detect unsupported devices being inserted and removed.
// It is also used to inform the application when a power fault has occurred.
// This function is required when the g_USBGenericEventDriver is included in
// the host controller driver array that is passed in to the
// USBHCDRegisterDrivers() function.
//
//*****************************************************************************
void
USBHCDEvents(void *pvData)
{
tEventInfo *pEventInfo;
//
// Cast this pointer to its actual type.
//
pEventInfo = (tEventInfo *)pvData;
switch(pEventInfo->ui32Event)
{
//
// New keyboard detected.
//
case USB_EVENT_CONNECTED:
{
//
// See if this is a HID Keyboard.
//
if((USBHCDDevClass(pEventInfo->ui32Instance, 0) == USB_CLASS_HID) &&
(USBHCDDevProtocol(pEventInfo->ui32Instance, 0) ==
USB_HID_PROTOCOL_KEYB))
{
//
// Indicate that the keyboard has been detected.
//
UARTprintf("Keyboard Connected\n");
//
// Proceed to the STATE_KEYBOARD_INIT state so that the main
// loop can finish initialized the mouse since
// USBHKeyboardInit() cannot be called from within a callback.
//
g_eUSBState = STATE_KEYBOARD_INIT;
}
break;
}
//
// Unsupported device detected.
//
case USB_EVENT_UNKNOWN_CONNECTED:
{
UARTprintf("Unsupported Device Class (0x%02x) Connected.\n",
pEventInfo->ui32Instance);
//
// An unknown device was detected.
//
g_eUSBState = STATE_UNKNOWN_DEVICE;
UpdateStatus();
break;
}
//
// Device has been unplugged.
//
case USB_EVENT_DISCONNECTED:
{
//
// Indicate that the device has been disconnected.
//
UARTprintf("Device Disconnected\n");
//
// Change the state so that the main loop knows that the device
// is no longer present.
//
g_eUSBState = STATE_NO_DEVICE;
//
// Update the screen.
//
UpdateStatus();
break;
}
//
// Power Fault occurred.
//
case USB_EVENT_POWER_FAULT:
{
UARTprintf("Power Fault\n");
//.........这里部分代码省略.........
示例3: main
//.........这里部分代码省略.........
// Put the application name in the middle of the banner.
//
GrContextFontSet(&g_sContext, g_psFontFixed6x8);
GrStringDrawCentered(&g_sContext, "usb-host-", -1,
GrContextDpyWidthGet(&g_sContext) / 2, 4, 0);
GrStringDrawCentered(&g_sContext, "keyboard", -1,
GrContextDpyWidthGet(&g_sContext) / 2, 14, 0);
//
// Calculate the number of characters that will fit on a line.
// Make sure to leave a small border for the text box.
//
g_ui32CharsPerLine = (GrContextDpyWidthGet(&g_sContext) - 4) /
GrFontMaxWidthGet(g_psFontFixed6x8);
//
// Calculate the number of lines per usable text screen. This requires
// taking off space for the top and bottom banners and adding a small bit
// for a border.
//
g_ui32LinesPerScreen = (GrContextDpyHeightGet(&g_sContext) -
(3*(DISPLAY_BANNER_HEIGHT + 1)))/
GrFontHeightGet(g_psFontFixed6x8);
//
// Open and instance of the keyboard class driver.
//
UARTprintf("Host Keyboard Application\n");
//
// Initial update of the screen.
//
UpdateStatus();
//
// The main loop for the application.
//
while(1)
{
//
// Tell the OTG library code how much time has passed in
// milliseconds since the last call.
//
USBOTGMain(GetTickms());
//
// Has the USB mode changed since last time we checked?
//
if(g_eCurrentUSBMode != eLastMode)
{
//
// Remember the new mode.
//
eLastMode = g_eCurrentUSBMode;
switch(eLastMode)
{
case eUSBModeHost:
pcString = "HOST";
break;
case eUSBModeDevice:
pcString = "DEVICE";
break;
示例4: UpdateStatusInterface
void __saveds UpdateStatusInterface(rsiCONTEXT *rc, float percent, float elapsed, int y, int lines, rsiSMALL_COLOR *line)
{
UpdateStatus(rc, percent, elapsed, y, lines, line);
}
示例5: SetParentID
int CArduinoNeoPixelShutter::Initialize()
{
CArduinoNeoPixelHub* hub = static_cast<CArduinoNeoPixelHub*>(GetParentHub());
if (!hub || !hub->IsPortAvailable()) {
return ERR_NO_PORT_SET;
}
char hubLabel[MM::MaxStrLength];
hub->GetLabel(hubLabel);
SetParentID(hubLabel); // for backward comp.
// set property list
// -----------------
// OnOff
// ------
CPropertyAction* pAct = new CPropertyAction (this, &CArduinoNeoPixelShutter::OnOnOff);
int ret = CreateProperty("OnOff", "1", MM::Integer, false, pAct);
if (ret != DEVICE_OK)
return ret;
pAct = new CPropertyAction (this, &CArduinoNeoPixelShutter::OnIntensity);
ret = CreateProperty("Intensity", "255", MM::Integer, false, pAct);
SetPropertyLimits("Intensity", 0, 255);
if (ret != DEVICE_OK)
return ret;
pAct = new CPropertyAction(this, &CArduinoNeoPixelShutter::OnRedBrightness);
ret = CreateProperty("Red brightness", "255", MM::Integer, false, pAct);
SetPropertyLimits("Red brightness", 0, 255);
if (ret != DEVICE_OK)
return ret;
pAct = new CPropertyAction(this, &CArduinoNeoPixelShutter::OnGreenBrightness);
ret = CreateProperty("Green brightness", "255", MM::Integer, false, pAct);
SetPropertyLimits("Green brightness", 0, 255);
if (ret != DEVICE_OK)
return ret;
pAct = new CPropertyAction(this, &CArduinoNeoPixelShutter::OnBlueBrightness);
ret = CreateProperty("Blue brightness", "255", MM::Integer, false, pAct);
SetPropertyLimits("Blue brightness", 0, 255);
if (ret != DEVICE_OK)
return ret;
pAct = new CPropertyAction(this, &CArduinoNeoPixelShutter::OnMulti);
ret = CreateProperty("Multi", "8", MM::Integer, false, pAct);
SetPropertyLimits("Multi", 0, 1<<3);
if (ret != DEVICE_OK)
return ret;
// set shutter into the off state
//WriteToPort(0);
std::vector<std::string> vals;
vals.push_back("0");
vals.push_back("1");
ret = SetAllowedValues("OnOff", vals);
if (ret != DEVICE_OK)
return ret;
ret = UpdateStatus();
if (ret != DEVICE_OK)
return ret;
changedTime_ = GetCurrentMMTime();
initialized_ = true;
return DEVICE_OK;
}
示例6: main
//*****************************************************************************
//
// This is the main loop that runs the application.
//
//*****************************************************************************
int
main(void)
{
tRectangle sRect;
//
// Set the clocking to run directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_8MHZ);
//
// Enable the USB mux GPIO.
//
ROM_SysCtlPeripheralEnable(USB_MUX_GPIO_PERIPH);
//
// The LM3S3748 board uses a USB mux that must be switched to use the
// host connector and not the device connecter.
//
ROM_GPIOPinTypeGPIOOutput(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN);
ROM_GPIOPinWrite(USB_MUX_GPIO_BASE, USB_MUX_GPIO_PIN, USB_MUX_SEL_DEVICE);
//
// Configure SysTick for a 100Hz interrupt. The FatFs driver wants a 10 ms
// tick.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / 100);
ROM_SysTickEnable();
ROM_SysTickIntEnable();
//
// Configure and enable uDMA
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
SysCtlDelay(10);
uDMAControlBaseSet(&sDMAControlTable[0]);
uDMAEnable();
//
// Initialize the display driver.
//
Formike128x128x16Init();
//
// Turn on the backlight.
//
Formike128x128x16BacklightOn();
//
// Initialize the graphics context.
//
GrContextInit(&g_sContext, &g_sFormike128x128x16);
//
// Fill the top 15 rows of the screen with blue to create the banner.
//
sRect.sXMin = 0;
sRect.sYMin = 0;
sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1;
sRect.sYMax = DISPLAY_BANNER_HEIGHT;
GrContextForegroundSet(&g_sContext, ClrDarkBlue);
GrRectFill(&g_sContext, &sRect);
//
// Put a white box around the banner.
//
GrContextForegroundSet(&g_sContext, ClrWhite);
GrRectDraw(&g_sContext, &sRect);
//
// Put the application name in the middle of the banner.
//
GrContextFontSet(&g_sContext, g_pFontFixed6x8);
GrStringDrawCentered(&g_sContext, "usb_dev_msc", -1,
GrContextDpyWidthGet(&g_sContext) / 2, 7, 0);
//
// Initialize the idle timeout and reset all flags.
//
g_ulIdleTimeout = 0;
g_ulFlags = 0;
//
// Initialize the state to idle.
//
g_eMSCState = MSC_DEV_IDLE;
//
// Draw the status bar and set it to idle.
//
UpdateStatus("Idle", 1);
//
// Pass our device information to the USB library and place the device
//.........这里部分代码省略.........
示例7: CrashIf
void EbookController::HandleMobiLayoutDone(EbookFormattingTask *ld)
{
if (formattingThreadNo != ld->threadNo) {
// this is a message from cancelled thread, we can disregard
//lf("EbookController::MobiLayout() thread msg discarded, curr thread: %d, sending thread: %d", layoutThreadNo, ld->threadNo);
return;
}
//lf("EbookController::HandleMobiLayoutMsg() %d pages, ld=0x%x", ld->pageCount, (int)ld);
HtmlPage *pageToShow = NULL;
if (!ld->fromBeginning) {
// if this is the first page sent, we're currently showing a page
// formatted for old window size. Replace that page with new page
if (0 == formattingTemp.pagesFromPage.Count()) {
CrashIf(0 == ld->pageCount);
pageToShow = ld->pages[0];
}
formattingTemp.pagesFromPage.Append(ld->pages, ld->pageCount);
if (pageToShow) {
CrashIf(pageToShow->reparseIdx != pageShown->reparseIdx);
ShowPage(pageToShow, false);
}
//lf("Got %d pages from page, total %d", ld->pageCount, formattingTemp.pagesFromPage.Count());
//UpdateStatus();
return;
}
// we're showing pages from the beginning
if (-1 != startReparseIdx) {
// we're formatting a book for which we need to restore
// page from previous session
CrashIf(formattingTemp.reparseIdx != 0);
for (size_t i = 0; i < ld->pageCount; i++) {
HtmlPage *pd = ld->pages[i];
if (pd->reparseIdx == startReparseIdx) {
pageToShow = pd;
} else if (pd->reparseIdx >= startReparseIdx) {
// this is the first page whose reparseIdx is greater than
// the one we're looking for, so previous page has the data
if (i > 0) {
pageToShow = ld->pages[i];
//lf("showing page %d", i);
} else {
if (0 == formattingTemp.pagesFromBeginning.Count()) {
pageToShow = ld->pages[0];
} else {
size_t pageNo = formattingTemp.pagesFromBeginning.Count() - 1;
//lf("showing page %d from formattingTemp.pagesFromBeginning", (int)pageNo);
pageToShow = formattingTemp.pagesFromBeginning.At(pageNo);
}
}
}
if (pageToShow) {
startReparseIdx = -1;
break;
}
}
} else {
if (0 == formattingTemp.pagesFromBeginning.Count()) {
CrashIf(0 == ld->pageCount);
pageToShow = ld->pages[0];
//lf("showing ld->pages[0], pageCount = %d", ld->pageCount);
}
}
formattingTemp.pagesFromBeginning.Append(ld->pages, ld->pageCount);
//lf("Got %d pages from beginning, total %d", ld->pageCount, formattingTemp.pagesFromBeginning.Count());
if (0 == formattingTemp.reparseIdx) {
// if we're starting from the beginning, show the first page as
// quickly as we can
if (pageToShow)
ShowPage(pageToShow, false);
}
if (ld->finished) {
CrashIf(pagesFromBeginning || pagesFromPage);
pagesFromBeginning = new Vec<HtmlPage *>(formattingTemp.pagesFromBeginning);
formattingTemp.pagesFromBeginning.Reset();
size_t pageCount = formattingTemp.pagesFromPage.Count();
if (pageCount > 0) {
pagesFromPage = new Vec<HtmlPage *>(formattingTemp.pagesFromPage);
formattingTemp.pagesFromPage.Reset();
}
StopFormattingThread();
}
UpdateStatus();
}
示例8: MainWndProc
//.........这里部分代码省略.........
scope.start = xscale.start / scale;
}
xscale.start -= xscale.step;
scope.start = xscale.start / scale;
InvalidateRgn(xscale.hwnd, NULL, TRUE);
break;
// Reset
case RESET_ID:
scope.index = 0;
scope.start = 0;
scope.bright = FALSE;
scope.single = FALSE;
scope.polarity = FALSE;
scope.storage = FALSE;
SendMessage(toolbar.hwnd, TB_CHECKBUTTON, BRIGHT_ID, FALSE);
SendMessage(toolbar.hwnd, TB_CHECKBUTTON, SINGLE_ID, FALSE);
SendMessage(toolbar.hwnd, TB_CHANGEBITMAP, SYNC_ID, POSITIVE_BM);
SendMessage(toolbar.hwnd, TB_CHECKBUTTON, STORAGE_ID, FALSE);
break;
// Scope
case SCOPE_ID:
ScopeClicked(wParam, lParam);
break;
}
// Update status
UpdateStatus();
// Set the focus back to the window
SetFocus(hWnd);
break;
// Menu command
case WM_MENUCOMMAND:
// Set up timebase
timebase.index = wParam;
break;
// Notify
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code)
{
case TBN_DROPDOWN:
switch (((LPNMTOOLBAR)lParam)->iItem)
{
case LEVEL_ID:
DisplayLevelControl(hWnd, wParam, lParam);
break;
case TIMEBASE_ID:
DisplayTimebaseMenu(hWnd, wParam, lParam);
break;
}
return TBDDRET_DEFAULT;
示例9: LinkFrom
//*****************************************************************************
//
// This function listens for a link request from another SimpliciTI device.
//
//*****************************************************************************
tBoolean
LinkFrom(void)
{
linkID_t linkID1;
uint8_t pucMsg[MAX_APP_PAYLOAD], ucLen, ucLtid;
unsigned long ulCount;
smplStatus_t eRetcode;
//
// Tell the user what we're doing.
//
UpdateStatus(false, "Listening for link...");
//
// Keep the compiler happy.
//
eRetcode = SMPL_TIMEOUT;
//
// Turn on LED 1 to indicate that we are listening.
//
SetLED(1, true);
//
// Listen for link for 10 seconds or so. This logic may fail if you
// happen to have sat around for about 13.6 years between starting the
// example and pressing the mode selection button. I suspect I will be
// forgiven for this.
//
ulCount = g_ulSysTickCount + (LINK_TIMEOUT_SECONDS * TICKS_PER_SECOND);
while (ulCount > g_ulSysTickCount)
{
//
// Process our message queue to keep the widget library happy.
//
WidgetMessageQueueProcess();
//
// Listen for a link. This call takes quite some time to return.
//
eRetcode = SMPL_LinkListen(&linkID1);
//
// Was the link successful?
//
if (SMPL_SUCCESS == eRetcode)
{
//
// Yes - drop out of the loop.
//
break;
}
}
//
// Did we link successfully?
//
if(eRetcode != SMPL_SUCCESS)
{
//
// No - Tell the user what happened and return an error.
//
UpdateStatus(false, "Failed to link!");
return(false);
}
//
// Turn off LED 1 to indicate that our listen succeeded.
//
UpdateStatus(false, "Link succeeded.");
SetLED(1, false);
//
// Clear our message counter.
//
ulCount = 0;
//
// Enter an infinite loop polling for messages.
//
while (1)
{
//
// Turn the radio off and pretend to sleep for a second or so.
//
SMPL_Ioctl(IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_SLEEP, 0);
SPIN_ABOUT_A_SECOND; /* emulate MCU sleeping */
//
// Turn the radio back on again.
//
SMPL_Ioctl(IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_AWAKE, 0);
//
// Were any messages "received"?
//.........这里部分代码省略.........
示例10: AudioThread
DWORD WINAPI AudioThread(LPVOID lpParameter)
{
// Set up timebase
scope.scale = timebase.values[timebase.index];
xscale.scale = scope.scale;
xscale.step = 500 * xscale.scale;
// Update display
InvalidateRgn(xscale.hwnd, NULL, TRUE);
UpdateStatus();
// Create wave format structure
static WAVEFORMATEX wf =
{WAVE_FORMAT_PCM, CHANNELS,
SAMPLE_RATE, SAMPLE_RATE * BLOCK_ALIGN,
BLOCK_ALIGN, BITS_PER_SAMPLE, 0};
MMRESULT mmr;
// Open a waveform audio input device
mmr = waveInOpen(&audio.hwi, WAVE_MAPPER | WAVE_FORMAT_DIRECT, &wf,
(DWORD_PTR)audio.id, (DWORD_PTR)NULL, CALLBACK_THREAD);
if (mmr != MMSYSERR_NOERROR)
{
static char s[64];
waveInGetErrorText(mmr, s, sizeof(s));
MessageBox(window.hwnd, s, "WaveInOpen", MB_OK | MB_ICONERROR);
return mmr;
}
do
{
// Mixer structures
static MIXERLINE mxl =
{sizeof(MIXERLINE)};
static MIXERCONTROL mxc =
{sizeof(MIXERCONTROL)};
static MIXERLINECONTROLS mxlc =
{sizeof(MIXERLINECONTROLS)};
static MIXERCONTROLDETAILS mxcd =
{sizeof(MIXERCONTROLDETAILS)};
static MIXERCONTROLDETAILS_UNSIGNED mxcdu;
// Open a mixer device
mmr = mixerOpen(&mixer.hmx, (UINT)audio.hwi, (DWORD_PTR)window.hwnd, 0,
CALLBACK_WINDOW | MIXER_OBJECTF_HWAVEIN);
if (mmr != MMSYSERR_NOERROR)
break;
// Mixer line types
DWORD types[] =
{MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE,
MIXERLINE_COMPONENTTYPE_SRC_AUXILIARY,
MIXERLINE_COMPONENTTYPE_SRC_PCSPEAKER,
MIXERLINE_COMPONENTTYPE_SRC_TELEPHONE,
MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER,
MIXERLINE_COMPONENTTYPE_SRC_COMPACTDISC,
MIXERLINE_COMPONENTTYPE_SRC_UNDEFINED,
MIXERLINE_COMPONENTTYPE_SRC_DIGITAL,
MIXERLINE_COMPONENTTYPE_SRC_WAVEOUT,
MIXERLINE_COMPONENTTYPE_SRC_ANALOG,
MIXERLINE_COMPONENTTYPE_SRC_LINE};
// Get mixer line info
for (int i = 0; i < Length(types); i++)
{
// Try a component type
mxl.dwComponentType = types[i];
// Get the info
mmr = mixerGetLineInfo((HMIXEROBJ)mixer.hmx, &mxl,
MIXER_GETLINEINFOF_COMPONENTTYPE);
// Try again if error
if (mmr != MMSYSERR_NOERROR)
continue;
// Check if line is active
if (mxl.fdwLine & MIXERLINE_LINEF_ACTIVE)
//.........这里部分代码省略.........
示例11: WaveInData
//.........这里部分代码省略.........
}
// No sync, try next time
if (state == 0)
break;
// Reset trigger
if (scope.single && scope.trigger)
scope.trigger = FALSE;
// FIRST: First chunk of data
case FIRST:
// Update count
count = timebase.counts[timebase.index];
scope.length = count;
// Copy data
memmove(buffer, data + index, (STEP - index) * sizeof(short));
index = STEP - index;
// If done, wait for sync again
if (index >= count)
state = INIT;
// Else get some more data next time
else
state++;
break;
// NEXT: Subsequent chunks of data
case NEXT:
// Copy data
memmove(buffer + index, data, STEP * sizeof(short));
index += STEP;
// Done, wait for sync again
if (index >= count)
state = INIT;
// Else if last but one chunk, get last chunk next time
else if (index + STEP >= count)
state++;
break;
// LAST: Last chunk of data
case LAST:
// Copy data
memmove(buffer + index, data, (count - index) * sizeof(short));
// Wait for sync next time
state = INIT;
break;
}
// Give the buffer back
waveInAddBuffer(audio.hwi, (WAVEHDR *)lParam, sizeof(WAVEHDR));
if (scope.scale != timebase.values[timebase.index])
{
// Set up scale
scope.scale = timebase.values[timebase.index];
xscale.scale = scope.scale;
xscale.step = 500 * xscale.scale;
// Reset start
scope.start = 0;
xscale.start = 0;
// Update display
InvalidateRgn(xscale.hwnd, NULL, TRUE);
UpdateStatus();
}
// Update display
InvalidateRgn(scope.hwnd, NULL, TRUE);
}
示例12: do_CreateInstance
NS_IMETHODIMP
MailEwsLoadCalendarItemsCallback::LocalOperation(void * response) {
load_item_response * r = (load_item_response *)response;
if (!r) return NS_OK;
ews_item ** item = r->item;
nsresult rv;
mailews_logger << "create calIEvent on main threads:"
<< r->item_count
<< std::endl;
nsCOMPtr<nsIMutableArray> calendarItems =
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCString ownerEmail;
rv = GetOwnerEmail(m_pIncomingServer, ownerEmail);
NS_ENSURE_SUCCESS(rv, rv);
for(int i=0;i < r->item_count;i++) {
if (item[i]->item_type == EWS_Item_Calendar) {
ews_calendar_item * cal_item = (ews_calendar_item*)item[i];
nsCOMPtr<calIEvent> e =
do_CreateInstance(CAL_EVENT_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
if (item[i]->mime_content) {
char *decodedContent =
PL_Base64Decode(item[i]->mime_content,
strlen(item[i]->mime_content),
nullptr);
nsCString data;
data.Adopt(decodedContent);
CleanUpIcalString(data);
rv = e->SetIcalString(data);
NS_ENSURE_SUCCESS(rv, rv);
nsCString uid(((ews_calendar_item*)item[i])->uid);
if (uid.IsEmpty()) {
GenerateUid(uid);
mailews_logger << "generate uid for event:"
<< item[i]->item_id
<< ","
<< item[i]->change_key
<< ","
<< uid.get()
<< std::endl
<< data.get()
<< std::endl;
}
e->SetId(uid);
nsCOMPtr<calIDateTime> dtStart;
e->GetStartDate(getter_AddRefs(dtStart));
if (!dtStart) {
mailews_logger << "skip no start date event:"
<< item[i]->item_id
<< ","
<< item[i]->change_key
<< ","
<< uid.get()
<< std::endl
<< data.get()
<< std::endl;
continue;
}
rv = e->RemoveAllAttendees();
NS_ENSURE_SUCCESS(rv, rv);
rv = UpdateAttendee(e,
(ews_calendar_item*)item[i],
ownerEmail,
true);
NS_ENSURE_SUCCESS(rv, rv);
rv = UpdateAttendee(e,
(ews_calendar_item*)item[i],
ownerEmail,
false);
NS_ENSURE_SUCCESS(rv, rv);
rv = UpdateOccurrence(e,
(ews_calendar_item*)item[i]);
NS_ENSURE_SUCCESS(rv, rv);
rv = UpdateStatus(e,
ownerEmail);
NS_ENSURE_SUCCESS(rv, rv);
} else {
rv = From(m_pIncomingServer,
(ews_calendar_item *)item[i], e);
NS_ENSURE_SUCCESS(rv, rv);
}
//Save item id
//.........这里部分代码省略.........
示例13: strdup
// update the user lists..
void IRCQuery::ChangeUserNick(char *OtherNick)
{
if (m_OtherNick) free(m_OtherNick);
m_OtherNick = strdup(OtherNick);
UpdateStatus();
}
示例14: main
//*****************************************************************************
//
// Main application entry function.
//
//*****************************************************************************
int
main(void)
{
tBoolean bRetcode;
smplStatus_t eRetcode;
ioctlScanChan_t sScan;
freqEntry_t pFreq[NWK_FREQ_TBL_SIZE];
tBoolean bFirstTimeThrough;
unsigned long ulLoop;
uint8_t ucLast;
//
// Set the system clock to run at 50MHz from the PLL
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// NB: We don't call PinoutSet() in this testcase since the EM header
// expansion board doesn't currently have an I2C ID EEPROM. If we did
// call PinoutSet() this would configure all the EPI pins for SDRAM and
// we don't want to do this.
//
g_eDaughterType = DAUGHTER_NONE;
//
// Enable peripherals required to drive the LCD.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
//
// Configure SysTick for a 10Hz interrupt.
//
ROM_SysTickPeriodSet(ROM_SysCtlClockGet() / TICKS_PER_SECOND);
ROM_SysTickEnable();
ROM_SysTickIntEnable();
//
// Initialize the display driver.
//
Kitronix320x240x16_SSD2119Init();
//
// Initialize the touch screen driver.
//
TouchScreenInit();
//
// Set the touch screen event handler.
//
TouchScreenCallbackSet(WidgetPointerMessage);
//
// Add the compile-time defined widgets to the widget tree.
//
WidgetAdd(WIDGET_ROOT, (tWidget *)&g_sHeading);
//
// Initialize the status string.
//
UpdateStatus("Initializing...");
//
// Paint the widget tree to make sure they all appear on the display.
//
WidgetPaint(WIDGET_ROOT);
//
// Initialize the SimpliciTI BSP.
//
BSP_Init();
//
// Set the SimpliciTI device address using the current Ethernet MAC address
// to ensure something like uniqueness.
//
bRetcode = SetSimpliciTIAddress();
//
// Did we have a problem with the address?
//
if(!bRetcode)
{
//
// Yes - make sure the display is updated then hang the app.
//
WidgetMessageQueueProcess();
while(1)
{
//
// MAC address is not set so hang the app.
//
//.........这里部分代码省略.........
示例15: buildXMLStringNetCtl
//.........这里部分代码省略.........
else if (command == "Down")
sPanasonicCall = buildXMLStringNetCtl("DOWN-ONOFF");
else if (command == "Left")
sPanasonicCall = buildXMLStringNetCtl("LEFT-ONOFF");
else if (command == "Right")
sPanasonicCall = buildXMLStringNetCtl("RIGHT-ONOFF");
else if (command == "ChannelUp")
sPanasonicCall = buildXMLStringNetCtl("CH_UP-ONOFF");
else if (command == "ChannelDown")
sPanasonicCall = buildXMLStringNetCtl("CH_DOWN-ONOFF");
else if (command == "VolumeUp")
sPanasonicCall = buildXMLStringNetCtl("VOLUP-ONOFF");
else if (command == "VolumeDown")
sPanasonicCall = buildXMLStringNetCtl("VOLDOWN-ONOFF");
else if (command == "Mute")
sPanasonicCall = buildXMLStringNetCtl("MUTE-ONOFF");
else if (command == "inputtv")
sPanasonicCall = buildXMLStringNetCtl("TV-ONOFF");
else if (command == "inputav")
sPanasonicCall = buildXMLStringNetCtl("AV-ONOFF");
else if (command == "Red")
sPanasonicCall = buildXMLStringNetCtl("RED-ONOFF");
else if (command == "Green")
sPanasonicCall = buildXMLStringNetCtl("GREEN-ONOFF");
else if (command == "Blue")
sPanasonicCall = buildXMLStringNetCtl("BLUE-ONOFF");
else if (command == "Yellow")
sPanasonicCall = buildXMLStringNetCtl("YELLOW-ONOFF");
else if (command == "ContextMenu")
sPanasonicCall = buildXMLStringNetCtl("MENU-ONOFF");
else if (command == "Channels" || command == "guide")
sPanasonicCall = buildXMLStringNetCtl("EPG-ONOFF");
else if (command == "Back" || command == "Return")
sPanasonicCall = buildXMLStringNetCtl("RETURN-ONOFF");
else if (command == "Select")
sPanasonicCall = buildXMLStringNetCtl("ENTER-ONOFF");
else if (command == "Info")
sPanasonicCall = buildXMLStringNetCtl("INFO-ONOFF");
else if (command == "1")
sPanasonicCall = buildXMLStringNetCtl("D1-ONOFF");
else if (command == "2")
sPanasonicCall = buildXMLStringNetCtl("D2-ONOFF");
else if (command == "3")
sPanasonicCall = buildXMLStringNetCtl("D3-ONOFF");
else if (command == "4")
sPanasonicCall = buildXMLStringNetCtl("D4-ONOFF");
else if (command == "5")
sPanasonicCall = buildXMLStringNetCtl("D5-ONOFF");
else if (command == "6")
sPanasonicCall = buildXMLStringNetCtl("D6-ONOFF");
else if (command == "7")
sPanasonicCall = buildXMLStringNetCtl("D7-ONOFF");
else if (command == "8")
sPanasonicCall = buildXMLStringNetCtl("D8-ONOFF");
else if (command == "9")
sPanasonicCall = buildXMLStringNetCtl("D9-ONOFF");
else if (command == "0")
sPanasonicCall = buildXMLStringNetCtl("D0-ONOFF");
else if (command == "hdmi1")
sPanasonicCall = buildXMLStringNetCtl("HDMI1");
else if (command == "hdmi2")
sPanasonicCall = buildXMLStringNetCtl("HDMI2");
else if (command == "hdmi3")
sPanasonicCall = buildXMLStringNetCtl("HDMI3");
else if (command == "hdmi4")
sPanasonicCall = buildXMLStringNetCtl("HDMI4");
else if (command == "Rewind")
sPanasonicCall = buildXMLStringNetCtl("REW-ONOFF");
else if (command == "FastForward")
sPanasonicCall = buildXMLStringNetCtl("FF-ONOFF");
else if (command == "PlayPause")
sPanasonicCall = buildXMLStringNetCtl("PLAY-ONOFF");
else if (command == "Stop")
sPanasonicCall = buildXMLStringNetCtl("STOP-ONOFF");
else if (command == "pause")
sPanasonicCall = buildXMLStringNetCtl("PAUSE-ONOFF");
else if (command == "Power" || command == "power" || command == "off" || command == "Off")
sPanasonicCall = buildXMLStringNetCtl("POWER-ONOFF");
else if (command == "ShowSubtitles")
sPanasonicCall = buildXMLStringNetCtl("STTL-ONOFF");
else if (command == "On" || command == "on")
{
_log.Log(LOG_NORM, "Panasonic Plugin: (%s) Can't use command: '%s'.", m_Name.c_str(), command.c_str());
// Workaround to get the plugin to reset device status, otherwise the UI goes out of sync with plugin
m_CurrentStatus.Clear();
m_CurrentStatus.Status(MSTAT_UNKNOWN);
UpdateStatus(true);
}
else
_log.Log(LOG_NORM, "Panasonic Plugin: (%s) Unknown command: '%s'.", m_Name.c_str(), command.c_str());
if (sPanasonicCall.length())
{
if (handleWriteAndRead(sPanasonicCall) != "ERROR")
_log.Log(LOG_NORM, "Panasonic Plugin: (%s) Sent command: '%s'.", m_Name.c_str(), sPanasonicCall.c_str());
//else
// _log.Log(LOG_NORM, "Panasonic Plugin: (%s) can't send command: '%s'.", m_Name.c_str(), sPanasonicCall.c_str());
}
}