- Home /
"Inaccessible due to protection level" error - New to programming
I'm a highschool student conducting a research project about using the Move.Me app on the Playstation 3 to create an application. I'm trying to get the basic down and hook p my PS3 to my PC but I keep on getting this error. The error is anywhere where it says 'PSMoveWrapper.client_connected' and 'PSMoveWrapper.client(string,int)'. Errors are on lines 6 7 24 49 64 65 72 87 89 101 103 119 146 165 256 298 329 334 335 Any assistance would be much appreciated, thanks.
/// /// the same as Connect(ipAdress, port)". /// public void Connect() { Connect(ipAddress, port); }
public void Connect(string address, int port) {
if(!onlineMode) {
Debug.LogWarning("onlineMode == false, running in offline mode!");
return;
}
PSMoveWrapper.client_connect(address, port);
isConnected =PSMoveWrapper.client_connected;
Debug.Log("Connect");
}
///
/// Pause camera stream; Reset all move controllers; Disconnect;
/// If you just want to disconnect, call Disconnect(false)
///
public void Disconnect() {
Disconnect(true);
}
public void Disconnect(bool isCleanUp) {
if(isCleanUp) {
CameraFramePause();
ResetAll();
}
PSMoveWrapper.client_disconnect();
isConnected = false;
Debug.Log("Disconnect");
}
///
/// Resume camera stream and set slice num to 8.
/// Camera stream is initially paused.
///
public void CameraFrameResume() {
CameraFrameResume(8);
}
///
/// Resume camera stream and set slice num.
/// Camera stream is initially paused.
///
/// <param>
/// A , range from 1 to 8
///
public void CameraFrameResume(int sliceNum) {
if(!isConnected) {
return;
}
sliceNum = Mathf.Clamp(sliceNum, 1, 8);
PSMoveWrapper.moveClient.CameraFrameResume();
isCameraResume = true;
SetCameraFrameSlices(sliceNum);
}
///
/// Set slice number
///
/// <param>
/// A , range from 1 to 8
///
public void SetCameraFrameSlices(int sliceNum) {
if(!isConnected) {
return;
}
PSMoveWrapper.moveClient.CameraFrameSetNumSlices((uint)sliceNum);
PSMoveWrapper.moveClient.SetNumImageSlices(sliceNum);
}
public void CameraFramePause() {
if(!isConnected) {
return;
}
PSMoveWrapper.moveClient.CameraFramePause();
isCameraResume = false;
}
///
/// Calibrate the PS Move. The ball will NOT glow after calibration.
/// You need to call any one of the "SetColor" methods to make it glow, and the "Track" methods to track.
///
/// <param>
/// A , move controller number
///
public void Calibrate(int num) {
if(!isConnected) {
return;
}
if (PSMoveWrapper.moveClient != null)
{
PSMoveWrapper.moveClient.CalibrateController(num);
}
}
///
/// Set all PS Moves with default color and track with corresponding hue.
/// Use this method when you do not care about the color of all PS Moves.
///
public void TrackAll() {
if(!isConnected) {
return;
}
if (PSMoveWrapper.moveClient != null)
{
PSMoveWrapper.moveClient.TrackAllHues();
}
}
///
/// Let PS3 pick color and track the selected PS Move.
/// Use this method when you do not care about the color of the ball.
///
/// <param>
/// A , move controller number.
///
public void AutoTrack(int num) {
if(!isConnected) {
return;
}
trackingHue[num] = Convert.ToInt32(PICK_FOR_ME);
PSMoveWrapper.moveClient.SendRequestPacket(PSMoveClient.ClientRequest.PSMoveClientRequestTrackHues,
Convert.ToUInt32(trackingHue[0]),
Convert.ToUInt32(trackingHue[1]),
Convert.ToUInt32(trackingHue[2]),
Convert.ToUInt32(trackingHue[3]));
}
///
/// Set the color of PS Move's ball.
/// The PS Eye camera will NOT automatically track after calling this method.
/// If you change the color of a tracking PS Move, the tracking will be lost.
/// You need to call any one of the "Track" methods to track.
/// The minimum step for color is 0.2f for any RGB value, the alpha value is not used.
///
/// <param>
/// A , move controller number.
///
/// <param>
/// A
///
public void SetColor(int num, Color color) {
if(!isConnected) {
return;
}
float r = color.r;
float g = color.g;
float b = color.b;
PSMoveWrapper.moveClient.SendRequestPacket(PSMoveClient.ClientRequest.PSMoveClientRequestForceRGB, Convert.ToUInt32(num),
r, g, b);
}
///
/// Set the tracking hue of PS Move.
/// The hue should fit the ball's color to enable tracking.
///
/// <param>
/// A , move controller number.
///
/// <param>
/// A
///
public void SetTrackingHue(int num, int hue) {
if(!isConnected) {
return;
}
trackingHue[num] = hue;
PSMoveWrapper.moveClient.SendRequestPacket(PSMoveClient.ClientRequest.PSMoveClientRequestTrackHues,
Convert.ToUInt32(trackingHue[0]),
Convert.ToUInt32(trackingHue[1]),
Convert.ToUInt32(trackingHue[2]),
Convert.ToUInt32(trackingHue[3]));
}
public void SetColorAndTrack(int num, Color color) {
SetColor(num, color);
SetTrackingHue(num, GetHueFromColor(color));
}
///
/// the same as CalibrateAndTrack(num, 0.8f)
///
/// <param>
/// A
///
public void CalibrateAndTrack(int num) {
CalibrateAndTrack(num, 0.8f);
}
///
/// the same as CalibrateAndTrack(num, color, 0.8f)
///
/// <param>
/// A
///
/// <param>
/// A
///
public void CalibrateAndTrack(int num, Color color) {
CalibrateAndTrack(num, color, 0.8f);
}
///
/// The combination of "Calibrate" and "AutoTrack".
/// Since calibration takes time, tracking should be delayed a certain amount of seconds.
/// 0.8f seems appropriate after some tests.
///
/// <param>
/// A , move controller number.
///
/// <param>
/// A , delay time for tracking after calibration.
///
public void CalibrateAndTrack(int num, float time) {
Calibrate(num);
StartCoroutine(DelayTrack(num, time));
}
///
/// The combination of "Calibrate" and "SetColorAndTrack".
///
/// <param>
/// A , move controller number.
///
/// <param>
/// A , the color to set and to track
///
/// <param>
/// A , delay time for tracking after calibration.
///
public void CalibrateAndTrack(int num, Color color, float time) {
Calibrate(num);
StartCoroutine(DelayTrackHue(num, color, time));
}
private IEnumerator DelayTrack(int num, float time) {
yield return new WaitForSeconds(time);
AutoTrack(num);
}
private IEnumerator DelayTrackHue(int num, Color color, float time) {
yield return new WaitForSeconds(time);
SetColorAndTrack(num, color);
}
public void ResetAll () {
for(int i =0; i
/// Reset move controller.
/// The ball will not glow and it need to re-calibrate.
///
/// <param>
/// A , move controller number.
///
public void Reset(int num) {
if(!isConnected) {
return;
}
PSMoveWrapper.moveClient.SendRequestPacket(PSMoveClient.ClientRequest.PSMoveClientRequestControllerReset, Convert.ToUInt32(num));
}
///
/// Set rumble level. 0 -> not rumble. 19 -> max rumble.
///
/// <param>
/// A , move controller number.
///
/// <param>
/// A , rumble level, 0-19.
///
public void SetRumble(int num, int level) {
if(!isConnected) {
return;
}
level = Mathf.Clamp(level,0,19);
if(rumbleLevel[num] == level) {
return;
}
rumbleLevel[num] = level;
//map to actual rumble scale. 0 -> 0; 1-19 -> 70-250.
if(level!=0) {
level = level*10 + 60;
}
Rumble(num, level);
}
///
/// send rumble request.
/// The minimum step of the scale is 10.
/// According to the test, 0 is no rumble, 70 is minimum rumble and 250 is maximum rumble.
/// Scale 10-60 will not affect anything.
///
/// <param>
/// A
///
/// <param>
/// A , 0-255
///
private void Rumble(int num, int rumbleValue) {
//rumbleValue = Mathf.Clamp(rumbleValue, 0, 255);
PSMoveWrapper.moveClient.SendRequestPacket(PSMoveClient.ClientRequest.PSMoveClientRequestSetRumble, Convert.ToUInt32(num), Convert.ToUInt32(rumbleValue));
}
///
/// Get camera image.
/// The image should be 640x480, please check the length before using it.
/// Also I know it is a weird issue, but after Move.me started, please calibrate at least once to make sure the image stream working smoothly.
/// Once you have done this, it will work fine.
///
///
/// A , null if not connected or camera stream is paused.
///
public Color32[] GetCameraImage() {
if(!isConnected || !isCameraResume) {
return null;
}
PSMoveSharpState dummyState = new PSMoveSharpState();
List image = cameraFrameState.GetCameraFrameAndState(ref dummyState);
finalImage.Clear();
foreach(byte[] slice in image) {
imageTex.LoadImage(slice);
finalImage.AddRange(imageTex.GetPixels32());
}
return finalImage.ToArray();
}
private void UpdateState() {
if (PSMoveWrapper.moveClient == null)
{
return;
}
state = PSMoveWrapper.moveClient.GetLatestState();
cameraFrameState = PSMoveWrapper.moveClient.GetLatestCameraFrameState();
Please paste the entire error into your question. In general, the error means your accessing something that isn't public (relative to the scope you're in), and the full error should contain the name of the offending call and the line that it occurs on.
can you please tell me what line the error is on (it should be in the error msg)
Answer by DaveA · Mar 12, 2013 at 10:31 PM
In your PSMoveWrapper script, make sure the word public is in front of the functions client and variable client_connected (I'm guessing)