Skip to content

Commit 3d0393a

Browse files
committed
[iec] fujiCommand_t
1 parent 74f22cf commit 3d0393a

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

lib/device/iec/network.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void iecNetwork::iec_open()
7171

7272
// Check if the payload is RAW (i.e. from fujinet-lib) by the presence of "01" as the first uint8_t, which can't happen for BASIC.
7373
// If it is, then the next 2 bytes are the aux1/aux2 values (mode and trans), and the rest is the actual URL.
74-
// This is an efficiency so we don't have to send a 2nd command to tell it what the parameters should have been.
74+
// This is an efficiency so we don't have to send a 2nd command to tell it what the parameters should have been.
7575
// BASIC will still need to use "openparams" command, as the OPEN line doesn't have capacity for the parameters (can't use a "," as that's a valid URL character)
7676
if (payload[0] == 0x01) {
7777
channel_aux1 = payload[1];
@@ -80,7 +80,7 @@ void iecNetwork::iec_open()
8080
// capture the trans mode as though "settrans" had been invoked
8181
channel_data.translationMode = channel_aux2;
8282
// translationMode[commanddata.channel] = channel_aux2;
83-
83+
8484
// remove the marker bytes so the payload can continue as with BASIC setup
8585
if (payload.length() > 3)
8686
payload = payload.substr(3);
@@ -102,7 +102,7 @@ void iecNetwork::iec_open()
102102
channel_data.urlParser = std::move(PeoplesUrlParser::parseURL(channel_data.deviceSpec));
103103

104104
// Convert scheme to uppercase
105-
std::transform(channel_data.urlParser->scheme.begin(), channel_data.urlParser->scheme.end(), channel_data.urlParser->scheme.begin(),
105+
std::transform(channel_data.urlParser->scheme.begin(), channel_data.urlParser->scheme.end(), channel_data.urlParser->scheme.begin(),
106106
[](unsigned char c) { return std::toupper(c); });
107107

108108
// Instantiate protocol based on the scheme
@@ -385,7 +385,7 @@ void iecNetwork::parse_bite()
385385

386386
count++;
387387
} while ( end < channel_data.receiveBuffer.size() );
388-
388+
389389
//bites += "\"";
390390
//Debug_printv("[%s]", bites.c_str());
391391
channel_data.receiveBuffer = mstr::toPETSCII2(bites);
@@ -510,13 +510,13 @@ void iecNetwork::iec_command()
510510
return;
511511
}
512512

513-
uint8_t m = channel_data.protocol->special_inquiry(pt[0][0]);
513+
AtariSIODirection m = channel_data.protocol->special_inquiry((fujiCommandID_t) pt[0][0]);
514514
Debug_printv("pt[0][0]=[%2X] pt[1]=[%d] size[%d] m[%d]", pt[0][0], channel, pt.size(), m);
515-
if (m == 0x00)
515+
if (m == SIO_DIRECTION_NONE)
516516
perform_special_00();
517-
else if (m == 0x40)
517+
else if (m == SIO_DIRECTION_READ)
518518
perform_special_40();
519-
else if (m == 0x80)
519+
else if (m == SIO_DIRECTION_WRITE)
520520
perform_special_80();
521521
}
522522
}
@@ -970,7 +970,7 @@ void iecNetwork::set_open_params()
970970
iecStatus.msg = "invalid # of parameters";
971971
return;
972972
}
973-
973+
974974
int channel = atoi(pt[1].c_str());
975975
int mode = atoi(pt[2].c_str());
976976
int trans = atoi(pt[3].c_str());
@@ -1017,14 +1017,14 @@ bool iecNetwork::transmit(NetworkData &channel_data)
10171017
Debug_printf("iec_reopen_channel_listen() - Not connected");
10181018
return false;
10191019
}
1020-
1020+
10211021
// force incoming data from HOST to fixed ascii
10221022
// Debug_printv("[1] DATA: >%s< [%s]", channel_data.transmitBuffer.c_str(), mstr::toHex(channel_data.transmitBuffer).c_str());
10231023
clean_transform_petscii_to_ascii(channel_data.transmitBuffer);
10241024
// Debug_printv("[2] DATA: >%s< [%s]", channel_data.transmitBuffer.c_str(), mstr::toHex(channel_data.transmitBuffer).c_str());
1025-
1025+
10261026
Debug_printf("Received %u bytes. Transmitting.", channel_data.transmitBuffer.length());
1027-
1027+
10281028
channel_data.protocol->write(channel_data.transmitBuffer.length());
10291029
channel_data.transmitBuffer.clear();
10301030
channel_data.transmitBuffer.shrink_to_fit();
@@ -1035,19 +1035,19 @@ bool iecNetwork::transmit(NetworkData &channel_data)
10351035
bool iecNetwork::receive(NetworkData &channel_data, uint16_t rxBytes)
10361036
{
10371037
NetworkStatus ns;
1038-
1039-
if (!channel_data.protocol)
1038+
1039+
if (!channel_data.protocol)
10401040
{
10411041
//Debug_printv("No protocol set");
10421042
return false;
10431043
}
1044-
1044+
10451045
if (file_not_found)
10461046
{
10471047
Debug_printv("file not found");
10481048
return false;
10491049
}
1050-
1050+
10511051
// Get status
10521052
channel_data.protocol->status(&ns);
10531053
if( ns.rxBytesWaiting>0 )
@@ -1122,7 +1122,7 @@ uint8_t iecNetwork::getStatusData(char *buffer, uint8_t bufferSize)
11221122
{
11231123
if( is_binary_status )
11241124
{
1125-
if (!active_status_channel)
1125+
if (!active_status_channel)
11261126
Debug_printf("No active status channel\r\n");
11271127

11281128
if( !network_data_map[active_status_channel].protocol )
@@ -1135,17 +1135,17 @@ uint8_t iecNetwork::getStatusData(char *buffer, uint8_t bufferSize)
11351135
Debug_printf("msg: %s\r\n", iecStatus.msg.c_str());
11361136
util_petscii_to_ascii_str(iecStatus.msg); // are the util pescii/asccii functions reversed?
11371137
Debug_printf("msgPETSCII: %s\r\n", iecStatus.msg.c_str());
1138-
snprintf(buffer, bufferSize, "%d,%s,%02d,%02d\r\n",
1138+
snprintf(buffer, bufferSize, "%d,%s,%02d,%02d\r\n",
11391139
iecStatus.error, iecStatus.msg.c_str(), iecStatus.channel, iecStatus.connected);
11401140

11411141
Debug_printf("Sending status: %s\r\n", buffer);
1142-
1142+
11431143
// reset status
11441144
iecStatus.error = 0;
11451145
iecStatus.channel = 0;
11461146
iecStatus.connected = 0;
11471147
iecStatus.msg = "ok";
1148-
1148+
11491149
return strlen(buffer);
11501150
}
11511151
}

0 commit comments

Comments
 (0)