11.12.2012 Views

1 PLIN-API Documentation - PEAK-System

1 PLIN-API Documentation - PEAK-System

1 PLIN-API Documentation - PEAK-System

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.1 The LIN Client <strong>PLIN</strong> <strong>API</strong> <strong>Documentation</strong> Selecting a Hardware<br />

Selecting a Hardware ( see page<br />

6)<br />

This section contains Information about locating and selecting a LIN hardware for<br />

connection.<br />

Configuring a Client ( see page 7) This section contains Information about configuring basic parameters of a client.<br />

3.1.1 Creating a Client<br />

A <strong>PLIN</strong> client is an entity registered in the <strong>PLIN</strong> system which allows an user application to communicates on a LIN bus. The<br />

registration process is done using the function LIN_RegisterClient ( see page 106) which allocates the necessary<br />

information needed for the interaction User-<strong>API</strong>-Hardware.<br />

A client is identified twice on the <strong>PLIN</strong> system, one time through a name or label given by the user of the <strong>PLIN</strong> <strong>API</strong> at the<br />

moment of registration and, the most important, a unique handle which is returned by the function LIN_RegisterClient ( see<br />

page 106) when a client is successfully registered. This handle will be used for almost all calls to the <strong>API</strong> and for this reason<br />

it should be saved by the client application as long as a <strong>PLIN</strong> client is needed. When a <strong>PLIN</strong> client is not needed anymore,<br />

the opposite function, LIN_RemoveClient ( see page 107), should be called in order to liberate the resources occupied by<br />

that client. It is not necessary to disconnect a client (eg. using LIN_DisconnectClient ( see page 108)) before calling the<br />

LIN_RemoveClient ( see page 107) function. The disconnection is intrinsically done.<br />

See Also<br />

Selecting a Hardware ( see page 6)<br />

LIN_RegisterClient ( see page 106) (.NET: RegisterCleint)<br />

LIN_RemoveClient ( see page 107) (.NET: RemoveClient ( see page 52))<br />

LIN_DisconnectClient ( see page 108) (.NET: DisconnectClient ( see page 53))<br />

3.1.2 Selecting a Hardware<br />

After having a client registered in the <strong>PLIN</strong> system, a hardware can be connected using the LIN_ConnectClient ( see page<br />

108) function, in order to participate in a communication. A client must use the <strong>API</strong> to get connected to a hardware present in<br />

the system.<br />

The way to identify a hardware in the <strong>PLIN</strong> system is analog to the clients, using handles. The <strong>PLIN</strong> system assigns a<br />

handle, beginning with 1, to each LIN hardware registered in the system. A client application can ask for the available<br />

hardware, using the function LIN_GetAvailableHardware ( see page 117) which returns an array of handles from all LIN<br />

hardware available for connection.<br />

In many cases it is needed to physically identify a hardware before a client get connected, eg. when a computer has more<br />

than one LIN devices connected to different LIN busses. In this case, a client application can use the function<br />

LIN_IdentifyHardware ( see page 124) to identify a hardware. Calling this function with a valid hardware handle as<br />

parameter causes the owner of that handle to blink its LED several times, leaving it recognizable.<br />

The last step selecting a hardware is to connect the wanted hardware by using the function LIN_ConnectClient ( see page<br />

108). Completes the function successfully, means that the caller (<strong>PLIN</strong> client handle) was successfully associated to the<br />

hardware represented by the given hardware handle.<br />

A client can also disconnect a hardware connected before, using the opposed function LIN_DisconnectClient ( see page<br />

108). This function receives two handles, one representing the client requesting a separation and the other representing the<br />

hardware to disconnect. In similar way as by connecting, a client application can use the function LIN_IdentifyHardware (<br />

see page 124) to identify the hardware to disconnect.<br />

6<br />

3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!