Commit 81a16943 authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Add base interface for potential SoftJars; Add base for JSR120; NullPlayer corrections.

parent 3f5a8a44
Pipeline #90105 passed with stages
in 1 minute and 31 seconds
......@@ -75,6 +75,7 @@
<option value="$PROJECT_DIR$/modules/tool-manifest-writer" />
<option value="$PROJECT_DIR$/modules/tool-packfile" />
<option value="$PROJECT_DIR$/modules/vodafone-api" />
<option value="$PROJECT_DIR$/modules/wireless-messaging" />
<option value="$PROJECT_DIR$/modules/zip" />
<option value="$PROJECT_DIR$/tools" />
<option value="$PROJECT_DIR$/tools/pcf-to-sqf" />
......
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.jvm.mle.brackets;
import java.io.Closeable;
/**
* An input stream for reading resources within {@link SoftJarWrapper}.
*
* @since 2022/02/27
*/
public interface SoftJarResourceInputStream
extends Closeable
{
/** End of file reached. */
int EOF =
-1;
/** I/O Exception. */
int IO_EXCEPTION =
-2;
/**
* Reads the given number of bytes from the input stream.
*
* @param __b The number of bytes to read.
* @param __o The offset into the buffer.
* @param __l The number of bytes to read.
* @return The number of bytes read or a special code for specific
* circumstances.
* @since 2022/02/27
*/
int read(byte[] __b, int __o, int __l);
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.jvm.mle.brackets;
/**
* This is a wrapper for software enabled JARs.
*
* @since 2022/02/27
*/
public interface SoftJarWrapper
{
/**
* Opens the specifies resource within the JAR.
*
* @param __rc The resource to open.
* @return The opened resource or {@code null} if it does not exist.
* @since 2022/202/27
*/
SoftJarResourceInputStream openResource(String __rc);
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.jvm.softjar;
import cc.squirreljme.jvm.mle.brackets.SoftJarResourceInputStream;
import cc.squirreljme.jvm.mle.brackets.SoftJarWrapper;
import cc.squirreljme.runtime.cldc.debug.Debugging;
/**
* This class represents an instance of a {@code .kjx} file.
*
* The KJX format is simple and is in the following structure:
* - {@code uint8_t[3] magic}: Magic number.
* - {@code uint8_t jadStartPos}: Start position of the {@code .jad} file.
* - {@code uint8_t fileNameLen}: The length of the current KJX file name.
* - {@code uint8_t[fileNameLen] fileName}: The name of the current KJX file.
* - {@code uint16_t jadLen}: The length of the embedded JAD file.
* - {@code uint8_t jadNameLen}: The length of the JAD filename.
* - {@code uint8_t[jadNameLen] jadName}: The name of the JAD file.
* - {@code uint8_t[jadLen] jadContent}: The JAD contents.
* - {@code uint8_t[...rest...] jarData}: Remainder is the JAR data.
*
* @since 2022/02/27
*/
public class KjxSoftJar
implements SoftJarWrapper
{
/**
* {@inheritDoc}
* @since 2022/02/27
*/
@Override
public SoftJarResourceInputStream openResource(String __rc)
{
throw Debugging.todo();
}
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
/**
* This package contains the implementation of software backed JAR files and
* otherwise.
*
* @since 2022/02/27
*/
package cc.squirreljme.jvm.softjar;
......@@ -179,7 +179,15 @@ public final class NullPlayer
@Override
public final long getMediaTime()
{
throw new todo.TODO();
synchronized (this)
{
// {@squirreljme.error EA08 Cannot obtain the media time for a
// closed null stream.}
if (this._state == Player.CLOSED)
throw new IllegalStateException("EA08");
return Player.TIME_UNKNOWN;
}
}
/**
......@@ -227,7 +235,8 @@ public final class NullPlayer
if (this._state == Player.CLOSED)
throw new IllegalStateException("EA04");
if (this._state != Player.UNREALIZED)
// Become realized, otherwise everything is ignored
if (this._state == Player.UNREALIZED)
this._state = Player.REALIZED;
}
......@@ -266,12 +275,22 @@ public final class NullPlayer
/**
* {@inheritDoc}
* @since 2019/04/15
* @param __now
*/
@Override
public final long setMediaTime(long __a)
public final long setMediaTime(long __now)
throws MediaException
{
throw new todo.TODO();
synchronized (this)
{
// {@squirreljme.error EA09 Cannot set the media time on a null
// stream.}
if (this._state == Player.CLOSED ||
this._state == Player.UNREALIZED)
throw new IllegalStateException("EA09");
return Player.TIME_UNKNOWN;
}
}
/**
......
......@@ -56,7 +56,7 @@ public interface Player
void setLoopCount(int __a);
long setMediaTime(long __a)
long setMediaTime(long __now)
throws MediaException;
void setTimeBase(TimeBase __a)
......
......@@ -33,6 +33,7 @@ squirreljme
// Some commonly used extra APIs
optionalDependencies += project(":modules:bluetooth")
optionalDependencies += project(":modules:m3g")
optionalDependencies += project(":modules:wireless-messaging")
optionalDependencies += project(":modules:opengles")
// Third Party APIs, which are optionally included
......
import cc.squirreljme.plugin.swm.JavaMEMidletType
description = "Wireless Messaging API"
version = rootProject.version
squirreljme
{
javaDocErrorCode = "AL"
swmType = JavaMEMidletType.API
swmName = "Wireless Messaging API"
swmVendor = "Stephanie Gawroriski"
tags += "j2me"
tags += "messaging"
tags += "jsr120"
tags += "wma"
}
dependencies
{
api project(":modules:cldc-compact")
api project(":modules:gcf")
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.runtime.messaging;
import cc.squirreljme.runtime.cldc.debug.Debugging;
import cc.squirreljme.runtime.gcf.CustomConnectionFactory;
import java.io.IOException;
import javax.microedition.io.Connection;
import javax.microedition.io.ConnectionOption;
/**
* This is the factory which handles the {@code sms} protocol.
*
* @since 2022/02/27
*/
public class MessageConnectionFactory
implements CustomConnectionFactory
{
/**
* {@inheritDoc}
* @since 2022/02/27
*/
@Override
public Connection connect(String __part, int __mode, boolean __timeouts,
ConnectionOption<?>[] __opts)
throws IOException, NullPointerException
{
throw Debugging.todo();
}
/**
* {@inheritDoc}
* @since 2022/02/27
*/
@Override
public String scheme()
{
return "sms";
}
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
/**
* SquirrelJME specific support for the messaging API.
*
* @since 2022/02/27
*/
package cc.squirreljme.runtime.messaging;
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package javax.wireless.messaging;
public interface BinaryMessage
extends Message
{
byte[] getPayloadData();
void setPayloadData(byte[] __data);
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package javax.wireless.messaging;
import java.util.Date;
public interface Message
{
String getAddress();
Date getTimeStamp();
void setAddress(String __address);
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package javax.wireless.messaging;
import javax.microedition.io.Connection;
public interface MessageConnection
extends Connection
{
String BINARY_MESSAGE =
"binary";
String TEXT_MESSAGE =
"text";
Message newMessage(String __type);
Message newMessage(String __type, String __address);
int numberOfSegments(Message __msg);
Message receive();
void send(Message __msg);
void setMessageListener(MessageListener __listener);
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package javax.wireless.messaging;
public interface MessageListener
{
void notifyIncomingMessage(MessageConnection __connection);
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package javax.wireless.messaging;
public interface TextMessage
extends Message
{
String getPayloadText();
String setPayloadText(String __data);
}
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
/**
* This contains the message API, also known as JSR 120.
*
* @since 2022/02/27
*/
package javax.wireless.messaging;
# ---------------------------------------------------------------------------
# SquirrelJME
# Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
# ---------------------------------------------------------------------------
# SquirrelJME is under the GNU General Public License v3+, or later.
# See license.mkd for licensing and copyright information.
# ---------------------------------------------------------------------------
cc.squirreljme.runtime.messaging.MessageConnectionFactory
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment