Exemplo n.º 1
0
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
//
void core_frame_dot11_c::generate(
    u8_t type,
    u16_t duration,
    const core_mac_address_s& destination,
    const core_mac_address_s& source,
    const core_mac_address_s& bssid,
    u16_t sequence_control )
    {
    ASSERT( !data_length_m );
    ASSERT( max_data_length_m );   

    // Frame Control
    u16_t temp16( CORE_DOT11_FRAME_CONTROL_DEFAULT );
    temp16 |= type;

    // Data frames sent by a station must have the ToDS bit set.
    if( ( type & core_dot11_frame_control_type_mask ) == core_dot11_frame_control_type_data )
        {
        temp16 |= core_dot11_frame_control_to_ds_mask;
        }

    core_tools_c::copy(
        &data_m[data_length_m],
        reinterpret_cast<u8_t*>(&temp16),
        sizeof( temp16 ) );
    data_length_m += sizeof( temp16 );    

    // Duration
    temp16 = duration;
    core_tools_c::copy(
        &data_m[data_length_m],
        reinterpret_cast<u8_t*>(&temp16),
        sizeof( temp16 ) );
    data_length_m += sizeof( temp16 );    
    
    // BSSID
    core_tools_c::copy(
        &data_m[data_length_m],
        &bssid.addr[0],
        MAC_ADDR_LEN );
    data_length_m += MAC_ADDR_LEN;    
    
    // Source MAC
    core_tools_c::copy(
        &data_m[data_length_m],
        &source.addr[0],
        MAC_ADDR_LEN );
    data_length_m += MAC_ADDR_LEN;    

    // Destination MAC
    core_tools_c::copy(
        &data_m[data_length_m],
        &destination.addr[0],
        MAC_ADDR_LEN );
    data_length_m += MAC_ADDR_LEN;        

    // Sequence Control
    temp16 = sequence_control;
    core_tools_c::copy(
        &data_m[data_length_m],
        reinterpret_cast<u8_t*>(&temp16),
        sizeof( temp16 ) );
    data_length_m += sizeof( temp16 );
    }
Exemplo n.º 2
0
void Board::Initialise()
{
	float zbase = 400;							//  Variable to store how deep in the z axis the object is based.
	
	
	Vector4 temp1(-600, 800, 1200 + zbase, 1);
	Vector4 temp2(600, 800, 1200 + zbase, 1);
	Vector4 temp3(600, 800, 0 + zbase, 1);
	Vector4 temp4(-600,800,0 + zbase,1);
	top.Initialise(temp1, temp2, temp3, temp4);		//  Set individual vertex locations for the top face of the board
	
	Vector4 col1(70,50,4,1);
	Vector4 col2(92,67,5,1);
	Vector4 col3(102,75,6,1);
	Vector4 col4(119,77,0,1);
	Vector4 col5(69, 25, 18, 1);
	top.SetColours(col1, col2, col2, col3);			//  Set individual colour values of each of those vertices
	
	
	
	Vector4 temp5(-600, 800, 0 + zbase, 1);
	Vector4 temp6(600, 800, 0 + zbase, 1);
	Vector4 temp7(600, 1000, 0 + zbase, 1);
	Vector4 temp8(-600,1000, 0 + zbase,1);			//  Individual vertices for the front face
	
	Vector4 temp9(-800, 1000, 1200 + zbase + 300, 1);
	Vector4 temp10(800, 1000, 1200 + zbase + 300, 1);
	Vector4 temp11(800, 1000, 100, 1);
	Vector4 temp12(-800, 1000, 100,1);				//  Individual vertices for the base face
	table.Initialise(temp9, temp10, temp11, temp12);
	table.SetColours(col5, col5, col5, col5);		//  Set to one mat colour, no shading.
	
	Vector4 temp13(-600, 800, 1200 + zbase, 1);
	Vector4 temp14(-600, 800, 0 + zbase, 1);
	Vector4 temp15(-600, 1000, 0 + zbase, 1);
	Vector4 temp16(-600, 1000, 1200 + zbase, 1);	//  Set individual vertices for the left face
	
	Vector4 temp17(600, 800, 0 + zbase, 1);
	Vector4 temp18(600, 800, 1200 + zbase, 1);
	Vector4 temp19(600, 1000, 1200 + zbase, 1);
	Vector4 temp20(600, 1000, 0 + zbase, 1);		//  Set individual vertices for the right face

	sides[0].Initialise(temp5, temp6, temp7, temp8);
	sides[1].Initialise(temp13, temp14, temp15, temp16);
	sides[2].Initialise(temp17, temp18, temp19, temp20);
	sides[3].Initialise(temp2, temp1, temp16, temp19);		//  Use known vertices to initialise the side faces
	
	sides[0].SetColours(col3, col4, col4, col2);
	sides[1].SetColours(col1, col2, col2, col1);
	sides[2].SetColours(col2, col1, col1, col2);
	sides[3].SetColours(col4, col4, col4, col4);			//  Then set the colours
	
	
	float positionLocations[24][2] =   {{-450, 1050 + zbase},		//1					An array holding the centre locations
										{-300,  900 + zbase},		//2					of each of the positions where pieces
										{-150,  750 + zbase},		//3					can be placed.
										{  0 ,  750 + zbase},		//4
										{ 150,  750 + zbase},		//5
										{ 300,  900 + zbase},		//6
										{ 450, 1050 + zbase},		//7
										{  0 ,  900 + zbase},		//8
										{  0 , 1050 + zbase},		//9
										{-450,  600 + zbase},		//10
										{-300,  600 + zbase},		//11
										{-150,  600 + zbase},		//12
										{-450,  150 + zbase},		//13
										{-300,  300 + zbase},		//14
										{-150,  450 + zbase},		//15
										{  0 ,  150 + zbase},		//16
										{  0 ,  300 + zbase},		//17
										{  0 ,  450 + zbase},		//18
										{ 450,  150 + zbase},		//19
										{ 300,  300 + zbase},		//20
										{ 150,  450 + zbase},		//21
										{ 450,  600 + zbase},		//22
										{ 300,  600 + zbase},		//23
										{ 150,  600 + zbase}};		//24
	for (int i = 0; i < 24; i++) {									
		boardpositions[i].Initialise(positionLocations[i][0], positionLocations[i][1]);			//  Create the individual graphical representations
	}																							//  (class Position) and put in array for easy drawing.
	InitialiseLines();				//  Ugly function to draw each and every line on the
									//  board with individual hand-placed vertices.
									
	SetupMills();					//  Set up the mills (groups of three) with pointers to the positions
									//  as alternate referencing option
	
}