Esempio n. 1
0
/*
 * Class:     org_openhome_net_core_PropertyInt
 * Method:    ServicePropertyCreateIntCp
 * Signature: (Ljava/lang/String;Lorg/openhome/net/controlpoint/IPropertyChangeListener;)Lorg/openhome/net/core/Property/PropertyInitialised;
 */
JNIEXPORT jobject JNICALL Java_org_openhome_net_core_PropertyInt_ServicePropertyCreateIntCp
(JNIEnv *aEnv, jobject aObject, jstring aName, jobject aListener)
{
    OhNetCallback callback = &ChangeCallback;
    const char* name = (*aEnv)->GetStringUTFChars(aEnv, aName, NULL);
    ServiceProperty property;
    JniObjRef *ref;
    jclass statusClass;
    jmethodID cid;
    jobject propertyInit;

    InitialiseReferences(aEnv, aListener, &ref);

    statusClass = (*aEnv)->FindClass(aEnv, "org/openhome/net/core/Property$PropertyInitialised");
    if (statusClass == NULL)
    {
        printf("Unable to find class org/openhome/net/core/Property$PropertyInitialised\n");
        return NULL;
    }
    cid = (*aEnv)->GetMethodID(aEnv, statusClass, "<init>", "(Lorg/openhome/net/core/Property;JJ)V");
    if (cid == NULL) {
        printf("Unable to find constructor for class org/openhome/net/core/Property$PropertyInitialised\n");
        return NULL;
    }

    property = ServicePropertyCreateIntCp(name, callback, ref);
    propertyInit = (*aEnv)->NewObject(aEnv, statusClass, cid, aObject, (jlong)(size_t)property, (jlong)(size_t)ref);

    (*aEnv)->ReleaseStringUTFChars(aEnv, aName, name);

    return propertyInit;
}
Esempio n. 2
0
/*
 * Class:     org_openhome_net_controlpoint_Invocation
 * Method:    CpServiceInvocation
 * Signature: (JJ)J
 */
JNIEXPORT jlong JNICALL Java_org_openhome_net_controlpoint_Invocation_CpServiceInvocation
  (JNIEnv *aEnv, jobject aObject, jlong aService, jlong aAction)
{
	CpService service = (CpService) (size_t)aService;
	ServiceAction action = (ServiceAction) (size_t)aAction;
	OhNetCallbackAsync callback = &AsyncComplete;
	JniObjRef *ref;

	InitialiseReferences(aEnv, aObject, &ref);
	
	return (jlong) (size_t)CpServiceInvocation(service, action, callback, ref);
}
Esempio n. 3
0
/*
 * Class:     org_openhome_net_controlpoint_CpProxy
 * Method:    CpProxySetPropertyInitialEvent
 * Signature: (JLorg/openhome/net/controlpoint/IPropertyChangeListener;)J
 */
JNIEXPORT jlong JNICALL Java_org_openhome_net_controlpoint_CpProxy_CpProxySetPropertyInitialEvent
  (JNIEnv *aEnv, jclass aClass, jlong aProxy, jobject aCallback)
{
	THandle proxy = (THandle) (size_t)aProxy;
	OhNetCallback callback = (OhNetCallback) &CallbackInitial;
	JniObjRef *ref;
	aClass = aClass;
	
	InitialiseReferences(aEnv, aCallback, &ref);
	
	CpProxySetPropertyInitialEvent(proxy, callback, ref);
	
	return (jlong) (size_t)ref;
}