ConnectivityFoundry / AwaLWM2M

Awa LWM2M is an implementation of the OMA Lightweight M2M protocol in C.
BSD 3-Clause "New" or "Revised" License
102 stars 66 forks source link

API Client #349

Open gesaleh opened 7 years ago

gesaleh commented 7 years ago

Hi Client API is missing connection to the server when i do this the sessionId is missing in the request I used the server.api to connect and retreive the sessionID then the request Set and Get works

import api
import ipc
import ipc_lwm2m_client as client

ipcPort=12345
server_api = api.ServerAPI("127.0.0.1", ipcPort)
sessionId=server_api.GetSessionId()
print (sessionId)

def sendRequest(ipcChannel, requestType, responseType, path, value , sessionId):
    request = requestType(session_id=sessionId)
    request.add(path, value)
    print(request.serialize())
    response_xml = ipc.send_request_and_receive_response(ipcChannel, request.serialize())
    print(response_xml)
    #response = responseType(response_xml)
    return response

resp=sendRequest('udp://127.0.0.1:12345',client.SetRequest,client.SetResponse,(3001, 0, 0), 20.5 , sessionId)
print(resp)

but i keep getting segmentation fault at the end of the execution and it is related to the server api part

is the API going to be updated for the client ?