> ## Documentation Index
> Fetch the complete documentation index at: https://notevil.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# CAPLfunctionSOMEIPChangeServiceInstanceID

# SOMEIP\_ChangeServiceInstanceID (obsolete)

[Valid for](../../../Shared/FeatureAvailability.md): CANoe DE

## Function Syntax

```plaintext theme={null}
int SOMEIP_ChangeServiceInstanceID( serviceProviderRef* serviceProvider, dword instanceID ); // form 1
int SOMEIP_ChangeServiceInstanceID( serviceConsumerRef* serviceConsumer, dword instanceID ); // form 2
```

## Description

Changes the SOME/IP service instance ID of a provided service instance or the instance ID to which a consumed service should subscribe.

Before `SOMEIP_ChangeServiceInstanceID` is called, deactivate the simulated service instance first with `serviceProviderRef::ReleaseService`. Then change the service instance ID and restart the service again with `serviceProviderRef::ProvideService()`.

## Parameters

* **serviceProvider**: Service provider of which the service instance ID should be changed.
* **serviceConsumer**: Service consumer of which the service instance ID should be changed.
* **instanceID**: New service instance ID.

## Return Values

* **0**: Success
* **-1**: Service object is not initialized
* **-2**: Service object is not simulated
* **-3**: Invalid service object

## Example

```plaintext theme={null}
// stop service instance
PSIEngine1.consumerSide[DRV,HPCM].ReleaseService();
PSIEngine1.providerSide[HPCM].ReleaseService();
// change service instance ID to 2
SOMEIP_ChangeServiceInstanceID( CommunicationObjects::PSIEngine1.providerSide[HPCM], 2 );

// restart service instance
PSIEngine1.providerSide[HPCM].ProvideService();
PSIEngine1.consumerSide[DRV,HPCM].RequestService();
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.