> For the complete documentation index, see [llms.txt](https://docs.intrepidcs.com/vspy-3-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.intrepidcs.com/vspy-3-documentation/vehicle-spy-tutorials/tutorial-c-code-interface/part-2-adding-events.md).

# Part 2 - Adding Events

### 1. Vehicle Spy Setup:

In this tutorial, 2 events will be added. The first when a message is received and the second is for an application signal changing. Create a **Receive message** with an **Arb ID of 123** named **My Message** and an **Application Signal** named **My App Signal.**

### 2. C Code Interface:

In the C Code Interface view under the Setup tab, select your project and click on **Update Support Files** (Figure 1:![](https://cdn.intrepidcs.net/support/VehicleSpy/assets/smOne.gif)). This will add the new data items from Vehicle Spy to the header files. If Visual Studio is open, you may get a warning that files have been updated. Click on **Yes to All** to add the changes to your project.

![Figure 1: C Code Interface](https://3170208387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL6lcovCpkhoS9uTOFtEp%2Fuploads%2FKRmurC5Eotdj9N3KT1gN%2Fspyexamplecci2.1.gif?alt=media\&token=3e94912f-d92d-4bee-b859-bc882a0687b0)

### 3. Add Events:

With your project selected, click on the **Edit** button (Figure 1:![](https://cdn.intrepidcs.net/support/VehicleSpy/assets/smTwo.gif)). Being sure **Rx Messages** is selected, in **Message Events** tab select and add **My Message** (Figure 2). Under the **Application Signal Events** tab select and add **My App Signal** (Figure 3). Next, go to the **Event Handler Code** tab and select **Copy**. This is the event code. Paste this as new functions in your **SpyCCode.c** file in Visual Studio.\
\
For the SpyMsg\_MG\_My\_Message\_HS\_CAN event add **"printf("There's my Message!!!\n)";"**. For the SpyAppSign\_AS\_My\_App\_Signal add **"printf("App Signal changed\n");"**.

![Figure 2: Select Vehicle Spy Message items to use](https://3170208387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL6lcovCpkhoS9uTOFtEp%2Fuploads%2FehWgi7as9W88xS1fJec1%2Fspyexamplecci2.2.gif?alt=media\&token=876550fc-03cb-4aed-bcff-9199d650c65b)

![Figure 3: Select Vehicle Spy Application Signal items to use](https://3170208387-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FL6lcovCpkhoS9uTOFtEp%2Fuploads%2Fk6SOUTFOl3yLidGCPIEA%2Fspyexamplecci2.3.gif?alt=media\&token=45348957-0bbb-4c74-865f-258a09af2a19)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.intrepidcs.com/vspy-3-documentation/vehicle-spy-tutorials/tutorial-c-code-interface/part-2-adding-events.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
