Description

u8_request_peers_name_ident() – sends requests to the communication partner for its name of the device and the identification of its can2ser-channel. When we receive the answers then this information can be retrieved with the functions s_get_peers_DevName(), s_get_peers_ident_data() or toString().

Syntax

myExampleSerial.u8_request_peers_name_ident();

Parameters

None

Returns

uint8_t – 0: Error while sending the request on the can bus
1: OK

Example Code

The following example send the request and prints the received ‘name’ and ‘ident’ of the CAN2SER interface of the peer.

void setup()
{  
  // Wait for the PC can2ser-monitor to send handshakes
  while(!Serial) {;}
  Serial.println("Request and print the name");
  Serial.println("and channel identifier of the CAN2SER peer");
  // Send out the request
  Serial.u8_request_peers_name_ident();
  // give the PC some time to answer
  delay(100); 
}
void loop () 
{
  Serial.print("Connected to: '"+ Serial.s_get_peers_DevName());
  Serial.println("' - channel identifier: '" + Serial.s_get_peers_ident_data() +"'");
  delay(2000);
  Serial.println("---- using toString() -----");
  Serial.println(Serial.toString());
  delay(2000);
}

Notes and Warnings

See also


CAN2SER Class
s_get_peers_DevName(), s_get_peers_ident_data() or toString()
u8_set_ident_data()
BOOTLOADER SETTINGS – Library