static void send_pio_timed_message(PioState *pioState, const TimedMessage *p, int hold_repeat) { const TimedMessage **m = (const TimedMessage **) PanicNull(malloc(sizeof(const TimedMessage *))); *m = p; if (hold_repeat) MessageSendLater(&pioState->task, internal_pio_timer_message, m, p->msecRepeat); else MessageSendLater(&pioState->task, internal_pio_timer_message, m, p->msec); }
static void scanner_scanning_state_enter(void) { Source source; DEBUG(( "scanner, scanning state enter... \n" )); update_indication(); /** start scanning timeout timer **/ MessageSendLater(&scanner.task, SCANNER_SCANNING_TIMEOUT_IND, 0, SCANNER_SCANNING_TIMEOUT); /** pull-down and start timeout timer **/ trigger_drive_low(); /** MessageSendLater(&scanner.task, SCANNER_SCANNING_PULLDOWN_TIMEOUT_IND, 0, SCANNER_SCANNING_PULLDOWN_TIMEOUT); **/ /** clean-up uart source **/ source = StreamUartSource(); if (source && SourceSize(source) > 0) { SourceDrop(source, SourceSize(source)); } /** clear barcode **/ barcode_clear(&scanner.barcode); }
/**************************************************************************** NAME sinkEnableMultipointConnectable DESCRIPTION when in multi point mode check to see if device can be made connectable, this will be when only one AG is currently connected. this function will be called upon certain button presses which will reset the 60 second timer and allow a second AG to connect should the device have become non discoverable RETURNS none */ void sinkEnableMultipointConnectable( void ) { /* only applicable to multipoint devices and don't go connectable when taking or making an active call, allow connectable in streaming music state */ if((theSink.MultipointEnable)&&(stateManagerGetState() != deviceLimbo)) { /* if only one hfp instance is connected then set connectable to active */ if(deviceManagerNumConnectedDevs() < 2) { MAIN_DEBUG(("MP Go Conn \n" )); /* make device connectable */ sinkEnableConnectable(); /* cancel any currently running timers that would disable connectable mode */ MessageCancelAll( &theSink.task, EventSysConnectableTimeout ); /* remain connectable for a further 'x' seconds to allow a second AG to be connected if non-zero, otherwise stay connecatable forever */ if(theSink.conf1->timeouts.ConnectableTimeout_s) { MessageSendLater(&theSink.task, EventSysConnectableTimeout, 0, D_SEC(theSink.conf1->timeouts.ConnectableTimeout_s)); } } /* otherwise do nothing */ } }
static void hal_active_state_enter(void) { DEBUG(("hal active state enter...\n")); update_indication(); MessageSendLater(getHalTask(), HAL_ACTIVE_AUTO_SHUTDOWN_TIMEOUT, 0, HAL_ACTIVE_AUTO_SHUTDOWN_DURATION); }
void a2dpStreamStartMediaStreamHoldoff (void) { DEBUG_A2DP(("a2dpStreamStartMediaStreamHoldoff\n")); the_app->a2dp_media_stream_holdoff = TRUE; MessageCancelAll(&the_app->task, APP_A2DP_MEDIA_STREAM_HOLDOFF); MessageSendLater(&the_app->task, APP_A2DP_MEDIA_STREAM_HOLDOFF, 0, A2DP_MEDIA_STREAM_HOLDOFF_DELAY); }
/**************************************************************************** NAME inquiry_start_discovery - Begin inquiry procedure */ void inquiry_start_discovery(void) { INQUIRY_DEBUG(("INQUIRY: inquiry_start_discovery\n")); if (theSource->inquiry_data == NULL) { theSource->inquiry_data = (INQUIRY_SCAN_DATA_T *) memory_create(sizeof(INQUIRY_SCAN_DATA_T)); if (theSource->inquiry_data) { /* set read and write indexes */ theSource->inquiry_data->read_idx = 0; theSource->inquiry_data->write_idx = 0; theSource->inquiry_data->search_idx = 0; theSource->inquiry_data->inquiry_state_timeout = 0; if (theSource->ps_config->ps_timers.inquiry_state_timer != TIMER_NO_TIMEOUT) { MessageSendLater(&theSource->app_data.appTask, APP_INQUIRY_STATE_TIMEOUT, 0, D_SEC(theSource->ps_config->ps_timers.inquiry_state_timer)); } } } if (theSource->inquiry_data) { /* start Bluetooth inquiry */ ConnectionInquire(&theSource->connectionTask, INQUIRY_LAP, INQUIRY_MAX_RESPONSES, INQUIRY_TIMEOUT, (uint32)COD_MAJOR_AV); } else { /* memory should exist here issue a Panic */ Panic(); } }
/*************************************************************************** NAME UpgradeSMInit - Initialise the State Machine DESCRIPTION This function performs relevant initialisation of the state machine, currently just setting the initial state. This is currently determined by checking whether an upgraded application is running. */ void UpgradeSMInit() { switch(UpgradeCtxGetPSKeys()->upgrade_in_progress_key) { /* UPGRADE_RESUME_POINT_PRE_VALIDATE: @todo: What do we do in this case ? */ /* UPGRADE_RESUME_POINT_POST_REBOOT: UPGRADE_RESUME_POINT_COMMIT: @todo: Are these right, we want host to chat */ default: SetState(UPGRADE_STATE_CHECK_STATUS); break; /*case UPGRADE_RESUME_POINT_PRE_REBOOT: SetState(UPGRADE_STATE_VALIDATED); break;*/ case UPGRADE_RESUME_POINT_POST_REBOOT: SetState(UPGRADE_STATE_COMMIT_HOST_CONTINUE); MessageSendLater(UpgradeGetUpgradeTask(), UPGRADE_INTERNAL_RECONNECTION_TIMEOUT, NULL, D_SEC(UPGRADE_WAIT_FOR_RECONNECTION_TIME_SEC)); break; /*case UPGRADE_RESUME_POINT_ERASE: MoveToState(UPGRADE_STATE_COMMIT); break;*/ case UPGRADE_RESUME_POINT_ERROR: SetState(UPGRADE_STATE_ABORTING); break; } }
/**************************************************************************** DESCRIPTION Initialises the Button Module parameters */ void ButtonsInit ( ButtonsTaskData *pButtonsTask ) { #ifdef ENABLE_CAPSENSE uint8 i; bool success; #endif pButtonsTask->task.handler = ButtonsMessageHandler; /*connect the underlying PIO task to this task*/ MessagePioTask(&pButtonsTask->task); /*connect the underlying Charger task to this task*/ MessageChargerTask(&pButtonsTask->task); #ifdef ENABLE_CAPSENSE /* set the update rate, currently a fast update rate to detect short touches */ success = CapsenseConfigure(CAPSENSE_SET_CINT_UPDATE_DIVIDER, 0); /* set an initial trigger level for the cap sensors, this level will depend upon hardware and tests will need to be carried out to determine what a particular implementation requires */ for (i = 0; success && (i < BM_CAP_SENSORS); i++) success = CapsenseConfigurePad(i, CAPSENSE_SET_TRIGGER_LEVEL, BM_CAP_SENSOR_LOW_SENSITIVITY); B_DEBUG(("B: capsense %s\n", success ? "OK" : "FAIL: check CONFIG_CAP_SENSE_PRELOAD")) ; /* initialise task handler for capsense events after a short delay due to spurious events generated from the firmware during this time */ MessageSendLater(&pButtonsTask->task,B_MESSAGE_CAPSENSE_ENABLE,0,CAPSENSE_INIT_INTERVAL); #endif }
/**************************************************************************** NAME sinkRecallQueuedEvent DESCRIPTION Checks to see if an event was Queued and issues it RETURNS void */ void sinkRecallQueuedEvent ( void ) { /*this is currently only applicable to LNR and voice Dial but does not care */ if ((theSink.gEventQueuedOnConnection != (EventInvalid - EVENTS_MESSAGE_BASE))) { switch (stateManagerGetState() ) { case deviceIncomingCallEstablish: case deviceOutgoingCallEstablish: case deviceActiveCallSCO: case deviceActiveCallNoSCO: case deviceThreeWayCallWaiting: case deviceThreeWayCallOnHold: case deviceThreeWayMulticall: /* Do Nothing Message Gets ignored*/ break ; default: /* delay sending of queued message by 1 second as some phones are ignoring the AT command when using native firmware as the connection time is much quicker using that firmware */ MessageSendLater ( &theSink.task , (theSink.gEventQueuedOnConnection + EVENTS_MESSAGE_BASE), 0 , 1500) ; break; } } /*reset the queued event*/ sinkClearQueueudEvent(); }
static void tick_handler(void) { (void)AdcRequest(&battery_probe.task, battery_probe.source); (void)AdcRequest(&battery_probe.task, VM_ADC_SRC_VREF); MessageSendLater(getBatteryProbeTask(), BATTERY_PROBE_TICK, 0, battery_probe.tick_interval); }
/**************************************************************************** DESCRIPTION unmute the volume by message to allow a full dsp buffer to have been collected which will ensure a smooth ramping of the volume level */ void SubConnectedNowUnmuteVolume(DECODER_t * DECODER) { A2dpPluginConnectParams *codecData = (A2dpPluginConnectParams *) DECODER->params; /* Ensure the volume is set before applying it, it may not yet have become available from the VM app */ if(DECODER->volume.main.master != DIGITAL_VOLUME_MUTE || DECODER->volume.aux.master != DIGITAL_VOLUME_MUTE) { /* send the volume message to unmute the audio after a preset delay to allow a full dsp buffer to make use of the soft unmute function */ MAKE_AUDIO_MESSAGE( AUDIO_PLUGIN_SET_GROUP_VOLUME_MSG ) ; /* create volume message contents */ memmove(message, &DECODER->volume, sizeof(AUDIO_PLUGIN_SET_GROUP_VOLUME_MSG_T)); /* schedule in the unmute in 100ms*/ MessageSendLater((TaskData *)DECODER->task, AUDIO_PLUGIN_SET_GROUP_VOLUME_MSG, message , ALLOW_FULL_DSP_BUFFER_DELAY_FOR_SOFT_MUTE) ; } else { PRINT(("DECODER: SubConnectedNowUnmuteVolume - vol not set\n" )); } /* release the lock on changing volume and playing tones */ codecData->delay_volume_message_sending = FALSE; PRINT(("DECODER: SubConnectedNowUnmuteVolume\n" )); }
/**************************************************************************** NAME hidDisconnectingRemoteEnter DESCRIPTION Called whenever the HID instance enters the remote disconnecting state. Starts the disconnect timer. RETURNS void */ static void hidDisconnectingRemoteEnter(HID *hid) { HID_PRINT(("hidDisconnectingRemoteEnter\n")); /* Start disconnect timer */ MessageSendLater(&hid->task, HID_INTERNAL_DISCONNECT_TIMEOUT_IND, 0, D_SEC(HID_DISCONNECT_TIMEOUT)); }
void hfpHandlerRingInd ( void ) { /* Disconnect A2DP audio if it is streaming from a standalone A2DP source */ if (!IsA2dpSourceAnAg()) streamControlCeaseA2dpStreaming(TRUE); if ( !theHeadset.InBandRingEnabled ) { HFP_DEBUG(("HFP_DEBUG: OutBandRing\n")) ; /* Play ring tone from configuration */ } if ( (theHeadset.profile_connected == hfp_headset_profile) && !theHeadset.HSPCallAnswered ) { /* If using HSP then use ring indication as incoming call */ theHeadset.HSPIncomingCallInd = TRUE; stateManagerEnterIncomingCallEstablishState() ; MessageCancelAll ( &theHeadset.task , APP_CANCEL_HSP_INCOMING_CALL ) ; MessageSendLater ( &theHeadset.task , APP_CANCEL_HSP_INCOMING_CALL , 0 , D_SEC(6) ) ; } }
/**************************************************************************** NAME slcConnectionComplete DESCRIPTION SLC connection has completed RETURNS void */ static void slcConnectionComplete(hfp_link_priority priority, Sink sink, bdaddr* bd_addr) { /* mark as connected */ theSink.profile_data[PROFILE_INDEX(priority)].status.connected = TRUE; /* Another connection made, update number of current connections */ SLC_DEBUG(("SLC: Pro Connected[%x], NoOfDev=%x\n", (int)sink,deviceManagerNumConnectedDevs())) ; /* Enter connected state if applicable */ if(!stateManagerIsConnected()) stateManagerEnterConnectedState(); /* Ensure the underlying ACL is encrypted */ if(theSink.features.EncryptOnSLCEstablishment) ConnectionSmEncrypt( &theSink.task , sink , TRUE ); /* send message to do indicate a stop of the paging process when in connectable state */ if(theSink.paging_in_progress) MessageSend(&theSink.task, EventSysStopPagingInConnState ,0); /* if device initiated connection */ if(!gSlcData.gSlcConnectRemote) { /* If no event is queued send button press */ if(!theSink.gEventQueuedOnConnection) HfpHsButtonPressRequest(priority); /* Continue trying to connect to next device in 0.1 seconds time to allow current device to finish connecting */ MessageSendLater(&theSink.task,EventSysContinueSlcConnectRequest,0,theSink.conf1->timeouts.SecondAGConnectDelayTime_s); } /* Initialise call transfer flag */ gSlcData.gCallTransferInProgress = FALSE ; }
/**************************************************************************** NAME usbSetLowPowerMode DESCRIPTION If delay is non zero queue a message to reset into low powered mode. If delay is zero do nothing. RETURNS void */ static void usbSetLowPowerMode(uint8 delay) { /* Only queue low power mode if not enumerated and attached to normal host/hub */ if(!theSink.usb.enumerated && delay && (UsbAttachedStatus() == HOST_OR_HUB)) { USB_DEBUG(("USB: Queue low power in %d sec\n", delay)); MessageSendLater(&theSink.task, EventUsbLowPowerMode, 0, D_SEC(delay)); } }
static void scanner_warmup_state_enter(void) { DEBUG(( "scanner, warmup state enter... \n" )); update_indication(); /** start clock **/ MessageSendLater(&scanner.task, SCANNER_WARMUP_WAIT_TIMEOUT_IND, 0, SCANNER_WARMUP_WAIT_TIMEOUT); }
void avrcpConnectReq(bdaddr addr, bool delay_request) { APP_AVRCP_CONNECT_REQ_T *message = (APP_AVRCP_CONNECT_REQ_T*)PanicUnlessMalloc(sizeof(APP_AVRCP_CONNECT_REQ_T)); message->addr = addr; if (delay_request) MessageSendLater(&theHeadset.task, APP_AVRCP_CONNECT_REQ, message, 3000); else MessageSend(&theHeadset.task, APP_AVRCP_CONNECT_REQ, message); }
/**************************************************************************** NAME scanStartAppInquiryTimer DESCRIPTION Starts the timer for inquiry. Inquiry mode will end once the timer fires. */ void scanStartAppInquiryTimer (void) { if (!the_app->inquiring) /* Don't restart a timer that is already running */ { MessageCancelAll(&the_app->task, APP_INQUIRY_TIMER); MessageSendLater(&the_app->task, APP_INQUIRY_TIMER, 0, 120000); the_app->inquiring = TRUE; the_app->app_inquiry_timer_expired = FALSE; } }
static void led_controller1( Task t, MessageId id, Message payload ) { PRINT(("Pattern No. %d\n", count )); ledsPlay( patterns[count] ); count++; count %= NO_OF_PATTERNS; MessageSendLater( t, 0, 0, DELAY ); }
/**************************************************************************** NAME PioSetDimState DESCRIPTION Update funtion for a led that is currently dimming RETURNS void */ void PioSetDimState ( uint16 pPIO ) { uint16 lDim = 0x0000 ; LEDActivity_t *gActiveLED = &theSink.theLEDTask->gActiveLEDS[pPIO]; if (gActiveLED->DimDir && gActiveLED->DimState >= DIM_NUM_STEPS ) { lDim = 0xFFF; DIM_DEBUG(("DIM:+[F] [ON]\n" )); } else if ( !gActiveLED->DimDir && gActiveLED->DimState == 0x0 ) { lDim = 0 ; DIM_DEBUG(("DIM:-[0] [OFF]\n" )); } else { if(gActiveLED->DimDir) gActiveLED->DimState++ ; else gActiveLED->DimState-- ; DIM_DEBUG(("DIM:Direction [%x], DimState:[%x], DimTime:[%x]\n", gActiveLED->DimDir, gActiveLED->DimState, gActiveLED->DimTime)); lDim = (gActiveLED->DimState * (DIM_STEP_SIZE) ) ; MessageCancelAll ( &theSink.theLEDTask->task, (DIM_MSG_BASE + pPIO) ) ; MessageSendLater ( &theSink.theLEDTask->task, (DIM_MSG_BASE + pPIO) , 0 , gActiveLED->DimTime ) ; } #ifndef NO_LED2 if (pPIO == 14) { LedConfigure(LED_0, LED_DUTY_CYCLE, lDim); LedConfigure(LED_0, LED_PERIOD, DIM_PERIOD ); LedConfigure(LED_0, LED_ENABLE, TRUE ) ; } else if (pPIO ==15) { LedConfigure(LED_1, LED_DUTY_CYCLE, lDim); LedConfigure(LED_1, LED_PERIOD, DIM_PERIOD ); LedConfigure(LED_1, LED_ENABLE, TRUE ) ; } else if (pPIO ==10) { LedConfigure(LED_2, LED_DUTY_CYCLE, lDim); LedConfigure(LED_2, LED_PERIOD, DIM_PERIOD ); LedConfigure(LED_2, LED_ENABLE, TRUE ) ; } #endif }
static void hal_deactivating_state_enter(void) { DEBUG(("hal deactivating state enter...\n")); update_indication(); ledsPlay(BEEP_TWICE); /* ledsPlay(MOTOR_TWICE);*/ MessageSendLater(getHalTask(), HAL_DEACTIVATING_TIMEOUT, 0, BEEP_TWICE_DURATION + 100); /** send message to profile **/ MessageSend(hal.profile_task, HAL_MESSAGE_SWITCHING_OFF, 0); MessageSend(hal.function_task, HAL_MESSAGE_SWITCHING_OFF, 0); }
/**************************************************************************** NAME audio_start_active_timer - Starts the audio active timer in USB mode if the USB audio interfaces are inactive */ void audio_start_active_timer(void) { MessageCancelFirst(&theSource->app_data.appTask, APP_USB_AUDIO_ACTIVE); MessageCancelFirst(&theSource->app_data.appTask, APP_USB_AUDIO_INACTIVE); #ifndef ANALOGUE_INPUT_DEVICE /* Audio active timer only applies to a USB device as an Analogue input device cannot be notified when audio is present */ if ((theSource->ps_config->ps_timers.usb_audio_active_timer != TIMER_NO_TIMEOUT) && (!theSource->audio_data.audio_usb_active)) { /* send the audio inactive message after the PS configured delay */ MessageSendLater(&theSource->app_data.appTask, APP_USB_AUDIO_INACTIVE, 0, D_SEC(theSource->ps_config->ps_timers.usb_audio_active_timer)); } #endif }
static void send_pio_enter_messages(PioState *pioState, InternalState state) { uint16 init_count = enter_messages[state].count; uint16 count = init_count; const EnterMessage *p = enter_messages[state].send; while(count--) { if (p->double_tap) { if (pioState->pio_states.double_press == state) { if (MessageCancelAll(&pioState->task, double_pio_press_timer)) { pioState->pio_states.store_held = Unknown; MessageSend(pioState->client, p->id, 0); } else MessageSendLater(&pioState->task, double_pio_press_timer, 0, p->timeout); } else { pioState->pio_states.double_press = state; (void) MessageCancelAll(&pioState->task, double_pio_press_timer); MessageSendLater(&pioState->task, double_pio_press_timer, 0, p->timeout); } } else if (!p->release) MessageSend(pioState->client, p->id, 0); else { pioState->pio_states.store_held = state; pioState->pio_states.store_count = init_count - (count + 1); } p++; } }
/******************************************************************************* NAME gattHidRcCreateButtonEventMessage DESCRIPTION Create and send button related message events to Remote control message handler. PARAMETERS mid Messge ID that to be send timer If any timer associated mask Button Mask cid Connection ID delay_time delay */ static void gattHidRcCreateButtonEventMessage(gattHidRcMessageID_t mid, gattHidRcTimerID_t timer, uint16 mask, uint16 cid, uint32 delay_time) { /* Create a BLE_HID_RC_BUTTON_EVENT_MSG_T, * this data type is generic for all "button event messages" * sent to the Input monitor */ MAKE_GATT_HID_RC_MESSAGE(GATT_HID_RC_BUTTON_EVENT_MSG); message->timer = timer; message->mask = mask; message->cid = cid; /* Dispatch the message */ MessageSendLater(&GATT_HID_RC.task, mid, message, delay_time); }
/**************************************************************************** NAME handleAppRefreshEncryptionReq DESCRIPTION Handles the application refresh encryption key message. */ static void handleAppRefreshEncryptionReq(devInstanceTaskData *inst) { switch (the_app->app_state) { case AppStateIdle: { /* If we have a device active but not in call / streaming */ ConnectionSmEncryptionKeyRefresh(&inst->bd_addr); break; } default: { break; } } MessageSendLater(&inst->task, APP_REFRESH_ENCRYPTION_REQ, 0, D_MIN(EPR_TIMEOUT)); }
void connectionHandleRfcommRegisterReq(connectionRfcommState *rfcommState, const CL_INTERNAL_RFCOMM_REGISTER_REQ_T *req) { /* Create an entry in the connection map to enable incoming primitives on this server channel to be mapped to the correct task */ Task connectTask; const profile_task_recipe *recipe; map_id id; id.channel = INVALID_SERVER_CHANNEL; /* If we're using lazy tasks store the info otherwise store nulls */ if (req->theConnectTask && req->task_recipe) { connectTask = req->theConnectTask; recipe = req->task_recipe; } else { connectTask = req->theAppTask; recipe = 0; } if(connectionAddTaskMap(conn_rfcomm, id, connectTask, recipe)) { /* Lock RFC registration */ rfcommState->registerLock = req->theAppTask; { /* Register with Bluestack so it allocates an RFCOMM channel */ MAKE_PRIM_T(RFC_REGISTER_REQ); prim->phandle = 0; VmSendRfcommPrim(prim); } { /* Set up watchdog timeout */ MAKE_CL_MESSAGE(CL_INTERNAL_RFCOMM_REGISTER_TIMEOUT_IND); message->theAppTask = req->theAppTask; MessageSendLater(connectionGetCmTask(), CL_INTERNAL_RFCOMM_REGISTER_TIMEOUT_IND, message, RFCOMM_REGISTER_TIMEOUT); } } else sendRfcommRegisterCfm(req->theAppTask, fail, INVALID_SERVER_CHANNEL); }
/**************************************************************************** NAME slcConnectionSetup DESCRIPTION Perform link setup for a given SLC RETURNS void */ static void slcConnectionSetup(hfp_link_priority priority, Sink sink, bdaddr* bd_addr) { uint16 priorityIdx = PROFILE_INDEX(priority); /* Set timeout to 5 seconds */ ConnectionSetLinkSupervisionTimeout(sink, SINK_LINK_SUPERVISION_TIMEOUT); /* Send our link policy settings */ linkPolicyUseHfpSettings(priority, sink); /* Send a delayed message to request a role indication and make necessary changes as appropriate */ MessageCancelFirst(&theSink.task , EventSysCheckRole); MessageSendConditionally (&theSink.task , EventSysCheckRole , NULL , &theSink.rundata->connection_in_progress ); #ifdef ENABLE_PBAP /* Connect the PBAP link of this device */ pbapConnect(priority); #endif /* Sync volume level and mute settings with AG */ VolumeSendAndSetHeadsetVolume(theSink.profile_data[priorityIdx].audio.gSMVolumeLevel ,FALSE , priority) ; /* Enable +CLIP from AG if using Audio Prompt numbers/names or display, always request if using display */ #if !defined(ENABLE_DISPLAY) if(theSink.features.VoicePromptNumbers) #endif HfpCallerIdEnableRequest(priority, TRUE); /* HS uses call waiting indications when AG SCO is not routed */ HfpCallWaitingEnableRequest(priority, TRUE); /* Attempt to pull the audio across if not already present, delay by 5 seconds to prevent a race condition occuring with certain phones */ MessageSendLater ( &theSink.task , EventSysCheckForAudioTransfer , 0 , 5000 ) ; /* Send different event if first connection since power on - allows different LED pattern */ if((theSink.features.UseDiffConnectedEventAtPowerOn)&&(theSink.powerup_no_connection)) MessageSend (&theSink.task , EventSysSLCConnectedAfterPowerOn , NULL ); else MessageSend (&theSink.task , EventSysSLCConnected , NULL ); /* Reset the flag - first connection indicated */ theSink.powerup_no_connection = FALSE; }
static void hal_activating_state_enter(void) { DEBUG(("hal activating state enter...\n")); update_indication(); hal.beep_finished = FALSE; hal.power_button_released = FALSE; /** ledsPlay(ALL_LEDS_OFF); **/ ledsPlay(BEEP_TWICE); /*ledsPlay(MOTOR_TWICE);*/ /* PioSetDir(1<<9, 1<<9); PioSet(1<<9, 1<<9); */ MessageSendLater(getHalTask(), HAL_ACTIVATING_TIMEOUT, 0, BEEP_TWICE_DURATION + 100); }
static void sendRingNotifications (AGHFP *aghfp) { if (aghfp->ring_repeat_interval != 0) { aghfpSendRingAlert(aghfp); MessageSendLater(&aghfp->task, AGHFP_INTERNAL_RING_REPEAT_REQ, 0, aghfp->ring_repeat_interval); if ( !usingHsp(aghfp) && (aghfp->hf_supported_features & aghfp_hf_cli_presentation) ) { aghfp_call_details *call_details = &aghfp->call_params.call_details; aghfpSendCallerId(aghfp, call_details->type_number, call_details->size_number, call_details->size_alpha, call_details->data); } if ( haveAudio(aghfp) && inbandSupported(aghfp) ) { aghfpSendInBandRingTone(aghfp); } } }
/****************************************************************************** NAME sinkBleBatteryLevelReadSendAndRepeat DESCRIPTION Checks and dispatches the battery levels required for each gatt connection. If required, it starts a repeat timer. PARAMETERS NONE RETURNS NONE */ void sinkBleBatteryLevelReadSendAndRepeat(void) { uint16 idx; uint16 updateNeedsSending = 0; for( idx = 0;idx < GATT.client.number_connections;idx++ ) { gatt_client_connection_t *conn = &(GATT.client.connection[idx]); if( LOCAL_UPDATE_REQD( conn ) ) { updateNeedsSending++; GattBatteryServerSendLevelNotification( GATT_SERVER.bas_server_local, 1, &(conn->cid), powerManagerBatteryLevelAsPercentage() ); } #if defined(GATT_BATTERY_SERVER_PEER) && defined(ENABLE_PEER) if( PEER_UPDATE_REQD( conn ) ) { updateNeedsSending++; GattBatteryServerSendLevelNotification( GATT_SERVER.bas_server_peer, 1, &(conn->cid), peerGetBatteryLevel() ); } #endif #ifdef GATT_BATTERY_SERVER_REMOTE if( REMOTE_UPDATE_REQD( conn ) ) { updateNeedsSending++; GattBatteryServerSendLevelNotification( GATT_SERVER.bas_server_remote, 1, &(conn->cid), gattBatteryClientGetCachedLevel() ); } #endif } if( updateNeedsSending > 0 ) { MessageSendLater( sinkGetBleTask(), BLE_INTERNAL_MESSAGE_BATTERY_READ_TIMER, 0, GATT_SERVER_BATTERY_UPDATE_TIME ); } }