Const
Init function
Perform actions following UDS initialization using a normal function.
Util.Init(()=>{
console.log('Hello UDS!')
})
Perform actions following UDS initialization using an async function.
Util.Init(async ()=>{
const file=await fs.readFile(path.join(process.env.PROJECT_ROOT,'file.bin'))
let length=file.length
console.log('Hello UDS file! file length is', length)
})
send functions
- This function will be called after the message has been sent.
- Please replace
Can.DiagRequest.send
with your own service item name. The format is<tester name>.<service item name>.send
Util.On('Can.DiagRequest.send', async (req) => {
// The req is a `DiagRequest`
console.log(req.getServiceName(), ': send');
});
recv function
- This function will be called after the response message has been received.
- Please replace
Can.DiagRequest.recv
with your own service item name. The format is<tester name>.<service item name>.recv
Util.On('Can.DiagRequest.recv', async (req) => {
// The req is a `DiagResponse`
console.log(req.getServiceName(), ':recv');
});
More
For more details, please refer to the UDSClass |
UDSClass
class.
Global instance of UDSClass, providing access to UDS functionality throughout the application. Use this instance to interact with UDS features and services.