本文整理汇总了C++中BT::disconnect方法的典型用法代码示例。如果您正苦于以下问题:C++ BT::disconnect方法的具体用法?C++ BT::disconnect怎么用?C++ BT::disconnect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BT
的用法示例。
在下文中一共展示了BT::disconnect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hardware_off
void hardware_off(void)
{
hardware_flashlight(0);
if(battery_status() == 0)
{
//if(timer.cableIsConnected())
//{
// menu.message(STR("Error: Cable"));
//}
//else
//{
shutter_off();
// Save the current time-lapse settings to nv-mem
timer.saveCurrent();
// If USB is used, detach from the bus
USB_Detach();
// Shutdown bluetooth
bt.disconnect();
bt.sleep();
// Disable all interrupts
cli();
// Shutdown
setHigh(POWER_HOLD_PIN);
FOREVER;
//}
}
else // Plugged in
{
// Charging screen //
clock.sleeping = 1;
menu.spawn((void *) batteryStatus);
}
}
示例2: btConnect
volatile char btConnect(char key, char first)
{
static uint8_t sfirst = 1;
uint8_t i;
static uint8_t menuSize;
static uint8_t menuSelected;
uint8_t c;
uint8_t update, menuScroll;
update = 0;
if(sfirst)
{
menuScroll = 0;
menuSelected = 0;
sfirst = 0;
update = 1;
if(bt.state != BT_ST_CONNECTED)
{
bt.advertise();
bt.scan();
}
}
switch(key)
{
case LEFT_KEY:
case FL_KEY:
sfirst = 1;
if(bt.state != BT_ST_CONNECTED) bt.sleep();
return FN_CANCEL;
case FR_KEY:
if(bt.state == BT_ST_CONNECTED)
{
bt.disconnect();
}
else
{
bt.connect(bt.device[menuSelected].addr);
}
break;
}
update = 1;
switch(bt.event)
{
case BT_EVENT_DISCOVERY:
debug(STR("dicovery!\r\n"));
break;
case BT_EVENT_SCAN_COMPLETE:
debug(STR("done!\r\n"));
if(bt.state != BT_ST_CONNECTED) bt.scan();
break;
case BT_EVENT_DISCONNECT:
bt.scan();
break;
default:
update = 0;
}
bt.event = BT_EVENT_NULL; // clear event so we don't process it twice
if(first)
{
update = 1;
}
if(key == UP_KEY && menuSelected > 0)
{
menuSelected--;
update = 1;
}
else if(key == DOWN_KEY && menuSelected < menuSize - 1)
{
menuSelected++;
update = 1;
}
if(update)
{
lcd.cls();
if(bt.state == BT_ST_CONNECTED)
{
menu.setTitle(TEXT("Connect"));
lcd.writeStringTiny(18, 20, TEXT("Connected!"));
menu.setBar(TEXT("RETURN"), TEXT("DISCONNECT"));
}
else
{
if(menuSelected > 2)
menuScroll = menuSelected - 2;
menuSize = 0;
for(i = 0; i < bt.devices; i++)
{
if(i >= menuScroll && i <= menuScroll + 4)
{
//.........这里部分代码省略.........