#include <Poke.h>
Poke::Poke |
( |
std::string |
carName | ) |
|
Default constructor of class Poke.
set the attributes of the data packet and producer, set car name directly.
- Parameters
-
carName | the unique ID of the car |
void Poke::BroadcastData |
( |
int |
AimPosition | ) |
|
broadcast a interest whose name is data information.
- Parameters
-
- Note
- this kind of interest is "/place/74/common/1/74/20160511T089022.123456/Car1/"
shared_ptr< Data > Poke::createDataPacket |
( |
Name |
GetInterestName, |
|
|
int |
SearchResult, |
|
|
std::string |
aimAtPosition |
|
) |
| |
ndn method
function to create data packet according to information from map module and attributes.
- Parameters
-
GetInterestName,the | interest name which is the same to the interest. |
SearchResult,the | information from searching the map module. |
aimAtPosition,aim | location. |
- Returns
- the data packet.
- Note
- payload statistify "1/74/20160511T089022.123456/Car1/"
Interest Poke::createInterestPacket |
( |
std::string |
m_name | ) |
|
create the interest packet according to the interest name and attributes.
- Parameters
-
std::string | m_name, the data information has sent before. |
- Returns
- the interest packet.
- Note
- input string must statistify "/place/74/common/1/74/20160511T089022.123456/Car1/"
int Poke::GetAimPosition |
( |
std::string |
getName | ) |
|
get aim position from interest's name.
- Returns
- aim position.
int Poke::GetInformationFromMemory |
( |
int |
AimPosition | ) |
|
search map module and find the state of the position there.
- Returns
- the state of the aim position.
int Poke::GetTypeOfInterest |
( |
std::string |
AimPosition, |
|
|
Interest |
interest |
|
) |
| |
judget the type of the interest and make decision, common interest should not answer it.
- Parameters
-
AimPosition,aim | position. |
interest,coming | interest. |
- Returns
- the type of interest.
bool Poke::isDataSent |
( |
| ) |
const |
tell other module whether send a packet successfully.
- Returns
- true - data send successfully.
-
false - data send falsed.
void Poke::onData |
( |
const Interest & |
interest, |
|
|
Data & |
data |
|
) |
| |
ndn method
function which is part of send interest, meaningless here. because the interest producer sent is only to tell others the data information, don't want to any back data. will never call this function.
void Poke::onInterest |
( |
const Name & |
name, |
|
|
const Interest & |
interest |
|
) |
| |
ndn method
receive coming interest matches root interest.
- Parameters
-
name,interest | name. |
interest,coming | interest |
void Poke::onRegisterFailed |
( |
const Name & |
prefix, |
|
|
const std::string & |
reason |
|
) |
| |
ndn method
call the function if register false.
- Parameters
-
void Poke::onTimeout |
( |
const Interest & |
interest | ) |
|
ndn method
function which is part of send interest, meaningless here. because the interest producer sent is only to tell others the data information, don't want to any back data.
- Parameters
-
interest,contains | data information |
ndn method
first here, the loop continue to listen the interest. call other functions if necessary.
void Poke::setForceData |
( |
| ) |
|
ndn method
set attribute of data packet, force to send.
void Poke::setFreshnessPeriod |
( |
int |
freshnessPeriod | ) |
|
ndn method
set attribute of data packet, data packet's fresh time.
- Parameters
-
freshnessPeriod,data | packet's fresh time. |
void Poke::setIdentityName |
( |
char * |
identityName | ) |
|
ndn method
set attribute of data packet
void Poke::setLastAsFinalBlockId |
( |
| ) |
|
ndn method
set attribute of data packet
void Poke::setPrefixName |
( |
char * |
prefixName | ) |
|
ndn method
set root interest name to be listened, if coming interest matches this root, answer it.
- Parameters
-
prefixName,root | interest name |
- Note
- input string must statistify "ndn:/place"
void Poke::setTimeout |
( |
int |
timeout | ) |
|
ndn method
set producer's waitting time if necessary.
- Parameters
-
void Poke::setUseDigestSha256 |
( |
| ) |
|
ndn method
set attribute of data packet, whether use digital signment.
introduce kinds of attributes.
void Poke::usepeek |
( |
std::string |
m_interest_name | ) |
|
use peek to send a interest whose name is data information
call other functions if necessary.
- Note
- input string must satisfy "/place/74/common/1/74/20160511T089022.123456/Car1/"
std::string Poke::m_carName |
|
private |
time::milliseconds Poke::m_freshnessPeriod |
|
private |
shared_ptr<Name> Poke::m_identityName |
|
private |
bool Poke::m_isForceDataSet |
|
private |
bool Poke::m_isLastAsFinalBlockIdSet |
|
private |
bool Poke::m_isUseDigestSha256Set |
|
private |
KeyChain Poke::m_keyChain |
|
private |
std::string Poke::m_payload |
|
private |
time::milliseconds Poke::m_timeout |
|
private |
The documentation for this class was generated from the following files: