Exemple #1
0
void sccb_read_reg( uint8_t reg, uint8_t *data ) {
	start_transmission( );

	phase1_id_address( SCCB_ADDR_WRITE );

	sccb_us_delay(10);

	phase2_sub_address( reg );

	sccb_us_delay(10);

	stop_transmission( );

	/* time delay btw 2-phase write cycle and 2-phase read cycle */
	sccb_us_delay(50);
	start_transmission( );

	phase1_id_address( SCCB_ADDR_READ );

	sccb_us_delay(10);

	phase2_read_data ( data );

	stop_transmission( );
}
Exemple #2
0
void callstate_cb(ToxAV *av, uint32_t friend_number, uint32_t state, void *user_data)
{
    CallControl.call_state = state;

    switch ( state ) {
        case ( TOXAV_FRIEND_CALL_STATE_ERROR ):
            line_info_add(CallControl.prompt, NULL, NULL, NULL, SYS_MSG, 0, 0, "ToxAV callstate error!");

#ifdef VIDEO
            callback_video_end(friend_number);
#endif /* VIDEO */

            stop_transmission(&CallControl.calls[friend_number], friend_number);
            callback_call_ended(friend_number);
            CallControl.pending_call = false;

        break;
        case ( TOXAV_FRIEND_CALL_STATE_FINISHED ):
            if ( CallControl.pending_call )
                callback_call_rejected(friend_number);
            else
                callback_call_ended(friend_number);

#ifdef VIDEO
            callback_recv_video_end(friend_number);
            callback_video_end(friend_number);
#endif /* VIDEO */

            stop_transmission(&CallControl.calls[friend_number], friend_number);

            /* Reset stored call state after finishing */
            CallControl.call_state = 0;
            CallControl.pending_call = false;

        break;
        default:
            if ( CallControl.pending_call ) {
                /* Start answered call */
                callback_call_started(friend_number);
                CallControl.pending_call = false;

            } else {
#ifdef VIDEO
                /* Handle receiving client video call states */
                if ( state & TOXAV_FRIEND_CALL_STATE_SENDING_V )
                    callback_recv_video_starting(friend_number);
                else if ( state & ~TOXAV_FRIEND_CALL_STATE_SENDING_V )
                    callback_recv_video_end(friend_number);

#endif /* VIDEO */
            }

        break;
    }
}
Exemple #3
0
void callback_call_canceled ( void* av, int32_t call_index, void* arg )
{
    CB_BODY(call_index, arg, onCancel);

    /* In case call is active */
    stop_transmission(call_index);
}
Exemple #4
0
void callback_call_canceled ( int32_t call_index, void* arg )
{
    CB_BODY(call_index, arg, onCancel);

    /* In case call is active */
    stop_transmission(call_index);
    ((ToxWindow*)arg)->call_idx = -1;
}
Exemple #5
0
void callback_peer_timeout ( void* av, int32_t call_index, void* arg )
{
    CB_BODY(call_index, arg, onPeerTimeout);
    stop_transmission(call_index);
    /* Call is stopped manually since there might be some other
     * actions that one can possibly take on timeout
     */
    toxav_stop_call(ASettins.av, call_index);
}
Exemple #6
0
void terminate_audio()
{
    int i;
    for (i = 0; i < MAX_CALLS; ++i)
        stop_transmission(&CallControl.calls[i], i);

    if ( CallControl.av )
        toxav_kill(CallControl.av);

    terminate_devices();
}
Exemple #7
0
void terminate_audio()
{
    int i;
    for (i = 0; i < MAX_CALLS; i ++)
        stop_transmission(i);

    if ( ASettins.av )
        toxav_kill(ASettins.av);
    
    terminate_devices();
}
Exemple #8
0
void sccb_write_reg( uint8_t reg, uint8_t data ) {
	start_transmission( );

	phase1_id_address( SCCB_ADDR_WRITE );

	phase2_sub_address( reg );

	phase3_write_data( data );

	stop_transmission( );
}
Exemple #9
0
void cmd_hangup(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
{
    const char *error_str;

    if ( argc != 0 ) {
        error_str = "Unknown arguments.";
        goto on_error;
    }

    if ( !CallControl.av ) {
        error_str = "Audio not supported!";
        goto on_error;
    }

#ifdef VIDEO
    callback_video_end(self->num);

#endif /* VIDEO */



    if ( CallControl.pending_call ) {
        /* Manually send a cancel call control because call hasn't started */
        toxav_call_control(CallControl.av, self->num, TOXAV_CALL_CONTROL_CANCEL, NULL);
        callback_call_canceled(self->num);
    }
    else {
        stop_transmission(&CallControl.calls[self->num], self->num);
        callback_call_ended(self->num);
    }

    CallControl.pending_call = false;

    return;
on_error:
    print_err (self, error_str);
}
Exemple #10
0
void callback_call_ended ( void* av, int32_t call_index, void* arg )
{
    CB_BODY(call_index, arg, onEnd);
    stop_transmission(call_index);
}
Exemple #11
0
void callback_recv_ending ( void* av, int32_t call_index, void* arg )
{
    CB_BODY(call_index, arg, onEnding);
    stop_transmission(call_index);
}
Exemple #12
0
void callback_call_ended ( int32_t call_index, void* arg )
{
    CB_BODY(call_index, arg, onEnd);
    stop_transmission(call_index);
    ((ToxWindow*)arg)->call_idx = -1;
}
Exemple #13
0
void callback_recv_error ( int32_t call_index, void* arg )
{
    CB_BODY(call_index, arg, onError);
    stop_transmission(call_index);
    ((ToxWindow*)arg)->call_idx = -1;
}