diff --git a/java/custom/com/nokia/mid/impl/jms/core/MIDletRegistry.java b/java/custom/com/nokia/mid/impl/jms/core/MIDletRegistry.java new file mode 100644 index 00000000..6449370e --- /dev/null +++ b/java/custom/com/nokia/mid/impl/jms/core/MIDletRegistry.java @@ -0,0 +1,22 @@ +package com.nokia.mid.impl.jms.core; + +public class MIDletRegistry { + private static MIDletRegistry instance = new MIDletRegistry(); + + private MIDletRegistry() { } + + public static MIDletRegistry getMIDletRegistry() { + return instance; + } + + public Object getMIDletLocation(int id) { + System.out.println("MIDletRegistry::getMIDletLocation not implemented: " + id); + return null; + } + + public MIDletSuite findMIDletSuite(String param1, String param2) { + System.out.println("MIDletRegistry::findMIDletSuite not implemented."); + return null; + } +} + diff --git a/java/custom/com/nokia/mid/impl/jms/core/MIDletSuite.java b/java/custom/com/nokia/mid/impl/jms/core/MIDletSuite.java new file mode 100644 index 00000000..af80bf4b --- /dev/null +++ b/java/custom/com/nokia/mid/impl/jms/core/MIDletSuite.java @@ -0,0 +1,5 @@ +package com.nokia.mid.impl.jms.core; + +public class MIDletSuite { +} + diff --git a/midp/localmsg.js b/midp/localmsg.js index d85a4389..7320f2ff 100644 --- a/midp/localmsg.js +++ b/midp/localmsg.js @@ -770,6 +770,60 @@ NokiaImageProcessingLocalMsgConnection.prototype.sendMessageToServer = function( } }; +var NokiaProductInfoLocalMsgConnection = function() { + LocalMsgConnection.call(this); +}; + +NokiaProductInfoLocalMsgConnection.prototype = Object.create(LocalMsgConnection.prototype); + +NokiaProductInfoLocalMsgConnection.prototype.sendMessageToServer = function(message) { + var encoder = new DataEncoder(); + var decoder = new DataDecoder(message.data, message.offset, message.length); + decoder.getStart(DataType.STRUCT); + + var name = decoder.getValue(DataType.METHOD); + switch (name) { + case "Common": + encoder.putStart(DataType.STRUCT, "event"); + encoder.put(DataType.METHOD, "name", "Common"); + encoder.putStart(DataType.STRUCT, "message"); + encoder.put(DataType.METHOD, "name", "ProtocolVersion"); + encoder.put(DataType.STRING, "version", "1.1"); + encoder.putEnd(DataType.STRUCT, "message"); + encoder.putEnd(DataType.STRUCT, "event"); + + var data = new TextEncoder().encode(encoder.getData()); + this.sendMessageToClient({ + data: data, + length: data.length, + offset: 0, + }); + break; + case "ReadProductInfo": + encoder.putStart(DataType.STRUCT, "event"); + encoder.put(DataType.METHOD, "name", "ReadProductInfo"); + encoder.put(DataType.STRING, "result", "OK"); + encoder.put(DataType.STRING, "unkown_str_1", ""); + encoder.put(DataType.STRING, "unkown_str_2", ""); + encoder.put(DataType.STRING, "unkown_str_3", ""); + encoder.put(DataType.STRING, "unkown_str_4", ""); // Probably RMCODE + encoder.put(DataType.STRING, "unkown_str_5", ""); + encoder.putEnd(DataType.STRUCT, "event"); + + var data = new TextEncoder().encode(encoder.getData()); + this.sendMessageToClient({ + data: data, + length: data.length, + offset: 0, + }); + break; + default: + console.error("(nokia.status-info) event " + name + " not implemented " + + util.decodeUtf8(new Uint8Array(message.data.buffer, message.offset, message.length))); + return; + } +}; + var NokiaActiveStandbyLocalMsgConnection = function() { LocalMsgConnection.call(this); } @@ -921,6 +975,7 @@ MIDP.LocalMsgConnections["nokia.file-ui"] = NokiaFileUILocalMsgConnection; MIDP.LocalMsgConnections["nokia.image-processing"] = NokiaImageProcessingLocalMsgConnection; MIDP.LocalMsgConnections["nokia.sa.service-registry"] = NokiaSASrvRegLocalMsgConnection; MIDP.LocalMsgConnections["nokia.active-standby"] = NokiaActiveStandbyLocalMsgConnection; +MIDP.LocalMsgConnections["nokia.product-info"] = NokiaProductInfoLocalMsgConnection; Native.create("org/mozilla/io/LocalMsgConnection.init.(Ljava/lang/String;)V", function(jName) { var name = util.fromJavaString(jName);