https://toitlang.org/ logo
``` import ble import encoding.json import io imp...
# general
i
Copy code
import ble
import encoding.json
import io

import .rpc
import .security

class CustomRpcService extends RpcService:
  static ID_ ::= 0x54
  static DESCRIPTION_ ::= "custom-service"

  custom-service-callback_/Lambda

  constructor service/ble.LocalService --custom-service-callback/Lambda? --security/Security:
    custom-service-callback_ = custom-service-callback
    super service ID_
        --description=DESCRIPTION_
        --security=security
         

  handle-request data/ByteArray -> ByteArray:      
    return custom-service-callback_.call data  `